@@ -745,29 +807,18 @@ static int xenfb_read_frontend_fb_config
xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "request-update", "1");
xenfb->refresh_period = -1;
- /* TODO check for permitted ranges */
- fb_page = xenfb->fb.page;
- xenfb->depth = fb_page->depth;
- xenfb->width = fb_page->width;
- xenfb->height = fb_page->height;
- /* TODO check for consistency with the above */
- xenfb->fb_len = fb_page->mem_length;
- xenfb->row_stride = fb_page->line_length;
-
- /* Protect against hostile frontend, limit fb_len to max allowed */
if (xenfb_xs_scanf1(xenfb->xsh, xenfb->fb.nodename, "videoram", "%d",
&videoram) < 0)
videoram = 0;
- videoram = videoram * 1024 * 1024;
- if (videoram && xenfb->fb_len > videoram) {
- fprintf(stderr, "Framebuffer requested length of %zd exceeded
allowed %d\n",
- xenfb->fb_len, videoram);
- xenfb->fb_len = videoram;
- if (xenfb->row_stride * xenfb->height > xenfb->fb_len)
- xenfb->height = xenfb->fb_len / xenfb->row_stride;
- }
- fprintf(stderr, "Framebuffer depth %d width %d height %d line %d\n",
- fb_page->depth, fb_page->width, fb_page->height,
fb_page->line_length);
+ fb_page = xenfb->fb.page;
+ if (xenfb_configure_fb(xenfb, videoram * 1024 * 1024U,
+ fb_page->width, fb_page->height, fb_page->depth,
+ fb_page->mem_length, 0, fb_page->line_length)
+ < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
if (xenfb_map_fb(xenfb, xenfb->fb.otherend_id) < 0)
return -1;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel