[Mesa-dev,v2] i965: fix dma_buf import with non-zero offset.

Submitted by Gwenole Beauchesne on March 14, 2014, 5:46 p.m.

Details

Message ID 1394819160-20647-1-git-send-email-gwenole.beauchesne@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Gwenole Beauchesne March 14, 2014, 5:46 p.m.
Fix eglCreateImage() from a packed dma_buf surface with a non-zero offset
to pixels data. In particular, this fixes support for planar YUV surfaces
when they are individually mapped on a per-plane basis, i.e. when the
OES_EGL_image_external is not used and user application wants to use its
own shader code for composition, or processing on individual plane (OCL).

v2: fixed check for tile boundary.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
---
 src/mesa/drivers/dri/i965/intel_screen.c |    7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 1e3d58f..5005b5c 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -737,6 +737,13 @@  intel_create_image_from_fds(__DRIscreen *screen,
       image->strides[index] = strides[index];
    }
 
+   if (f->nplanes == 1) {
+      image->offset = image->offsets[0];
+      if (image->region->tiling != I915_TILING_NONE && (image->offset & 0xfff))
+         _mesa_warning(NULL,
+                       "intel_create_image_from_fds: offset not on tile boundary");
+   }
+
    intel_setup_image_from_dimensions(image);
 
    return image;

Comments

Pushed to git master after r-b on IRC (#intel-gfx) a few days ago. Thanks.

2014-03-14 18:46 GMT+01:00 Gwenole Beauchesne <gb.devel@gmail.com>:
> Fix eglCreateImage() from a packed dma_buf surface with a non-zero offset
> to pixels data. In particular, this fixes support for planar YUV surfaces
> when they are individually mapped on a per-plane basis, i.e. when the
> OES_EGL_image_external is not used and user application wants to use its
> own shader code for composition, or processing on individual plane (OCL).
>
> v2: fixed check for tile boundary.
>
> Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
> ---
>  src/mesa/drivers/dri/i965/intel_screen.c |    7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index 1e3d58f..5005b5c 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -737,6 +737,13 @@ intel_create_image_from_fds(__DRIscreen *screen,
>        image->strides[index] = strides[index];
>     }
>
> +   if (f->nplanes == 1) {
> +      image->offset = image->offsets[0];
> +      if (image->region->tiling != I915_TILING_NONE && (image->offset & 0xfff))
> +         _mesa_warning(NULL,
> +                       "intel_create_image_from_fds: offset not on tile boundary");
> +   }
> +
>     intel_setup_image_from_dimensions(image);
>
>     return image;
> --
> 1.7.9.5
>