lima: fix buffer import with offset
authorQiang Yu <yuq825@gmail.com>
Sat, 28 Mar 2020 06:09:22 +0000 (14:09 +0800)
committerMarge Bot <eric+marge@anholt.net>
Tue, 31 Mar 2020 01:40:29 +0000 (01:40 +0000)
commite46b2ef7243a7f916b7d77f3495bea26f4f24d62
tree4a0937ff1a09e98ac83c1c89ead06c3dc90bfd03
parent02ad147c5c80a124630992ae6c5ae705c6c68bed
lima: fix buffer import with offset

With EGL_EXT_image_dma_buf_import, user can import dma_buf
with offset.

This is also used by AOSP GLConsumer::updateTexImage
with HAL_PIXEL_FORMAT_YV12 buffer which store YUV planes in
the same buffer with offset. Render sample from it using
GL_OES_EGL_image_external. This should fix some video
display problem when using MediaCodec soft decoding which
generates HAL_PIXEL_FORMAT_YV12 buffer and render it on
screen.

Test program:
https://github.com/yuq/gfx/tree/master/yuv2rgb/dma-buf

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4362>
src/gallium/drivers/lima/lima_resource.c