[PATCH 2/2] ephyr: Ensure stride of private framebuffer is multiple of 4

Eric Anholt eric at anholt.net
Wed Oct 23 01:42:09 CEST 2013


Søren Sandmann <sandmann at cs.au.dk> writes:

> From: Søren Sandmann Pedersen <ssp at redhat.com>
>
> The fb layer of X can't deal with strides that are not a multiple of
> 4, so when Xephyr allocates its own framebuffer it should make sure to
> align it.
>
> This fixes crashes and rendering corruption when Xephyr runs in a
> depth that is different from the host X server and its screen size is
> not a multiple of 4 / depth. (This is particularly easy to trigger if
> you use the -resizeable option).
> ---
>  hw/kdrive/ephyr/hostx.c |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
> index 86f3679..b547525 100644
> --- a/hw/kdrive/ephyr/hostx.c
> +++ b/hw/kdrive/ephyr/hostx.c
> @@ -719,12 +719,14 @@ hostx_screen_init(KdScreenInfo *screen,
>          return scrpriv->ximg->data;
>      }
>      else {
> -        *bytes_per_line = width * (scrpriv->server_depth >> 3);
> +        int Bpp = scrpriv->server_depth >> 3;

It took me a moment to figure out that 'B' was probaby capitalized to
mean bytes as opposed to bits.  I prefer the bytes_per_pixel naming in
the other hunk if you feel the units need clarification here.

> +        int stride = (width * Bpp + 0x3) & ~0x3;
> +        

trailing whitespace

> +        *bytes_per_line = stride;
>          *bits_per_pixel = scrpriv->server_depth;

Other than the whitespace, these two patches are:

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20131022/41cd5f26/attachment.pgp>


More information about the xorg-devel mailing list