This way all of the buffer allocation/destruction is in the same file. v2 Jason Ekstrand <[email protected]>: - Don't change the signature of drmmode_free_bos
Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Keith Packard <[email protected]> --- hw/xfree86/drivers/modesetting/driver.c | 14 -------------- hw/xfree86/drivers/modesetting/drmmode_display.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index 1ebf807..25d2d45 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -995,15 +995,6 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) if (!drmmode_create_initial_bos(pScrn, &ms->drmmode)) return FALSE; - if (ms->drmmode.shadow_enable) { - ms->drmmode.shadow_fb = - calloc(1, - pScrn->displayWidth * pScrn->virtualY * - ((pScrn->bitsPerPixel + 7) >> 3)); - if (!ms->drmmode.shadow_fb) - ms->drmmode.shadow_enable = FALSE; - } - miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, @@ -1215,11 +1206,6 @@ CloseScreen(ScreenPtr pScreen) ms->damage = NULL; } - if (ms->drmmode.shadow_enable) { - shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen)); - free(ms->drmmode.shadow_fb); - ms->drmmode.shadow_fb = NULL; - } drmmode_uevent_fini(pScrn, &ms->drmmode); drmmode_free_bos(pScrn, &ms->drmmode); diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 824500b..534341d 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -39,6 +39,7 @@ #include "micmap.h" #include "xf86cmap.h" #include "xf86DDC.h" +#include "shadow.h" #include <xf86drm.h> #include "xf86Crtc.h" @@ -1539,6 +1540,15 @@ drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode) return FALSE; pScrn->displayWidth = drmmode_bo_get_pitch(&drmmode->front_bo) / cpp; + if (drmmode->shadow_enable) { + drmmode->shadow_fb = + calloc(1, + pScrn->displayWidth * pScrn->virtualY * + ((pScrn->bitsPerPixel + 7) >> 3)); + if (!drmmode->shadow_fb) + drmmode->shadow_enable = FALSE; + } + width = ms->cursor_width; height = ms->cursor_height; bpp = 32; @@ -1603,6 +1613,7 @@ drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode) void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int i; @@ -1611,6 +1622,12 @@ drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode) drmmode->fb_id = 0; } + if (drmmode->shadow_enable) { + shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen)); + free(drmmode->shadow_fb); + drmmode->shadow_fb = NULL; + } + drmmode_bo_destroy(drmmode, &drmmode->front_bo); for (i = 0; i < xf86_config->num_crtc; i++) { -- 2.2.0 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
