Bug Summary

File:dummy_driver.c
Location:line 690, column 2
Description:Value stored to 'Base' is never read

Annotated Source Code

1
2/*
3 * Copyright 2002, SuSE Linux AG, Author: Egbert Eich
4 */
5
6#ifdef HAVE_CONFIG_H1
7#include "config.h"
8#endif
9
10/* All drivers should typically include these */
11#include "xf86.h"
12#include "xf86_OSproc.h"
13
14/* All drivers initialising the SW cursor need this */
15#include "mipointer.h"
16
17/* All drivers using the mi colormap manipulation need this */
18#include "micmap.h"
19
20/* identifying atom needed by magnifiers */
21#include <X11/Xatom.h>
22#include "property.h"
23
24#include "xf86cmap.h"
25
26#include "xf86fbman.h"
27
28#include "fb.h"
29
30#include "picturestr.h"
31
32#ifdef XvExtension1
33#include "xf86xv.h"
34#include <X11/extensions/Xv.h>
35#endif
36
37/*
38 * Driver data structures.
39 */
40#include "dummy.h"
41
42/* These need to be checked */
43#include <X11/X.h>
44#include <X11/Xproto.h>
45#include "scrnintstr.h"
46#include "servermd.h"
47#ifdef USE_DGA1
48#define _XF86DGA_SERVER_
49#include <X11/extensions/xf86dgaproto.h>
50#endif
51
52/* Mandatory functions */
53static const OptionInfoRec * DUMMYAvailableOptions(int chipid, int busid);
54static void DUMMYIdentify(int flags);
55static Bool DUMMYProbe(DriverPtr drv, int flags);
56static Bool DUMMYPreInit(ScrnInfoPtr pScrn, int flags);
57static Bool DUMMYScreenInit(SCREEN_INIT_ARGS_DECLScreenPtr pScreen, int argc, char **argv);
58static Bool DUMMYEnterVT(VT_FUNC_ARGS_DECLScrnInfoPtr arg);
59static void DUMMYLeaveVT(VT_FUNC_ARGS_DECLScrnInfoPtr arg);
60static Bool DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECLScreenPtr pScreen);
61static Bool DUMMYCreateWindow(WindowPtr pWin);
62static void DUMMYFreeScreen(FREE_SCREEN_ARGS_DECLScrnInfoPtr arg);
63static ModeStatus DUMMYValidMode(SCRN_ARG_TYPEScrnInfoPtr arg, DisplayModePtr mode,
64 Bool verbose, int flags);
65static Bool DUMMYSaveScreen(ScreenPtr pScreen, int mode);
66
67/* Internally used functions */
68static Bool dummyModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
69static void dummySave(ScrnInfoPtr pScrn);
70static void dummyRestore(ScrnInfoPtr pScrn, Bool restoreText);
71static Bool dummyDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op,
72 pointer ptr);
73
74
75/* static void DUMMYDisplayPowerManagementSet(ScrnInfoPtr pScrn, */
76/* int PowerManagementMode, int flags); */
77
78#define DUMMY_VERSION4000 4000
79#define DUMMY_NAME"DUMMY" "DUMMY"
80#define DUMMY_DRIVER_NAME"dummy" "dummy"
81
82#define DUMMY_MAJOR_VERSION0 PACKAGE_VERSION_MAJOR0
83#define DUMMY_MINOR_VERSION3 PACKAGE_VERSION_MINOR3
84#define DUMMY_PATCHLEVEL7 PACKAGE_VERSION_PATCHLEVEL7
85
86#define DUMMY_MAX_WIDTH32767 32767
87#define DUMMY_MAX_HEIGHT32767 32767
88
89/*
90 * This is intentionally screen-independent. It indicates the binding
91 * choice made in the first PreInit.
92 */
93static int pix24bpp = 0;
94
95
96/*
97 * This contains the functions needed by the server after loading the driver
98 * module. It must be supplied, and gets passed back by the SetupProc
99 * function in the dynamic case. In the static case, a reference to this
100 * is compiled in, and this requires that the name of this DriverRec be
101 * an upper-case version of the driver name.
102 */
103
104_X_EXPORT__attribute__((visibility("default"))) DriverRec DUMMY = {
105 DUMMY_VERSION4000,
106 DUMMY_DRIVER_NAME"dummy",
107 DUMMYIdentify,
108 DUMMYProbe,
109 DUMMYAvailableOptions,
110 NULL((void*)0),
111 0,
112 dummyDriverFunc
113};
114
115static SymTabRec DUMMYChipsets[] = {
116 { DUMMY_CHIP, "dummy" },
117 { -1, NULL((void*)0) }
118};
119
120typedef enum {
121 OPTION_SW_CURSOR
122} DUMMYOpts;
123
124static const OptionInfoRec DUMMYOptions[] = {
125 { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE0 },
126 { -1, NULL((void*)0), OPTV_NONE, {0}, FALSE0 }
127};
128
129#ifdef XFree86LOADER
130
131static MODULESETUPPROTO(dummySetup)void *dummySetup(void *, void *, int*, int*);
132
133static XF86ModuleVersionInfo dummyVersRec =
134{
135 "dummy",
136 MODULEVENDORSTRING"X.Org Foundation",
137 MODINFOSTRING10xef23fdc5,
138 MODINFOSTRING20x10dc023a,
139 XORG_VERSION_CURRENT(((1) * 10000000) + ((18) * 100000) + ((99) * 1000) + 1),
140 DUMMY_MAJOR_VERSION0, DUMMY_MINOR_VERSION3, DUMMY_PATCHLEVEL7,
141 ABI_CLASS_VIDEODRV"X.Org Video Driver",
142 ABI_VIDEODRV_VERSION((((21) << 16) & 0xFFFF0000) | ((0) & 0x0000FFFF
))
,
143 MOD_CLASS_VIDEODRV"X.Org Video Driver",
144 {0,0,0,0}
145};
146
147/*
148 * This is the module init data.
149 * Its name has to be the driver name followed by ModuleData
150 */
151_X_EXPORT__attribute__((visibility("default"))) XF86ModuleData dummyModuleData = { &dummyVersRec, dummySetup, NULL((void*)0) };
152
153static pointer
154dummySetup(pointer module, pointer opts, int *errmaj, int *errmin)
155{
156 static Bool setupDone = FALSE0;
157
158 if (!setupDone) {
159 setupDone = TRUE1;
160 xf86AddDriver(&DUMMY, module, HaveDriverFuncs1);
161
162 /*
163 * Modules that this driver always requires can be loaded here
164 * by calling LoadSubModule().
165 */
166
167 /*
168 * The return value must be non-NULL on success even though there
169 * is no TearDownProc.
170 */
171 return (pointer)1;
172 } else {
173 if (errmaj) *errmaj = LDR_ONCEONLY;
174 return NULL((void*)0);
175 }
176}
177
178#endif /* XFree86LOADER */
179
180static Bool
181DUMMYGetRec(ScrnInfoPtr pScrn)
182{
183 /*
184 * Allocate a DUMMYRec, and hook it into pScrn->driverPrivate.
185 * pScrn->driverPrivate is initialised to NULL, so we can check if
186 * the allocation has already been done.
187 */
188 if (pScrn->driverPrivate != NULL((void*)0))
189 return TRUE1;
190
191 pScrn->driverPrivate = xnfcalloc(sizeof(DUMMYRec), 1)XNFcallocarray((sizeof(DUMMYRec)), (1));
192
193 if (pScrn->driverPrivate == NULL((void*)0))
194 return FALSE0;
195 return TRUE1;
196}
197
198static void
199DUMMYFreeRec(ScrnInfoPtr pScrn)
200{
201 if (pScrn->driverPrivate == NULL((void*)0))
202 return;
203 free(pScrn->driverPrivate);
204 pScrn->driverPrivate = NULL((void*)0);
205}
206
207static const OptionInfoRec *
208DUMMYAvailableOptions(int chipid, int busid)
209{
210 return DUMMYOptions;
211}
212
213/* Mandatory */
214static void
215DUMMYIdentify(int flags)
216{
217 xf86PrintChipsets(DUMMY_NAME"DUMMY", "Driver for Dummy chipsets",
218 DUMMYChipsets);
219}
220
221/* Mandatory */
222static Bool
223DUMMYProbe(DriverPtr drv, int flags)
224{
225 Bool foundScreen = FALSE0;
226 int numDevSections, numUsed;
227 GDevPtr *devSections;
228 int i;
229
230 if (flags & PROBE_DETECT0x01)
231 return FALSE0;
232 /*
233 * Find the config file Device sections that match this
234 * driver, and return if there are none.
235 */
236 if ((numDevSections = xf86MatchDevice(DUMMY_DRIVER_NAME"dummy",
237 &devSections)) <= 0) {
238 return FALSE0;
239 }
240
241 numUsed = numDevSections;
242
243 if (numUsed > 0) {
244
245 for (i = 0; i < numUsed; i++) {
246 ScrnInfoPtr pScrn = NULL((void*)0);
247 int entityIndex =
248 xf86ClaimNoSlot(drv,DUMMY_CHIP,devSections[i],TRUE1);
249 /* Allocate a ScrnInfoRec and claim the slot */
250 if ((pScrn = xf86AllocateScreen(drv,0 ))) {
251 xf86AddEntityToScreen(pScrn,entityIndex);
252 pScrn->driverVersion = DUMMY_VERSION4000;
253 pScrn->driverName = DUMMY_DRIVER_NAME"dummy";
254 pScrn->name = DUMMY_NAME"DUMMY";
255 pScrn->Probe = DUMMYProbe;
256 pScrn->PreInit = DUMMYPreInit;
257 pScrn->ScreenInit = DUMMYScreenInit;
258 pScrn->SwitchMode = DUMMYSwitchMode;
259 pScrn->AdjustFrame = DUMMYAdjustFrame;
260 pScrn->EnterVT = DUMMYEnterVT;
261 pScrn->LeaveVT = DUMMYLeaveVT;
262 pScrn->FreeScreen = DUMMYFreeScreen;
263 pScrn->ValidMode = DUMMYValidMode;
264
265 foundScreen = TRUE1;
266 }
267 }
268 }
269 return foundScreen;
270}
271
272# define RETURN \
273 { DUMMYFreeRec(pScrn);\
274 return FALSE0;\
275 }
276
277/* Mandatory */
278Bool
279DUMMYPreInit(ScrnInfoPtr pScrn, int flags)
280{
281 ClockRangePtr clockRanges;
282 int i;
283 DUMMYPtr dPtr;
284 int maxClock = 300000;
285 GDevPtr device = xf86GetEntityInfo(pScrn->entityList[0])->device;
286
287 if (flags & PROBE_DETECT0x01)
288 return TRUE1;
289
290 /* Allocate the DummyRec driverPrivate */
291 if (!DUMMYGetRec(pScrn)) {
292 return FALSE0;
293 }
294
295 dPtr = DUMMYPTR(pScrn)((DUMMYPtr)((pScrn)->driverPrivate));
296
297 pScrn->chipset = (char *)xf86TokenToString(DUMMYChipsets,
298 DUMMY_CHIP);
299
300 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Chipset is a DUMMY\n");
301
302 pScrn->monitor = pScrn->confScreen->monitor;
303
304 if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb0x01 | Support32bppFb0x02))
305 return FALSE0;
306 else {
307 /* Check that the returned depth is one we support */
308 switch (pScrn->depth) {
309 case 8:
310 case 15:
311 case 16:
312 case 24:
313 break;
314 default:
315 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
316 "Given depth (%d) is not supported by this driver\n",
317 pScrn->depth);
318 return FALSE0;
319 }
320 }
321
322 xf86PrintDepthBpp(pScrn);
323 if (pScrn->depth == 8)
324 pScrn->rgbBits = 8;
325
326 /* Get the depth24 pixmap format */
327 if (pScrn->depth == 24 && pix24bpp == 0)
328 pix24bpp = xf86GetBppFromDepth(pScrn, 24);
329
330 /*
331 * This must happen after pScrn->display has been set because
332 * xf86SetWeight references it.
333 */
334 if (pScrn->depth > 8) {
335 /* The defaults are OK for us */
336 rgb zeros = {0, 0, 0};
337
338 if (!xf86SetWeight(pScrn, zeros, zeros)) {
339 return FALSE0;
340 } else {
341 /* XXX check that weight returned is supported */
342 ;
343 }
344 }
345
346 if (!xf86SetDefaultVisual(pScrn, -1))
347 return FALSE0;
348
349 if (pScrn->depth > 1) {
350 Gamma zeros = {0.0, 0.0, 0.0};
351
352 if (!xf86SetGamma(pScrn, zeros))
353 return FALSE0;
354 }
355
356 xf86CollectOptions(pScrn, device->options);
357 /* Process the options */
358 if (!(dPtr->Options = malloc(sizeof(DUMMYOptions))))
359 return FALSE0;
360 memcpy(dPtr->Options, DUMMYOptions, sizeof(DUMMYOptions))__builtin___memcpy_chk (dPtr->Options, DUMMYOptions, sizeof
(DUMMYOptions), __builtin_object_size (dPtr->Options, 0))
;
361
362 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options);
363
364 xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor);
365
366 if (device->videoRam != 0) {
367 pScrn->videoRam = device->videoRam;
368 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "VideoRAM: %d kByte\n",
369 pScrn->videoRam);
370 } else {
371 pScrn->videoRam = 4096;
372 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kByte\n",
373 pScrn->videoRam);
374 }
375
376 if (device->dacSpeeds[0] != 0) {
377 maxClock = device->dacSpeeds[0];
378 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Max Clock: %d kHz\n",
379 maxClock);
380 } else {
381 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Max Clock: %d kHz\n",
382 maxClock);
383 }
384
385 pScrn->progClock = TRUE1;
386 /*
387 * Setup the ClockRanges, which describe what clock ranges are available,
388 * and what sort of modes they can be used for.
389 */
390 clockRanges = (ClockRangePtr)xnfcalloc(sizeof(ClockRange), 1)XNFcallocarray((sizeof(ClockRange)), (1));
391 clockRanges->next = NULL((void*)0);
392 clockRanges->ClockMulFactor = 1;
393 clockRanges->minClock = 11000; /* guessed ยงยงยง */
394 clockRanges->maxClock = maxClock;
395 clockRanges->clockIndex = -1; /* programmable */
396 clockRanges->interlaceAllowed = TRUE1;
397 clockRanges->doubleScanAllowed = TRUE1;
398
399 /* Subtract memory for HW cursor */
400
401
402 {
403 int apertureSize = (pScrn->videoRam * 1024);
404 i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
405 pScrn->display->modes, clockRanges,
406 NULL((void*)0), 256, DUMMY_MAX_WIDTH32767,
407 (8 * pScrn->bitsPerPixel),
408 128, DUMMY_MAX_HEIGHT32767, pScrn->display->virtualX,
409 pScrn->display->virtualY, apertureSize,
410 LOOKUP_BEST_REFRESH);
411
412 if (i == -1)
413 RETURN;
414 }
415
416 /* Prune the modes marked as invalid */
417 xf86PruneDriverModes(pScrn);
418
419 if (i == 0 || pScrn->modes == NULL((void*)0)) {
420 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
421 RETURN;
422 }
423
424 /*
425 * Set the CRTC parameters for all of the modes based on the type
426 * of mode, and the chipset's interlace requirements.
427 *
428 * Calling this is required if the mode->Crtc* values are used by the
429 * driver and if the driver doesn't provide code to set them. They
430 * are not pre-initialised at all.
431 */
432 xf86SetCrtcForModes(pScrn, 0);
433
434 /* Set the current mode to the first in the list */
435 pScrn->currentMode = pScrn->modes;
436
437 /* Print the list of modes being used */
438 xf86PrintModes(pScrn);
439
440 /* If monitor resolution is set on the command line, use it */
441 xf86SetDpi(pScrn, 0, 0);
442
443 if (xf86LoadSubModule(pScrn, "fb") == NULL((void*)0)) {
444 RETURN;
445 }
446
447 if (!dPtr->swCursor) {
448 if (!xf86LoadSubModule(pScrn, "ramdac"))
449 RETURN;
450 }
451
452 /* We have no contiguous physical fb in physical memory */
453 pScrn->memPhysBase = 0;
454 pScrn->fbOffset = 0;
455
456 return TRUE1;
457}
458#undef RETURN
459
460/* Mandatory */
461static Bool
462DUMMYEnterVT(VT_FUNC_ARGS_DECLScrnInfoPtr arg)
463{
464 SCRN_INFO_PTR(arg)ScrnInfoPtr pScrn = (arg);
465
466 /* Should we re-save the text mode on each VT enter? */
467 if(!dummyModeInit(pScrn, pScrn->currentMode))
468 return FALSE0;
469
470 DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)pScrn, pScrn->frameX0, pScrn->frameY0);
471
472 return TRUE1;
473}
474
475/* Mandatory */
476static void
477DUMMYLeaveVT(VT_FUNC_ARGS_DECLScrnInfoPtr arg)
478{
479 SCRN_INFO_PTR(arg)ScrnInfoPtr pScrn = (arg);
480 dummyRestore(pScrn, TRUE1);
481}
482
483static void
484DUMMYLoadPalette(
485 ScrnInfoPtr pScrn,
486 int numColors,
487 int *indices,
488 LOCO *colors,
489 VisualPtr pVisual
490){
491 int i, index, shift, Gshift;
492 DUMMYPtr dPtr = DUMMYPTR(pScrn)((DUMMYPtr)((pScrn)->driverPrivate));
493
494 switch(pScrn->depth) {
495 case 15:
496 shift = Gshift = 1;
497 break;
498 case 16:
499 shift = 0;
500 Gshift = 0;
501 break;
502 default:
503 shift = Gshift = 0;
504 break;
505 }
506
507 for(i = 0; i < numColors; i++) {
508 index = indices[i];
509 dPtr->colors[index].red = colors[index].red << shift;
510 dPtr->colors[index].green = colors[index].green << Gshift;
511 dPtr->colors[index].blue = colors[index].blue << shift;
512 }
513
514}
515
516static ScrnInfoPtr DUMMYScrn; /* static-globalize it */
517
518/* Mandatory */
519static Bool
520DUMMYScreenInit(SCREEN_INIT_ARGS_DECLScreenPtr pScreen, int argc, char **argv)
521{
522 ScrnInfoPtr pScrn;
523 DUMMYPtr dPtr;
524 int ret;
525 VisualPtr visual;
526
527 /*
528 * we need to get the ScrnInfoRec for this screen, so let's allocate
529 * one first thing
530 */
531 pScrn = xf86ScreenToScrn(pScreen);
532 dPtr = DUMMYPTR(pScrn)((DUMMYPtr)((pScrn)->driverPrivate));
533 DUMMYScrn = pScrn;
534
535
536 if (!(dPtr->FBBase = malloc(pScrn->videoRam * 1024)))
537 return FALSE0;
538
539 /*
540 * next we save the current state and setup the first mode
541 */
542 dummySave(pScrn);
543
544 if (!dummyModeInit(pScrn,pScrn->currentMode))
545 return FALSE0;
546 DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)pScrn, pScrn->frameX0, pScrn->frameY0);
547
548 /*
549 * Reset visual list.
550 */
551 miClearVisualTypes();
552
553 /* Setup the visuals we support. */
554
555 if (!miSetVisualTypes(pScrn->depth,
556 miGetDefaultVisualMask(pScrn->depth),
557 pScrn->rgbBits, pScrn->defaultVisual))
558 return FALSE0;
559
560 if (!miSetPixmapDepths ()) return FALSE0;
561
562 /*
563 * Call the framebuffer layer's ScreenInit function, and fill in other
564 * pScreen fields.
565 */
566 ret = fbScreenInit(pScreen, dPtr->FBBase,
567 pScrn->virtualX, pScrn->virtualY,
568 pScrn->xDpi, pScrn->yDpi,
569 pScrn->displayWidth, pScrn->bitsPerPixel);
570 if (!ret)
571 return FALSE0;
572
573 if (pScrn->depth > 8) {
574 /* Fixup RGB ordering */
575 visual = pScreen->visuals + pScreen->numVisuals;
576 while (--visual >= pScreen->visuals) {
577 if ((visual->class | DynamicClass1) == DirectColor5) {
578 visual->offsetRed = pScrn->offset.red;
579 visual->offsetGreen = pScrn->offset.green;
580 visual->offsetBlue = pScrn->offset.blue;
581 visual->redMask = pScrn->mask.red;
582 visual->greenMask = pScrn->mask.green;
583 visual->blueMask = pScrn->mask.blue;
584 }
585 }
586 }
587
588 /* must be after RGB ordering fixed */
589 fbPictureInit(pScreen, 0, 0);
590
591 xf86SetBlackWhitePixels(pScreen);
592
593#ifdef USE_DGA1
594 DUMMYDGAInit(pScreen);
595#endif
596
597 if (dPtr->swCursor)
598 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Software Cursor.\n");
599
600 {
601
602
603 BoxRec AvailFBArea;
604 int lines = pScrn->videoRam * 1024 /
605 (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
606 AvailFBArea.x1 = 0;
607 AvailFBArea.y1 = 0;
608 AvailFBArea.x2 = pScrn->displayWidth;
609 AvailFBArea.y2 = lines;
610 xf86InitFBManager(pScreen, &AvailFBArea);
611
612 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
613 "Using %i scanlines of offscreen memory \n"
614 , lines - pScrn->virtualY);
615 }
616
617 xf86SetBackingStore(pScreen);
618 xf86SetSilkenMouse(pScreen);
619
620 /* Initialise cursor functions */
621 miDCInitialize (pScreen, xf86GetPointerScreenFuncs());
622
623
624 if (!dPtr->swCursor) {
625 /* HW cursor functions */
626 if (!DUMMYCursorInit(pScreen)) {
627 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
628 "Hardware cursor initialization failed\n");
629 return FALSE0;
630 }
631 }
632
633 /* Initialise default colourmap */
634 if(!miCreateDefColormap(pScreen))
635 return FALSE0;
636
637 if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
638 DUMMYLoadPalette, NULL((void*)0),
639 CMAP_PALETTED_TRUECOLOR0x0000001
640 | CMAP_RELOAD_ON_MODE_SWITCH0x0000002))
641 return FALSE0;
642
643/* DUMMYInitVideo(pScreen); */
644
645 pScreen->SaveScreen = DUMMYSaveScreen;
646
647
648 /* Wrap the current CloseScreen function */
649 dPtr->CloseScreen = pScreen->CloseScreen;
650 pScreen->CloseScreen = DUMMYCloseScreen;
651
652 /* Wrap the current CreateWindow function */
653 dPtr->CreateWindow = pScreen->CreateWindow;
654 pScreen->CreateWindow = DUMMYCreateWindow;
655
656 /* Report any unused options (only for the first generation) */
657 if (serverGeneration == 1) {
658 xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
659 }
660
661 return TRUE1;
662}
663
664/* Mandatory */
665Bool
666DUMMYSwitchMode(SWITCH_MODE_ARGS_DECLScrnInfoPtr arg, DisplayModePtr mode)
667{
668 SCRN_INFO_PTR(arg)ScrnInfoPtr pScrn = (arg);
669 return dummyModeInit(pScrn, mode);
670}
671
672/* Mandatory */
673void
674DUMMYAdjustFrame(ADJUST_FRAME_ARGS_DECLScrnInfoPtr arg, int x, int y)
675{
676 SCRN_INFO_PTR(arg)ScrnInfoPtr pScrn = (arg);
677 int Base;
678
679 Base = (y * pScrn->displayWidth + x) >> 2;
680
681 /* Scale Base by the number of bytes per pixel. */
682 switch (pScrn->depth) {
683 case 8 :
684 break;
685 case 15 :
686 case 16 :
687 Base *= 2;
688 break;
689 case 24 :
690 Base *= 3;
Value stored to 'Base' is never read
691 break;
692 default :
693 break;
694 }
695}
696
697/* Mandatory */
698static Bool
699DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECLScreenPtr pScreen)
700{
701 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
702 DUMMYPtr dPtr = DUMMYPTR(pScrn)((DUMMYPtr)((pScrn)->driverPrivate));
703
704 if(pScrn->vtSema){
705 dummyRestore(pScrn, TRUE1);
706 free(dPtr->FBBase);
707 }
708
709 if (dPtr->CursorInfo)
710 xf86DestroyCursorInfoRec(dPtr->CursorInfo);
711
712 pScrn->vtSema = FALSE0;
713 pScreen->CloseScreen = dPtr->CloseScreen;
714 return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGSpScreen);
715}
716
717/* Optional */
718static void
719DUMMYFreeScreen(FREE_SCREEN_ARGS_DECLScrnInfoPtr arg)
720{
721 SCRN_INFO_PTR(arg)ScrnInfoPtr pScrn = (arg);
722 DUMMYFreeRec(pScrn);
723}
724
725static Bool
726DUMMYSaveScreen(ScreenPtr pScreen, int mode)
727{
728 ScrnInfoPtr pScrn = NULL((void*)0);
729 DUMMYPtr dPtr;
730
731 if (pScreen != NULL((void*)0)) {
732 pScrn = xf86ScreenToScrn(pScreen);
733 dPtr = DUMMYPTR(pScrn)((DUMMYPtr)((pScrn)->driverPrivate));
734
735 dPtr->screenSaver = xf86IsUnblank(mode);
736 }
737 return TRUE1;
738}
739
740/* Optional */
741static ModeStatus
742DUMMYValidMode(SCRN_ARG_TYPEScrnInfoPtr arg, DisplayModePtr mode, Bool verbose, int flags)
743{
744 return(MODE_OK);
745}
746
747static void
748dummySave(ScrnInfoPtr pScrn)
749{
750}
751
752static void
753dummyRestore(ScrnInfoPtr pScrn, Bool restoreText)
754{
755}
756
757static Bool
758dummyModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
759{
760 dummyRestore(pScrn, FALSE0);
761
762 return(TRUE1);
763}
764
765Atom VFB_PROP = 0;
766#define VFB_PROP_NAME"VFB_IDENT" "VFB_IDENT"
767
768static Bool
769DUMMYCreateWindow(WindowPtr pWin)
770{
771 ScreenPtr pScreen = pWin->drawable.pScreen;
772 DUMMYPtr dPtr = DUMMYPTR(DUMMYScrn)((DUMMYPtr)((DUMMYScrn)->driverPrivate));
773 WindowPtr pWinRoot;
774 int ret;
775
776 pScreen->CreateWindow = dPtr->CreateWindow;
777 ret = pScreen->CreateWindow(pWin);
778 dPtr->CreateWindow = pScreen->CreateWindow;
779 pScreen->CreateWindow = DUMMYCreateWindow;
780
781 if(ret != TRUE1)
782 return(ret);
783
784 if(dPtr->prop == FALSE0) {
785#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION)(((((((21) << 16) & 0xFFFF0000) | ((0) & 0x0000FFFF
))) & 0xFFFF0000) >> 16)
< 8
786 pWinRoot = WindowTable[DUMMYScrn->pScreen->myNum];
787#else
788 pWinRoot = DUMMYScrn->pScreen->root;
789#endif
790 if (! ValidAtom(VFB_PROP))
791 VFB_PROP = MakeAtom(VFB_PROP_NAME"VFB_IDENT", strlen(VFB_PROP_NAME"VFB_IDENT"), 1);
792
793 ret = dixChangeWindowProperty(serverClient, pWinRoot, VFB_PROP,
794 XA_STRING((Atom) 31), 8, PropModeReplace0,
795 (int)4, (pointer)"TRUE", FALSE0);
796 if( ret != Success0)
797 ErrorF("Could not set VFB root window property");
798 dPtr->prop = TRUE1;
799
800 return TRUE1;
801 }
802 return TRUE1;
803}
804
805#ifndef HW_SKIP_CONSOLE4
806#define HW_SKIP_CONSOLE4 4
807#endif
808
809static Bool
810dummyDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
811{
812 CARD32 *flag;
813
814 switch (op) {
815 case GET_REQUIRED_HW_INTERFACES:
816 flag = (CARD32*)ptr;
817 (*flag) = HW_SKIP_CONSOLE4;
818 return TRUE1;
819 default:
820 return FALSE0;
821 }
822}