mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 15:02:40 -04:00
drm/connector: Add helper to compare HDR metadata
All the drivers that support the HDR metadata property have a similar function to compare the metadata from one connector state to the next, and force a mode change if they differ. All these functions run pretty much the same code, so let's turn it into an helper that can be shared across those drivers. Reviewed-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20210430094451.2145002-2-maxime@cerno.tech
This commit is contained in:
@@ -6275,25 +6275,6 @@ static int fill_hdr_info_packet(const struct drm_connector_state *state,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_hdr_metadata_different(const struct drm_connector_state *old_state,
|
||||
const struct drm_connector_state *new_state)
|
||||
{
|
||||
struct drm_property_blob *old_blob = old_state->hdr_output_metadata;
|
||||
struct drm_property_blob *new_blob = new_state->hdr_output_metadata;
|
||||
|
||||
if (old_blob != new_blob) {
|
||||
if (old_blob && new_blob &&
|
||||
old_blob->length == new_blob->length)
|
||||
return memcmp(old_blob->data, new_blob->data,
|
||||
old_blob->length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
amdgpu_dm_connector_atomic_check(struct drm_connector *conn,
|
||||
struct drm_atomic_state *state)
|
||||
@@ -6311,7 +6292,7 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn,
|
||||
if (!crtc)
|
||||
return 0;
|
||||
|
||||
if (is_hdr_metadata_different(old_con_state, new_con_state)) {
|
||||
if (!drm_connector_atomic_hdr_metadata_equal(old_con_state, new_con_state)) {
|
||||
struct dc_info_packet hdr_infopacket;
|
||||
|
||||
ret = fill_hdr_info_packet(new_con_state, &hdr_infopacket);
|
||||
@@ -8803,7 +8784,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
|
||||
dm_old_crtc_state->abm_level;
|
||||
|
||||
hdr_changed =
|
||||
is_hdr_metadata_different(old_con_state, new_con_state);
|
||||
!drm_connector_atomic_hdr_metadata_equal(old_con_state, new_con_state);
|
||||
|
||||
if (!scaling_changed && !abm_changed && !hdr_changed)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user