Skip to contentSkip to conversation

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

PATCH New Timothy Pearson 1 participant 1 message Aug 1, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/gpu/drm/ast/ast_main.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/ast/ast_main.c +13 -11
index 7bc3aa6..090b571 100644
@@ -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;
Signature · 5 lines
2.8.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel