[PATCH 4/6] modesetting: reverse prime support

Aaron Plattner aplattner at nvidia.com
Fri Jun 26 14:28:10 PDT 2015


On 06/25/2015 03:56 PM, Dave Airlie wrote:
>>> +
>>> +        screenpix = screen->GetScreenPixmap(screen);
>>> +        screen->width = screenpix->drawable.width = total_width;
>>> +        screen->height = screenpix->drawable.height = max_height;
>>
>> Directly setting the width/height of a pixmap?  That seems suspicious to
>> me.  Usually you're using ModifyPixmapHeader(), since you need to change
>> other things (like the pointer/stride) at the same time.  Is there an
>> explanation for this being safe?
> 
> I just pre-existing precedent for this
> 
> xf86RandR12.c:xf86RandR12ScreenSetSize
> 
> after it calls the driver resize hook does
>    pScrnPix = (*pScreen->GetScreenPixmap) (pScreen);
>     pScreen->width = pScrnPix->drawable.width = width;
>     pScreen->height = pScrnPix->drawable.height = height;
> 
> and since I'm doing pretty much the same thing resizing the screen,
> I used the code from there.

Yeah, for things like this, ModifyPixmapHeader() doesn't really do
anything useful and gets in the way when you try to do things like set
devPrivate.ptr to NULL, since it just skips the pointer write in that case:

        if (pPixData)
            pPixmap->devPrivate.ptr = pPixData;

Not that you *couldn't* use ModifyPixmapHeader here, though.

> Dave.

-- 
Aaron


More information about the xorg-devel mailing list