renderer/native: Only enable shadowfbs if we can blit

There is no point in enabling shadow buffers if we can't as that'd be
even slower than not having them at all.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
This commit is contained in:
Jonas Ådahl 2020-05-05 17:06:35 +02:00 committed by Georges Basile Stavracas Neto
parent f60c485117
commit 346cadeddb

View File

@ -3105,12 +3105,17 @@ should_force_shadow_fb (MetaRendererNative *renderer_native,
MetaGpuKms *primary_gpu) MetaGpuKms *primary_gpu)
{ {
MetaRenderer *renderer = META_RENDERER (renderer_native); MetaRenderer *renderer = META_RENDERER (renderer_native);
CoglContext *cogl_context =
cogl_context_from_renderer_native (renderer_native);
int kms_fd; int kms_fd;
uint64_t prefer_shadow = 0; uint64_t prefer_shadow = 0;
if (meta_renderer_is_hardware_accelerated (renderer)) if (meta_renderer_is_hardware_accelerated (renderer))
return FALSE; return FALSE;
if (!cogl_has_feature (cogl_context, COGL_FEATURE_ID_BLIT_FRAMEBUFFER))
return FALSE;
kms_fd = meta_gpu_kms_get_fd (primary_gpu); kms_fd = meta_gpu_kms_get_fd (primary_gpu);
if (drmGetCap (kms_fd, DRM_CAP_DUMB_PREFER_SHADOW, &prefer_shadow) == 0) if (drmGetCap (kms_fd, DRM_CAP_DUMB_PREFER_SHADOW, &prefer_shadow) == 0)
{ {