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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx>
---
 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
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux