[PATCH v2 1/6] modesetting: Allocate and destroy shadow_fb in drmmode_display
Jason Ekstrand
jason at jlekstrand.net
Wed Jan 7 15:59:06 PST 2015
This way all of the buffer allocation/destruction is in the same file.
v2 Jason Ekstrand <jason.ekstrand at intel.com>:
- Don't change the signature of drmmode_free_bos
Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
---
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
More information about the xorg-devel
mailing list