From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/6] drm/fb: Fix depth 15 support in drm_fb_helper.c
Date: Wed, 25 Jul 2012 13:07:40 +1000 [thread overview]
Message-ID: <1343185660.3715.34.camel@pasglop> (raw)
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@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++) {
reply other threads:[~2012-07-25 3:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343185660.3715.34.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox