[Mesa-dev] [PATCH kmscube] cube-tex: make use of modifiers

Emil Velikov emil.l.velikov at gmail.com
Tue Mar 20 18:45:50 UTC 2018


On 20 March 2018 at 18:02, Christian Gmeiner
<christian.gmeiner at 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.gmeiner at 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 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


More information about the mesa-dev mailing list