modesetting: Move ModifyPixmapHeader calls out of if/else branches.

Both branches called ModifyPixmapHeader with essentially the same
parameters.  By using new_pixels in the shadowfb case, we can make
them completely the same, and move them out a level, for simplicity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Kenneth Graunke 2014-12-09 14:38:39 -08:00
parent 35e9924484
commit b4324c6a23

View File

@ -1231,22 +1231,18 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
if (!new_pixels)
goto fail;
if (!drmmode->shadow_enable)
screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
pitch, new_pixels);
else {
void *new_shadow;
if (drmmode->shadow_enable) {
uint32_t size = scrn->displayWidth * scrn->virtualY *
((scrn->bitsPerPixel + 7) >> 3);
new_shadow = calloc(1, size);
if (new_shadow == NULL)
new_pixels = calloc(1, size);
if (new_pixels == NULL)
goto fail;
free(drmmode->shadow_fb);
drmmode->shadow_fb = new_shadow;
screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
pitch, drmmode->shadow_fb);
drmmode->shadow_fb = new_pixels;
}
screen->ModifyPixmapHeader(ppix, width, height, -1, -1, pitch, new_pixels);
#ifdef GLAMOR
if (drmmode->glamor) {
if (!glamor_egl_create_textured_screen(screen,