From b4324c6a2382dc96295bdb061316f699e4ffabb9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 9 Dec 2014 14:38:39 -0800 Subject: [PATCH] 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 Tested-by: Jason Ekstrand Reviewed-by: Keith Packard --- hw/xfree86/drivers/modesetting/drmmode_display.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index fddbaff96..f88148d71 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -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,