[Intel-gfx] [PATCH 2/2] Unify options handling between UXA and SNA

Eugeni Dodonov eugeni.dodonov at intel.com
Mon Oct 31 18:10:19 CET 2011


Unifies available options for both UXA and SNA drivers, and
moves them into a common header file, intel_opts.h.

Signed-off-by: Eugeni Dodonov <eugeni.dodonov at intel.com>
---
 src/intel_driver.c          |   63 ++++------------------------------------
 src/intel_module.c          |    8 ++---
 src/intel_opts.h            |   67 +++++++++++++++++++++++++++++++++++++++++++
 src/sna/sna.h               |   15 ---------
 src/sna/sna_display.c       |    2 +
 src/sna/sna_driver.c        |   25 ++--------------
 src/sna/sna_video.c         |    2 +
 src/sna/sna_video_overlay.c |    2 +
 8 files changed, 85 insertions(+), 99 deletions(-)

diff --git a/src/intel_driver.c b/src/intel_driver.c
index 09c306c..09307c4 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -75,58 +75,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i915_drm.h"
 #include <xf86drmMode.h>
 
-/* *INDENT-OFF* */
-/*
- * Note: "ColorKey" is provided for compatibility with the i810 driver.
- * However, the correct option name is "VideoKey".  "ColorKey" usually
- * refers to the tranparency key for 8+24 overlays, not for video overlays.
- */
-
-typedef enum {
-   OPTION_DRI,
-   OPTION_VIDEO_KEY,
-   OPTION_COLOR_KEY,
-   OPTION_FALLBACKDEBUG,
-   OPTION_TILING_FB,
-   OPTION_TILING_2D,
-   OPTION_SHADOW,
-   OPTION_SWAPBUFFERS_WAIT,
-   OPTION_TRIPLE_BUFFER,
-#ifdef INTEL_XVMC
-   OPTION_XVMC,
-#endif
-   OPTION_PREFER_OVERLAY,
-   OPTION_DEBUG_FLUSH_BATCHES,
-   OPTION_DEBUG_FLUSH_CACHES,
-   OPTION_DEBUG_WAIT,
-   OPTION_HOTPLUG,
-   OPTION_RELAXED_FENCING,
-   OPTION_USE_SNA,
-} I830Opts;
-
-static OptionInfoRec I830Options[] = {
-   {OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
-   {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
-   {OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0},	FALSE},
-   {OPTION_TILING_2D,	"Tiling",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_TILING_FB,	"LinearFramebuffer",	OPTV_BOOLEAN,	{0},	FALSE},
-   {OPTION_SHADOW,	"Shadow",	OPTV_BOOLEAN,	{0},	FALSE},
-   {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN,	{0},	TRUE},
-#ifdef INTEL_XVMC
-   {OPTION_XVMC,	"XvMC",		OPTV_BOOLEAN,	{0},	TRUE},
-#endif
-   {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE},
-   {OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, FALSE},
-   {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, FALSE},
-   {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, FALSE},
-   {OPTION_HOTPLUG,	"HotPlug",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_RELAXED_FENCING,	"RelaxedFencing",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_USE_SNA,	"UseSna",	OPTV_BOOLEAN,	{0},	FALSE},
-   {-1,			NULL,		OPTV_NONE,	{0},	FALSE}
-};
-/* *INDENT-ON* */
+#include "intel_opts.h"
 
 static void i830AdjustFrame(int scrnIndex, int x, int y, int flags);
 static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen);
@@ -155,7 +104,7 @@ I830DPRINTF(const char *filename, int line, const char *function,
 /* Export I830 options to i830 driver where necessary */
 const OptionInfoRec *intel_uxa_available_options(int chipid, int busid)
 {
-	return I830Options;
+	return intelOptions;
 }
 
 static void
@@ -293,9 +242,9 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn)
 
 	/* Process the options */
 	xf86CollectOptions(scrn, NULL);
-	if (!(intel->Options = malloc(sizeof(I830Options))))
+	if (!(intel->Options = malloc(sizeof(intelOptions))))
 		return FALSE;
-	memcpy(intel->Options, I830Options, sizeof(I830Options));
+	memcpy(intel->Options, intelOptions, sizeof(intelOptions));
 	xf86ProcessOptions(scrn->scrnIndex, scrn->options, intel->Options);
 
 	intel->fallback_debug = xf86ReturnOptValBool(intel->Options,
@@ -1383,9 +1332,9 @@ static Bool intelPreInit(ScrnInfoPtr scrn, int flags)
 	 * need SNA... */
 	xf86CollectOptions(scrn, NULL);
 
-	if (!(Options = malloc(sizeof(I830Options))))
+	if (!(Options = malloc(sizeof(intelOptions))))
 		return FALSE;
-	memcpy(Options, I830Options, sizeof(I830Options));
+	memcpy(Options, intelOptions, sizeof(intelOptions));
 	xf86ProcessOptions(scrn->scrnIndex, scrn->options, Options);
 
 	xf86DrvMsg(0, X_INFO, "Detecting SNA...\n");
diff --git a/src/intel_module.c b/src/intel_module.c
index a39ce21..da23217 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -40,6 +40,8 @@
 
 #include <xf86drmMode.h>
 
+#include "intel_opts.h"
+
 static struct intel_device_info *chipset_info;
 
 static const struct intel_device_info intel_i81x_info = {
@@ -381,11 +383,7 @@ intel_available_options(int chipid, int busid)
 #endif
 
 	default:
-#if USE_SNA
-		return sna_available_options(chipid, busid);
-#else
-		return intel_uxa_available_options(chipid, busid);
-#endif
+		return intelOptions;
 	}
 }
 
diff --git a/src/intel_opts.h b/src/intel_opts.h
new file mode 100644
index 0000000..200e45c
--- /dev/null
+++ b/src/intel_opts.h
@@ -0,0 +1,67 @@
+/* *INDENT-OFF* */
+/*
+ * Note: "ColorKey" is provided for compatibility with the i810 driver.
+ * However, the correct option name is "VideoKey".  "ColorKey" usually
+ * refers to the tranparency key for 8+24 overlays, not for video overlays.
+ */
+
+typedef enum {
+   OPTION_DRI,
+   OPTION_VIDEO_KEY,
+   OPTION_COLOR_KEY,
+   OPTION_FALLBACKDEBUG,
+   OPTION_TILING_FB,
+   OPTION_TILING_2D,
+   OPTION_SHADOW,
+   OPTION_SWAPBUFFERS_WAIT,
+   OPTION_TRIPLE_BUFFER,
+#ifdef INTEL_XVMC
+   OPTION_XVMC,
+#endif
+   OPTION_PREFER_OVERLAY,
+   OPTION_DEBUG_FLUSH_BATCHES,
+   OPTION_DEBUG_FLUSH_CACHES,
+   OPTION_DEBUG_WAIT,
+   OPTION_HOTPLUG,
+   OPTION_RELAXED_FENCING,
+   OPTION_USE_SNA,
+#ifdef USE_SNA
+   OPTION_THROTTLE,
+   OPTION_VMAP,
+   OPTION_ZAPHOD,
+   OPTION_DELAYED_FLUSH,
+#endif
+   NUM_OPTIONS,
+} intelOpts;
+
+static OptionInfoRec intelOptions[] = {
+   {OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
+   {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
+   {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
+   {OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0},	FALSE},
+   {OPTION_TILING_2D,	"Tiling",	OPTV_BOOLEAN,	{0},	TRUE},
+   {OPTION_TILING_FB,	"LinearFramebuffer",	OPTV_BOOLEAN,	{0},	FALSE},
+   {OPTION_SHADOW,	"Shadow",	OPTV_BOOLEAN,	{0},	FALSE},
+   {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN,	{0},	TRUE},
+   {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN,	{0},	TRUE},
+#ifdef INTEL_XVMC
+   {OPTION_XVMC,	"XvMC",		OPTV_BOOLEAN,	{0},	TRUE},
+#endif
+   {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE},
+   {OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, FALSE},
+   {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, FALSE},
+   {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, FALSE},
+   {OPTION_HOTPLUG,	"HotPlug",	OPTV_BOOLEAN,	{0},	TRUE},
+   {OPTION_RELAXED_FENCING,	"RelaxedFencing",	OPTV_BOOLEAN,	{0},	TRUE},
+   {OPTION_USE_SNA,	"UseSna",	OPTV_BOOLEAN,	{0},	FALSE},
+#ifdef USE_SNA
+   {OPTION_THROTTLE,	"Throttle",	OPTV_BOOLEAN,	{0},	TRUE},
+   {OPTION_VMAP,	"UseVmap",	OPTV_BOOLEAN,	{0},	TRUE},
+   {OPTION_ZAPHOD,	"ZaphodHeads",	OPTV_STRING,	{0},	FALSE},
+   {OPTION_DELAYED_FLUSH,	"DelayedFlush",	OPTV_BOOLEAN,	{0},	TRUE},
+#endif
+   {-1,			NULL,		OPTV_NONE,	{0},	FALSE}
+};
+/* *INDENT-ON* */
+
+
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 3d2ecaf..1d5cadc 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -182,21 +182,6 @@ static inline void sna_set_pixmap(PixmapPtr pixmap, struct sna_pixmap *sna)
 }
 
 enum {
-	OPTION_TILING_FB,
-	OPTION_TILING_2D,
-	OPTION_PREFER_OVERLAY,
-	OPTION_COLOR_KEY,
-	OPTION_VIDEO_KEY,
-	OPTION_HOTPLUG,
-	OPTION_THROTTLE,
-	OPTION_RELAXED_FENCING,
-	OPTION_VMAP,
-	OPTION_ZAPHOD,
-	OPTION_DELAYED_FLUSH,
-	NUM_OPTIONS
-};
-
-enum {
 	FLUSH_TIMER = 0,
 	EXPIRE_TIMER,
 	NUM_TIMERS
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 98743bc..b6e9351 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -43,6 +43,8 @@
 #include "sna.h"
 #include "sna_reg.h"
 
+#include "intel_opts.h"
+
 #if DEBUG_DISPLAY
 #undef DBG
 #define DBG(x) ErrorF x
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 4118cdd..a5b049b 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -65,6 +65,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "sna_video.h"
 
 #include "intel_driver.h"
+#include "intel_opts.h"
 
 #include <sys/ioctl.h>
 #include <sys/fcntl.h>
@@ -80,31 +81,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define DBG(x) ErrorF x
 #endif
 
-static OptionInfoRec sna_options[] = {
-   {OPTION_TILING_FB,	"LinearFramebuffer",	OPTV_BOOLEAN,	{0},	FALSE},
-   {OPTION_TILING_2D,	"Tiling",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE},
-   {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
-   {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
-   {OPTION_HOTPLUG,	"HotPlug",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_THROTTLE,	"Throttle",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_RELAXED_FENCING,	"UseRelaxedFencing",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_VMAP,	"UseVmap",	OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_ZAPHOD,	"ZaphodHeads",	OPTV_STRING,	{0},	FALSE},
-   {OPTION_DELAYED_FLUSH,	"DelayedFlush",	OPTV_BOOLEAN,	{0},	TRUE},
-   {-1,			NULL,		OPTV_NONE,	{0},	FALSE}
-};
-
 static Bool sna_enter_vt(int scrnIndex, int flags);
 
 /* temporary */
 extern void xf86SetCursor(ScreenPtr screen, CursorPtr pCurs, int x, int y);
 
-const OptionInfoRec *sna_available_options(int chipid, int busid)
-{
-	return sna_options;
-}
-
 static void
 sna_load_palette(ScrnInfoPtr scrn, int numColors, int *indices,
 		 LOCO * colors, VisualPtr pVisual)
@@ -265,10 +246,10 @@ static Bool sna_get_early_options(ScrnInfoPtr scrn)
 
 	/* Process the options */
 	xf86CollectOptions(scrn, NULL);
-	if (!(sna->Options = malloc(sizeof(sna_options))))
+	if (!(sna->Options = malloc(sizeof(intelOptions))))
 		return FALSE;
 
-	memcpy(sna->Options, sna_options, sizeof(sna_options));
+	memcpy(sna->Options, intelOptions, sizeof(intelOptions));
 	xf86ProcessOptions(scrn->scrnIndex, scrn->options, sna->Options);
 
 	return TRUE;
diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index d1d5b52..2665536 100644
--- a/src/sna/sna_video.c
+++ b/src/sna/sna_video.c
@@ -57,6 +57,8 @@
 #include "sna_reg.h"
 #include "sna_video.h"
 
+#include "intel_opts.h"
+
 #include <xf86xv.h>
 #include <X11/extensions/Xv.h>
 
diff --git a/src/sna/sna_video_overlay.c b/src/sna/sna_video_overlay.c
index a20c111..51173fb 100644
--- a/src/sna/sna_video_overlay.c
+++ b/src/sna/sna_video_overlay.c
@@ -36,6 +36,8 @@
 #include <fourcc.h>
 #include <i915_drm.h>
 
+#include "intel_opts.h"
+
 #if DEBUG_VIDEO_OVERLAY
 #undef DBG
 #define DBG(x) ErrorF x
-- 
1.7.7.1




More information about the Intel-gfx mailing list