[PATCH] drm/ast: Fix incorrect memory size detection with analog VGA

Timothy Pearson tpearson at raptorengineering.com
Mon Aug 1 18:45:24 UTC 2016


On mainboards with analog VGA output the memory size is incorrectly
detected due to an invalid register probe.  This leads to a corrupted
and unusable framebuffer on the analog VGA output.

Do not probe the DP501-related VGA scratch register if the DP501
device was not detected.

Tested-on: ASUS KGPE-D16 (AST2050) w/ 8MB VRAM.

Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
---
 drivers/gpu/drm/ast/ast_main.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 7bc3aa6..090b571 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -372,17 +372,19 @@ static u32 ast_get_vram_info(struct drm_device *dev)
 	case 3: vram_size = AST_VIDMEM_SIZE_64M; break;
 	}
 
-	jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x99, 0xff);
-	switch (jreg & 0x03) {
-	case 1:
-		vram_size -= 0x100000;
-		break;
-	case 2:
-		vram_size -= 0x200000;
-		break;
-	case 3:
-		vram_size -= 0x400000;
-		break;
+	if (ast->tx_chip_type == AST_TX_DP501) {
+		jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x99, 0xff);
+		switch (jreg & 0x03) {
+		case 1:
+			vram_size -= 0x100000;
+			break;
+		case 2:
+			vram_size -= 0x200000;
+			break;
+		case 3:
+			vram_size -= 0x400000;
+			break;
+		}
 	}
 
 	return vram_size;
-- 
2.8.1


More information about the dri-devel mailing list