mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: David Airlie <airlied@linux.ie>
Cc: Stefan Dirsch <sndirsch@suse.de>,
	Bernhard Wiedemann <bwiedemann@suse.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/cirrus: Add bpp option
Date: Tue, 29 Jan 2013 09:29:17 +0100	[thread overview]
Message-ID: <s5htxq0s882.wl%tiwai@suse.de> (raw)
In-Reply-To: <1359130915-30082-2-git-send-email-tiwai@suse.de>

Add a new option, bpp, to specify the default bpp value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

This patch is applied on the top of previous two patches.
I couldn't find an easy way to specify the default bpp, so I cooked
the driver quickly.  If there is any other convenient way to achieve
this, let me know...

Takashi

===
 drivers/gpu/drm/cirrus/cirrus_drv.c  | 9 +++++++++
 drivers/gpu/drm/cirrus/cirrus_drv.h  | 2 ++
 drivers/gpu/drm/cirrus/cirrus_mode.c | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 8ecb601..407750fb 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -15,9 +15,12 @@
 #include "cirrus_drv.h"
 
 int cirrus_modeset = -1;
+int cirrus_bpp = 16;
 
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, cirrus_modeset, int, 0400);
+MODULE_PARM_DESC(bpp, "Default bits per pixel");
+module_param_named(bpp, cirrus_bpp, int, 0400);
 
 /*
  * This is the generic driver code. This binds the driver to the drm core,
@@ -121,6 +124,12 @@ static int __init cirrus_init(void)
 
 	if (cirrus_modeset == 0)
 		return -EINVAL;
+
+	if (cirrus_bpp % 8 || cirrus_bpp < 8 || cirrus_bpp > 24) {
+		pr_err("cirrus: invalid bpp %d, default to 16\n", cirrus_bpp);
+		cirrus_bpp = 16;
+	}
+
 	return drm_pci_init(&driver, &cirrus_pci_driver);
 }
 
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.h b/drivers/gpu/drm/cirrus/cirrus_drv.h
index 6e0cc72..45ffdb8 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.h
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.h
@@ -176,6 +176,8 @@ cirrus_bo(struct ttm_buffer_object *bo)
 #define to_cirrus_obj(x) container_of(x, struct cirrus_gem_object, base)
 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 
+extern int cirrus_modeset;
+extern int cirrus_bpp;
 				/* cirrus_mode.c */
 void cirrus_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
 			     u16 blue, int regno);
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index e259f07..3524081 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -588,7 +588,7 @@ int cirrus_modeset_init(struct cirrus_device *cdev)
 	cdev->dev->mode_config.max_height = CIRRUS_MAX_FB_HEIGHT;
 
 	cdev->dev->mode_config.fb_base = cdev->mc.vram_base;
-	cdev->dev->mode_config.preferred_depth = 16;
+	cdev->dev->mode_config.preferred_depth = cirrus_bpp;
 	/* don't prefer a shadow on virt GPU */
 	cdev->dev->mode_config.prefer_shadow = 0;
 
-- 
1.8.1.1


  reply	other threads:[~2013-01-29  8:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25 16:21 [PATCH 1/2] drm/cirrus: Correct register values for 16bpp Takashi Iwai
2013-01-25 16:21 ` [PATCH 2/2] drm/cirrus: Use 16bpp as default Takashi Iwai
2013-01-29  8:29   ` Takashi Iwai [this message]
2013-01-29  9:53     ` [PATCH] drm/cirrus: Add bpp option Daniel Vetter
2013-01-29  9:57       ` Takashi Iwai
2013-01-29 10:03         ` Daniel Vetter
2013-01-29  8:26 ` [PATCH 1/2] drm/cirrus: Correct register values for 16bpp Takashi Iwai

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=s5htxq0s882.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=airlied@linux.ie \
    --cc=bwiedemann@suse.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sndirsch@suse.de \
    /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

all inboxes | Powered by JetHome®