xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Gareth Stockwell <gareth.stockwell@arm.com>, xen-devel@lists.xen.org
Subject: Re: Modifying xenfb colour depth from Android domU
Date: Thu, 28 Aug 2014 13:43:57 +0100	[thread overview]
Message-ID: <53FF240D.7090007@citrix.com> (raw)
In-Reply-To: <53FEF481.1080201@arm.com>

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

  parent reply	other threads:[~2014-08-28 12:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28  9:21 Modifying xenfb colour depth from Android domU Gareth Stockwell
2014-08-28 10:15 ` David Vrabel
2014-08-28 11:16   ` Gareth Stockwell
2014-08-28 12:43 ` David Vrabel [this message]
2014-09-04 22:38   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53FF240D.7090007@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=gareth.stockwell@arm.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).