Skip to content

Commit 171b357

Browse files
committed
drm/ast: Only set VGA SCREEN_DISABLE bit in CRTC code
The SCREEN_DISABLE bit controls scanout from display memory. The bit affects all planes, so set it only in the CRTC's atomic enable and disable functions. A number of bugs affect this fix. First of all, ast_set_std_regs() tries to set VGASR1 except for the SD bit. But the read bitmask is invert, so it preserves anything except the SD bit. Fix this by re-inverting the read mask. The second issue is that primary-plane and CRTC helpers modify the SD bit. The bit controls scanout for all planes, primary and HW cursor, so set it only in the CRTC code. Further add a constant to represent the SD bit in VGASR1. Keep the plane's atomic_disable around to make the DRM framework happy. v2: - fix typos in commit message Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240627153638.8765-7-tzimmermann@suse.de
1 parent bb5367d commit 171b357

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static void ast_set_std_reg(struct ast_device *ast,
303303

304304
/* Set SEQ; except Screen Disable field */
305305
ast_set_index_reg(ast, AST_IO_VGASRI, 0x00, 0x03);
306-
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, stdtable->seq[0]);
306+
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0x20, stdtable->seq[0]);
307307
for (i = 1; i < 4; i++) {
308308
jreg = stdtable->seq[i];
309309
ast_set_index_reg(ast, AST_IO_VGASRI, (i + 1), jreg);
@@ -690,15 +690,15 @@ static void ast_primary_plane_helper_atomic_enable(struct drm_plane *plane,
690690
* Therefore only reprogram the address after enabling the plane.
691691
*/
692692
ast_set_start_address_crt1(ast, (u32)ast_plane->offset);
693-
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x1, 0xdf, 0x00);
694693
}
695694

696695
static void ast_primary_plane_helper_atomic_disable(struct drm_plane *plane,
697696
struct drm_atomic_state *state)
698697
{
699-
struct ast_device *ast = to_ast_device(plane->dev);
700-
701-
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x1, 0xdf, 0x20);
698+
/*
699+
* Keep this empty function to avoid calling
700+
* atomic_update when disabling the plane.
701+
*/
702702
}
703703

704704
static int ast_primary_plane_helper_get_scanout_buffer(struct drm_plane *plane,
@@ -1029,14 +1029,14 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
10291029
*/
10301030
switch (mode) {
10311031
case DRM_MODE_DPMS_ON:
1032-
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0);
10331032
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0);
1033+
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0);
10341034
break;
10351035
case DRM_MODE_DPMS_STANDBY:
10361036
case DRM_MODE_DPMS_SUSPEND:
10371037
case DRM_MODE_DPMS_OFF:
10381038
ch = mode;
1039-
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0x20);
1039+
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, AST_IO_VGASR1_SD);
10401040
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, ch);
10411041
break;
10421042
}

drivers/gpu/drm/ast/ast_reg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define AST_IO_VGAER_VGA_ENABLE BIT(0)
2323

2424
#define AST_IO_VGASRI (0x44)
25+
#define AST_IO_VGASR1_SD BIT(5)
2526
#define AST_IO_VGADRR (0x47)
2627
#define AST_IO_VGADWR (0x48)
2728
#define AST_IO_VGAPDR (0x49)

0 commit comments

Comments
 (0)