drm/vkms: use the gamma LUT of the state being composed
PATCH 1/1 drm/vkms: use the gamma LUT of the state being composed
Compose a frame from crtc_state, but take the gamma LUT from crtc->state, which may already be newer: the worker runs from the vblank timer and can fall behind a commit. Such a frame combines the planes of one state with the LUT of another; the CRC and the writeback output can then be wrong.
Read crtc_state->base.gamma_lut instead, and clear the derived fields when there is no LUT.
Fixes db1f254f2cfa ("drm/vkms: Add support to 1D gamma LUT")
Signed-off-by Oarora Etimis <[email protected]>
--- drivers/gpu/drm/vkms/vkms_composer.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/vkms/vkms_composer.c +9 -5
@@ -609,6 +609,7 @@ void vkms_composer_worker(struct work_struct *work) struct vkms_crtc_state, composer_work);struct drm_crtc *crtc = crtc_state->base.crtc; +struct drm_property_blob *gamma_lut = crtc_state->base.gamma_lut;struct vkms_writeback_job *active_wb = crtc_state->active_writeback;struct vkms_output *out =drm_crtc_to_vkms_output (crtc);bool crc_pending, wb_pending;
@@ -625,19 +626,22 @@ void vkms_composer_worker(struct work_struct *work) crtc_state->frame_end =0 ; crtc_state->crc_pending = false; -if (crtc->state->gamma_lut) { +/* crtc->state may be newer than the state this frame is built from. */ +if (gamma_lut && gamma_lut->length) {s64 max_lut_index_fp;s64 u16_max_fp =drm_int2fixp (0xffff ); - crtc_state->gamma_lut.base = (struct drm_color_lut *)crtc->state->gamma_lut->data; + crtc_state->gamma_lut.base = (struct drm_color_lut *)gamma_lut->data; crtc_state->gamma_lut.lut_length = - crtc->state->gamma_lut->length /sizeof (struct drm_color_lut ); + gamma_lut->length /sizeof (struct drm_color_lut ); max_lut_index_fp =drm_int2fixp (crtc_state->gamma_lut.lut_length -1 ); - crtc_state->gamma_lut.channel_value2index_ratio =drm_fixp_div (max_lut_index_fp, - u16_max_fp); + crtc_state->gamma_lut.channel_value2index_ratio = +drm_fixp_div (max_lut_index_fp, u16_max_fp); }else { crtc_state->gamma_lut.base =NULL ; + crtc_state->gamma_lut.lut_length =0 ; + crtc_state->gamma_lut.channel_value2index_ratio =0 ; }spin_unlock_irq (&out->composer_lock);
Signature · 1 line
2.55.0
Hello,
Gentle ping on this one -- I have not seen any comments yet. Would someone have a moment to take a look?
Thanks,
Oarora Etimis