summaryrefslogtreecommitdiffstats
path: root/src/gbm/backends/dri/gbm_dri.c
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <[email protected]>2012-01-25 16:24:18 +0200
committerKristian Høgsberg <[email protected]>2012-03-28 22:14:34 -0400
commitfd6acb97fb9164b57daf3ca4b1bd637ca4685b64 (patch)
treeab9fe6d8cdd70cadfb4048326ea5b1c21191ca8f /src/gbm/backends/dri/gbm_dri.c
parent0d1ef1f57f9011fd2bc3354d60fb19db29af7363 (diff)
gbm: Create hooks for dri2_loader_extension in dri backend
Pass a dri2_loader extension to the dri driver when gbm creates the dri screen. The implementation jumps through pointers in the gbm device so that an EGL on GBM implementation can provide the real implementations.
Diffstat (limited to 'src/gbm/backends/dri/gbm_dri.c')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 5398e3dd400..4df6e8fcf06 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -54,6 +54,49 @@ dri_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
return dri->lookup_image(screen, image, dri->lookup_user_data);
}
+static __DRIbuffer *
+dri_get_buffers(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *data)
+{
+ struct gbm_dri_surface *surf = data;
+ struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm);
+
+ if (dri->get_buffers == NULL)
+ return NULL;
+
+ return dri->get_buffers(driDrawable, width, height, attachments,
+ count, out_count, surf->dri_private);
+}
+
+static void
+dri_flush_front_buffer(__DRIdrawable * driDrawable, void *data)
+{
+ struct gbm_dri_surface *surf = data;
+ struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm);
+
+ if (dri->flush_front_buffer != NULL)
+ dri->flush_front_buffer(driDrawable, surf->dri_private);
+}
+
+static __DRIbuffer *
+dri_get_buffers_with_format(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *data)
+{
+ struct gbm_dri_surface *surf = data;
+ struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm);
+
+ if (dri->get_buffers_with_format == NULL)
+ return NULL;
+
+ return
+ dri->get_buffers_with_format(driDrawable, width, height, attachments,
+ count, out_count, surf->dri_private);
+}
+
static const __DRIuseInvalidateExtension use_invalidate = {
{ __DRI_USE_INVALIDATE, 1 }
};
@@ -63,6 +106,13 @@ static const __DRIimageLookupExtension image_lookup_extension = {
dri_lookup_egl_image
};
+const __DRIdri2LoaderExtension dri2_loader_extension = {
+ { __DRI_DRI2_LOADER, 3 },
+ dri_get_buffers,
+ dri_flush_front_buffer,
+ dri_get_buffers_with_format,
+};
+
struct dri_extension_match {
const char *name;
int version;
@@ -187,7 +237,8 @@ dri_screen_create(struct gbm_dri_device *dri)
dri->extensions[0] = &image_lookup_extension.base;
dri->extensions[1] = &use_invalidate.base;
- dri->extensions[2] = NULL;
+ dri->extensions[2] = &dri2_loader_extension.base;
+ dri->extensions[3] = NULL;
if (dri->dri2 == NULL)
return -1;