diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2017-06-22 18:37:26 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2017-08-23 16:27:25 +0900 |
commit | 3f6210ca2c8ef60d59efc8139151d3b9838bb875 (patch) | |
tree | e3d72b6ae857a8bd607f018d0a9cdb4e23dcc287 | |
parent | 0472a605e0ec8fec1892bbc3a84698b7ef9c5296 (diff) |
Create radeon_pixmap_clear helper
Preparatory, no functional change intended yet.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 16 | ||||
-rw-r--r-- | src/radeon_bo_helper.c | 21 | ||||
-rw-r--r-- | src/radeon_bo_helper.h | 3 |
3 files changed, 25 insertions, 15 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index f926bc01..387d9e09 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -2211,9 +2211,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) uint32_t tiling_flags = 0, base_align; PixmapPtr ppix = screen->GetScreenPixmap(screen); void *fb_shadow; - xRectangle rect; - Bool force; - GCPtr gc; if (scrn->virtualX == width && scrn->virtualY == height) return TRUE; @@ -2356,18 +2353,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) goto fail; } - /* Clear new buffer */ - gc = GetScratchGC(ppix->drawable.depth, scrn->pScreen); - force = info->accel_state->force; - info->accel_state->force = TRUE; - ValidateGC(&ppix->drawable, gc); - rect.x = 0; - rect.y = 0; - rect.width = width; - rect.height = height; - (*gc->ops->PolyFillRect)(&ppix->drawable, gc, 1, &rect); - FreeScratchGC(gc); - info->accel_state->force = force; + radeon_pixmap_clear(ppix); radeon_cs_flush_indirect(scrn); radeon_bo_wait(info->front_bo); diff --git a/src/radeon_bo_helper.c b/src/radeon_bo_helper.c index a8ba7618..01b9e3df 100644 --- a/src/radeon_bo_helper.c +++ b/src/radeon_bo_helper.c @@ -195,6 +195,27 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth, return bo; } +/* Clear the pixmap contents to black */ +void +radeon_pixmap_clear(PixmapPtr pixmap) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen)); + GCPtr gc = GetScratchGC(pixmap->drawable.depth, screen); + Bool force = info->accel_state->force; + xRectangle rect; + + info->accel_state->force = TRUE; + ValidateGC(&pixmap->drawable, gc); + rect.x = 0; + rect.y = 0; + rect.width = pixmap->drawable.width; + rect.height = pixmap->drawable.height; + gc->ops->PolyFillRect(&pixmap->drawable, gc, 1, &rect); + FreeScratchGC(gc); + info->accel_state->force = force; +} + /* Get GEM handle for the pixmap */ Bool radeon_get_pixmap_handle(PixmapPtr pixmap, uint32_t *handle) { diff --git a/src/radeon_bo_helper.h b/src/radeon_bo_helper.h index 77134250..e1856adb 100644 --- a/src/radeon_bo_helper.h +++ b/src/radeon_bo_helper.h @@ -28,6 +28,9 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth, int usage_hint, int bitsPerPixel, int *new_pitch, struct radeon_surface *new_surface, uint32_t *new_tiling); +extern void +radeon_pixmap_clear(PixmapPtr pixmap); + extern uint32_t radeon_get_pixmap_tiling_flags(PixmapPtr pPix); |