backends/native: Add color space and HDR metadata updates
Allows to prepare KMS updates to set the color space and HDR Static Metadata on the output. For some reason we need ALLOW_MODESET on commits which change the HDR Static Metadata InfoFrame on AMDGPU. There is no technical reason why one needs to mode set to send an InfoFrame and the driver should just manage without ALLOW_MODESET. Until this is resolved in the kernel we just prepare KMS updates which might mode set. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2879>
This commit is contained in:
parent
5984aa8137
commit
f092b6c78c
3 changed files with 65 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <glib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "backends/meta-output.h"
|
||||
#include "backends/native/meta-kms-crtc.h"
|
||||
#include "backends/native/meta-kms-plane-private.h"
|
||||
#include "backends/native/meta-kms-types.h"
|
||||
|
@ -101,6 +102,16 @@ typedef struct _MetaKmsConnectorUpdate
|
|||
gboolean has_update;
|
||||
uint64_t value;
|
||||
} max_bpc;
|
||||
|
||||
struct {
|
||||
gboolean has_update;
|
||||
MetaOutputColorspace value;
|
||||
} colorspace;
|
||||
|
||||
struct {
|
||||
gboolean has_update;
|
||||
MetaOutputHdrMetadata value;
|
||||
} hdr;
|
||||
} MetaKmsConnectorUpdate;
|
||||
|
||||
typedef struct _MetaKmsPageFlipListener
|
||||
|
|
|
@ -407,6 +407,40 @@ meta_kms_update_set_max_bpc (MetaKmsUpdate *update,
|
|||
connector_update->max_bpc.has_update = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_update_set_color_space (MetaKmsUpdate *update,
|
||||
MetaKmsConnector *connector,
|
||||
MetaOutputColorspace color_space)
|
||||
{
|
||||
MetaKmsConnectorUpdate *connector_update;
|
||||
|
||||
g_assert (meta_kms_connector_get_device (connector) == update->device);
|
||||
g_return_if_fail (meta_kms_connector_is_color_space_supported (connector,
|
||||
color_space));
|
||||
|
||||
connector_update = ensure_connector_update (update, connector);
|
||||
connector_update->colorspace.has_update = TRUE;
|
||||
connector_update->colorspace.value = color_space;
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_update_set_hdr_metadata (MetaKmsUpdate *update,
|
||||
MetaKmsConnector *connector,
|
||||
MetaOutputHdrMetadata *metadata)
|
||||
{
|
||||
MetaKmsConnectorUpdate *connector_update;
|
||||
|
||||
g_assert (meta_kms_connector_get_device (connector) == update->device);
|
||||
g_return_if_fail (meta_kms_connector_is_hdr_metadata_supported (connector));
|
||||
|
||||
connector_update = ensure_connector_update (update, connector);
|
||||
connector_update->hdr.has_update = TRUE;
|
||||
connector_update->hdr.value = *metadata;
|
||||
|
||||
/* Currently required on AMDGPU but should in general not require mode sets */
|
||||
update->needs_modeset = TRUE;
|
||||
}
|
||||
|
||||
static MetaKmsCrtcColorUpdate *
|
||||
ensure_color_update (MetaKmsUpdate *update,
|
||||
MetaKmsCrtc *crtc)
|
||||
|
@ -898,6 +932,17 @@ merge_connector_updates_from (MetaKmsUpdate *update,
|
|||
connector_update->max_bpc =
|
||||
other_connector_update->max_bpc;
|
||||
}
|
||||
|
||||
if (other_connector_update->colorspace.has_update)
|
||||
{
|
||||
connector_update->colorspace =
|
||||
other_connector_update->colorspace;
|
||||
}
|
||||
|
||||
if (other_connector_update->hdr.has_update)
|
||||
{
|
||||
connector_update->hdr = other_connector_update->hdr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <xf86drmMode.h>
|
||||
|
||||
#include "backends/meta-monitor-transform.h"
|
||||
#include "backends/meta-output.h"
|
||||
#include "backends/native/meta-drm-buffer.h"
|
||||
#include "backends/native/meta-kms-types.h"
|
||||
#include "meta/boxes.h"
|
||||
|
@ -123,6 +124,14 @@ void meta_kms_update_set_max_bpc (MetaKmsUpdate *update,
|
|||
MetaKmsConnector *connector,
|
||||
uint64_t max_bpc);
|
||||
|
||||
void meta_kms_update_set_color_space (MetaKmsUpdate *update,
|
||||
MetaKmsConnector *connector,
|
||||
MetaOutputColorspace color_space);
|
||||
|
||||
void meta_kms_update_set_hdr_metadata (MetaKmsUpdate *update,
|
||||
MetaKmsConnector *connector,
|
||||
MetaOutputHdrMetadata *metadata);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_kms_update_set_power_save (MetaKmsUpdate *update);
|
||||
|
||||
|
|
Loading…
Reference in a new issue