<div dir="ltr">Hi<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 30, 2015 at 8:12 AM, Dave Airlie <span dir="ltr"><<a href="mailto:airlied@gmail.com" target="_blank">airlied@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
<br>
At the moment to get an EGL image to a dma-buf file descriptor,<br>
you have to use EGL_MESA_drm_image, and then use libdrm to<br>
convert this to a file descriptor.<br>
<br>
This extension just provides an API modelled on EGL_MESA_drm_image,<br>
to return a dma-buf file descriptor.<br>
<br>
v2: update spec for new API proposal<br>
add internal queries to get the fourcc back from intel driver.<br>
<br>
v2.1: add gallium pieces.<br>
<br>
v2.2: add offsets to spec and API, rename fd->fds, stride->strides<br>
in API. rewrite spec a bit more, add some q/a<br>
<br>
v2.3:<br>
add modifiers to query interface and 64-bit type for that (Daniel Stone)<br>
specifiy what happens to num fds vs num planes differences. (Chad Versace)<br>
<br>
v2.4:<br>
fix grammar (Daniel Stone)<br>
<br>
Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
---<br>
docs/specs/MESA_image_dma_buf_export.txt | 142 +++++++++++++++++++++++++++++++<br>
include/EGL/eglmesaext.h | 8 ++<br>
include/GL/internal/dri_interface.h | 4 +-<br>
src/egl/drivers/dri2/egl_dri2.c | 59 ++++++++++++-<br>
src/egl/main/eglapi.c | 48 +++++++++++<br>
src/egl/main/eglapi.h | 10 +++<br>
src/egl/main/egldisplay.h | 2 +<br>
src/egl/main/eglfallbacks.c | 5 ++<br>
src/egl/main/eglmisc.c | 2 +<br>
src/gallium/state_trackers/dri/dri2.c | 32 ++++++-<br>
src/mesa/drivers/dri/i965/intel_screen.c | 25 +++++-<br>
11 files changed, 332 insertions(+), 5 deletions(-)<br>
create mode 100644 docs/specs/MESA_image_dma_buf_export.txt<br>
<br>
diff --git a/docs/specs/MESA_image_dma_buf_export.txt b/docs/specs/MESA_image_dma_buf_export.txt<br>
new file mode 100644<br>
index 0000000..3bc5890<br>
--- /dev/null<br>
+++ b/docs/specs/MESA_image_dma_buf_export.txt<br>
@@ -0,0 +1,142 @@<br>
+Name<br>
+<br>
+ MESA_image_dma_buf_export<br>
+<br>
+Name Strings<br>
+<br>
+ EGL_MESA_image_dma_buf_export<br>
+<br>
+Contributors<br>
+<br>
+ Dave Airlie<br>
+<br>
+Contact<br>
+<br>
+ Dave Airlie (airlied 'at' redhat 'dot' com)<br>
+<br>
+Status<br>
+<br>
+ Proposal<br>
+<br>
+Version<br>
+<br>
+ Version 2<br>
+<br>
+Number<br>
+<br>
+ <unnumbered><br>
+<br>
+Dependencies<br>
+<br>
+ Reguires EGL 1.4 or later. This extension is written against the<br>
+ wording of the EGL 1.4 specification.<br>
+<br>
+ EGL_KHR_base_image is required.<br>
+<br>
+ The EGL implementation must be running on a Linux kernel supporting the<br>
+ dma_buf buffer sharing mechanism.<br>
+<br>
+Overview<br>
+<br>
+ This extension provides entry points for integrating EGLImage with the<br>
+ dma-buf infrastructure. The extension allows creating a Linux dma_buf<br>
+ file descriptor or multiple file descriptors, in the case of multi-plane<br>
+ YUV image, from an EGLImage.<br>
+<br>
+ It is designed to provide the complementary functionality to EGL_EXT_image_dma_buf_import.<br>
+<br>
+IP Status<br>
+<br>
+ Open-source; freely implementable.<br>
+<br>
+New Types<br>
+<br>
+ This is a 64 bit unsigned integer.<br>
+<br>
+ typedef khronos_uint64_t EGLuint64MESA;<br>
+<br>
+<br>
+New Procedures and Functions<br>
+<br>
+ EGLBoolean eglExportDMABUFImageQueryMESA(EGLDisplay dpy,<br>
+ EGLImageKHR image,<br>
+ int *fourcc,<br>
+ int *num_planes,<br>
+ EGLuint64MESA *modifiers);<br>
+<br>
+ EGLBoolean eglExportDMABUFImageMESA(EGLDisplay dpy,<br>
+ EGLImageKHR image,<br>
+ int *fds,<br>
+ EGLint *strides,<br>
+ EGLint *offsets);<br>
+<br>
+New Tokens<br>
+<br>
+ None<br>
+<br>
+<br>
+Additions to the EGL 1.4 Specification:<br>
+<br>
+ To mirror the import extension, this extension attempts to return<br>
+ enough information to enable an exported dma-buf to be imported<br>
+ via eglCreateImageKHR and EGL_LINUX_DMA_BUF_EXT token.<br>
+<br>
+ Retrieving the information is a two step process, so two APIs<br>
+ are required.<br>
+<br>
+ The first entrypoint<br>
+ EGLBoolean eglExportDMABUFImageQueryMESA(EGLDisplay dpy,<br>
+ EGLImageKHR image,<br>
+ int *fourcc,<br>
+ int *num_planes,<br>
+ EGLuint64MESA *modifiers);<br>
+<br>
+ is used to retrieve the pixel format of the buffer, as specified by<br>
+ drm_fourcc.h, the number of planes in the image and the Linux<br>
+ drm modifiers. <fourcc>, <num_planes> and <modifiers> may be NULL,<br>
+ in which case no value is retrieved.<br>
+<br>
+ The second entrypoint retrieves the dma_buf file descriptors,<br>
+ strides and offsets for the image. The caller should pass<br>
+ arrays sized according to the num_planes values retrieved previously.<br>
+ Passing arrays of the wrong size will have undefined results.<br>
+ If the number of fds is less than the number of planes, then<br>
+ subsequent fd slots should contain -1.<br>
+<br>
+ EGLBoolean eglExportDMABUFImageMESA(EGLDisplay dpy,<br>
+ EGLImageKHR image,<br>
+ int *fds,<br>
+ EGLint *strides,<br>
+ EGLint *offsets);<br>
+<br>
+ <fds>, <strides>, <offsets> can be NULL if the infomatation isn't<br>
+ required by the caller.<br>
+<br>
+Issues<br>
+<br>
+1. Should the API look more like an attribute getting API?<br>
+<br>
+ANSWER: No, from a user interface pov, having to iterate across calling<br>
+the API up to 12 times using attribs seems like the wrong solution.<br>
+<br>
+2. Should the API take a plane and just get the fd/stride/offset for that<br>
+ plane?<br>
+<br>
+ANSWER: UNKNOWN,this might be just as valid an API.<br>
+<br>
+3. Does ownership of the file descriptor remain with the app?<br>
+<br>
+ANSWER: Yes, the app is responsible for closing any fds retrieved.<br>
+<br>
+4. If number of planes and number of fds differ what should we do?<br>
+<br>
+ANSWER: Return -1 for the secondary slots, as this avoids having<br>
+to dup the fd extra times to make the interface sane.<br>
+<br>
+Revision History<br>
+<br>
+ Version 2, March, 2015<br>
+ Add a query interface (Dave Airlie)<br>
+ Version 1, June 3, 2014<br>
+ Initial draft (Dave Airlie)<br>
+<br>
diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h<br>
index 5fcc527..595babd 100644<br>
--- a/include/EGL/eglmesaext.h<br>
+++ b/include/EGL/eglmesaext.h<br>
@@ -170,6 +170,14 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EG<br>
#define EGL_NO_CONFIG_MESA ((EGLConfig)0)<br>
#endif<br>
<br>
+#if KHRONOS_SUPPORT_INT64<br>
+#ifndef EGL_MESA_image_dma_buf_export<br>
+#define EGL_MESA_image_dma_buf_export 1<br>
+typedef khronos_uint64_t EGLuint64MESA;<br>
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *fourcc, EGLint *nplanes, EGLuint64MESA *modifiers);<br>
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);<br>
+#endif<br>
+#endif<br>
#ifdef __cplusplus<br>
}<br>
#endif<br>
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h<br>
index 1d670b1..eb7da23 100644<br>
--- a/include/GL/internal/dri_interface.h<br>
+++ b/include/GL/internal/dri_interface.h<br>
@@ -1006,7 +1006,7 @@ struct __DRIdri2ExtensionRec {<br>
* extensions.<br>
*/<br>
#define __DRI_IMAGE "DRI_IMAGE"<br>
-#define __DRI_IMAGE_VERSION 10<br>
+#define __DRI_IMAGE_VERSION 11<br>
<br>
/**<br>
* These formats correspond to the similarly named MESA_FORMAT_*<br>
@@ -1097,6 +1097,8 @@ struct __DRIdri2ExtensionRec {<br>
#define __DRI_IMAGE_ATTRIB_FD 0x2007 /* available in versions<br>
* 7+. Each query will return a<br>
* new fd. */<br>
+#define __DRI_IMAGE_ATTRIB_FOURCC 0x2008 /* available in versions 11 */<br>
+#define __DRI_IMAGE_ATTRIB_NUM_PLANES 0x2009 /* available in versions 11 */<br>
<br>
enum __DRIYUVColorSpace {<br>
__DRI_YUV_COLOR_SPACE_UNDEFINED = 0,<br>
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c<br>
index 6306483..3d0a8fe 100644<br>
--- a/src/egl/drivers/dri2/egl_dri2.c<br>
+++ b/src/egl/drivers/dri2/egl_dri2.c<br>
@@ -524,8 +524,14 @@ dri2_setup_screen(_EGLDisplay *disp)<br>
<br>
capabilities = dri2_dpy->image->getCapabilities(dri2_dpy->dri_screen);<br>
disp->Extensions.MESA_drm_image = (capabilities & __DRI_IMAGE_CAP_GLOBAL_NAMES) != 0;<br>
- } else<br>
+<br>
+ if (dri2_dpy->image->base.version >= 11)<br>
+ disp->Extensions.MESA_image_dma_buf_export = EGL_TRUE;<br>
+ } else {<br>
disp->Extensions.MESA_drm_image = EGL_TRUE;<br>
+ if (dri2_dpy->image->base.version >= 11)<br>
+ disp->Extensions.MESA_image_dma_buf_export = EGL_TRUE;<br>
+ }<br>
<br>
disp->Extensions.KHR_image_base = EGL_TRUE;<br>
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;<br>
@@ -1964,6 +1970,55 @@ dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img,<br>
<br>
return EGL_TRUE;<br>
}<br>
+<br>
+static EGLBoolean<br>
+dri2_export_dma_buf_image_query_mesa(_EGLDriver *drv, _EGLDisplay *disp,<br>
+ _EGLImage *img,<br>
+ EGLint *fourcc, EGLint *nplanes,<br>
+ EGLuint64MESA *modifiers)<br>
+{<br>
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);<br>
+ struct dri2_egl_image *dri2_img = dri2_egl_image(img);<br>
+<br>
+ (void) drv;<br>
+<br>
+<br>
+ if (nplanes)<br>
+ dri2_dpy->image->queryImage(dri2_img->dri_image,<br>
+ __DRI_IMAGE_ATTRIB_NUM_PLANES, nplanes);<br>
+ if (fourcc)<br>
+ dri2_dpy->image->queryImage(dri2_img->dri_image,<br>
+ __DRI_IMAGE_ATTRIB_FOURCC, fourcc);<br>
+<br>
+ if (modifiers)<br>
+ *modifiers = 0;<br>
+<br>
+ return EGL_TRUE;<br>
+}<br>
+<br>
+static EGLBoolean<br>
+dri2_export_dma_buf_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img,<br>
+ int *fds, EGLint *strides, EGLint *offsets)<br>
+{<br>
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);<br>
+ struct dri2_egl_image *dri2_img = dri2_egl_image(img);<br>
+<br>
+ (void) drv;<br>
+<br>
+ /* rework later to provide multiple fds/strides/offsets */<br>
+ if (fds)<br>
+ dri2_dpy->image->queryImage(dri2_img->dri_image,<br>
+ __DRI_IMAGE_ATTRIB_FD, fds);<br>
+<br>
+ if (strides)<br>
+ dri2_dpy->image->queryImage(dri2_img->dri_image,<br>
+ __DRI_IMAGE_ATTRIB_STRIDE, strides);<br>
+<br>
+ if (offsets)<br>
+ offsets[0] = 0;<br>
+<br>
+ return EGL_TRUE;<br>
+}<br>
#endif<br>
<br>
#ifdef HAVE_WAYLAND_PLATFORM<br>
@@ -2218,6 +2273,8 @@ _eglBuiltInDriverDRI2(const char *args)<br>
#ifdef HAVE_LIBDRM<br>
dri2_drv->base.API.CreateDRMImageMESA = dri2_create_drm_image_mesa;<br>
dri2_drv->base.API.ExportDRMImageMESA = dri2_export_drm_image_mesa;<br>
+ dri2_drv->base.API.ExportDMABUFImageQueryMESA = dri2_export_dma_buf_image_query_mesa;<br>
+ dri2_drv->base.API.ExportDMABUFImageMESA = dri2_export_dma_buf_image_mesa;<br>
#endif<br>
#ifdef HAVE_WAYLAND_PLATFORM<br>
dri2_drv->base.API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl;<br>
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c<br>
index db44a26..2d2ed39 100644<br>
--- a/src/egl/main/eglapi.c<br>
+++ b/src/egl/main/eglapi.c<br>
@@ -1114,6 +1114,10 @@ eglGetProcAddress(const char *procname)<br>
{ "eglCreatePlatformWindowSurfaceEXT", (_EGLProc) eglCreatePlatformWindowSurfaceEXT },<br>
{ "eglCreatePlatformPixmapSurfaceEXT", (_EGLProc) eglCreatePlatformPixmapSurfaceEXT },<br>
{ "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM },<br>
+#ifdef EGL_MESA_drm_buf_image_export<br></blockquote><div><br> EGL_MESA_image_dma_buf_export instead?<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ { "eglExportDMABUFImageQueryMESA", (_EGLProc) eglExportDMABUFImageQueryMESA },<br>
+ { "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA },<br>
+#endif<br>
{ NULL, NULL }<br>
};<br>
EGLint i;<br>
@@ -1801,3 +1805,47 @@ eglGetSyncValuesCHROMIUM(EGLDisplay display, EGLSurface surface,<br>
<br>
RETURN_EGL_EVAL(disp, ret);<br>
}<br>
+<br>
+#ifdef EGL_MESA_image_dma_buf_export<br>
+EGLBoolean EGLAPIENTRY<br>
+eglExportDMABUFImageQueryMESA(EGLDisplay dpy, EGLImageKHR image,<br>
+ EGLint *fourcc, EGLint *nplanes,<br>
+ EGLuint64MESA *modifiers)<br>
+{<br>
+ _EGLDisplay *disp = _eglLockDisplay(dpy);<br>
+ _EGLImage *img = _eglLookupImage(image, disp);<br>
+ _EGLDriver *drv;<br>
+ EGLBoolean ret;<br>
+<br>
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);<br>
+ assert(disp->Extensions.MESA_image_dma_buf_export);<br>
+<br>
+ if (!img)<br>
+ RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);<br>
+<br>
+ ret = drv->API.ExportDMABUFImageQueryMESA(drv, disp, img, fourcc, nplanes,<br>
+ modifiers);<br>
+<br>
+ RETURN_EGL_EVAL(disp, ret);<br>
+}<br>
+<br>
+EGLBoolean EGLAPIENTRY<br>
+eglExportDMABUFImageMESA(EGLDisplay dpy, EGLImageKHR image,<br>
+ int *fds, EGLint *strides, EGLint *offsets)<br>
+{<br>
+ _EGLDisplay *disp = _eglLockDisplay(dpy);<br>
+ _EGLImage *img = _eglLookupImage(image, disp);<br>
+ _EGLDriver *drv;<br>
+ EGLBoolean ret;<br>
+<br>
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);<br>
+ assert(disp->Extensions.MESA_image_dma_buf_export);<br>
+<br>
+ if (!img)<br>
+ RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);<br>
+<br>
+ ret = drv->API.ExportDMABUFImageMESA(drv, disp, img, fds, strides, offsets);<br>
+<br>
+ RETURN_EGL_EVAL(disp, ret);<br>
+}<br>
+#endif<br>
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h<br>
index cb01cab..092abb9 100644<br>
--- a/src/egl/main/eglapi.h<br>
+++ b/src/egl/main/eglapi.h<br>
@@ -141,6 +141,11 @@ typedef EGLBoolean (*SwapBuffersWithDamageEXT_t) (_EGLDriver *drv, _EGLDisplay *<br>
<br>
typedef EGLBoolean (*GetSyncValuesCHROMIUM_t) (_EGLDisplay *dpy, _EGLSurface *surface, EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc);<br>
<br>
+#ifdef EGL_MESA_image_dma_buf_export<br>
+typedef EGLBoolean (*ExportDMABUFImageQueryMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *fourcc, EGLint *stride, EGLuint64MESA *modifiers);<br>
+typedef EGLBoolean (*ExportDMABUFImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *fds, EGLint *strides, EGLint *offsets);<br>
+#endif<br>
+<br>
/**<br>
* The API dispatcher jumps through these functions<br>
*/<br>
@@ -228,6 +233,11 @@ struct _egl_api<br>
<br>
QueryBufferAge_t QueryBufferAge;<br>
GetSyncValuesCHROMIUM_t GetSyncValuesCHROMIUM;<br>
+<br>
+#ifdef EGL_MESA_image_dma_buf_export<br>
+ ExportDMABUFImageQueryMESA_t ExportDMABUFImageQueryMESA;<br>
+ ExportDMABUFImageMESA_t ExportDMABUFImageMESA;<br>
+#endif<br>
};<br>
<br>
#endif /* EGLAPI_INCLUDED */<br>
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h<br>
index bcdc2b2..8581cb2 100644<br>
--- a/src/egl/main/egldisplay.h<br>
+++ b/src/egl/main/egldisplay.h<br>
@@ -123,6 +123,8 @@ struct _egl_extensions<br>
EGLBoolean EXT_buffer_age;<br>
EGLBoolean EXT_swap_buffers_with_damage;<br>
EGLBoolean EXT_image_dma_buf_import;<br>
+<br>
+ EGLBoolean MESA_image_dma_buf_export;<br>
};<br>
<br>
<br>
diff --git a/src/egl/main/eglfallbacks.c b/src/egl/main/eglfallbacks.c<br>
index 0b70e92..6127426 100644<br>
--- a/src/egl/main/eglfallbacks.c<br>
+++ b/src/egl/main/eglfallbacks.c<br>
@@ -120,4 +120,9 @@ _eglInitDriverFallbacks(_EGLDriver *drv)<br>
#ifdef EGL_NOK_swap_region<br>
drv->API.SwapBuffersRegionNOK = NULL;<br>
#endif<br>
+<br>
+#ifdef EGL_MESA_dma_buf_image_export<br>
+ drv->API.ExportDMABUFImageQueryMESA = NULL;<br>
+ drv->API.ExportDMABUFImageMESA = NULL;<br>
+#endif<br>
}<br>
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c<br>
index 2f49809..7837684 100644<br>
--- a/src/egl/main/eglmisc.c<br>
+++ b/src/egl/main/eglmisc.c<br>
@@ -126,6 +126,8 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)<br>
_EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);<br>
<br>
_EGL_CHECK_EXTENSION(NV_post_sub_buffer);<br>
+<br>
+ _EGL_CHECK_EXTENSION(MESA_image_dma_buf_export);<br>
#undef _EGL_CHECK_EXTENSION<br>
}<br>
<br>
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c<br>
index 7d65ba3..f8f4ecf 100644<br>
--- a/src/gallium/state_trackers/dri/dri2.c<br>
+++ b/src/gallium/state_trackers/dri/dri2.c<br>
@@ -76,6 +76,30 @@ static int convert_fourcc(int format, int *dri_components_p)<br>
return format;<br>
}<br>
<br>
+static int convert_to_fourcc(int format)<br>
+{<br>
+ switch(format) {<br>
+ case __DRI_IMAGE_FORMAT_RGB565:<br>
+ format = __DRI_IMAGE_FOURCC_RGB565;<br>
+ break;<br>
+ case __DRI_IMAGE_FORMAT_ARGB8888:<br>
+ format = __DRI_IMAGE_FOURCC_ARGB8888;<br>
+ break;<br>
+ case __DRI_IMAGE_FORMAT_XRGB8888:<br>
+ format = __DRI_IMAGE_FOURCC_XRGB8888;<br>
+ break;<br>
+ case __DRI_IMAGE_FORMAT_ABGR8888:<br>
+ format = __DRI_IMAGE_FOURCC_ABGR8888;<br>
+ break;<br>
+ case __DRI_IMAGE_FORMAT_XBGR8888:<br>
+ format = __DRI_IMAGE_FOURCC_XBGR8888;<br>
+ break;<br>
+ default:<br>
+ return -1;<br>
+ }<br>
+ return format;<br>
+}<br>
+<br>
/**<br>
* DRI2 flush extension.<br>
*/<br>
@@ -909,6 +933,12 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)<br>
return GL_FALSE;<br>
*value = image->dri_components;<br>
return GL_TRUE;<br>
+ case __DRI_IMAGE_ATTRIB_FOURCC:<br>
+ *value = convert_to_fourcc(image->dri_format);<br>
+ return GL_TRUE;<br>
+ case __DRI_IMAGE_ATTRIB_NUM_PLANES:<br>
+ *value = 1;<br>
+ return GL_TRUE;<br>
default:<br>
return GL_FALSE;<br>
}<br>
@@ -1203,7 +1233,7 @@ dri2_get_capabilities(__DRIscreen *_screen)<br>
<br>
/* The extension is modified during runtime if DRI_PRIME is detected */<br>
static __DRIimageExtension dri2ImageExtension = {<br>
- .base = { __DRI_IMAGE, 10 },<br>
+ .base = { __DRI_IMAGE, 11 },<br>
<br>
.createImageFromName = dri2_create_image_from_name,<br>
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,<br>
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c<br>
index cea7ddf..39e8eaf 100644<br>
--- a/src/mesa/drivers/dri/i965/intel_screen.c<br>
+++ b/src/mesa/drivers/dri/i965/intel_screen.c<br>
@@ -300,6 +300,17 @@ intel_image_format_lookup(int fourcc)<br>
return f;<br>
}<br>
<br>
+static boolean intel_lookup_fourcc(int dri_format, int *fourcc)<br></blockquote><div><br></div><div>s/boolean/bool<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+{<br>
+ for (unsigned i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {<br>
+ if (intel_image_formats[i].planes[0].dri_format == dri_format) {<br>
+ *fourcc = intel_image_formats[i].fourcc;<br>
+ return true;<br>
+ }<br>
+ }<br>
+ return false;<br>
+}<br>
+<br>
static __DRIimage *<br>
intel_allocate_image(int dri_format, void *loaderPrivate)<br>
{<br>
@@ -559,6 +570,14 @@ intel_query_image(__DRIimage *image, int attrib, int *value)<br>
if (drm_intel_bo_gem_export_to_prime(image->bo, value) == 0)<br>
return true;<br>
return false;<br>
+ case __DRI_IMAGE_ATTRIB_FOURCC:<br>
+ if (intel_lookup_fourcc(image->dri_format, value))<br>
+ return true;<br>
+ return false;<br>
+ case __DRI_IMAGE_ATTRIB_NUM_PLANES:<br>
+ *value = 1;<br>
+ return true;<br>
+<br>
default:<br>
return false;<br>
}<br>
@@ -784,7 +803,7 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)<br>
}<br>
<br>
static const __DRIimageExtension intelImageExtension = {<br>
- .base = { __DRI_IMAGE, 8 },<br>
+ .base = { __DRI_IMAGE, 11 },<br>
<br>
.createImageFromName = intel_create_image_from_name,<br>
.createImageFromRenderbuffer = intel_create_image_from_renderbuffer,<br>
@@ -797,7 +816,9 @@ static const __DRIimageExtension intelImageExtension = {<br>
.fromPlanar = intel_from_planar,<br>
.createImageFromTexture = intel_create_image_from_texture,<br>
.createImageFromFds = intel_create_image_from_fds,<br>
- .createImageFromDmaBufs = intel_create_image_from_dma_bufs<br>
+ .createImageFromDmaBufs = intel_create_image_from_dma_bufs,<br>
+ .blitImage = NULL,<br>
+ .getCapabilities = NULL<br>
};<br>
<br>
static int<br>
<span class=""><font color="#888888">--<br>
2.3.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Marc-André Lureau</div>
</div></div></div>