xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/xpr/dri.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /**************************************************************************
2 
3    Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
4    Copyright (c) 2002-2012 Apple Computer, Inc.
5    All Rights Reserved.
6 
7    Permission is hereby granted, free of charge, to any person obtaining a
8    copy of this software and associated documentation files (the
9    "Software"), to deal in the Software without restriction, including
10    without limitation the rights to use, copy, modify, merge, publish,
11    distribute, sub license, and/or sell copies of the Software, and to
12    permit persons to whom the Software is furnished to do so, subject to
13    the following conditions:
14 
15    The above copyright notice and this permission notice (including the
16    next paragraph) shall be included in all copies or substantial portions
17    of the Software.
18 
19    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22    IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23    ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 
27 **************************************************************************/
28 
29 /*
30  * Authors:
31  *   Jens Owen <jens@precisioninsight.com>
32  *   Jeremy Huddleston <jeremyhu@apple.com>
33  */
34 
35 /* Prototypes for AppleDRI functions */
36 
37 #ifndef _DRI_H_
38 #define _DRI_H_
39 
40 #include <X11/Xdefs.h>
41 #include "scrnintstr.h"
42 #define _APPLEDRI_SERVER_
43 #include "appledri.h"
44 #include <Xplugin.h>
45 
46 typedef void (*ClipNotifyPtr)(WindowPtr, int, int);
47 
48 /*
49  * These functions can be wrapped by the DRI.  Each of these have
50  * generic default funcs (initialized in DRICreateInfoRec) and can be
51  * overridden by the driver in its [driver]DRIScreenInit function.
52  */
53 typedef struct {
54     CopyWindowProcPtr CopyWindow;
55     ClipNotifyProcPtr ClipNotify;
56 } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
57 
58 typedef struct {
59     xp_surface_id id;
60     int kind;
61 } DRISurfaceNotifyArg;
62 
63 extern Bool
64 DRIScreenInit(ScreenPtr pScreen);
65 
66 extern Bool
67 DRIFinishScreenInit(ScreenPtr pScreen);
68 
69 extern void
70 DRICloseScreen(ScreenPtr pScreen);
71 
72 extern Bool
73 DRIExtensionInit(void);
74 
75 extern void
76 DRIReset(void);
77 
78 extern Bool
79 DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable);
80 
81 extern Bool
82 DRIAuthConnection(ScreenPtr pScreen, unsigned int magic);
83 
84 extern Bool DRICreateSurface(ScreenPtr pScreen,
85                              Drawable id,
86                              DrawablePtr pDrawable,
87                              xp_client_id client_id,
88                              xp_surface_id * surface_id,
89                              unsigned int key[2],
90                              void (*notify)(void *arg, void *data),
91                              void *notify_data);
92 
93 extern Bool
94 DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
95                   void (*notify)(void *arg,
96                                  void *data), void *notify_data);
97 
98 extern Bool
99 DRIDrawablePrivDelete(void *pResource, XID id);
100 
101 extern DRIWrappedFuncsRec *
102 DRIGetWrappedFuncs(ScreenPtr pScreen);
103 
104 extern void
105 DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
106 
107 extern void
108 DRIClipNotify(WindowPtr pWin, int dx, int dy);
109 
110 extern void
111 DRISurfaceNotify(xp_surface_id id, int kind);
112 
113 extern void
114 DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion);
115 
116 extern Bool
117 DRICreatePixmap(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
118                 char *path,
119                 size_t pathmax);
120 
121 extern Bool
122 DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height, int *pitch,
123                  int *bpp,
124                  void **ptr);
125 
126 extern void
127 DRIDestroyPixmap(DrawablePtr pDrawable);
128 
129 #endif
130