Skip to content

Commit 10e26e7

Browse files
committed
drm/ast: Reload gamma LUT after changing primary plane's color format
The gamma LUT has to be reloaded after changing the primary plane's color format. This used to be done implicitly by the CRTC atomic_enable() helper after updating the primary plane. With the recent reordering of the steps, the primary plane's setup was moved last and invalidated the gamma LUT. Fix this by setting the LUT from within atomic_flush(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Fixes: 2f0ddd8 ("drm/ast: Enable CRTC before planes") Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Dave Airlie <airlied@redhat.com> Cc: dri-devel@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20200922144655.23624-1-tzimmermann@suse.de (cherry-picked from 8e3784d)
1 parent 2820526 commit 10e26e7

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
742742
case DRM_MODE_DPMS_SUSPEND:
743743
if (ast->tx_chip_type == AST_TX_DP501)
744744
ast_set_dp501_video_output(crtc->dev, 1);
745-
ast_crtc_load_lut(ast, crtc);
746745
break;
747746
case DRM_MODE_DPMS_OFF:
748747
if (ast->tx_chip_type == AST_TX_DP501)
@@ -777,6 +776,21 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
777776
return 0;
778777
}
779778

779+
static void
780+
ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state)
781+
{
782+
struct ast_private *ast = to_ast_private(crtc->dev);
783+
struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc->state);
784+
struct ast_crtc_state *old_ast_crtc_state = to_ast_crtc_state(old_crtc_state);
785+
786+
/*
787+
* The gamma LUT has to be reloaded after changing the primary
788+
* plane's color format.
789+
*/
790+
if (old_ast_crtc_state->format != ast_crtc_state->format)
791+
ast_crtc_load_lut(ast, crtc);
792+
}
793+
780794
static void
781795
ast_crtc_helper_atomic_enable(struct drm_crtc *crtc,
782796
struct drm_crtc_state *old_crtc_state)
@@ -830,6 +844,7 @@ ast_crtc_helper_atomic_disable(struct drm_crtc *crtc,
830844

831845
static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = {
832846
.atomic_check = ast_crtc_helper_atomic_check,
847+
.atomic_flush = ast_crtc_helper_atomic_flush,
833848
.atomic_enable = ast_crtc_helper_atomic_enable,
834849
.atomic_disable = ast_crtc_helper_atomic_disable,
835850
};

0 commit comments

Comments
 (0)