Blob Blame History Raw
From: Egbert Eich <eich@suse.de>
Date: Tue, 18 Jul 2017 17:20:53 +0200
Subject: drm/radeon: Set depth on low mem to 16 bpp instead of 8 bpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 7b8bd6bb4298ac7c9aeb7ecab9e4864da3272b64
Patch-mainline: v4.14-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

The radeon driver reduces the framebuffer resolution to 8bpp if a
device with less than 32MB VRAM is found.  This causes the framebuffer
to run in 8 bit paletted mode.  For a text console this is not an
issue as 256 different colors is more than one gets on a VGA text
console.  However this leads to a poor 8bit pseudo-color visual when
running X on fbdev, too, which is quite ugly.

In this patch, we try to give some moderate compromise: limit the
framebuffer bpp to 8 only when VRAM is 8MB or less, and use 16 bpp
otherwise for 32MB or less VRAM.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Egbert Eich <eich@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/gpu/drm/radeon/radeon_fb.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -344,9 +344,12 @@ int radeon_fbdev_init(struct radeon_devi
 	if (list_empty(&rdev->ddev->mode_config.connector_list))
 		return 0;
 
-	/* select 8 bpp console on RN50 or 16MB cards */
-	if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
+	/* select 8 bpp console on 8MB cards, or 16 bpp on RN50 or 32MB */
+	if (rdev->mc.real_vram_size <= (8*1024*1024))
 		bpp_sel = 8;
+	else if (ASIC_IS_RN50(rdev) ||
+		 rdev->mc.real_vram_size <= (32*1024*1024))
+		bpp_sel = 16;
 
 	rfbdev = kzalloc(sizeof(struct radeon_fbdev), GFP_KERNEL);
 	if (!rfbdev)