xf86-video-modesetting: 4 commits - src/driver.c src/driver.h src/drmmode_display.c src/drmmode_display.h
Dave Airlie
airlied at kemper.freedesktop.org
Mon Feb 20 03:07:02 PST 2012
src/driver.c | 27 ++++++++++++++-------------
src/driver.h | 3 +--
src/drmmode_display.c | 26 ++++++++++++++++++++------
src/drmmode_display.h | 4 ++++
4 files changed, 39 insertions(+), 21 deletions(-)
New commits:
commit 24f2790951dd4b1f1fd138f2087248a005a64e27
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Feb 20 11:05:59 2012 +0000
modesetting: fix shadow resizing.
if we hotplugged and output, the shadow got disabled by accident.
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index caa9f44..c004721 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -984,8 +984,21 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
if (!new_pixels)
goto fail;
- screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
- pitch, new_pixels);
+ if (!drmmode->shadow_enable)
+ screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+ pitch, new_pixels);
+ else {
+ void *new_shadow;
+ uint32_t size = scrn->displayWidth * scrn->virtualY *
+ ((scrn->bitsPerPixel + 7) >> 3);
+ new_shadow = calloc(1, size);
+ if (new_shadow == NULL)
+ goto fail;
+ free(drmmode->shadow_fb);
+ drmmode->shadow_fb = new_shadow;
+ screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+ pitch, drmmode->shadow_fb);
+ }
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,9,99,1,0)
scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr;
commit 027a799d85a9d5cd8d599dc6f88e5a38adabe68b
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Feb 20 11:00:56 2012 +0000
modesetting: move shadow stuff to other structure
we need this for resize to work properly.
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/driver.c b/src/driver.c
index b66f0d7..8703b0b 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -492,9 +492,9 @@ PreInit(ScrnInfoPtr pScrn, int flags)
prefer_shadow = !!value;
}
- ms->shadow_enable = xf86ReturnOptValBool(ms->Options, OPTION_SHADOW_FB, prefer_shadow);
+ ms->drmmode.shadow_enable = xf86ReturnOptValBool(ms->Options, OPTION_SHADOW_FB, prefer_shadow);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB: preferred %s, enabled %s\n", prefer_shadow ? "YES" : "NO", ms->shadow_enable ? "YES" : "NO");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB: preferred %s, enabled %s\n", prefer_shadow ? "YES" : "NO", ms->drmmode.shadow_enable ? "YES" : "NO");
ms->drmmode.fd = ms->fd;
if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n");
@@ -527,7 +527,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- if (ms->shadow_enable) {
+ if (ms->drmmode.shadow_enable) {
if (!xf86LoadSubModule(pScrn, "shadow")) {
return FALSE;
}
@@ -577,13 +577,13 @@ CreateScreenResources(ScreenPtr pScreen)
rootPixmap = pScreen->GetScreenPixmap(pScreen);
- if (ms->shadow_enable)
- pixels = ms->shadow_fb;
+ if (ms->drmmode.shadow_enable)
+ pixels = ms->drmmode.shadow_fb;
if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, pixels))
FatalError("Couldn't adjust screen pixmap\n");
- if (ms->shadow_enable) {
+ if (ms->drmmode.shadow_enable) {
if (!shadowAdd(pScreen, rootPixmap, shadowUpdatePackedWeak(),
msShadowWindow, 0, 0))
return FALSE;
@@ -634,11 +634,11 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!drmmode_create_initial_bos(pScrn, &ms->drmmode))
return FALSE;
- if (ms->shadow_enable) {
- ms->shadow_fb = calloc(1, pScrn->displayWidth * pScrn->virtualY *
+ if (ms->drmmode.shadow_enable) {
+ ms->drmmode.shadow_fb = calloc(1, pScrn->displayWidth * pScrn->virtualY *
((pScrn->bitsPerPixel + 7) >> 3));
- if (!ms->shadow_fb)
- ms->shadow_enable = FALSE;
+ if (!ms->drmmode.shadow_fb)
+ ms->drmmode.shadow_enable = FALSE;
}
miClearVisualTypes();
@@ -677,7 +677,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
fbPictureInit(pScreen, NULL, 0);
- if (ms->shadow_enable && !msShadowInit(pScreen)) {
+ if (ms->drmmode.shadow_enable && !msShadowInit(pScreen)) {
xf86DrvMsg(scrnIndex, X_ERROR,
"shadow fb init failed\n");
return FALSE;
@@ -791,10 +791,10 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen)
ms->damage = NULL;
}
- if (ms->shadow_enable) {
+ if (ms->drmmode.shadow_enable) {
shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
- free(ms->shadow_fb);
- ms->shadow_fb = NULL;
+ free(ms->drmmode.shadow_fb);
+ ms->drmmode.shadow_fb = NULL;
}
drmmode_uevent_fini(pScrn, &ms->drmmode);
diff --git a/src/driver.h b/src/driver.h
index 2e51089..79561c8 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -75,8 +75,7 @@ typedef struct _modesettingRec
DamagePtr damage;
Bool dirty_enabled;
- Bool shadow_enable;
- void *shadow_fb;
+
} modesettingRec, *modesettingPtr;
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 7ede159..e83167b 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -54,6 +54,10 @@ typedef struct {
drmEventContext event_context;
struct dumb_bo *front_bo;
Bool sw_cursor;
+
+ Bool shadow_enable;
+ void *shadow_fb;
+
} drmmode_rec, *drmmode_ptr;
typedef struct {
commit c4e451ac9229de32fd69e4f446fa740af55e014a
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Feb 20 10:54:36 2012 +0000
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 at redhat.com>
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;
commit 3e3061738d6bcc651b849767a53ee9764f96f1a9
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Feb 20 10:54:21 2012 +0000
shadowfb: dump shadowfb state at startup
diff --git a/src/driver.c b/src/driver.c
index 8af9a9f..b66f0d7 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -494,6 +494,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
ms->shadow_enable = xf86ReturnOptValBool(ms->Options, OPTION_SHADOW_FB, prefer_shadow);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB: preferred %s, enabled %s\n", prefer_shadow ? "YES" : "NO", ms->shadow_enable ? "YES" : "NO");
ms->drmmode.fd = ms->fd;
if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n");
More information about the xorg-commit
mailing list