* add sampler view usage.
*/
use_lowered = true;
- for (i = 0; i < map->nplanes; i++) {
- if (!pscreen->is_format_supported(pscreen,
- dri2_get_pipe_format_for_dri_format(map->planes[i].dri_format),
- screen->target, 0, 0,
- PIPE_BIND_SAMPLER_VIEW))
- break;
- }
-
- if (i == map->nplanes)
+ if (dri2_yuv_dma_buf_supported(screen, map))
tex_usage |= PIPE_BIND_SAMPLER_VIEW;
}
pscreen->query_dmabuf_modifiers(pscreen, format, max, modifiers,
external_only, count);
return true;
+ } else if (dri2_yuv_dma_buf_supported(screen, map)) {
+ *count = 1;
+ if (modifiers)
+ modifiers[0] = DRM_FORMAT_MOD_NONE;
+ return true;
}
return false;
}
return PIPE_FORMAT_NONE;
}
+boolean
+dri2_yuv_dma_buf_supported(struct dri_screen *screen,
+ const struct dri2_format_mapping *map)
+{
+ struct pipe_screen *pscreen = screen->base.screen;
+
+ for (unsigned i = 0; i < map->nplanes; i++) {
+ if (!pscreen->is_format_supported(pscreen,
+ dri2_get_pipe_format_for_dri_format(map->planes[i].dri_format),
+ screen->target, 0, 0, PIPE_BIND_SAMPLER_VIEW))
+ return false;
+ }
+ return true;
+}
+
boolean
dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
int *count)
PIPE_BIND_RENDER_TARGET) ||
pscreen->is_format_supported(pscreen, map->pipe_format,
screen->target, 0, 0,
- PIPE_BIND_SAMPLER_VIEW)) {
+ PIPE_BIND_SAMPLER_VIEW) ||
+ dri2_yuv_dma_buf_supported(screen, map)) {
if (j < max)
formats[j] = map->dri_fourcc;
j++;
boolean
dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
int *count);
+boolean
+dri2_yuv_dma_buf_supported(struct dri_screen *screen,
+ const struct dri2_format_mapping *map);
__DRIimage *
dri2_lookup_egl_image(struct dri_screen *screen, void *handle);