<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 9, 2017 at 5:48 PM, Ben Widawsky <span dir="ltr"><<a href="mailto:ben@bwidawsk.net" target="_blank">ben@bwidawsk.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Modifiers will be obtains or guessed by the client and passed in during<br></blockquote><div><br></div><div>"obtained"<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
image creation/import.<br>
<br>
This requires bumping the DRIimage version.<br>
<br>
As of this patch, the modifiers aren't plumbed all the way down, this<br>
patch simply makes sure the interface level stuff is correct.<br>
<br>
v2: Don't allow usage + modifiers<br>
<br>
v3: Make NAND actually NAND. Bug introduced in v2. (Jason)<br>
<br>
Cc: Kristian Høgsberg <<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>><br>
Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
Reviewed-by: Eric Engestrom <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>> (v1)<br>
Acked-by: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
---<br>
include/GL/internal/dri_<wbr>interface.h | 27 ++++++++++++++++++++++++++-<br>
src/gallium/state_trackers/<wbr>dri/dri2.c | 1 +<br>
src/mesa/drivers/dri/i965/<wbr>intel_screen.c | 32 ++++++++++++++++++++++++++++++<wbr>+-<br>
3 files changed, 58 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/include/GL/internal/dri_<wbr>interface.h b/include/GL/internal/dri_<wbr>interface.h<br>
index 598d111f33..53fac6fc3c 100644<br>
--- a/include/GL/internal/dri_<wbr>interface.h<br>
+++ b/include/GL/internal/dri_<wbr>interface.h<br>
@@ -1136,7 +1136,7 @@ struct __DRIdri2ExtensionRec {<br>
* extensions.<br>
*/<br>
#define __DRI_IMAGE "DRI_IMAGE"<br>
-#define __DRI_IMAGE_VERSION 13<br>
+#define __DRI_IMAGE_VERSION 14<br>
<br>
/**<br>
* These formats correspond to the similarly named MESA_FORMAT_*<br>
@@ -1257,6 +1257,8 @@ struct __DRIdri2ExtensionRec {<br>
#define __DRI_IMAGE_ATTRIB_NUM_PLANES 0x2009 /* available in versions 11 */<br>
<br>
#define __DRI_IMAGE_ATTRIB_OFFSET 0x200A /* available in versions 13 */<br>
+#define __DRI_IMAGE_ATTRIB_MODIFIER_<wbr>LOWER 0x200B /* available in versions 14 */<br>
+#define __DRI_IMAGE_ATTRIB_MODIFIER_<wbr>UPPER 0x200C /* available in versions 14 */<br>
<br>
enum __DRIYUVColorSpace {<br>
__DRI_YUV_COLOR_SPACE_<wbr>UNDEFINED = 0,<br>
@@ -1468,6 +1470,29 @@ struct __DRIimageExtensionRec {<br>
*/<br>
void (*unmapImage)(__DRIcontext *context, __DRIimage *image, void *data);<br>
<br>
+<br>
+ /**<br>
+ * Creates an image with implementation's favorite modifiers.<br>
+ *<br>
+ * This acts like createImage except there is a list of modifiers passed in<br>
+ * which the implementation may selectively use to create the DRIimage. The<br>
+ * result should be the implementation selects one modifier (perhaps it would<br>
+ * hold on to a few and later pick).<br>
+ *<br>
+ * The created image should be destroyed with destroyImage().<br>
+ *<br>
+ * Returns the new DRIimage. The chosen modifier can be obtained later on<br>
+ * and passed back to things like the kernel's AddFB2 interface.<br>
+ *<br>
+ * \sa __DRIimageRec::createImage<br>
+ *<br>
+ * \since 14<br>
+ */<br>
+ __DRIimage *(*createImageWithModifiers)(_<wbr>_DRIscreen *screen,<br>
+ int width, int height, int format,<br>
+ const uint64_t *modifiers,<br>
+ const unsigned int modifier_count,<br>
+ void *loaderPrivate);<br>
};<br>
<br>
<br>
diff --git a/src/gallium/state_trackers/<wbr>dri/dri2.c b/src/gallium/state_trackers/<wbr>dri/dri2.c<br>
index b50e096443..12e466c6f1 100644<br>
--- a/src/gallium/state_trackers/<wbr>dri/dri2.c<br>
+++ b/src/gallium/state_trackers/<wbr>dri/dri2.c<br>
@@ -1413,6 +1413,7 @@ static __DRIimageExtension dri2ImageExtension = {<br>
.getCapabilities = dri2_get_capabilities,<br>
.mapImage = dri2_map_image,<br>
.unmapImage = dri2_unmap_image,<br>
+ .createImageWithModifiers = NULL,<br>
};<br>
<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_screen.c b/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
index 21786eb54a..3452572874 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
@@ -510,9 +510,11 @@ intel_destroy_image(__DRIimage *image)<br>
}<br>
<br>
static __DRIimage *<br>
-intel_create_image(__<wbr>DRIscreen *dri_screen,<br>
+__intel_create_image(__<wbr>DRIscreen *dri_screen,<br>
int width, int height, int format,<br>
unsigned int use,<br>
+ const uint64_t *modifiers,<br>
+ unsigned count,<br>
void *loaderPrivate)<br>
{<br>
__DRIimage *image;<br>
@@ -521,6 +523,12 @@ intel_create_image(__DRIscreen *dri_screen,<br>
int cpp;<br>
unsigned long pitch;<br>
<br>
+ /* Callers of this may specify a modifier, or a dri usage, but not both. The<br>
+ * newer modifier interface deprecates the older usage flags newer modifier<br>
+ * interface deprecates the older usage flags.<br>
+ */<br>
+ assert(!(use && count));<br>
+<br>
tiling = I915_TILING_X;<br>
if (use & __DRI_IMAGE_USE_CURSOR) {<br>
if (width != 64 || height != 64)<br>
@@ -550,6 +558,27 @@ intel_create_image(__DRIscreen *dri_screen,<br>
return image;<br>
}<br>
<br>
+static __DRIimage *<br>
+intel_create_image(__<wbr>DRIscreen *dri_screen,<br>
+ int width, int height, int format,<br>
+ unsigned int use,<br>
+ void *loaderPrivate)<br>
+{<br>
+ return __intel_create_image(dri_<wbr>screen, width, height, format, use, NULL, 0,<br>
+ loaderPrivate);<br>
+}<br>
+<br>
+static __DRIimage *<br>
+intel_create_image_with_<wbr>modifiers(__DRIscreen *dri_screen,<br>
+ int width, int height, int format,<br>
+ const uint64_t *modifiers,<br>
+ const unsigned count,<br>
+ void *loaderPrivate)<br>
+{<br>
+ return __intel_create_image(dri_<wbr>screen, width, height, format, 0, NULL, 0,<br></blockquote><div><br></div><div>Did you want to pass the modifiers through? Maybe that's in another patch.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ loaderPrivate);<br>
+}<br>
+<br>
static GLboolean<br>
intel_query_image(__DRIimage *image, int attrib, int *value)<br>
{<br>
@@ -840,6 +869,7 @@ static const __DRIimageExtension intelImageExtension = {<br>
.getCapabilities = NULL,<br>
.mapImage = NULL,<br>
.unmapImage = NULL,<br>
+ .createImageWithModifiers = intel_create_image_with_<wbr>modifiers,<br>
};<br>
<br>
static int<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.12.0<br>
<br>
</font></span></blockquote></div><br></div></div>