Removed code which is obsolete, unused, commented out or irrelevant

xorg.conf options "DRI" & "HWcursor" removed (now always true)
xorg.conf option "NoAccel" removed as unused
omap and PowerVR specific features removed

Change-Id: I1c9269e9e7abe8dd44079155437ea3b4183d4733
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0b74ff5..630d08a 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -166,7 +166,7 @@
 	mode->VTotal = kmode->vtotal;
 	mode->VScan = kmode->vscan;
 
-	mode->Flags = kmode->flags; //& FLAG_BITS;
+	mode->Flags = kmode->flags;
 	mode->name = strdup(kmode->name);
 
 	DEBUG_MSG("copy mode %s (%p %p)", kmode->name, mode->name, mode);
@@ -198,7 +198,7 @@
 	kmode->vtotal = mode->VTotal;
 	kmode->vscan = mode->VScan;
 
-	kmode->flags = mode->Flags; //& FLAG_BITS;
+	kmode->flags = mode->Flags;
 	if (mode->name)
 		strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN);
 	kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
diff --git a/src/omap_dri2.c b/src/omap_dri2.c
index 1372b0a..95b021e 100644
--- a/src/omap_dri2.c
+++ b/src/omap_dri2.c
@@ -159,28 +159,6 @@
 
 	if (attachment == DRI2BufferFrontLeft) {
 		pPixmap = draw2pix(pDraw);
-
-
-/* TODO: MIDEGL-1442: We don't have enough memory to allocate three physically contiguous buffers at the same time! Because all our
- * buffers are scanout-able we'll not bother allocating *another* scanout buffer and just use the one we already have
- * and save that extra buffer size */
-#if 0
-		/* to do flipping, if we don't have DMM, then we need a scanout
-		 * capable (physically contiguous) buffer.. this bit of gymnastics
-		 * ensures that.
-		 */
-		if (canflip(pDraw) && !has_dmm(pOMAP) &&
-				(OMAPPixmapBo(pPixmap) != pOMAP->scanout)) {
-
-			/* need to re-allocate pixmap to get a scanout capable buffer */
-			PixmapPtr pNewPix = createpix(pDraw);
-
-			OMAPPixmapExchange(pPixmap, pNewPix);
-
-			pScreen->DestroyPixmap(pNewPix);
-		}
-#endif
-
 		pPixmap->refcnt++;
 	} else {
 		pPixmap = createpix(pDraw);
@@ -603,10 +581,7 @@
 {
 	ScreenPtr pScreen = pDraw->pScreen;
 	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-//	OMAPPtr pOMAP = OMAPPTR(pScrn);
 
-#if 0
-#endif
 	ERROR_MSG("not implemented");
 	return FALSE;
 }
diff --git a/src/omap_driver.c b/src/omap_driver.c
index 64ae20a..a294a67 100644
--- a/src/omap_driver.c
+++ b/src/omap_driver.c
@@ -84,27 +84,19 @@
 #endif
 };
 
+#define MALI_4XX_CHIPSET_ID (0x0400)
+#define MALI_T6XX_CHIPSET_ID (0x0600)
+
 /** Supported "chipsets." */
 static SymTabRec OMAPChipsets[] = {
-		/* OMAP2 and earlier not supported */
-		{ 0x3430, "OMAP3430 with PowerVR SGX530" },
-		{ 0x3630, "OMAP3630 with PowerVR SGX530" },
-		{ 0x4430, "OMAP4430 with PowerVR SGX540" },
-		{ 0x4460, "OMAP4460 with PowerVR SGX540" },
-		/*    { 4470, "OMAP4470 with <redacted> ;-)" }, */
-		{ 0x5430, "OMAP5430 with PowerVR SGX544 MP" },
-		{ 0x5432, "OMAP5432 with PowerVR SGX544 MP" },
-        { 0x0400, "Mali-T400" },
-		{ 0x0600, "Mali-T60x" },
+		{ MALI_4XX_CHIPSET_ID, "Mali-4XX" },
+		{ MALI_T6XX_CHIPSET_ID, "Mali-T6XX" },
 		{-1, NULL }
 };
 
 /** Supported options, as enum values. */
 typedef enum {
 	OPTION_DEBUG,
-	OPTION_DRI,
-	OPTION_NO_ACCEL,
-	OPTION_HW_CURSOR,
 	OPTION_NO_FLIP,
 	/* TODO: MIDEGL-1453: probably need to add an option to let user specify bus-id */
 } OMAPOpts;
@@ -112,9 +104,6 @@
 /** Supported options. */
 static const OptionInfoRec OMAPOptions[] = {
 	{ OPTION_DEBUG,		"Debug",	OPTV_BOOLEAN,	{0},	FALSE },
-	{ OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	FALSE },
-	{ OPTION_NO_ACCEL,	"NoAccel",	OPTV_BOOLEAN,	{0},	FALSE },
-	{ OPTION_HW_CURSOR,	"HWcursor",	OPTV_BOOLEAN,	{0},	FALSE },
 	{ OPTION_NO_FLIP,	"NoFlip",	OPTV_BOOLEAN,	{0},	FALSE },
 	{ -1,				NULL,		OPTV_NONE,		{0},	FALSE }
 };
@@ -126,9 +115,7 @@
 static int
 OMAPOpenDRM(int n)
 {
-	char bus_id[32];
-	snprintf(bus_id, sizeof(bus_id), "platform:omapdrm:%02d", n);
-	return open("/dev/dri/card0", O_RDWR, 0);/*drmOpen("mali_drm", bus_id);*/
+	return open("/dev/dri/card0", O_RDWR, 0);
 }
 
 static Bool
@@ -498,27 +485,15 @@
 			pOMAP->drmmode->dumb_scanout_flags,
 			pOMAP->drmmode->dumb_no_scanout_flags);
 
-	/* query chip-id: */
-	if (omap_get_param(pOMAP->dev, OMAP_PARAM_CHIPSET_ID, &value)) {
-		ERROR_MSG("Could not read chipset");
-		goto fail;
-	}
-	pOMAP->chipset = value;
-
 	/* find matching chipset name: */
 	for (i = 0; OMAPChipsets[i].name; i++) {
-		if (OMAPChipsets[i].token == pOMAP->chipset) {
+		if (OMAPChipsets[i].token == MALI_T6XX_CHIPSET_ID) {
 			pScrn->chipset = (char *)OMAPChipsets[i].name;
 			break;
 		}
 	}
 
-	if (!pScrn->chipset) {
-		ERROR_MSG("Unknown chipset: %s", pScrn->chipset);
-		goto fail;
-	}
-
-	INFO_MSG("Found chipset: %s", pScrn->chipset);
+	INFO_MSG("Chipset: %s", pScrn->chipset);
 
 	/*
 	 * Process the "xorg.conf" file options:
@@ -533,22 +508,11 @@
 	/* Determine if the user wants debug messages turned on: */
 	omapDebug = xf86ReturnOptValBool(pOMAP->pOptionInfo, OPTION_DEBUG, FALSE);
 
-	pOMAP->dri = xf86ReturnOptValBool(pOMAP->pOptionInfo, OPTION_DRI, TRUE);
-
-	/* Determine if user wants to disable hw mouse cursor: */
-	pOMAP->HWCursor = xf86ReturnOptValBool(pOMAP->pOptionInfo,
-			OPTION_HW_CURSOR, TRUE);
-	INFO_MSG("Using %s cursor", pOMAP->HWCursor ? "HW" : "SW");
-
 	/* Determine if user wants to disable buffer flipping: */
 	pOMAP->NoFlip = xf86ReturnOptValBool(pOMAP->pOptionInfo,
 			OPTION_NO_FLIP, FALSE);
 	INFO_MSG("Buffer Flipping is %s", pOMAP->NoFlip ? "Disabled" : "Enabled");
 
-	/* Determine if the user wants to disable acceleration: */
-	pOMAP->NoAccel = xf86ReturnOptValBool(pOMAP->pOptionInfo,
-			OPTION_NO_ACCEL, FALSE);
-
 	/*
 	 * Select the video modes:
 	 */
@@ -591,32 +555,6 @@
 		goto fail;
 	}
 
-	switch (pOMAP->chipset) {
-	case 0x3430:
-	case 0x3630:
-	case 0x4430:
-	case 0x4460:
-	case 0x5430:
-	case 0x5432:
-		if (xf86LoadSubModule(pScrn, SUB_MODULE_PVR)) {
-			INFO_MSG("Loaded the %s sub-module", SUB_MODULE_PVR);
-		} else {
-			INFO_MSG("Cannot load the %s sub-module", SUB_MODULE_PVR);
-			/* note that this is not fatal.. since IMG/PVR EXA module
-			 * is closed source, it is only optional.
-			 */
-			pOMAP->NoAccel = TRUE;  /* don't call InitPowerVREXA() */
-		}
-		break;
-		/* case 0x4470: ..; break; */
-	case 0x0600:
-		pOMAP->NoAccel = TRUE;  /* don't call InitPowerVREXA() */
-		break;
-	default:
-		ERROR_MSG("Unsupported chipset: %d", pOMAP->chipset);
-		goto fail;
-	}
-
 	TRACE_EXIT();
 	return TRUE;
 
@@ -636,37 +574,11 @@
 	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 	OMAPPtr pOMAP = OMAPPTR(pScrn);
 
-	if (!pOMAP->NoAccel) {
-		switch (pOMAP->chipset) {
-		case 0x3430:
-		case 0x3630:
-		case 0x4430:
-		case 0x4460:
-		case 0x5430:
-		case 0x5432:
-			INFO_MSG("Initializing the \"%s\" sub-module ...", SUB_MODULE_PVR);
-			pOMAP->pOMAPEXA = InitPowerVREXA(pScreen, pScrn, pOMAP->drmFD);
-			if (pOMAP->pOMAPEXA) {
-				INFO_MSG("Successfully initialized the \"%s\" sub-module",
-						SUB_MODULE_PVR);
-			} else {
-				INFO_MSG("Could not initialize the \"%s\" sub-module",
-						SUB_MODULE_PVR);
-				pOMAP->NoAccel = TRUE;
-			}
-			break;
-		default:
-			ERROR_MSG("Unsupported chipset: %d", pOMAP->chipset);
-			pOMAP->NoAccel = TRUE;
-			break;
-		}
-	}
-
 	if (!pOMAP->pOMAPEXA) {
 		pOMAP->pOMAPEXA = InitNullEXA(pScreen, pScrn, pOMAP->drmFD);
 	}
 
-	if (pOMAP->dri && pOMAP->pOMAPEXA) {
+	if (pOMAP->pOMAPEXA) {
 		pOMAP->dri = OMAPDRI2ScreenInit(pScreen);
 	} else {
 		pOMAP->dri = FALSE;
@@ -790,11 +702,8 @@
 	/* Initialize the cursor: */
 	miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
 
-	if (pOMAP->HWCursor) {
-		if (!drmmode_cursor_init(pScreen)) {
-			ERROR_MSG("Hardware cursor initialization failed");
-			pOMAP->HWCursor = FALSE;
-		}
+	if (!drmmode_cursor_init(pScreen)) {
+		ERROR_MSG("Hardware cursor initialization failed");
 	}
 
 	/* XXX -- Is this the right place for this?  The Intel i830 driver says:
diff --git a/src/omap_driver.h b/src/omap_driver.h
index 7acf9d3..94fccd8 100644
--- a/src/omap_driver.h
+++ b/src/omap_driver.h
@@ -115,19 +115,16 @@
 /** The driver's Screen-specific, "private" data structure. */
 typedef struct _OMAPRec
 {
-	/** Chipset id */
-	int					chipset;
-
 	/**
 	 * Pointer to a structure used to communicate and coordinate with an
 	 * external EXA library (if loaded).
 	 */
 	OMAPEXAPtr			pOMAPEXA;
 
-	/** various user-configurable options: */
+	/** record if OMAPDRI2ScreenInit() was successful */
 	Bool				dri;
-	Bool				HWCursor;
-	Bool				NoAccel;
+
+	/** user-configurable option: */
 	Bool				NoFlip;
 
 	/** File descriptor of the connection with the DRM. */
@@ -156,7 +153,7 @@
 
 	/** Flips we are waiting for: */
 	int					pending_flips;
-       /* For invalidating backbuffers on Hotplug */
+	/* For invalidating backbuffers on Hotplug */
 	Bool			has_resized;
 } OMAPRec, *OMAPPtr;
 
@@ -164,11 +161,6 @@
  * Misc utility macros:
  */
 
-static inline Bool has_dmm(OMAPPtr pOMAP)
-{
-	return pOMAP->chipset >= 0x4430;
-}
-
 /** Return a pointer to the driver's private structure. */
 #define OMAPPTR(p) ((OMAPPtr)((p)->driverPrivate))
 #define OMAPPTR_FROM_SCREEN(pScreen) \
diff --git a/src/omap_drmif_fb.h b/src/omap_drmif_fb.h
index c111f22..ac77390 100644
--- a/src/omap_drmif_fb.h
+++ b/src/omap_drmif_fb.h
@@ -26,8 +26,6 @@
 
 #include <stdint.h>
 
-#define OMAP_PARAM_CHIPSET_ID 0
-
 #define HW_CURSOR_ARGB		(0)
 #define HW_CURSOR_PL111		(1)
 
diff --git a/src/omap_dumb.c b/src/omap_dumb.c
index a2a32db..cd96e29 100644
--- a/src/omap_dumb.c
+++ b/src/omap_dumb.c
@@ -317,12 +317,6 @@
 	return msync(bo->map_addr, bo->size, MS_SYNC | MS_INVALIDATE);
 }
 
-int omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value)
-{
-	*value = 0x0600;
-	return 0;
-}
-
 int omap_bo_add_fb(struct omap_bo *bo)
 {
 	int ret;
diff --git a/src/omap_exa.c b/src/omap_exa.c
index 10c926a..6c546a0 100644
--- a/src/omap_exa.c
+++ b/src/omap_exa.c
@@ -306,14 +306,6 @@
 		}
 	}
 
-	/* wait for blits complete.. note we could be a bit more clever here
-	 * for non-DRI2 buffers and use separate OMAP{Prepare,Finish}GPUAccess()
-	 * fxns wrapping accelerated GPU operations.. this way we don't have
-	 * to prep/fini around each CPU operation, but only when there is an
-	 * intervening GPU operation (or if we go to a stronger op mask, ie.
-	 * first CPU access is READ and second is WRITE).
-	 */
-
 	if (omap_bo_cpu_prep(priv->bo, idx2op(index))) {
 		xf86DrvMsg(-1, X_ERROR, "%s: omap_bo_cpu_prep failed - "
 				"unable to synchronise access.\n", __FUNCTION__);
diff --git a/src/omap_exa.h b/src/omap_exa.h
index 0c91404..29d98aa 100644
--- a/src/omap_exa.h
+++ b/src/omap_exa.h
@@ -72,14 +72,6 @@
 
 
 /**
- * Canonical name of an external sub-module providing support for EXA
- * acceleration, that utiltizes the OMAP's PowerVR accelerator and uses closed
- * source from Imaginations Technology Limited.
- */
-#define SUB_MODULE_PVR	"omap_pvr"
-OMAPEXAPtr InitPowerVREXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd);
-
-/**
  * Fallback EXA implementation
  */
 OMAPEXAPtr InitNullEXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd);
@@ -121,7 +113,6 @@
 } OMAPPixmapPrivRec, *OMAPPixmapPrivPtr;
 
 #define OMAP_CREATE_PIXMAP_SCANOUT 0x80000000
-#define OMAP_CREATE_PIXMAP_TILED   0x40000000
 
 
 void * OMAPCreatePixmap2 (ScreenPtr pScreen, int width, int height,