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

Emil Velikov emil.l.velikov at gmail.com
Wed May 3 14:32:17 UTC 2017


Hi Dan,

On 3 May 2017 at 09:43, Daniel Stone <daniels at collabora.com> wrote:
> 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;
I think we want to fix intel_from_planar,
intel_create_image_from_renderbuffer and
intel_create_image_from_texture as well?

With that
Fixes: d78a36ea624 ("i965/dri: Handle the linear fb modifier")
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

As a follow-up we might consider factoring and sharing the common bits
for all the "create image" functions.
Just an idea anyway.

-Emil


More information about the mesa-dev mailing list