drm-backend: add color_outcome / HDR metadata serial

Output color profile may be changed in flight. Output basic color
characteristics and EOTF mode cannot yet be changed in flight, but it is
reasonable to assume they could in the future. Therefore the color
outcome data may change in flight as well, which is the basis for HDR
metadata, which needs to be updated as well.

Track the changes to color outcome data with a serial number.
DRM-backend checks the serial number to see if it needs to re-create the
HDR metadata blob. This allows the changes to propagate all the way to
KMS.

The code added here is more of a reminder of what should happen than a
tested path.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2022-05-06 13:57:12 +03:00 committed by Pekka Paalanen
parent c217453c85
commit 8ebebb20ef
4 changed files with 9 additions and 1 deletions

View File

@ -534,6 +534,7 @@ struct weston_output {
struct weston_color_characteristics color_characteristics;
struct weston_output_color_outcome *color_outcome;
uint64_t color_outcome_serial;
int (*enable)(struct weston_output *output);
int (*disable)(struct weston_output *output);

View File

@ -551,6 +551,7 @@ struct drm_output {
uint32_t gbm_bo_flags;
uint32_t hdr_output_metadata_blob_id;
uint64_t ackd_color_outcome_serial;
/* Plane being displayed directly on the CRTC */
struct drm_plane *scanout_plane;

View File

@ -113,7 +113,8 @@ drm_output_ensure_hdr_output_metadata_blob(struct drm_output *output)
uint32_t blob_id = 0;
int ret;
if (output->hdr_output_metadata_blob_id)
if (output->hdr_output_metadata_blob_id &&
output->ackd_color_outcome_serial == output->base.color_outcome_serial)
return 0;
src = weston_output_get_hdr_metadata_type1(&output->base);
@ -167,7 +168,11 @@ drm_output_ensure_hdr_output_metadata_blob(struct drm_output *output)
return -1;
}
drmModeDestroyPropertyBlob(output->backend->drm.fd,
output->hdr_output_metadata_blob_id);
output->hdr_output_metadata_blob_id = blob_id;
output->ackd_color_outcome_serial = output->base.color_outcome_serial;
return 0;
}

View File

@ -6537,6 +6537,7 @@ weston_output_set_color_outcome(struct weston_output *output)
weston_output_color_outcome_destroy(&output->color_outcome);
output->color_outcome = colorout;
output->color_outcome_serial++;
output->from_blend_to_output_by_backend = false;