xf86-video-modesetting: Branch 'restart' - 2 commits - configure.ac src/driver.c src/drmmode_display.c

Dave Airlie airlied at kemper.freedesktop.org
Thu Sep 29 06:23:30 PDT 2011


 configure.ac          |    4 +++
 src/driver.c          |   60 ++++++++++++++------------------------------------
 src/drmmode_display.c |   26 ++++++++++-----------
 3 files changed, 33 insertions(+), 57 deletions(-)

New commits:
commit 9772f3e16b0e15ea48463c8af7e5c28ece116dea
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Sep 29 14:13:58 2011 +0100

    add -Wall, cleanup warnings

diff --git a/configure.ac b/configure.ac
index 3d4d267..12251fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,10 @@ AC_PROG_LIBTOOL
 AC_PROG_CC
 AM_PROG_CC_C_O
 
+if test "x$GCC" = "xyes"; then
+        CPPFLAGS="$CPPFLAGS -Wall"
+fi
+
 AH_TOP([#include "xorg-server.h"])
 
 AC_ARG_WITH(xorg-module-dir,
diff --git a/src/driver.c b/src/driver.c
index b56db94..d1348c9 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -33,6 +33,7 @@
 #include "config.h"
 #endif
 
+#include <unistd.h>
 #include <fcntl.h>
 #include "xf86.h"
 #include "xf86_OSproc.h"
@@ -199,8 +200,6 @@ ms_pci_probe(DriverPtr driver,
 	     int entity_num, struct pci_device *dev, intptr_t match_data)
 {
     ScrnInfoPtr scrn = NULL;
-    EntityInfoPtr entity;
-    DevUnion *private;
 
     scrn = xf86ConfigPciEntity(scrn, 0, entity_num, NULL,
 			       NULL, NULL, NULL, NULL, NULL);
@@ -239,14 +238,11 @@ ms_pci_probe(DriverPtr driver,
 static Bool
 Probe(DriverPtr drv, int flags)
 {
-    int i, numUsed, numDevSections, *usedChips;
-    EntPtr msEnt = NULL;
-    DevUnion *pPriv;
+    int i, numDevSections;
     GDevPtr *devSections;
     Bool foundScreen = FALSE;
-    int numDevs;
     char *dev;
-    ScrnInfoPtr scrn;
+    ScrnInfoPtr scrn = NULL;
 
     /* For now, just bail out for PROBE_DETECT. */
     if (flags & PROBE_DETECT)
@@ -268,7 +264,7 @@ Probe(DriverPtr drv, int flags)
 		int entity;
 		entity = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
 		scrn = xf86ConfigFbEntity(scrn, 0, entity,
-					   NULL, NULL, NULL, NULL);
+					  NULL, NULL, NULL, NULL);
 	    }
 
 	    if (scrn)
@@ -376,17 +372,11 @@ FreeRec(ScrnInfoPtr pScrn)
 static Bool
 PreInit(ScrnInfoPtr pScrn, int flags)
 {
-    xf86CrtcConfigPtr xf86_config;
     modesettingPtr ms;
-    MessageType from = X_PROBED;
     rgb defaultWeight = { 0, 0, 0 };
     EntityInfoPtr pEnt;
     EntPtr msEnt = NULL;
     char *BusID;
-    int i;
-    char *s;
-    int num_pipe;
-    int max_width, max_height;
 
     if (pScrn->numEntities != 1)
 	return FALSE;
@@ -526,7 +516,6 @@ CreateScreenResources(ScreenPtr pScreen)
     modesettingPtr ms = modesettingPTR(pScrn);
     PixmapPtr rootPixmap;
     Bool ret;
-    int flags;
     void *pixels;
     pScreen->CreateScreenResources = ms->createScreenResources;
     ret = pScreen->CreateScreenResources(pScreen);
@@ -567,9 +556,6 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     modesettingPtr ms = modesettingPTR(pScrn);
     VisualPtr visual;
-    unsigned long sys_mem;
-    int c;
-    MessageType from;
     int ret;
 
     ErrorF("ms is %p\n", ms);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4f25bbe..375170f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -108,11 +108,13 @@ static int dumb_bo_map(int fd, struct dumb_bo *bo)
 	return 0;
 }
 
+#if 0
 static int dumb_bo_unmap(int fd, struct dumb_bo *bo)
 {
 	bo->map_count--;
 	return 0;
 }
+#endif
 
 static int dumb_bo_destroy(int fd, struct dumb_bo *bo)
 {
@@ -260,7 +262,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		     Rotation rotation, int x, int y)
 {
 	ScrnInfoPtr pScrn = crtc->scrn;
-	//	RADEONInfoPtr info = RADEONPTR(pScrn);
 	xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
@@ -273,11 +274,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	int i;
 	int fb_id;
 	drmModeModeInfo kmode;
-	int pitch;
-	uint32_t tiling_flags = 0;
 	int height;
 
-	pitch = pScrn->displayWidth;
 	height = pScrn->virtualY;
 
 	if (drmmode->fb_id == 0) {
@@ -795,7 +793,6 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num, int *num_dv
 	drmModePropertyPtr props;
 	char name[32];
 	int i;
-	const char *s;
 
 	koutput = drmModeGetConnector(drmmode->fd, drmmode->mode_res->connectors[num]);
 	if (!koutput)
@@ -938,10 +935,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 screen_size;
 	int cpp = (scrn->bitsPerPixel + 1) / 8;
-	struct dumb_bo *front_bo;
-	uint32_t tiling_flags = 0;
 	PixmapPtr ppix = screen->GetScreenPixmap(screen);
 	void *new_pixels;
 
@@ -949,12 +943,12 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 		return TRUE;
 
 	xf86DrvMsg(scrn->scrnIndex, X_INFO,
-		   "Allocate new frame buffer %dx%d stride %d\n",
-		   width, height, pitch / cpp);
+		   "Allocate new frame buffer %dx%d stride\n",
+		   width, height);
 
 	old_width = scrn->virtualX;
 	old_height = scrn->virtualY;
-	old_pitch = scrn->displayWidth;
+	old_pitch = drmmode->front_bo->pitch;
 	old_fb_id = drmmode->fb_id;
 	old_front = drmmode->front_bo;
 
@@ -1009,7 +1003,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	drmmode->front_bo = old_front;
 	scrn->virtualX = old_width;
 	scrn->virtualY = old_height;
-	scrn->displayWidth = old_pitch;
+	scrn->displayWidth = old_pitch / cpp;
 	drmmode->fb_id = old_fb_id;
 
 	return FALSE;
@@ -1021,11 +1015,9 @@ static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
 
 Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 {
-	xf86CrtcConfigPtr xf86_config;
 	int i, num_dvi = 0, num_hdmi = 0;
 
 	xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
-	xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
 
 	drmmode->scrn = pScrn;
 	drmmode->cpp = cpp;
commit 1b9690d2b1f1bc33f149ff7ab8950b24029c030c
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Sep 29 14:05:43 2011 +0100

    fix server recycling

diff --git a/src/driver.c b/src/driver.c
index bc80e30..b56db94 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -570,31 +570,17 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     unsigned long sys_mem;
     int c;
     MessageType from;
+    int ret;
 
-    /* deal with server regeneration */
-    if (ms->fd < 0) {
-	char *BusID;
-
-	BusID = malloc(64);
-	sprintf(BusID, "PCI:%d:%d:%d",
-#if XSERVER_LIBPCIACCESS
-		((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
-		ms->PciInfo->dev, ms->PciInfo->func
-#else
-		((pciConfigPtr) ms->PciInfo->thisCard)->busnum,
-		((pciConfigPtr) ms->PciInfo->thisCard)->devnum,
-		((pciConfigPtr) ms->PciInfo->thisCard)->funcnum
-#endif
-	    );
-
-	ms->fd = drmOpen(NULL, BusID);
-
-	if (ms->fd < 0)
-	    return FALSE;
-    }
-
+    ErrorF("ms is %p\n", ms);
     pScrn->pScreen = pScreen;
 
+    ret = drmSetMaster(ms->fd);
+    if (ret) {
+        ErrorF("Unable to set master\n");
+        return FALSE;
+    }
+      
     /* HW dependent - FIXME */
     pScrn->displayWidth = pScrn->virtualX;
     if (!drmmode_create_initial_bos(pScrn, &ms->drmmode))
@@ -716,7 +702,9 @@ EnterVT(int scrnIndex, int flags)
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     modesettingPtr ms = modesettingPTR(pScrn);
 
-    if (!xf86SetDesiredModes(pScrn))
+    pScrn->vtSema = TRUE;
+
+    if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
 	return FALSE;
 
     return TRUE;
@@ -752,8 +740,8 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
     pScreen->CreateScreenResources = ms->createScreenResources;
     pScreen->BlockHandler = ms->BlockHandler;
-    drmClose(ms->fd);
-    ms->fd = -1;
+
+    drmDropMaster(ms->fd);
 
     pScrn->vtSema = FALSE;
     pScreen->CloseScreen = ms->CloseScreen;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index d94ce03..4f25bbe 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1329,6 +1329,12 @@ void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 {
 	xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
 	int i;
+
+	if (drmmode->fb_id) {
+		drmModeRmFB(drmmode->fd, drmmode->fb_id);
+		drmmode->fb_id = 0;
+	}
+
 	dumb_bo_destroy(drmmode->fd, drmmode->front_bo);
 	drmmode->front_bo = NULL;
 


More information about the xorg-commit mailing list