diff --git a/libweston/backend-drm/colorops.c b/libweston/backend-drm/colorops.c index 585c1c38a..dbe2a2f4d 100644 --- a/libweston/backend-drm/colorops.c +++ b/libweston/backend-drm/colorops.c @@ -57,17 +57,20 @@ drm_colorop_3x1d_lut_blob_destroy_handler(struct wl_listener *l, void *data) * * \param device The DRM device in which we want to look for the blob. * \param xform The xform from which the LUT comes from. + * \param curve_step What curve step from the xform originated the 3x1D LUT. * \param lut_len How many taps each of the 1D LUT has. */ struct drm_colorop_3x1d_lut_blob * drm_colorop_3x1d_lut_blob_search(struct drm_device *device, struct weston_color_transform *xform, + enum weston_color_curve_step curve_step, uint32_t lut_len) { struct drm_colorop_3x1d_lut_blob *lut; wl_list_for_each(lut, &device->drm_colorop_3x1d_lut_blob_list, link) - if (lut->xform == xform && lut->lut_len == lut_len) + if (lut->xform == xform && lut->curve_step == curve_step && + lut->lut_len == lut_len) return lut; return NULL; @@ -84,6 +87,7 @@ drm_colorop_3x1d_lut_blob_search(struct drm_device *device, * \param device The DRM device in which this colorop blob is stored. * \param xform The xform from which the LUT comes from. This object matches its * lifetime. + * \param curve_step What xform curve step originated the 3x1D LUT. * \param lut_len The number of taps for each of the 1D LUT. * \param blob_id The KMS blob id (associated to the DRM device). * \return The 3x1D LUT colorop blob. @@ -91,6 +95,7 @@ drm_colorop_3x1d_lut_blob_search(struct drm_device *device, struct drm_colorop_3x1d_lut_blob * drm_colorop_3x1d_lut_blob_create(struct drm_device *device, struct weston_color_transform *xform, + enum weston_color_curve_step curve_step, uint32_t lut_len, uint32_t blob_id) { struct drm_colorop_3x1d_lut_blob *lut; @@ -98,9 +103,10 @@ drm_colorop_3x1d_lut_blob_create(struct drm_device *device, lut = xzalloc(sizeof(*lut)); lut->device = device; - lut->blob_id = blob_id; lut->xform = xform; + lut->curve_step = curve_step; lut->lut_len = lut_len; + lut->blob_id = blob_id; wl_list_insert(&device->drm_colorop_3x1d_lut_blob_list, &lut->link); diff --git a/libweston/backend-drm/colorops.h b/libweston/backend-drm/colorops.h index baa5dffbf..7b7b2b8c8 100644 --- a/libweston/backend-drm/colorops.h +++ b/libweston/backend-drm/colorops.h @@ -57,11 +57,13 @@ struct drm_color_pipeline { struct drm_colorop_3x1d_lut_blob * drm_colorop_3x1d_lut_blob_create(struct drm_device *device, struct weston_color_transform *xform, + enum weston_color_curve_step curve_step, uint32_t lut_len, uint32_t blob_id); struct drm_colorop_3x1d_lut_blob * drm_colorop_3x1d_lut_blob_search(struct drm_device *device, struct weston_color_transform *xform, + enum weston_color_curve_step curve_step, uint32_t lut_len); void @@ -76,6 +78,7 @@ drm_plane_release_color_pipelines(struct drm_plane *plane); static inline struct drm_colorop_3x1d_lut_blob * drm_colorop_3x1d_lut_blob_create(struct drm_device *device, struct weston_color_transform *xform, + enum weston_color_curve_step curve_step, uint32_t lut_len, uint32_t blob_id) { return NULL; @@ -84,6 +87,7 @@ drm_colorop_3x1d_lut_blob_create(struct drm_device *device, static inline struct drm_colorop_3x1d_lut_blob * drm_colorop_3x1d_lut_blob_search(struct drm_device *device, struct weston_color_transform *xform, + enum weston_color_curve_step curve_step, uint32_t lut_len) { return NULL; diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 21a244413..47a058bf2 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -406,6 +406,9 @@ struct drm_colorop_3x1d_lut_blob { struct weston_color_transform *xform; struct wl_listener destroy_listener; + /* Which curve of the xform the 3x1D LUT was generated from. */ + enum weston_color_curve_step curve_step; + uint32_t lut_len; uint32_t blob_id; diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index e38df30cc..14508eb2f 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -2283,6 +2283,7 @@ drm_output_pick_blend_to_output(struct drm_output *output) struct drm_backend *b = device->backend; struct drm_colorop_3x1d_lut_blob *colorop_lut; struct weston_color_transform *xform; + enum weston_color_curve_step curve_step; struct drm_color_lut *drm_lut; size_t lut_len; uint32_t gamma_lut_blob_id; @@ -2304,10 +2305,17 @@ drm_output_pick_blend_to_output(struct drm_output *output) } /** - * First let's check if the xform has already been cached. If that's the + * For now we expect blend-to-output to be composed of pre-curve only, + * so lut_3x1d_from_blend_to_output() will return a LUT it creates from + * the xform pre-curve. + */ + curve_step = WESTON_COLOR_CURVE_STEP_PRE; + + /** + * First let's check if the LUT has already been cached. If that's the * case, we make use of it. */ - colorop_lut = drm_colorop_3x1d_lut_blob_search(device, xform, lut_len); + colorop_lut = drm_colorop_3x1d_lut_blob_search(device, xform, curve_step, lut_len); if (colorop_lut) { output->blend_to_output_xform = colorop_lut; return 0; @@ -2337,8 +2345,8 @@ drm_output_pick_blend_to_output(struct drm_output *output) } output->blend_to_output_xform = - drm_colorop_3x1d_lut_blob_create(device, xform, lut_len, - gamma_lut_blob_id); + drm_colorop_3x1d_lut_blob_create(device, xform, curve_step, + lut_len, gamma_lut_blob_id); return 0; }