Re: [PATCH] miniport/qxl: FillVideoMode: only allow word aligned strides

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

 



> On 10/11/2012 12:23 PM, Alon Levy wrote:
> > This is a pixman requirement. If it isn't enforced spice crashes,
> > qemu
> > with it. That should be fixed, but there is no simple way to allow
> > for
> > non word aligned strides, and the only down side is that for 16 bit
> > modes we will require even widths. And we already have the same
> > implementation detail in the X driver, only there it is a multiple
> > of 8,
> > not 4.
> > ---
> >   miniport/qxl.c | 9 ++++++++-
> >   1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/miniport/qxl.c b/miniport/qxl.c
> > index 55e55d3..f177d91 100644
> > --- a/miniport/qxl.c
> > +++ b/miniport/qxl.c
> > @@ -469,17 +469,24 @@ VP_STATUS
> > FillVidModeInfo(VIDEO_MODE_INFORMATION *pMode, ULONG xres, ULONG
> > yres,
> >   /* Fills given video mode structure */
> >   VP_STATUS FillVidModeInfo(VIDEO_MODE_INFORMATION *pMode, ULONG
> >   xres, ULONG yres, ULONG bpp, ULONG index)
> >   {
> > +    unsigned bytes_pp = (bpp + 7) / 8;
> > +
> >       if (xres<= 0 || yres<= 0)
> >           return ERROR_INVALID_DATA;
> >
> >       VideoPortZeroMemory(pMode, sizeof(VIDEO_MODE_INFORMATION));
> >
> > +    /* Honor pixmap's stride % 4 == 0 limitation. Pixmap is used
> > by spice-server. */
> > +    if (xres * bytes_pp % 4 != 0) {
> > +        xres = ((xres * bytes_pp)&  ~0x3) / bytes_pp;
> > +    }
> > +
> 
> Hi Alon,
> 
> I think this calculation is wrong. For example assume xres=3 and
> bytes_pp=5
>      xres = (15 & ~0x3) / 5   =   12 / 5  =  2
> 
> but now xres * bytes_pp = 10
> 
> Are there assumptions I'm missing ?

in practice bytes_pp is 2 or 4.

> 
> Thanks,
>      Uri.
> 
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]