mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
renderer/native: Look up prefers-shadow cap via MetaKmsDevice
This eliminates the second last user of drmGetCap() from outside of MetaKmsImplDevice. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
This commit is contained in:
parent
93f9c99cc5
commit
86c4369f41
@ -121,6 +121,12 @@ meta_kms_device_get_cursor_size (MetaKmsDevice *device,
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_device_prefers_shadow_buffer (MetaKmsDevice *device)
|
||||
{
|
||||
return device->caps.prefers_shadow_buffer;
|
||||
}
|
||||
|
||||
GList *
|
||||
meta_kms_device_get_connectors (MetaKmsDevice *device)
|
||||
{
|
||||
|
@ -45,6 +45,8 @@ gboolean meta_kms_device_get_cursor_size (MetaKmsDevice *device,
|
||||
uint64_t *out_cursor_width,
|
||||
uint64_t *out_cursor_height);
|
||||
|
||||
gboolean meta_kms_device_prefers_shadow_buffer (MetaKmsDevice *device);
|
||||
|
||||
GList * meta_kms_device_get_connectors (MetaKmsDevice *device);
|
||||
|
||||
GList * meta_kms_device_get_crtcs (MetaKmsDevice *device);
|
||||
|
@ -300,6 +300,7 @@ init_caps (MetaKmsImplDevice *impl_device)
|
||||
meta_kms_impl_device_get_instance_private (impl_device);
|
||||
int fd;
|
||||
uint64_t cursor_width, cursor_height;
|
||||
uint64_t prefer_shadow;
|
||||
|
||||
fd = meta_device_file_get_fd (priv->device_file);
|
||||
if (drmGetCap (fd, DRM_CAP_CURSOR_WIDTH, &cursor_width) == 0 &&
|
||||
@ -309,6 +310,14 @@ init_caps (MetaKmsImplDevice *impl_device)
|
||||
priv->caps.cursor_width = cursor_width;
|
||||
priv->caps.cursor_height = cursor_height;
|
||||
}
|
||||
|
||||
if (drmGetCap (fd, DRM_CAP_DUMB_PREFER_SHADOW, &prefer_shadow) == 0)
|
||||
{
|
||||
if (prefer_shadow)
|
||||
g_message ("Device '%s' prefers shadow buffer", priv->path);
|
||||
|
||||
priv->caps.prefers_shadow_buffer = prefer_shadow;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -37,6 +37,8 @@ typedef struct _MetaKmsDeviceCaps
|
||||
gboolean has_cursor_size;
|
||||
uint64_t cursor_width;
|
||||
uint64_t cursor_height;
|
||||
|
||||
gboolean prefers_shadow_buffer;
|
||||
} MetaKmsDeviceCaps;
|
||||
|
||||
typedef struct _MetaKmsProp MetaKmsProp;
|
||||
|
@ -978,8 +978,7 @@ should_force_shadow_fb (MetaRendererNative *renderer_native,
|
||||
MetaRenderer *renderer = META_RENDERER (renderer_native);
|
||||
CoglContext *cogl_context =
|
||||
cogl_context_from_renderer_native (renderer_native);
|
||||
int kms_fd;
|
||||
uint64_t prefer_shadow = 0;
|
||||
MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (primary_gpu);
|
||||
|
||||
if (meta_renderer_is_hardware_accelerated (renderer))
|
||||
return FALSE;
|
||||
@ -987,24 +986,7 @@ should_force_shadow_fb (MetaRendererNative *renderer_native,
|
||||
if (!cogl_has_feature (cogl_context, COGL_FEATURE_ID_BLIT_FRAMEBUFFER))
|
||||
return FALSE;
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (primary_gpu);
|
||||
if (drmGetCap (kms_fd, DRM_CAP_DUMB_PREFER_SHADOW, &prefer_shadow) == 0)
|
||||
{
|
||||
if (prefer_shadow)
|
||||
{
|
||||
static gboolean logged_once = FALSE;
|
||||
|
||||
if (!logged_once)
|
||||
{
|
||||
g_message ("Forcing shadow framebuffer");
|
||||
logged_once = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return meta_kms_device_prefers_shadow_buffer (kms_device);
|
||||
}
|
||||
|
||||
static CoglFramebuffer *
|
||||
|
Loading…
Reference in New Issue
Block a user