[Mesa-dev] [PATCH] i965: Set modifier for imported and duplicated images

Daniel Stone daniels at collabora.com
Wed May 3 08:43:04 UTC 2017


When a buffer is being created from FD or GEM flink import, the current
API makes no provision for passing modifier information along with this.
Set the modifier for such images to DRM_FORMAT_MOD_INVALID.

Also preserve the modifier when duplicating an image, as will be done by
GBM when importing from a wl_buffer.

This doubly tripped up Wayland, as the images would first have been
created (as wl_buffers) with a 0 modifier, and then lost what modifier
they would've had when being duplicated into gbm_bos.

This patch does not address the renderbuffer/texture targets, which
require more thought.

Signed-off-by: Daniel Stone <daniels at collabora.com>
Cc: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/i965/intel_screen.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 23a4bd6d6c..a729dd98c9 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -398,6 +398,7 @@ intel_create_image_from_name(__DRIscreen *dri_screen,
     else
        cpp = _mesa_get_format_bytes(image->format);
 
+    image->modifier = DRM_FORMAT_MOD_INVALID;
     image->width = width;
     image->height = height;
     image->pitch = pitch * cpp;
@@ -710,6 +711,7 @@ intel_dup_image(__DRIimage *orig_image, void *loaderPrivate)
    image->planar_format   = orig_image->planar_format;
    image->dri_format      = orig_image->dri_format;
    image->format          = orig_image->format;
+   image->modifier        = orig_image->modifier;
    image->offset          = orig_image->offset;
    image->width           = orig_image->width;
    image->height          = orig_image->height;
@@ -805,6 +807,7 @@ intel_create_image_from_fds(__DRIscreen *dri_screen,
    if (image == NULL)
       return NULL;
 
+   image->modifier = DRM_FORMAT_MOD_INVALID;
    image->width = width;
    image->height = height;
    image->pitch = strides[0];
-- 
2.12.2



More information about the mesa-dev mailing list