mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 04:42:14 +00:00
kms-impl-device: Fail if we can't enable universal planes
We currently don't handle the lack of DRM_CLIENT_CAP_UNIVERSAL_PLANES KMS capability. Fail constructing a device that can't handle this up front, so later made assumptions, such as presence of a primary plane, are actually valid. If we want to support lack of said capability, the required planes need to be emulated by a dummy MetaKmsPlane object. https://gitlab.gnome.org/GNOME/mutter/merge_requests/665
This commit is contained in:
parent
f2f4af0d50
commit
1c25b75571
@ -156,7 +156,9 @@ create_impl_device_in_impl (MetaKmsImpl *impl,
|
||||
CreateImplDeviceData *data = user_data;
|
||||
MetaKmsImplDevice *impl_device;
|
||||
|
||||
impl_device = meta_kms_impl_device_new (data->device, impl, data->fd);
|
||||
impl_device = meta_kms_impl_device_new (data->device, impl, data->fd, error);
|
||||
if (!impl_device)
|
||||
return FALSE;
|
||||
|
||||
data->out_impl_device = impl_device;
|
||||
data->out_crtcs = meta_kms_impl_device_copy_crtcs (impl_device);
|
||||
|
@ -307,23 +307,32 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device)
|
||||
}
|
||||
|
||||
MetaKmsImplDevice *
|
||||
meta_kms_impl_device_new (MetaKmsDevice *device,
|
||||
MetaKmsImpl *impl,
|
||||
int fd)
|
||||
meta_kms_impl_device_new (MetaKmsDevice *device,
|
||||
MetaKmsImpl *impl,
|
||||
int fd,
|
||||
GError **error)
|
||||
{
|
||||
MetaKms *kms = meta_kms_impl_get_kms (impl);
|
||||
MetaKmsImplDevice *impl_device;
|
||||
int ret;
|
||||
drmModeRes *drm_resources;
|
||||
|
||||
meta_assert_in_kms_impl (kms);
|
||||
|
||||
ret = drmSetClientCap (fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
|
||||
if (ret != 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
|
||||
"Failed to activate universal planes: %s",
|
||||
g_strerror (-ret));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
impl_device = g_object_new (META_TYPE_KMS_IMPL_DEVICE, NULL);
|
||||
impl_device->device = device;
|
||||
impl_device->impl = impl;
|
||||
impl_device->fd = fd;
|
||||
|
||||
drmSetClientCap (fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
|
||||
|
||||
drm_resources = drmModeGetResources (fd);
|
||||
|
||||
init_crtcs (impl_device, drm_resources);
|
||||
|
@ -57,8 +57,9 @@ void meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device);
|
||||
|
||||
int meta_kms_impl_device_close (MetaKmsImplDevice *impl_device);
|
||||
|
||||
MetaKmsImplDevice * meta_kms_impl_device_new (MetaKmsDevice *device,
|
||||
MetaKmsImpl *kms_impl,
|
||||
int fd);
|
||||
MetaKmsImplDevice * meta_kms_impl_device_new (MetaKmsDevice *device,
|
||||
MetaKmsImpl *kms_impl,
|
||||
int fd,
|
||||
GError **error);
|
||||
|
||||
#endif /* META_KMS_IMPL_DEVICE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user