[PATCH 2/6] drm/fb: Fix depth 15 support in drm_fb_helper.c

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue Jul 24 20:07:40 PDT 2012


fbset can pass var->bits_per_pixel = 15 when doing fbset -depth 15,
so we need to "correct" that to bpp 16 / depth 15.

Additionally, we make it possible to pass 15 as an argument to
drm_fb_helper_single_fb_probe() which will similarily select
a bpp of 15 and a depth of 15.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 drivers/gpu/drm/drm_fb_helper.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index f546d1e..da6873c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -571,6 +571,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	}
 
 	switch (var->bits_per_pixel) {
+	case 15:
+		/*
+		 * There is no such thing as a packed 15bpp,
+		 * so in this case, assume 16bpp, depth 15
+		 */
+		depth = 15;
+		var->bits_per_pixel = 16;
+		break;
 	case 16:
 		depth = (var->green.length == 6) ? 16 : 15;
 		break;
@@ -722,10 +730,15 @@ int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
 	sizes.fb_width = (unsigned)-1;
 	sizes.fb_height = (unsigned)-1;
 
-	/* if driver picks 8 or 16 by default use that
-	   for both depth/bpp */
+	/*
+	 * If driver picks 8 or 16 by default use that
+	 * for both depth/bpp, however convert 15 to bpp 16
+	 * depth 15
+	 */
 	if (preferred_bpp != sizes.surface_bpp) {
 		sizes.surface_depth = sizes.surface_bpp = preferred_bpp;
+		if (preferred_bpp == 15)
+			sizes.surface_bpp = 16;
 	}
 	/* first up get a count of crtcs now in use and new min/maxes width/heights */
 	for (i = 0; i < fb_helper->connector_count; i++) {





More information about the dri-devel mailing list