[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/3] xen-fbfront: Read width/height from backend
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> --- 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 428d273..341c919 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.3.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |