summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-02-20 10:54:36 +0000
committerDave Airlie <airlied@redhat.com>2012-02-20 10:55:48 +0000
commitc4e451ac9229de32fd69e4f446fa740af55e014a (patch)
tree335a5cc8d13c860bc95c326c35fa89027514df73
parent3e3061738d6bcc651b849767a53ee9764f96f1a9 (diff)
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>
-rw-r--r--src/drmmode_display.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 57ac521..caa9f44 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -946,7 +946,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
ScreenPtr screen = screenInfo.screens[scrn->scrnIndex];
uint32_t old_fb_id;
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);
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);
int width;
int height;
- int bpp;
+ int bpp = pScrn->bitsPerPixel;
int i;
+ int cpp = (bpp + 7) / 8;
width = pScrn->virtualX;
height = pScrn->virtualY;
- bpp = pScrn->bitsPerPixel;
+
drmmode->front_bo = dumb_bo_create(drmmode->fd, width, height, bpp);
if (!drmmode->front_bo)
return FALSE;
-
+ pScrn->displayWidth = drmmode->front_bo->pitch / cpp;
width = height = 64;
bpp = 32;