[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1300198274-1325-2-git-send-email-konrad.wilk@oracle.com>
Date: Tue, 15 Mar 2011 10:11:12 -0400
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: linux-kernel@...r.kernel.org,
Jeremy Fitzhardinge <jeremy@...p.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: xen-devel@...ts.xensource.com,
Konrad Rzeszutek Wilk <konrad@...nel.org>,
Stefano Stabellini <stefano.stabellini@...citrix.com>,
Ian Campbell <Ian.Campbell@...rix.com>, dgdegra@...ho.nsa.gov
Subject: [PATCH 1/4] xen-fbfront: Read width/height from backend
From: Daniel De Graaf <dgdegra@...ho.nsa.gov>
This allows the backend driver to specify the size of the framebuffer
instead of requiring it to be on the kernel command line.
Signed-off-by: Daniel De Graaf <dgdegra@...ho.nsa.gov>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Acked-by: Ian Campbell <Ian.Campbell@...citrix.com>
---
drivers/video/xen-fbfront.c | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index a20218c..56d6061 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -58,7 +58,7 @@ struct xenfb_info {
#define XENFB_DEFAULT_FB_LEN (XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH / 8)
enum { KPARAM_MEM, KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
-static int video[KPARAM_CNT] = { 2, XENFB_WIDTH, XENFB_HEIGHT };
+static int video[KPARAM_CNT] = { 0, 0, 0 };
module_param_array(video, int, NULL, 0);
MODULE_PARM_DESC(video,
"Video memory size in MB, width, height in pixels (default 2,800,600)");
@@ -363,7 +363,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
{
struct xenfb_info *info;
struct fb_info *fb_info;
- int fb_size;
+ int fb_size, fb_need;
int val;
int ret;
@@ -375,14 +375,32 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
/* Limit kernel param videoram amount to what is in xenstore */
if (xenbus_scanf(XBT_NIL, dev->otherend, "videoram", "%d", &val) == 1) {
- if (val < video[KPARAM_MEM])
+ if (!video[KPARAM_MEM] || val < video[KPARAM_MEM])
video[KPARAM_MEM] = val;
}
+ /* Take width/height from xenstore if not set on command line */
+ if (!video[KPARAM_WIDTH]) {
+ if (xenbus_scanf(XBT_NIL, dev->otherend, "width", "%d", &val) == 1)
+ video[KPARAM_WIDTH] = val;
+ else
+ video[KPARAM_WIDTH] = XENFB_WIDTH;
+ }
+ if (!video[KPARAM_HEIGHT]) {
+ if (xenbus_scanf(XBT_NIL, dev->otherend, "height", "%d", &val) == 1)
+ video[KPARAM_HEIGHT] = val;
+ else
+ video[KPARAM_HEIGHT] = XENFB_HEIGHT;
+ }
+
+ fb_need = video[KPARAM_WIDTH] * video[KPARAM_HEIGHT] * XENFB_DEPTH / 8;
+ if (video[KPARAM_MEM])
+ fb_size = video[KPARAM_MEM] * 1024 * 1024;
+ else
+ fb_size = video[KPARAM_MEM] = fb_need;
+
/* If requested res does not fit in available memory, use default */
- fb_size = video[KPARAM_MEM] * 1024 * 1024;
- if (video[KPARAM_WIDTH] * video[KPARAM_HEIGHT] * XENFB_DEPTH / 8
- > fb_size) {
+ if (fb_need > fb_size) {
video[KPARAM_WIDTH] = XENFB_WIDTH;
video[KPARAM_HEIGHT] = XENFB_HEIGHT;
fb_size = XENFB_DEFAULT_FB_LEN;
--
1.7.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