kms/mode: Recreate blob id each mode set
This simplifies the blob management and isn't that less efficient that it matters. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
This commit is contained in:
parent
3c9ab768ec
commit
db1d35c53d
@ -264,10 +264,12 @@ process_mode_set (MetaKmsImplDevice *impl_device,
|
||||
uint32_t mode_id;
|
||||
GList *l;
|
||||
|
||||
mode_id = meta_kms_mode_ensure_blob_id (mode, error);
|
||||
mode_id = meta_kms_mode_create_blob_id (mode, error);
|
||||
if (mode_id == 0)
|
||||
return FALSE;
|
||||
|
||||
g_array_append_val (blob_ids, mode_id);
|
||||
|
||||
meta_topic (META_DEBUG_KMS,
|
||||
"[atomic] Setting mode of CRTC %u (%s) to %s",
|
||||
meta_kms_crtc_get_id (crtc),
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "backends/native/meta-kms-mode.h"
|
||||
|
||||
uint32_t meta_kms_mode_ensure_blob_id (MetaKmsMode *mode,
|
||||
uint32_t meta_kms_mode_create_blob_id (MetaKmsMode *mode,
|
||||
GError **error);
|
||||
|
||||
void meta_kms_mode_free (MetaKmsMode *mode);
|
||||
|
@ -28,22 +28,22 @@ struct _MetaKmsMode
|
||||
MetaKmsImplDevice *impl_device;
|
||||
MetaKmsModeFlag flags;
|
||||
drmModeModeInfo drm_mode;
|
||||
uint32_t blob_id;
|
||||
};
|
||||
|
||||
uint32_t
|
||||
meta_kms_mode_ensure_blob_id (MetaKmsMode *mode,
|
||||
meta_kms_mode_create_blob_id (MetaKmsMode *mode,
|
||||
GError **error)
|
||||
{
|
||||
int fd;
|
||||
int ret;
|
||||
uint32_t blob_id;
|
||||
|
||||
fd = meta_kms_impl_device_get_fd (mode->impl_device);
|
||||
|
||||
ret = drmModeCreatePropertyBlob (fd,
|
||||
&mode->drm_mode,
|
||||
sizeof (mode->drm_mode),
|
||||
&mode->blob_id);
|
||||
&blob_id);
|
||||
if (ret < 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
|
||||
@ -52,7 +52,7 @@ meta_kms_mode_ensure_blob_id (MetaKmsMode *mode,
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mode->blob_id;
|
||||
return blob_id;
|
||||
}
|
||||
|
||||
const char *
|
||||
@ -124,15 +124,6 @@ meta_kms_mode_hash (MetaKmsMode *mode)
|
||||
void
|
||||
meta_kms_mode_free (MetaKmsMode *mode)
|
||||
{
|
||||
if (mode->blob_id)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = meta_kms_impl_device_get_fd (mode->impl_device);
|
||||
|
||||
drmModeDestroyPropertyBlob (fd, mode->blob_id);
|
||||
}
|
||||
|
||||
g_free (mode);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user