[Mesa-dev] [PATCH 11/11] etnaviv: advertise supported dmabuf modifiers

Lucas Stach l.stach at pengutronix.de
Tue Jun 27 15:20:02 UTC 2017


Am Dienstag, den 27.06.2017, 17:10 +0200 schrieb Wladimir J. van der
Laan:
> On Fri, Jun 23, 2017 at 05:50:28PM +0200, Lucas Stach wrote:
> > Simply advertise all supported modifiers, independent of the format.
> > Special formats, like compressed, which don't support all those modifiers
> > are already culled from the dmabuf format list, as we don't support
> > the render target binding for them.
> 
> The SPLIT formats are only supported on hardware with multiple pixel pipes.
> 
> Should this be checked, or is it harmless to advertize them unconditionally?

I _think_ it is harmless to advertise them.

Actually we support texturing from a SPLIT tiled surface just fine (by
resolving to a sampler compatible tiling), it's just a problem for
rendering. All use-cases I have seen so far have some sort of modifier
negotiation for the render buffers, so even if we advertise the SPLIT
formats as supported, they won't be chosen on single pipe hardware.

But now that I think thing about it, it should be fairly easy to not
advertise them in the first place by moving them to the end of the array
and breaking out of the loop early on single pipe hardware. I'll make
this change for the next revision.

Regards,
Lucas
> 
> Reviewed-by: Wladimir J. van der Laan
> 
> > Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> > ---
> >  src/gallium/drivers/etnaviv/etnaviv_screen.c | 36 ++++++++++++++++++++++++++++
> >  1 file changed, 36 insertions(+)
> > 
> > diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> > index b70897b6e41f..571f0b3d42d8 100644
> > --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> > +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> > @@ -45,6 +45,8 @@
> >  
> >  #include "state_tracker/drm_driver.h"
> >  
> > +#include <drm_fourcc.h>
> > +
> >  #define ETNA_DRM_VERSION(major, minor) ((major) << 16 | (minor))
> >  #define ETNA_DRM_VERSION_FENCE_FD      ETNA_DRM_VERSION(1, 1)
> >  
> > @@ -545,6 +547,39 @@ etna_screen_is_format_supported(struct pipe_screen *pscreen,
> >     return usage == allowed;
> >  }
> >  
> > +const uint64_t supported_modifiers[] = {
> > +   DRM_FORMAT_MOD_LINEAR,
> > +   DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED,
> > +   DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED,
> > +   DRM_FORMAT_MOD_VIVANTE_TILED,
> > +   DRM_FORMAT_MOD_VIVANTE_SUPER_TILED,
> > +};
> > +
> > +static void
> > +etna_screen_query_dmabuf_modifiers(struct pipe_screen *screen,
> > +                                   enum pipe_format format, int max,
> > +                                   uint64_t *modifiers,
> > +                                   unsigned int *external_only, int *count)
> > +{
> > +   int i;
> > +
> > +   if (!max) {
> > +      *count = ARRAY_SIZE(supported_modifiers);
> > +      return;
> > +   }
> > +
> > +   if (max > ARRAY_SIZE(supported_modifiers))
> > +      max = ARRAY_SIZE(supported_modifiers);
> > +
> > +   for (i = 0; i < max; i++) {
> > +      modifiers[i] = supported_modifiers[i];
> > +      if (external_only)
> > +         external_only[i] = 0;
> > +   }
> > +
> > +   *count = i;
> > +}
> > +
> >  static boolean
> >  etna_get_specs(struct etna_screen *screen)
> >  {
> > @@ -839,6 +874,7 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu,
> >     pscreen->get_timestamp = etna_screen_get_timestamp;
> >     pscreen->context_create = etna_context_create;
> >     pscreen->is_format_supported = etna_screen_is_format_supported;
> > +   pscreen->query_dmabuf_modifiers = etna_screen_query_dmabuf_modifiers;
> >  
> >     etna_fence_screen_init(pscreen);
> >     etna_query_screen_init(pscreen);
> > -- 
> > 2.11.0
> > 
> > _______________________________________________
> > etnaviv mailing list
> > etnaviv at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/etnaviv




More information about the mesa-dev mailing list