8 //#include <X11/extensions/dri2proto.h>
12 /* TODO: Bring in DRI XML options */
14 typedef struct dri_version
21 typedef struct dri_screen
25 dri_version_t ddx
, dri
, drm
;
35 typedef struct dri_drawable
37 drm_drawable_t drm_drawable
;
39 unsigned int sarea_index
;
40 unsigned int *sarea_stamp
;
41 unsigned int last_sarea_stamp
;
44 int num_cliprects
, num_back_cliprects
;
45 drm_clip_rect_t
*cliprects
, *back_cliprects
;
46 dri_screen_t
*dri_screen
;
47 unsigned int refcount
;
51 typedef struct dri_context
54 drm_context_t drm_context
;
55 dri_screen_t
*dri_screen
;
59 typedef struct dri_framebuffer
61 drm_handle_t drm_handle
;
62 int base
, size
, stride
;
67 int driCreateScreen(Display
*display
, int screen
, dri_screen_t
**dri_screen
, dri_framebuffer_t
*dri_framebuf
);
68 int driDestroyScreen(dri_screen_t
*dri_screen
);
69 int driCreateDrawable(dri_screen_t
*dri_screen
, Drawable drawable
, dri_drawable_t
**dri_drawable
);
70 int driUpdateDrawableInfo(dri_drawable_t
*dri_drawable
);
71 int driDestroyDrawable(dri_drawable_t
*dri_drawable
);
72 int driCreateContext(dri_screen_t
*dri_screen
, Visual
*visual
, dri_context_t
**dri_context
);
73 int driDestroyContext(dri_context_t
*dri_context
);
75 #define DRI_VALIDATE_DRAWABLE_INFO_ONCE(dri_drawable) \
78 if (*(dri_drawable->sarea_stamp) != dri_drawable->last_sarea_stamp) \
79 driUpdateDrawableInfo(dri_drawable); \
82 #define DRI_VALIDATE_DRAWABLE_INFO(dri_screen, dri_drawable) \
85 while (*(dri_drawable->sarea_stamp) != dri_drawable->last_sarea_stamp) \
87 register unsigned int hwContext = dri_screen->sarea->lock.lock & \
88 ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \
89 DRM_UNLOCK(dri_screen->fd, &dri_screen->sarea->lock, hwContext); \
91 DRM_SPINLOCK(&dri_screen->sarea->drawable_lock, dri_screen->draw_lock_id); \
92 DRI_VALIDATE_DRAWABLE_INFO_ONCE(dri_drawable); \
93 DRM_SPINUNLOCK(&dri_screen->sarea->drawable_lock, dri_screen->draw_lock_id); \
95 DRM_LIGHT_LOCK(dri_screen->fd, &dri_screen->sarea->lock, hwContext); \
99 int dri2CreateScreen(Display
*display
, int screen
, dri_screen_t
**dri_screen
);
100 int dri2DestroyScreen(dri_screen_t
*dri_screen
);
101 int dri2CreateDrawable(dri_screen_t
*dri_screen
, XID drawable
);
102 int dri2DestroyDrawable(dri_screen_t
*dri_screen
, XID drawable
);
103 int dri2CopyDrawable(dri_screen_t
*dri_screen
, XID drawable
, int dest
, int src
);
105 #define DRI_BUFFER_FRONT_LEFT 0
106 #define DRI_BUFFER_BACK_LEFT 1
107 #define DRI_BUFFER_FRONT_RIGHT 2
108 #define DRI_BUFFER_BACK_RIGHT 3
109 #define DRI_BUFFER_DEPTH 4
110 #define DRI_BUFFER_STENCIL 5
111 #define DRI_BUFFER_ACCUM 6
112 #define DRI_BUFFER_FAKE_FRONT_LEFT 7
113 #define DRI_BUFFER_FAKE_FRONT_RIGHT 8
114 #define DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */