mirror of
https://github.com/brl/mutter.git
synced 2025-04-22 09:59:38 +00:00
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;
|
uint32_t mode_id;
|
||||||
GList *l;
|
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)
|
if (mode_id == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
g_array_append_val (blob_ids, mode_id);
|
||||||
|
|
||||||
meta_topic (META_DEBUG_KMS,
|
meta_topic (META_DEBUG_KMS,
|
||||||
"[atomic] Setting mode of CRTC %u (%s) to %s",
|
"[atomic] Setting mode of CRTC %u (%s) to %s",
|
||||||
meta_kms_crtc_get_id (crtc),
|
meta_kms_crtc_get_id (crtc),
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "backends/native/meta-kms-mode.h"
|
#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);
|
GError **error);
|
||||||
|
|
||||||
void meta_kms_mode_free (MetaKmsMode *mode);
|
void meta_kms_mode_free (MetaKmsMode *mode);
|
||||||
|
@ -28,22 +28,22 @@ struct _MetaKmsMode
|
|||||||
MetaKmsImplDevice *impl_device;
|
MetaKmsImplDevice *impl_device;
|
||||||
MetaKmsModeFlag flags;
|
MetaKmsModeFlag flags;
|
||||||
drmModeModeInfo drm_mode;
|
drmModeModeInfo drm_mode;
|
||||||
uint32_t blob_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
meta_kms_mode_ensure_blob_id (MetaKmsMode *mode,
|
meta_kms_mode_create_blob_id (MetaKmsMode *mode,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
int ret;
|
||||||
|
uint32_t blob_id;
|
||||||
|
|
||||||
fd = meta_kms_impl_device_get_fd (mode->impl_device);
|
fd = meta_kms_impl_device_get_fd (mode->impl_device);
|
||||||
|
|
||||||
ret = drmModeCreatePropertyBlob (fd,
|
ret = drmModeCreatePropertyBlob (fd,
|
||||||
&mode->drm_mode,
|
&mode->drm_mode,
|
||||||
sizeof (mode->drm_mode),
|
sizeof (mode->drm_mode),
|
||||||
&mode->blob_id);
|
&blob_id);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
|
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 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mode->blob_id;
|
return blob_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@ -124,15 +124,6 @@ meta_kms_mode_hash (MetaKmsMode *mode)
|
|||||||
void
|
void
|
||||||
meta_kms_mode_free (MetaKmsMode *mode)
|
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);
|
g_free (mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user