[Mesa-dev] [PATCH kmscube] cube-tex: make use of modifiers
Eric Engestrom
eric.engestrom at imgtec.com
Tue Mar 20 18:32:34 UTC 2018
On Tuesday, 2018-03-20 19:02:00 +0100, Christian Gmeiner wrote:
> Fixes rendering issues with mode rgba on etnaviv. I have applied
> the same change for nv12 variants but they are not supported on
> etnaviv.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
LGTM!
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
> cube-tex.c | 32 ++++++++++++++++++++++++--------
> 1 file changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/cube-tex.c b/cube-tex.c
> index 9e38ae8..dba19ff 100644
> --- a/cube-tex.c
> +++ b/cube-tex.c
> @@ -213,7 +213,7 @@ static const char *fragment_shader_source_2img =
>
> static const uint32_t texw = 512, texh = 512;
>
> -static int get_fd_rgba(uint32_t *pstride)
> +static int get_fd_rgba(uint32_t *pstride, uint64_t *modifier)
> {
> struct gbm_bo *bo;
> void *map_data = NULL;
> @@ -234,6 +234,7 @@ static int get_fd_rgba(uint32_t *pstride)
> gbm_bo_unmap(bo, map_data);
>
> fd = gbm_bo_get_fd(bo);
> + *modifier = gbm_bo_get_modifier(bo);
>
> /* we have the fd now, no longer need the bo: */
> gbm_bo_destroy(bo);
> @@ -243,7 +244,7 @@ static int get_fd_rgba(uint32_t *pstride)
> return fd;
> }
>
> -static int get_fd_y(uint32_t *pstride)
> +static int get_fd_y(uint32_t *pstride, uint64_t *modifier)
> {
> struct gbm_bo *bo;
> void *map_data = NULL;
> @@ -264,6 +265,7 @@ static int get_fd_y(uint32_t *pstride)
> gbm_bo_unmap(bo, map_data);
>
> fd = gbm_bo_get_fd(bo);
> + *modifier = gbm_bo_get_modifier(bo);
>
> /* we have the fd now, no longer need the bo: */
> gbm_bo_destroy(bo);
> @@ -273,7 +275,7 @@ static int get_fd_y(uint32_t *pstride)
> return fd;
> }
>
> -static int get_fd_uv(uint32_t *pstride)
> +static int get_fd_uv(uint32_t *pstride, uint64_t *modifier)
> {
> struct gbm_bo *bo;
> void *map_data = NULL;
> @@ -294,6 +296,7 @@ static int get_fd_uv(uint32_t *pstride)
> gbm_bo_unmap(bo, map_data);
>
> fd = gbm_bo_get_fd(bo);
> + *modifier = gbm_bo_get_modifier(bo);
>
> /* we have the fd now, no longer need the bo: */
> gbm_bo_destroy(bo);
> @@ -306,7 +309,8 @@ static int get_fd_uv(uint32_t *pstride)
> static int init_tex_rgba(void)
> {
> uint32_t stride;
> - int fd = get_fd_rgba(&stride);
> + uint64_t modifier;
> + int fd = get_fd_rgba(&stride, &modifier);
> const EGLint attr[] = {
> EGL_WIDTH, texw,
> EGL_HEIGHT, texh,
> @@ -314,6 +318,8 @@ static int init_tex_rgba(void)
> EGL_DMA_BUF_PLANE0_FD_EXT, fd,
> EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
> EGL_DMA_BUF_PLANE0_PITCH_EXT, stride,
> + EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, modifier & 0xFFFFFFFF,
> + EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, modifier >> 32,
> EGL_NONE
> };
> EGLImage img;
> @@ -339,8 +345,9 @@ static int init_tex_rgba(void)
> static int init_tex_nv12_2img(void)
> {
> uint32_t stride_y, stride_uv;
> - int fd_y = get_fd_y(&stride_y);
> - int fd_uv = get_fd_uv(&stride_uv);
> + uint64_t modifier_y, modifier_uv;
> + int fd_y = get_fd_y(&stride_y, &modifier_y);
> + int fd_uv = get_fd_uv(&stride_uv, &modifier_uv);
> const EGLint attr_y[] = {
> EGL_WIDTH, texw,
> EGL_HEIGHT, texh,
> @@ -348,6 +355,8 @@ static int init_tex_nv12_2img(void)
> EGL_DMA_BUF_PLANE0_FD_EXT, fd_y,
> EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
> EGL_DMA_BUF_PLANE0_PITCH_EXT, stride_y,
> + EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, modifier_y & 0xFFFFFFFF,
> + EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, modifier_y >> 32,
> EGL_NONE
> };
> const EGLint attr_uv[] = {
> @@ -357,6 +366,8 @@ static int init_tex_nv12_2img(void)
> EGL_DMA_BUF_PLANE0_FD_EXT, fd_uv,
> EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
> EGL_DMA_BUF_PLANE0_PITCH_EXT, stride_uv,
> + EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, modifier_uv & 0xFFFFFFFF,
> + EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, modifier_uv >> 32,
> EGL_NONE
> };
> EGLImage img_y, img_uv;
> @@ -397,8 +408,9 @@ static int init_tex_nv12_2img(void)
> static int init_tex_nv12_1img(void)
> {
> uint32_t stride_y, stride_uv;
> - int fd_y = get_fd_y(&stride_y);
> - int fd_uv = get_fd_uv(&stride_uv);
> + uint64_t modifier_y, modifier_uv;
> + int fd_y = get_fd_y(&stride_y, &modifier_y);
> + int fd_uv = get_fd_uv(&stride_uv, &modifier_uv);
> const EGLint attr[] = {
> EGL_WIDTH, texw,
> EGL_HEIGHT, texh,
> @@ -406,9 +418,13 @@ static int init_tex_nv12_1img(void)
> EGL_DMA_BUF_PLANE0_FD_EXT, fd_y,
> EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
> EGL_DMA_BUF_PLANE0_PITCH_EXT, stride_y,
> + EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, modifier_y & 0xFFFFFFFF,
> + EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, modifier_y >> 32,
> EGL_DMA_BUF_PLANE1_FD_EXT, fd_uv,
> EGL_DMA_BUF_PLANE1_OFFSET_EXT, 0,
> EGL_DMA_BUF_PLANE1_PITCH_EXT, stride_uv,
> + EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, modifier_uv & 0xFFFFFFFF,
> + EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, modifier_uv >> 32,
> EGL_NONE
> };
> EGLImage img;
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list