+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 int
+image_get_buffers(__DRIdrawable *driDrawable,
+ unsigned int format,
+ uint32_t *stamp,
+ void *loaderPrivate,
+ uint32_t buffer_mask,
+ struct __DRIimageList *buffers)
+{
+ struct gbm_dri_surface *surf = loaderPrivate;
+ struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm);
+
+ if (dri->image_get_buffers == NULL)
+ return 0;
+
+ return dri->image_get_buffers(driDrawable, format, stamp,
+ surf->dri_private, buffer_mask, buffers);
+}
+
+static void
+swrast_get_drawable_info(__DRIdrawable *driDrawable,
+ int *x,
+ int *y,
+ int *width,
+ int *height,
+ void *loaderPrivate)
+{
+ struct gbm_dri_surface *surf = loaderPrivate;
+
+ *x = 0;
+ *y = 0;
+ *width = surf->base.width;
+ *height = surf->base.height;
+}
+
+static void
+swrast_put_image2(__DRIdrawable *driDrawable,
+ int op,
+ int x,
+ int y,
+ int width,
+ int height,
+ int stride,
+ char *data,
+ void *loaderPrivate)
+{
+ struct gbm_dri_surface *surf = loaderPrivate;
+ struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm);
+
+ dri->swrast_put_image2(driDrawable,
+ op, x, y,
+ width, height, stride,
+ data, surf->dri_private);
+}
+
+static void
+swrast_put_image(__DRIdrawable *driDrawable,
+ int op,
+ int x,
+ int y,
+ int width,
+ int height,
+ char *data,
+ void *loaderPrivate)
+{
+ return swrast_put_image2(driDrawable, op, x, y, width, height,
+ width * 4, data, loaderPrivate);
+}
+
+static void
+swrast_get_image(__DRIdrawable *driDrawable,
+ int x,
+ int y,
+ int width,
+ int height,
+ char *data,
+ void *loaderPrivate)
+{
+ struct gbm_dri_surface *surf = loaderPrivate;
+ struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm);
+
+ dri->swrast_get_image(driDrawable,
+ x, y,
+ width, height,
+ data, surf->dri_private);
+}
+
+static const __DRIuseInvalidateExtension use_invalidate = {
+ .base = { __DRI_USE_INVALIDATE, 1 }