summaryrefslogtreecommitdiff
path: root/src/gbm
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-11-08 22:06:51 -0800
committerIan Romanick <ian.d.romanick@intel.com>2013-11-15 13:39:39 -0800
commit76434775e07abe9f1f372284c0fd46d6fffccfa6 (patch)
treecfb9775600252fbd2ba3d508fbc152a08ffc4114 /src/gbm
parent236524430228e2cc090d89652a0a46591ebe7ac0 (diff)
gbm: Add support for __DRIimage based getBuffers when available
This lets us allocate color buffers as __DRIimages and pass them into the driver instead of having to create a __DRIbuffer with the flink that requires. With this patch, we can now run gbm on render-nodes. A render-node is a drm device that doesn't support modesetting and all the legacy DRI ioctls. flink is also not supported, but now that gbm doesn't need flink, we can run piglit on head-less gbm or head-less GPGPU. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Jordan Justen <jordan.l.justen@intel.com> Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 04e3ef00dbeab177793954781ddfd298724b6d8d)
Diffstat (limited to 'src/gbm')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c28
-rw-r--r--src/gbm/backends/dri/gbm_driint.h8
2 files changed, 34 insertions, 2 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index e95fcc7b23c..6c63c75e92d 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -104,6 +104,24 @@ dri_get_buffers_with_format(__DRIdrawable * driDrawable,
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 const __DRIuseInvalidateExtension use_invalidate = {
{ __DRI_USE_INVALIDATE, 1 }
};
@@ -120,6 +138,13 @@ const __DRIdri2LoaderExtension dri2_loader_extension = {
dri_get_buffers_with_format,
};
+const __DRIimageLoaderExtension image_loader_extension = {
+ { __DRI_IMAGE_LOADER, 1 },
+ image_get_buffers,
+ dri_flush_front_buffer,
+};
+
+
struct dri_extension_match {
const char *name;
int version;
@@ -258,7 +283,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] = &dri2_loader_extension.base;
- dri->extensions[3] = NULL;
+ dri->extensions[3] = &image_loader_extension.base;
+ dri->extensions[4] = NULL;
if (dri->dri2 == NULL)
return -1;
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index cb4e477abf4..fb303a3be55 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -52,7 +52,7 @@ struct gbm_dri_device {
__DRIdri2LoaderExtension *loader;
const __DRIconfig **driver_configs;
- const __DRIextension *extensions[4];
+ const __DRIextension *extensions[5];
const __DRIextension **driver_extensions;
__DRIimage *(*lookup_image)(__DRIscreen *screen, void *image, void *data);
@@ -67,6 +67,12 @@ struct gbm_dri_device {
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, void *data);
+ int (*image_get_buffers)(__DRIdrawable *driDrawable,
+ unsigned int format,
+ uint32_t *stamp,
+ void *loaderPrivate,
+ uint32_t buffer_mask,
+ struct __DRIimageList *buffers);
struct wl_drm *wl_drm;
};