diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-04 21:39:33 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-04 21:39:33 +0100 |
commit | f5529ea61b5e12e0c2d9fda817948ca0a4cab212 (patch) | |
tree | 9053ae4cd5612c65149010574df1568ea519aa84 | |
parent | ea508c177c961ba2f00129476a22a32ff3ea6f1b (diff) |
sna: Use a stack allocated PixmapRec for the fbcon copy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 33cbac7a..e1fc6fc9 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -987,7 +987,7 @@ void sna_copy_fbcon(struct sna *sna) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn); struct drm_mode_fb_cmd fbcon; - PixmapPtr scratch; + PixmapRec scratch; struct sna_pixmap *priv; struct kgem_bo *bo; BoxRec box; @@ -1041,27 +1041,22 @@ void sna_copy_fbcon(struct sna *sna) DBG(("%s: found fbcon, size=%dx%d, depth=%d, bpp=%d\n", __FUNCTION__, fbcon.width, fbcon.height, fbcon.depth, fbcon.bpp)); - /* Wrap the fbcon in a pixmap so that we select the right formats - * in the render copy in case we need to preserve the fbcon - * across a depth change upon starting X. - */ - scratch = GetScratchPixmapHeader(sna->scrn->pScreen, - fbcon.width, fbcon.height, - fbcon.depth, fbcon.bpp, - 0, NULL); - if (scratch == NullPixmap) + bo = sna_create_bo_for_fbcon(sna, &fbcon); + if (bo == NULL) return; + DBG(("%s: fbcon handle=%d\n", __FUNCTION__, bo->handle)); + + scratch.drawable.width = fbcon.width; + scratch.drawable.height = fbcon.height; + scratch.drawable.depth = fbcon.depth; + scratch.drawable.bitsPerPixel = fbcon.bpp; + scratch.devPrivate.ptr = NULL; + box.x1 = box.y1 = 0; box.x2 = min(fbcon.width, sna->front->drawable.width); box.y2 = min(fbcon.height, sna->front->drawable.height); - bo = sna_create_bo_for_fbcon(sna, &fbcon); - if (bo == NULL) - goto cleanup_scratch; - - DBG(("%s: fbcon handle=%d\n", __FUNCTION__, bo->handle)); - sx = dx = 0; if (box.x2 < (uint16_t)fbcon.width) sx = (fbcon.width - box.x2) / 2; @@ -1075,7 +1070,7 @@ void sna_copy_fbcon(struct sna *sna) dy = (sna->front->drawable.height - box.y2) / 2; ok = sna->render.copy_boxes(sna, GXcopy, - scratch, bo, sx, sy, + &scratch, bo, sx, sy, sna->front, priv->gpu_bo, dx, dy, &box, 1, 0); if (!DAMAGE_IS_ALL(priv->gpu_damage)) @@ -1086,9 +1081,6 @@ void sna_copy_fbcon(struct sna *sna) #if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(10, 0) sna->scrn->pScreen->canDoBGNoneRoot = ok; #endif - -cleanup_scratch: - FreeScratchPixmapHeader(scratch); } static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc) |