diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-03-30 11:44:09 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-03-31 16:24:45 +0900 |
commit | 83734317e6bdaeebb4462a63f541e73a1d7c2f77 (patch) | |
tree | 25aed7328049bc345cf28e4b35903c4e4ff80c1f /src | |
parent | 0b3aac1de9db42bfca545fa331e4985836682ec7 (diff) |
Update pixmap pitch in radeon_set_pixmap_bo
Stop second guessing it in drmmode_crtc_scanout_create.
Fixes display corruption in some cases with TearFree enabled.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94751
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/drmmode_display.c | 11 | ||||
-rw-r--r-- | src/radeon.h | 10 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 7ed8d6c4..73310151 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -97,7 +97,6 @@ RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name) static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn, int width, int height, int depth, int bpp, - int pitch, struct radeon_bo *bo, struct radeon_surface *psurf) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -112,7 +111,7 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn, return NULL; if (!(*pScreen->ModifyPixmapHeader)(pixmap, width, height, - depth, bpp, pitch, NULL)) { + depth, bpp, -1, NULL)) { return NULL; } @@ -401,8 +400,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, } pixmap = drmmode_create_bo_pixmap(pScrn, fbcon->width, fbcon->height, - fbcon->depth, fbcon->bpp, - fbcon->pitch, bo, NULL); + fbcon->depth, fbcon->bpp, bo, NULL); info->fbcon_pixmap = pixmap; radeon_bo_unref(bo); out_free_fb: @@ -577,7 +575,6 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout, ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; - unsigned long rotate_pitch; if (scanout->pixmap) { if (scanout->width == width && scanout->height == height) @@ -591,14 +588,10 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout, return NULL; } - rotate_pitch = RADEON_ALIGN(width, drmmode_get_pitch_align(pScrn, drmmode->cpp, 0)) - * drmmode->cpp; - scanout->pixmap = drmmode_create_bo_pixmap(pScrn, width, height, pScrn->depth, pScrn->bitsPerPixel, - rotate_pitch, scanout->bo, NULL); if (scanout->pixmap == NULL) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, diff --git a/src/radeon.h b/src/radeon.h index 37d5fb60..011b66b6 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -656,6 +656,8 @@ uint32_t radeon_get_pixmap_tiling(PixmapPtr pPix); static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo) { + ScreenPtr pScreen = pPix->drawable.pScreen; + #ifdef USE_GLAMOR RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(pPix->drawable.pScreen)); @@ -691,7 +693,9 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo) radeon_bo_ref(bo); priv->bo = bo; - radeon_bo_get_tiling(bo, &priv->tiling_flags, &pitch); + if (radeon_bo_get_tiling(bo, &priv->tiling_flags, &pitch) == 0 && + pitch != pPix->devKind) + pScreen->ModifyPixmapHeader(pPix, -1, -1, -1, -1, pitch, NULL); } out: radeon_set_pixmap_private(pPix, priv); @@ -710,7 +714,9 @@ out: radeon_bo_ref(bo); driver_priv->bo = bo; - radeon_bo_get_tiling(bo, &driver_priv->tiling_flags, &pitch); + if (radeon_bo_get_tiling(bo, &driver_priv->tiling_flags, &pitch) == 0 && + pitch != pPix->devKind) + pScreen->ModifyPixmapHeader(pPix, -1, -1, -1, -1, pitch, NULL); } } } |