On Tue, Mar 20, 2018 at 2:45 PM, Emil Velikov <emil.l.veli...@gmail.com> wrote: > On 20 March 2018 at 18:02, Christian Gmeiner > <christian.gmei...@gmail.com> 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.gmei...@gmail.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); >> > Based on the existing gbm_bo_get_modifier handling there should be a guard > here: > > #ifdef HAVE_GBM_MODIFIERS > *modifier = ... > #else > *modifier = DRM_FORMAT_MOD_INVALID; > #endif >
We probably *could* just require new enough version of gbm. But a similar issue came up with $blob gles driver that did not support gbm_bo_map(), and I'd suggested that we could probably start doing __attribute__((weak)) fallbacks for new gbm fxns which returned errors (or in this case DRM_FORMAT_MOD_LINEAR ?) to avoid making these things build time configs.. BR, -R > > >> /* 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); >> > Ditto > >> /* 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); >> > And again? > >> /* 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, > With these attributes added, only, if the modifier is valid. > Same goes for the analogous hunks through the rest of the patch. > > -Emil > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev