[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Modifying xenfb colour depth from Android domU



On 28/08/14 10:21, Gareth Stockwell wrote:
> I'm facing some problems getting xenfb to work with an Android domU, on
> ARM.
> 
> The issue is that the framebuffer is created with a depth of 32bpp,
> while the Android guest is rendering RGB565.
> 
> I tried to fix this by using the fbdev API to request a change of pixel
> format, during the Android startup:

Looked at this more closely.

> 2. Allow the guest to modify the framebuffer depth.
> 
> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
> index 02e1c01..b65a485 100644
> --- a/drivers/video/xen-fbfront.c
> +++ b/drivers/video/xen-fbfront.c
> @@ -295,12 +295,11 @@ xenfb_check_var(struct fb_var_screeninfo *var,
> struct fb_info *info)
>         if (var->xres > video[KPARAM_WIDTH] || var->yres >
> video[KPARAM_HEIGHT])
>                 return -EINVAL;
> 
> -       required_mem_len = var->xres * var->yres *
> xenfb_info->page->depth / 8;
> -       if (var->bits_per_pixel == xenfb_info->page->depth &&
> -           var->xres <= info->fix.line_length / (XENFB_DEPTH / 8) &&
> -           required_mem_len <= info->fix.smem_len) {
> +       required_mem_len = var->xres * var->yres * var->bits_per_pixel / 8;
> +       if (required_mem_len <= info->fix.smem_len) {
>                 var->xres_virtual = var->xres;
>                 var->yres_virtual = var->yres;
> +               info->fix.line_length = var->xres * var->bits_per_pixel
> / 8;
>                 return 0;
>         }
>         return -EINVAL;
> 
> This works for my case, but involves modifying the
> fb_info.fix.line_length value - is this allowed?

You must not in change it in xenfb_check_var() since is only for
validating the mode. Instead you should change it in xenfb_set_par().

When posting the patch, please Cc the framebuffer list and maintainers
in addition to xen-devel.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.