WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1/4] xen-fbfront: Read width/height from backend

To: linux-kernel@xxxxxxxxxxxxxxx, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/4] xen-fbfront: Read width/height from backend
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Tue, 15 Mar 2011 10:11:12 -0400
Cc: Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx>, dgdegra@xxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Tue, 15 Mar 2011 07:12:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1300198274-1325-1-git-send-email-konrad.wilk@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1300198274-1325-1-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
From: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Acked-by: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
---
 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel