[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5htxq0s882.wl%tiwai@suse.de>
Date: Tue, 29 Jan 2013 09:29:17 +0100
From: Takashi Iwai <tiwai@...e.de>
To: David Airlie <airlied@...ux.ie>
Cc: Stefan Dirsch <sndirsch@...e.de>,
Bernhard Wiedemann <bwiedemann@...e.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] drm/cirrus: Add bpp option
Add a new option, bpp, to specify the default bpp value.
Signed-off-by: Takashi Iwai <tiwai@...e.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists