[PATCH mesa 2/3] Add a DRI queryImage attribute to query the offset
Neil Roberts
neil at linux.intel.com
Thu Feb 6 05:58:30 PST 2014
This bumps the DRI image extension to version 9 and adds an attribute which
can be used with queryImage to get the image's offset within the buffer. This
will be used with eglCreateWaylandBufferFromImageWL in order to create a
buffer using an image which represents a plane of a planar buffer.
---
include/GL/internal/dri_interface.h | 1 +
src/mesa/drivers/dri/i965/intel_screen.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 81f7e60..16ca55f 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1085,6 +1085,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_ATTRIB_FD 0x2007 /* available in versions
* 7+. Each query will return a
* new fd. */
+#define __DRI_IMAGE_ATTRIB_OFFSET 0x2008 /* available in versions 9+ */
enum __DRIYUVColorSpace {
__DRI_YUV_COLOR_SPACE_UNDEFINED = 0,
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 7700a4e..cc10ddb 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -553,6 +553,12 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
if (drm_intel_bo_gem_export_to_prime(image->region->bo, value) == 0)
return true;
return false;
+ case __DRI_IMAGE_ATTRIB_OFFSET:
+ if (image->planar_format == NULL)
+ *value = image->offset;
+ else
+ *value = image->offsets[0];
+ return true;
default:
return false;
}
@@ -788,7 +794,7 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
}
static struct __DRIimageExtensionRec intelImageExtension = {
- .base = { __DRI_IMAGE, 8 },
+ .base = { __DRI_IMAGE, 9 },
.createImageFromName = intel_create_image_from_name,
.createImageFromRenderbuffer = intel_create_image_from_renderbuffer,
--
1.8.5.3
More information about the wayland-devel
mailing list