modesetting: fix stride if kernel modifies it.

If the kernel aligns things use its values instead.

fixes output on nouveau here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2012-02-20 10:54:36 +00:00
parent 2150cbda8c
commit eb44a004b7

View File

@ -946,7 +946,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
ScreenPtr screen = screenInfo.screens[scrn->scrnIndex]; ScreenPtr screen = screenInfo.screens[scrn->scrnIndex];
uint32_t old_fb_id; uint32_t old_fb_id;
int i, pitch, old_width, old_height, old_pitch; int i, pitch, old_width, old_height, old_pitch;
int cpp = (scrn->bitsPerPixel + 1) / 8; int cpp = (scrn->bitsPerPixel + 7) / 8;
PixmapPtr ppix = screen->GetScreenPixmap(screen); PixmapPtr ppix = screen->GetScreenPixmap(screen);
void *new_pixels; void *new_pixels;
@ -1287,16 +1287,17 @@ Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int width; int width;
int height; int height;
int bpp; int bpp = pScrn->bitsPerPixel;
int i; int i;
int cpp = (bpp + 7) / 8;
width = pScrn->virtualX; width = pScrn->virtualX;
height = pScrn->virtualY; height = pScrn->virtualY;
bpp = pScrn->bitsPerPixel;
drmmode->front_bo = dumb_bo_create(drmmode->fd, width, height, bpp); drmmode->front_bo = dumb_bo_create(drmmode->fd, width, height, bpp);
if (!drmmode->front_bo) if (!drmmode->front_bo)
return FALSE; return FALSE;
pScrn->displayWidth = drmmode->front_bo->pitch / cpp;
width = height = 64; width = height = 64;
bpp = 32; bpp = 32;