Skip to content

Commit 4f3265b

Browse files
committed
drm/ast: Handle primary-plane format setup in atomic_update
Several color registers are programmed in the DPMS code of the CRTC's atomic_enable helper and the primary plane's atomic_update. It requires the color format and the display mode. Both code paths handle different cases: the DPMS's code will not be executed if the color format changes without a full mode switch. The plane's code only runs if the color format changes, but ignores display-mode changes. The color format is a property of the primary plane, so consolidate all color-format code in the plane's atomic_update. Remove it from the DPMS helper. v2: - clarify commit message (Jocelyn) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240627153638.8765-5-tzimmermann@suse.de
1 parent fd63bf9 commit 4f3265b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,12 +649,12 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane,
649649
struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
650650
struct drm_framebuffer *old_fb = old_plane_state->fb;
651651
struct ast_plane *ast_plane = to_ast_plane(plane);
652+
struct drm_crtc *crtc = plane_state->crtc;
653+
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
652654
struct drm_rect damage;
653655
struct drm_atomic_helper_damage_iter iter;
654656

655-
if (!old_fb || (fb->format != old_fb->format)) {
656-
struct drm_crtc *crtc = plane_state->crtc;
657-
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
657+
if (!old_fb || (fb->format != old_fb->format) || crtc_state->mode_changed) {
658658
struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state);
659659
struct ast_vbios_mode_info *vbios_mode_info = &ast_crtc_state->vbios_mode_info;
660660

@@ -1025,7 +1025,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
10251025
u8 ch = AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF;
10261026
struct ast_crtc_state *ast_state;
10271027
const struct drm_format_info *format;
1028-
struct ast_vbios_mode_info *vbios_mode_info;
10291028

10301029
/* TODO: Maybe control display signal generation with
10311030
* Sync Enable (bit CR17.7).
@@ -1039,10 +1038,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
10391038
format = ast_state->format;
10401039

10411040
if (format) {
1042-
vbios_mode_info = &ast_state->vbios_mode_info;
1043-
1044-
ast_set_color_reg(ast, format);
1045-
ast_set_vbios_color_reg(ast, format, vbios_mode_info);
10461041
if (crtc->state->gamma_lut)
10471042
ast_crtc_set_gamma(ast, format, crtc->state->gamma_lut->data);
10481043
else

0 commit comments

Comments
 (0)