1 /***********************************************************
2 
3 Copyright 1987, 1998  The Open Group
4 
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
24 
25 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26 
27                         All Rights Reserved
28 
29 Permission to use, copy, modify, and distribute this software and its
30 documentation for any purpose and without fee is hereby granted,
31 provided that the above copyright notice appear in all copies and that
32 both that copyright notice and this permission notice appear in
33 supporting documentation, and that the name of Digital not be
34 used in advertising or publicity pertaining to distribution of the
35 software without specific, written prior permission.
36 
37 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43 SOFTWARE.
44 
45 ******************************************************************/
46 
47 #ifndef SCREENINTSTRUCT_H
48 #define SCREENINTSTRUCT_H
49 
50 #include "screenint.h"
51 #include "regionstr.h"
52 #include "colormap.h"
53 #include "cursor.h"
54 #include "validate.h"
55 #include <X11/Xproto.h>
56 #include "dix.h"
57 #include "privates.h"
58 #include <X11/extensions/randr.h>
59 
60 typedef struct _PixmapFormat {
61     unsigned char depth;
62     unsigned char bitsPerPixel;
63     unsigned char scanlinePad;
64 } PixmapFormatRec;
65 
66 typedef struct _Visual {
67     VisualID vid;
68     short class;
69     short bitsPerRGBValue;
70     short ColormapEntries;
71     short nplanes;              /* = log2 (ColormapEntries). This does not
72                                  * imply that the screen has this many planes.
73                                  * it may have more or fewer */
74     unsigned long redMask, greenMask, blueMask;
75     int offsetRed, offsetGreen, offsetBlue;
76 } VisualRec;
77 
78 typedef struct _Depth {
79     unsigned char depth;
80     short numVids;
81     VisualID *vids;             /* block of visual ids for this depth */
82 } DepthRec;
83 
84 typedef struct _ScreenSaverStuff {
85     WindowPtr pWindow;
86     XID wid;
87     char blanked;
88     Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ ,
89                                  int /*xstate */ ,
90                                  Bool /*force */ );
91 } ScreenSaverStuffRec;
92 
93 /*
94  *  There is a typedef for each screen function pointer so that code that
95  *  needs to declare a screen function pointer (e.g. in a screen private
96  *  or as a local variable) can easily do so and retain full type checking.
97  */
98 
99 typedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ );
100 
101 typedef void (*QueryBestSizeProcPtr) (int /*class */ ,
102                                       unsigned short * /*pwidth */ ,
103                                       unsigned short * /*pheight */ ,
104                                       ScreenPtr /*pScreen */ );
105 
106 typedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ ,
107                                    int /*on */ );
108 
109 typedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ ,
110                                  int /*sx */ ,
111                                  int /*sy */ ,
112                                  int /*w */ ,
113                                  int /*h */ ,
114                                  unsigned int /*format */ ,
115                                  unsigned long /*planeMask */ ,
116                                  char * /*pdstLine */ );
117 
118 typedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ ,
119                                  int /*wMax */ ,
120                                  DDXPointPtr /*ppt */ ,
121                                  int * /*pwidth */ ,
122                                  int /*nspans */ ,
123                                  char * /*pdstStart */ );
124 
125 typedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ ,
126                                        int /*x */ ,
127                                        int /*y */ ,
128                                        int /*width */ ,
129                                        int /*height */ ,
130                                        unsigned int /*subWindowMode */ );
131 
132 typedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ );
133 
134 typedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ );
135 
136 typedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ ,
137                                        int /*x */ ,
138                                        int /*y */ );
139 
140 typedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ ,
141                                                unsigned long /*mask */ );
142 
143 typedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ );
144 
145 typedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ );
146 
147 typedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ ,
148                                       WindowPtr /*pOldNextSib */ );
149 
150 typedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ ,
151                                     WindowPtr /*pChild */ ,
152                                     VTKind /*kind */ );
153 
154 typedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
155                                          WindowPtr /*pChild */ ,
156                                          VTKind /*kind */ );
157 
158 typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
159                                         RegionPtr /*prgn */);
160 
161 typedef void (*PaintWindowProcPtr) (WindowPtr /*pWindow*/,
162                                     RegionPtr /*pRegion*/,
163                                     int /*what*/);
164 
165 typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
166                                    DDXPointRec /*ptOldOrg */ ,
167                                    RegionPtr /*prgnSrc */ );
168 
169 typedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ ,
170                                           int /*x */ ,
171                                           int /*y */ ,
172                                           int /*w */ ,
173                                           int /*h */ ,
174                                           Bool /*generateExposures */ );
175 
176 typedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
177                                    int /*dx */ ,
178                                    int /*dy */ );
179 
180 /* pixmap will exist only for the duration of the current rendering operation */
181 #define CREATE_PIXMAP_USAGE_SCRATCH                     1
182 /* pixmap will be the backing pixmap for a redirected window */
183 #define CREATE_PIXMAP_USAGE_BACKING_PIXMAP              2
184 /* pixmap will contain a glyph */
185 #define CREATE_PIXMAP_USAGE_GLYPH_PICTURE               3
186 /* pixmap will be shared */
187 #define CREATE_PIXMAP_USAGE_SHARED                      4
188 
189 typedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ ,
190                                           int /*width */ ,
191                                           int /*height */ ,
192                                           int /*depth */ ,
193                                           unsigned /*usage_hint */ );
194 
195 typedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ );
196 
197 typedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
198                                     FontPtr /*pFont */ );
199 
200 typedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
201                                       FontPtr /*pFont */ );
202 
203 typedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ ,
204                                         ScreenPtr /*pScreen */ ,
205                                         BoxPtr /*pBox */ );
206 
207 typedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ ,
208                                      ScreenPtr /*pScreen */ ,
209                                      CursorPtr /*pCursor */ ,
210                                      BoxPtr /*pHotBox */ ,
211                                      BoxPtr /*pTopLeftBox */ );
212 
213 typedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ ,
214                                       ScreenPtr /*pScreen */ ,
215                                       CursorPtr /*pCursor */ );
216 
217 typedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
218                                       ScreenPtr /*pScreen */ ,
219                                       CursorPtr /*pCursor */ );
220 
221 typedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
222                                         ScreenPtr /*pScreen */ ,
223                                         CursorPtr /*pCursor */ );
224 
225 typedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ ,
226                                       ScreenPtr /*pScreen */ ,
227                                       CursorPtr /*pCursor */ ,
228                                       Bool /*displayed */ );
229 
230 typedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ ,
231                                           ScreenPtr /*pScreen */ ,
232                                           int /*x */ ,
233                                           int /*y */ ,
234                                           Bool /*generateEvent */ );
235 
236 typedef void (*CursorWarpedToProcPtr) (DeviceIntPtr /* pDev */ ,
237                                        ScreenPtr /*pScreen */ ,
238                                        ClientPtr /*pClient */ ,
239                                        WindowPtr /*pWindow */ ,
240                                        SpritePtr /*pSprite */ ,
241                                        int /*x */ ,
242                                        int /*y */ );
243 
244 typedef void (*CurserConfinedToProcPtr) (DeviceIntPtr /* pDev */ ,
245                                          ScreenPtr /*pScreen */ ,
246                                          WindowPtr /*pWindow */ );
247 
248 typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
249 
250 typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
251 
252 typedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ );
253 
254 typedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ );
255 
256 typedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ );
257 
258 typedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ ,
259                                               XID * /*pmaps */ );
260 
261 typedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ ,
262                                     int /*ndef */ ,
263                                     xColorItem * /*pdef */ );
264 
265 typedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ ,
266                                      unsigned short * /*pgreen */ ,
267                                      unsigned short * /*pblue */ ,
268                                      VisualPtr /*pVisual */ );
269 
270 typedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ );
271 
272 typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr pScreen,
273                                            void *timeout);
274 
275 /* result has three possible values:
276  * < 0 - error
277  * = 0 - timeout
278  * > 0 - activity
279  */
280 typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr pScreen,
281                                             int result);
282 
283 typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
284 
285 typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr pPixmap,
286                                            int width,
287                                            int height,
288                                            int depth,
289                                            int bitsPerPixel,
290                                            int devKind,
291                                            void *pPixData);
292 
293 typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
294 
295 typedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ ,
296                                         PixmapPtr /*pPix */ );
297 
298 typedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ );
299 
300 typedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ );
301 
302 typedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ );
303 
304 typedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ ,
305                                               WindowPtr /*firstChild */ ,
306                                               WindowPtr * /*pLayerWin */ );
307 
308 typedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ ,
309                                     int /*x */ ,
310                                     int /*y */ ,
311                                     int /*w */ ,
312                                     int /*h */ ,
313                                     int /*bw */ ,
314                                     WindowPtr /*pSib */ );
315 
316 typedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ ,
317                                    int /*x */ ,
318                                    int /*y */ ,
319                                    WindowPtr /*pSib */ ,
320                                    VTKind /*kind */ );
321 
322 typedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ ,
323                                      int /*x */ ,
324                                      int /*y */ ,
325                                      unsigned int /*w */ ,
326                                      unsigned int /*h */ ,
327                                      WindowPtr  /*pSib */
328     );
329 
330 typedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr   /*pWin */
331     );
332 
333 typedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ );
334 
335 typedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ ,
336                                        WindowPtr /*pPriorParent */ );
337 
338 typedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ ,
339                                  int /* kind */ );
340 
341 typedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ ,
342                                           unsigned int /*width */ );
343 
344 typedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ ,
345                                              WindowPtr /*pWin */ ,
346                                              Bool /*fromConfigure */ );
347 
348 typedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ ,
349                                                ScreenPtr /* pScreen */ );
350 
351 typedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ ,
352                                             ScreenPtr /* pScreen */ );
353 
354 typedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int,
355                                               int *, int *);
356 
357 
358 typedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **);
359 
360 typedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *);
361 
362 #define HAS_SYNC_SHARED_PIXMAP 1
363 /* The SyncSharedPixmap hook has two purposes:
364  *
365  * 1. If the master driver has it, the slave driver can use it to
366  * synchronize the shared pixmap contents with the screen pixmap.
367  * 2. If the slave driver has it, the master driver can expect the slave
368  * driver to call the master screen's SyncSharedPixmap hook, so the master
369  * driver doesn't have to synchronize the shared pixmap contents itself,
370  * e.g. from the BlockHandler.
371  *
372  * A driver must only set the hook if it handles both cases correctly.
373  *
374  * The argument is the slave screen's pixmap_dirty_list entry, the hook is
375  * responsible for finding the corresponding entry in the master screen's
376  * pixmap_dirty_list.
377  */
378 typedef void (*SyncSharedPixmapProcPtr)(PixmapDirtyUpdatePtr);
379 
380 typedef Bool (*StartPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr,
381                                            int x, int y,
382                                            int dst_x, int dst_y,
383                                            Rotation rotation);
384 
385 typedef Bool (*PresentSharedPixmapProcPtr)(PixmapPtr);
386 
387 typedef Bool (*RequestSharedPixmapNotifyDamageProcPtr)(PixmapPtr);
388 
389 typedef Bool (*StopPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr);
390 
391 typedef Bool (*StopFlippingPixmapTrackingProcPtr)(DrawablePtr,
392                                                   PixmapPtr, PixmapPtr);
393 
394 typedef Bool (*SharedPixmapNotifyDamageProcPtr)(PixmapPtr);
395 
396 typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
397 
398 typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
399                                        SpritePtr pSprite, int x, int y);
400 
401 typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
402 
403 typedef void (*DPMSProcPtr)(ScreenPtr pScreen, int level);
404 
405 /* Wrapping Screen procedures
406 
407    There are a few modules in the X server which dynamically add and
408     remove themselves from various screen procedure call chains.
409 
410     For example, the BlockHandler is dynamically modified by:
411 
412      * xf86Rotate
413      * miSprite
414      * composite
415      * render (for animated cursors)
416 
417     Correctly manipulating this chain is complicated by the fact that
418     the chain is constructed through a sequence of screen private
419     structures, each holding the next screen->proc pointer.
420 
421     To add a module to a screen->proc chain is fairly simple; just save
422     the current screen->proc value in the module screen private
423     and store the module's function in the screen->proc location.
424 
425     Removing a screen proc is a bit trickier. It seems like all you
426     need to do is set the screen->proc pointer back to the value saved
427     in your screen private. However, if some other module has come
428     along and wrapped on top of you, then the right place to store the
429     previous screen->proc value is actually in the wrapping module's
430     screen private structure(!). Of course, you have no idea what
431     other module may have wrapped on top, nor could you poke inside
432     its screen private in any case.
433 
434     To make this work, we restrict the unwrapping process to happen
435     during the invocation of the screen proc itself, and then we
436     require the screen proc to take some care when manipulating the
437     screen proc functions pointers.
438 
439     The requirements are:
440 
441      1) The screen proc must set the screen->proc pointer back to the
442         value saved in its screen private before calling outside its
443         module.
444 
445      2a) If the screen proc wants to be remove itself from the chain,
446          it must not manipulate screen->proc pointer again before
447          returning.
448 
449      2b) If the screen proc wants to remain in the chain, it must:
450 
451        2b.1) Re-fetch the screen->proc pointer and store that in
452              its screen private. This ensures that any changes
453              to the chain will be preserved.
454 
455        2b.2) Set screen->proc back to itself
456 
457     One key requirement here is that these steps must wrap not just
458     any invocation of the nested screen->proc value, but must nest
459     essentially any calls outside the current module. This ensures
460     that other modules can reliably manipulate screen->proc wrapping
461     using these same rules.
462 
463     For example, the animated cursor code in render has two macros,
464     Wrap and Unwrap.
465 
466         #define Unwrap(as,s,elt)    ((s)->elt = (as)->elt)
467 
468     Unwrap takes the screen private (as), the screen (s) and the
469     member name (elt), and restores screen->proc to that saved in the
470     screen private.
471 
472         #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
473 
474     Wrap takes the screen private (as), the screen (s), the member
475     name (elt) and the wrapping function (func). It saves the
476     current screen->proc value in the screen private, and then sets the
477     screen->proc to the local wrapping function.
478 
479     Within each of these functions, there's a pretty simple pattern:
480 
481         Unwrap(as, pScreen, UnrealizeCursor);
482 
483         // Do local stuff, including possibly calling down through
484         // pScreen->UnrealizeCursor
485 
486         Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
487 
488     The wrapping block handler is a bit different; it does the Unwrap,
489     the local operations and then only re-Wraps if the hook is still
490     required. Unwrap occurrs at the top of each function, just after
491     entry, and Wrap occurrs at the bottom of each function, just
492     before returning.
493  */
494 
495 typedef struct _Screen {
496     int myNum;                  /* index of this instance in Screens[] */
497     ATOM id;
498     short x, y, width, height;
499     short mmWidth, mmHeight;
500     short numDepths;
501     unsigned char rootDepth;
502     DepthPtr allowedDepths;
503     unsigned long rootVisual;
504     unsigned long defColormap;
505     short minInstalledCmaps, maxInstalledCmaps;
506     char backingStoreSupport, saveUnderSupport;
507     unsigned long whitePixel, blackPixel;
508     GCPtr GCperDepth[MAXFORMATS + 1];
509     /* next field is a stipple to use as default in a GC.  we don't build
510      * default tiles of all depths because they are likely to be of a color
511      * different from the default fg pixel, so we don't win anything by
512      * building a standard one.
513      */
514     PixmapPtr defaultStipple;
515     void *devPrivate;
516     short numVisuals;
517     VisualPtr visuals;
518     WindowPtr root;
519     ScreenSaverStuffRec screensaver;
520 
521     DevPrivateSetRec    screenSpecificPrivates[PRIVATE_LAST];
522 
523     /* Random screen procedures */
524 
525     CloseScreenProcPtr CloseScreen;
526     QueryBestSizeProcPtr QueryBestSize;
527     SaveScreenProcPtr SaveScreen;
528     GetImageProcPtr GetImage;
529     GetSpansProcPtr GetSpans;
530     SourceValidateProcPtr SourceValidate;
531 
532     /* Window Procedures */
533 
534     CreateWindowProcPtr CreateWindow;
535     DestroyWindowProcPtr DestroyWindow;
536     PositionWindowProcPtr PositionWindow;
537     ChangeWindowAttributesProcPtr ChangeWindowAttributes;
538     RealizeWindowProcPtr RealizeWindow;
539     UnrealizeWindowProcPtr UnrealizeWindow;
540     ValidateTreeProcPtr ValidateTree;
541     PostValidateTreeProcPtr PostValidateTree;
542     WindowExposuresProcPtr WindowExposures;
543     CopyWindowProcPtr CopyWindow;
544     ClearToBackgroundProcPtr ClearToBackground;
545     ClipNotifyProcPtr ClipNotify;
546     RestackWindowProcPtr RestackWindow;
547     PaintWindowProcPtr PaintWindow;
548 
549     /* Pixmap procedures */
550 
551     CreatePixmapProcPtr CreatePixmap;
552     DestroyPixmapProcPtr DestroyPixmap;
553 
554     /* Font procedures */
555 
556     RealizeFontProcPtr RealizeFont;
557     UnrealizeFontProcPtr UnrealizeFont;
558 
559     /* Cursor Procedures */
560 
561     ConstrainCursorProcPtr ConstrainCursor;
562     ConstrainCursorHarderProcPtr ConstrainCursorHarder;
563     CursorLimitsProcPtr CursorLimits;
564     DisplayCursorProcPtr DisplayCursor;
565     RealizeCursorProcPtr RealizeCursor;
566     UnrealizeCursorProcPtr UnrealizeCursor;
567     RecolorCursorProcPtr RecolorCursor;
568     SetCursorPositionProcPtr SetCursorPosition;
569     CursorWarpedToProcPtr CursorWarpedTo;
570     CurserConfinedToProcPtr CursorConfinedTo;
571 
572     /* GC procedures */
573 
574     CreateGCProcPtr CreateGC;
575 
576     /* Colormap procedures */
577 
578     CreateColormapProcPtr CreateColormap;
579     DestroyColormapProcPtr DestroyColormap;
580     InstallColormapProcPtr InstallColormap;
581     UninstallColormapProcPtr UninstallColormap;
582     ListInstalledColormapsProcPtr ListInstalledColormaps;
583     StoreColorsProcPtr StoreColors;
584     ResolveColorProcPtr ResolveColor;
585 
586     /* Region procedures */
587 
588     BitmapToRegionProcPtr BitmapToRegion;
589 
590     /* os layer procedures */
591 
592     ScreenBlockHandlerProcPtr BlockHandler;
593     ScreenWakeupHandlerProcPtr WakeupHandler;
594 
595     /* anybody can get a piece of this array */
596     PrivateRec *devPrivates;
597 
598     CreateScreenResourcesProcPtr CreateScreenResources;
599     ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
600 
601     GetWindowPixmapProcPtr GetWindowPixmap;
602     SetWindowPixmapProcPtr SetWindowPixmap;
603     GetScreenPixmapProcPtr GetScreenPixmap;
604     SetScreenPixmapProcPtr SetScreenPixmap;
605     NameWindowPixmapProcPtr NameWindowPixmap;
606 
607     PixmapPtr pScratchPixmap;   /* scratch pixmap "pool" */
608 
609     unsigned int totalPixmapSize;
610 
611     MarkWindowProcPtr MarkWindow;
612     MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
613     ConfigNotifyProcPtr ConfigNotify;
614     MoveWindowProcPtr MoveWindow;
615     ResizeWindowProcPtr ResizeWindow;
616     GetLayerWindowProcPtr GetLayerWindow;
617     HandleExposuresProcPtr HandleExposures;
618     ReparentWindowProcPtr ReparentWindow;
619 
620     SetShapeProcPtr SetShape;
621 
622     ChangeBorderWidthProcPtr ChangeBorderWidth;
623     MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
624 
625     /* Device cursor procedures */
626     DeviceCursorInitializeProcPtr DeviceCursorInitialize;
627     DeviceCursorCleanupProcPtr DeviceCursorCleanup;
628 
629     /* set it in driver side if X server can copy the framebuffer content.
630      * Meant to be used together with '-background none' option, avoiding
631      * malicious users to steal framebuffer's content if that would be the
632      * default */
633     Bool canDoBGNoneRoot;
634 
635     Bool isGPU;
636 
637     /* Info on this screen's slaves (if any) */
638     struct xorg_list slave_list;
639     struct xorg_list slave_head;
640     int output_slaves;
641     /* Info for when this screen is a slave */
642     ScreenPtr current_master;
643     Bool is_output_slave;
644     Bool is_offload_slave;
645 
646     SharePixmapBackingProcPtr SharePixmapBacking;
647     SetSharedPixmapBackingProcPtr SetSharedPixmapBacking;
648 
649     StartPixmapTrackingProcPtr StartPixmapTracking;
650     StopPixmapTrackingProcPtr StopPixmapTracking;
651     SyncSharedPixmapProcPtr SyncSharedPixmap;
652 
653     SharedPixmapNotifyDamageProcPtr SharedPixmapNotifyDamage;
654     RequestSharedPixmapNotifyDamageProcPtr RequestSharedPixmapNotifyDamage;
655     PresentSharedPixmapProcPtr PresentSharedPixmap;
656     StopFlippingPixmapTrackingProcPtr StopFlippingPixmapTracking;
657 
658     struct xorg_list pixmap_dirty_list;
659 
660     ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
661     XYToWindowProcPtr XYToWindow;
662     DPMSProcPtr DPMS;
663 } ScreenRec;
664 
665 static inline RegionPtr
BitmapToRegion(ScreenPtr _pScreen,PixmapPtr pPix)666 BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix)
667 {
668     return (*(_pScreen)->BitmapToRegion) (pPix);        /* no mi version?! */
669 }
670 
671 typedef struct _ScreenInfo {
672     int imageByteOrder;
673     int bitmapScanlineUnit;
674     int bitmapScanlinePad;
675     int bitmapBitOrder;
676     int numPixmapFormats;
677      PixmapFormatRec formats[MAXFORMATS];
678     int numScreens;
679     ScreenPtr screens[MAXSCREENS];
680     int numGPUScreens;
681     ScreenPtr gpuscreens[MAXGPUSCREENS];
682     int x;                      /* origin */
683     int y;                      /* origin */
684     int width;                  /* total width of all screens together */
685     int height;                 /* total height of all screens together */
686 } ScreenInfo;
687 
688 extern _X_EXPORT ScreenInfo screenInfo;
689 
690 extern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ ,
691                                  int /*argc */ ,
692                                  char ** /*argv */ );
693 
694 #endif                          /* SCREENINTSTRUCT_H */
695