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>
dev
Pekka Paalanen 3 years ago committed by Pekka Paalanen
parent c217453c85
commit 8ebebb20ef
  1. 1
      include/libweston/libweston.h
  2. 1
      libweston/backend-drm/drm-internal.h
  3. 7
      libweston/backend-drm/kms-color.c
  4. 1
      libweston/compositor.c

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

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

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

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

Loading…
Cancel
Save