Lucas Stach <l.st...@pengutronix.de> writes: > The Mesa state tracker will emulate YUV texture sampling for drivers that > don't support it natively by using multiple R8/RG88 samplers. Teach > dri2_query_dma_buf_modifiers about this special case. > This allows clients like GStreamer glupload or Kodi to properly query > the supported dma-buf import formats, without the need to take a special > code path for the emulated OES_external texture handling. > > Signed-off-by: Lucas Stach <l.st...@pengutronix.de> > --- > src/gallium/state_trackers/dri/dri2.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/src/gallium/state_trackers/dri/dri2.c > b/src/gallium/state_trackers/dri/dri2.c > index f139bd6722b9..4243a00cb38d 100644 > --- a/src/gallium/state_trackers/dri/dri2.c > +++ b/src/gallium/state_trackers/dri/dri2.c > @@ -1358,19 +1358,30 @@ dri2_query_dma_buf_modifiers(__DRIscreen *_screen, > int fourcc, int max, > const struct dri2_format_mapping *map = > dri2_get_mapping_by_fourcc(fourcc); > enum pipe_format format; > > - if (!map) > + if (!map || !pscreen->query_dmabuf_modifiers) > return false; > > format = map->pipe_format; > > - if (pscreen->query_dmabuf_modifiers != NULL && > - (pscreen->is_format_supported(pscreen, format, screen->target, 0, 0, > + if ((pscreen->is_format_supported(pscreen, format, screen->target, 0, 0, > PIPE_BIND_RENDER_TARGET) || > pscreen->is_format_supported(pscreen, format, screen->target, 0, 0, > PIPE_BIND_SAMPLER_VIEW))) { > pscreen->query_dmabuf_modifiers(pscreen, format, max, modifiers, > external_only, count); > return true; > + } else if (util_format_is_yuv(format) && > + pscreen->is_format_supported(pscreen, PIPE_FORMAT_R8_UNORM, > + screen->target, 0, 0, > + PIPE_BIND_SAMPLER_VIEW)) { > + /* YUV format sampling can be emulated by the Mesa state tracker by > + * using multiple R8/RG88 samplers if the driver doesn't support those > + * formats natively, so we need a special case here to give a mostly > + * accurate answer to the modifiers query. > + */ > + pscreen->query_dmabuf_modifiers(pscreen, PIPE_FORMAT_R8_UNORM, max, > + modifiers, external_only, count); > + return true;
I think this will report image_external YUV emulation formats even when the caller specified !external_only. Add external_only to the condition here?
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev