On Fri, May 13, 2016 at 5:40 AM, Michel Dänzer <[email protected]> wrote: > From: Michel Dänzer <[email protected]> > > The kernel driver returns 0 as the pitch of the fbcon BO via the > DRM_RADEON_GEM_GET_TILING ioctl, so we ended up using an incorrect > pitch in some cases. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94901 > Signed-off-by: Michel Dänzer <[email protected]>
Reviewed-by: Alex Deucher <[email protected]> > --- > src/drmmode_display.c | 16 +++++++++++++--- > src/radeon.h | 10 ++-------- > 2 files changed, 15 insertions(+), 11 deletions(-) > > diff --git a/src/drmmode_display.c b/src/drmmode_display.c > index 84c07c6..4271f04 100644 > --- a/src/drmmode_display.c > +++ b/src/drmmode_display.c > @@ -98,6 +98,7 @@ 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); > @@ -111,8 +112,16 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr > pScrn, > if (!pixmap) > return NULL; > > + if (pitch <= 0 && > + (radeon_bo_get_tiling(bo, &tiling, (uint32_t*)&pitch) != 0 || > + pitch <= 0)) { > + ErrorF("radeon_bo_get_tiling failed to determine pitch\n"); > + pScreen->DestroyPixmap(pixmap); > + return NULL; > + } > + > if (!(*pScreen->ModifyPixmapHeader)(pixmap, width, height, > - depth, bpp, -1, NULL)) { > + depth, bpp, pitch, NULL)) { > return NULL; > } > > @@ -401,7 +410,8 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, > } > > pixmap = drmmode_create_bo_pixmap(pScrn, fbcon->width, fbcon->height, > - fbcon->depth, fbcon->bpp, bo, NULL); > + fbcon->depth, fbcon->bpp, > fbcon->pitch, > + bo, NULL); > info->fbcon_pixmap = pixmap; > radeon_bo_unref(bo); > out_free_fb: > @@ -593,7 +603,7 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct > drmmode_scanout *scanout, > width, height, > pScrn->depth, > pScrn->bitsPerPixel, > - scanout->bo, NULL); > + -1, scanout->bo, NULL); > if (scanout->pixmap == NULL) > xf86DrvMsg(pScrn->scrnIndex, X_ERROR, > "Couldn't allocate scanout pixmap for CRTC\n"); > diff --git a/src/radeon.h b/src/radeon.h > index 011b66b..37d5fb6 100644 > --- a/src/radeon.h > +++ b/src/radeon.h > @@ -656,8 +656,6 @@ 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)); > > @@ -693,9 +691,7 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, > struct radeon_bo *bo) > radeon_bo_ref(bo); > priv->bo = bo; > > - if (radeon_bo_get_tiling(bo, &priv->tiling_flags, &pitch) == 0 && > - pitch != pPix->devKind) > - pScreen->ModifyPixmapHeader(pPix, -1, -1, -1, -1, pitch, > NULL); > + radeon_bo_get_tiling(bo, &priv->tiling_flags, &pitch); > } > out: > radeon_set_pixmap_private(pPix, priv); > @@ -714,9 +710,7 @@ out: > radeon_bo_ref(bo); > driver_priv->bo = bo; > > - if (radeon_bo_get_tiling(bo, &driver_priv->tiling_flags, &pitch) > == 0 && > - pitch != pPix->devKind) > - pScreen->ModifyPixmapHeader(pPix, -1, -1, -1, -1, pitch, > NULL); > + radeon_bo_get_tiling(bo, &driver_priv->tiling_flags, &pitch); > } > } > } > -- > 2.8.1 > > _______________________________________________ > xorg-driver-ati mailing list > [email protected] > https://lists.x.org/mailman/listinfo/xorg-driver-ati _______________________________________________ xorg-driver-ati mailing list [email protected] https://lists.x.org/mailman/listinfo/xorg-driver-ati
