All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ast: Fix incorrect memory size detection with analog VGA
@ 2016-08-01 18:45 Timothy Pearson
  0 siblings, 0 replies; only message in thread
From: Timothy Pearson @ 2016-08-01 18:45 UTC (permalink / raw)
  To: airlied, dri-devel


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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-01 18:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-01 18:45 [PATCH] drm/ast: Fix incorrect memory size detection with analog VGA Timothy Pearson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.