diff --git a/src/virgl_hw.h b/src/virgl_hw.h index 94e1d5e..d966093 100644 --- a/src/virgl_hw.h +++ b/src/virgl_hw.h @@ -398,6 +398,7 @@ struct virgl_caps_v2 { uint32_t max_combined_atomic_counter_buffers; uint32_t host_feature_check_version; struct virgl_supported_format_mask supported_readback_formats; + struct virgl_supported_format_mask scanout; }; union virgl_caps { diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index ba807c5..570fc86 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -686,6 +686,19 @@ static inline bool vrend_format_is_ds(enum virgl_formats format) return tex_conv_table[format].bindings & VIRGL_BIND_DEPTH_STENCIL; } +static inline bool vrend_format_can_scanout(enum virgl_formats format) +{ +#ifdef ENABLE_GBM_ALLOCATION + uint32_t gbm_format = virgl_gbm_convert_format(format); + if (!gbm_format) + return false; + + return gbm_device_is_format_supported(gbm->device, gbm_format, GBM_BO_USE_SCANOUT); +#else + return true; +#endif +} + struct vrend_context_tweaks *vrend_get_context_tweaks(struct vrend_context *ctx) { return &ctx->sub->tweaks; @@ -9461,14 +9474,17 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c caps->v2.capability_bits |= VIRGL_CAP_INDIRECT_PARAMS; for (int i = 0; i < VIRGL_FORMAT_MAX; i++) { + enum virgl_formats fmt = (enum virgl_formats)i; if (tex_conv_table[i].internalformat != 0) { - enum virgl_formats fmt = (enum virgl_formats)i; if (vrend_format_can_readback(fmt)) { VREND_DEBUG(dbg_features, NULL, "Support readback of %s\n", util_format_name(fmt)); set_format_bit(&caps->v2.supported_readback_formats, fmt); } } + + if (vrend_format_can_scanout(fmt)) + set_format_bit(&caps->v2.scanout, fmt); } if (has_feature(feat_clip_control))