From patchwork Wed Jul 25 03:07:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 1234221 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id AF6F23FD4F for ; Wed, 25 Jul 2012 03:24:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 886949F054 for ; Tue, 24 Jul 2012 20:24:27 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by gabe.freedesktop.org (Postfix) with ESMTP id 837439E9CA for ; Tue, 24 Jul 2012 20:22:40 -0700 (PDT) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id q6P37ekD022457 for ; Tue, 24 Jul 2012 22:07:41 -0500 Message-ID: <1343185660.3715.34.camel@pasglop> Subject: [PATCH 2/6] drm/fb: Fix depth 15 support in drm_fb_helper.c From: Benjamin Herrenschmidt To: dri-devel@lists.freedesktop.org Date: Wed, 25 Jul 2012 13:07:40 +1000 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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 --- 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++) {