Skip to contentSkip to conversation

Support SNA via a configuration option

PATCH New Eugeni Dodonov 1 participant 3 messages Oct 31, 2011

lore
Share & tools
lore
#0 lore raw

cover Support SNA via a configuration option

This patchset adds support for enabling SNA support via a configuration file option.

This way, it is possible to switch between UXA and SNA via config file changes, instead of having to recompile and install full driver.

Second patch goes a bit onwards and also unifies the options between SNA and UXA drivers into a single intelOptions structure. To reduce the universe entropy, those options are moved into intel_opts.h header, and the modules which need to use them do so by including this file.

Eugeni Dodonov (2):
Enable SNA via a configuration file option.
Unify options handling between UXA and SNA

 src/common.h                |    2 +-
 src/intel_driver.c          |  151 +++++++++++++++++++++++++++----------------
 src/intel_module.c          |   14 +---
 src/intel_opts.h            |   67 +++++++++++++++++++
 src/sna/sna.h               |   15 ----
 src/sna/sna_display.c       |    2 +
 src/sna/sna_driver.c        |   39 ++----------
 src/sna/sna_module.h        |    3 +-
 src/sna/sna_video.c         |    2 +
 src/sna/sna_video_overlay.c |    2 +
 10 files changed, 181 insertions(+), 116 deletions(-)
 create mode 100644 src/intel_opts.h
Signature · 1 line
1.7.7.1
#1 lore raw

PATCH 1/2 Enable SNA via a configuration file option.

This allows to use UXA and SNA from within the same driver, by setting an "UseSNA" option in the driver config - for example, by creating an /etc/X11/xorg.conf.d/99-intel-sna.conf:

Section "Device"
Identifier "intel"
driver "intel"
Option "UseSna" "True"
EndSection

This also allows to record the entity_num within the main intel driver, not only SNA.

---
 src/common.h         |    2 +-
 src/intel_driver.c   |   96 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/intel_module.c   |    6 +---
 src/sna/sna_driver.c |   14 +------
 src/sna/sna_module.h |    3 +-
 5 files changed, 100 insertions(+), 21 deletions(-)
src/common.h +1 -1
index 6f23cdd..6b86801 100644
@@ -77,7 +77,7 @@ I830DPRINTF_stub(const char *filename, int line, const char *function,
 
 /* I830 hooks for the I810 driver setup/probe. */
 extern const OptionInfoRec *I830AvailableOptions(int chipid, int busid);
-extern void intel_init_scrn(ScrnInfoPtr scrn);
+extern void intel_init_scrn(ScrnInfoPtr scrn, int entity_num);
 
 /* Symbol lists shared by the i810 and i830 parts. */
 extern int I830EntityIndex;
src/intel_driver.c +94 -2

119 lines not on this page · raw message

src/intel_module.c +1 -5
index cd9c1a3..a39ce21 100644
@@ -344,11 +344,7 @@ static Bool intel_pci_probe(DriverPtr		driver,
 #endif
 
 		default:
-#if USE_SNA
-			sna_init_scrn(scrn, entity_num);
-#else
-			intel_init_scrn(scrn);
-#endif
+			intel_init_scrn(scrn, entity_num);
 			break;
 		}
 	}
src/sna/sna_driver.c +2 -12
index 0df7ca0..4118cdd 100644
@@ -396,7 +396,7 @@ static void sna_selftest(void)
  * As a result, we want to set up that server initialization once rather
  * that doing it per generation.
  */
-static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
+Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
 {
 	struct sna *sna;
 	rgb defaultWeight = { 0, 0, 0 };
@@ -1019,10 +1019,8 @@ static Bool sna_pm_event(int scrnIndex, pmEvent event, Bool undo)
 	return TRUE;
 }
 
-void sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
+void sna_init_scrn(ScrnInfoPtr scrn)
 {
-	EntityInfoPtr entity;
-
 #if defined(USE_GIT_DESCRIBE)
 	xf86DrvMsg(scrn->scrnIndex, X_INFO,
 		   "SNA compiled from %s\n", git_version);
@@ -1044,12 +1042,4 @@ void sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
 	scrn->FreeScreen = sna_free_screen;
 	scrn->ValidMode = sna_valid_mode;
 	scrn->PMEvent = sna_pm_event;
-
-	xf86SetEntitySharable(scrn->entityList[0]);
-
-	entity = xf86GetEntityInfo(entity_num);
-	xf86SetEntityInstanceForScreen(scrn,
-				       entity->index,
-				       xf86GetNumEntityInstances(entity->index)-1);
-	free(entity);
 }
src/sna/sna_module.h +2 -1
index 97d5dd5..34022ba 100644
@@ -1,3 +1,4 @@
 const OptionInfoRec *sna_available_options(int chipid, int busid);
-void sna_init_scrn(ScrnInfoPtr scrn, int entity_num);
+void sna_init_scrn(ScrnInfoPtr scrn);
+Bool sna_pre_init(ScrnInfoPtr scrn, int flags);
 
Signature · 1 line
1.7.7.1
#2 lore raw

PATCH 2/2 Unify options handling between UXA and SNA

In reply to Eugeni Dodonov

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

---
 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(-)
src/intel_driver.c +6 -57
index 09c306c..09307c4 100644
@@ -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");
src/intel_module.c +3 -5
index a39ce21..da23217 100644
@@ -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;
 	}
 }
 
src/intel_opts.h new file +67 -0

67 lines not on this page · raw message

src/sna/sna.h +0 -15
index 3d2ecaf..1d5cadc 100644
@@ -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
src/sna/sna_display.c +2 -0
index 98743bc..b6e9351 100644
@@ -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
src/sna/sna_driver.c +3 -22
index 4118cdd..a5b049b 100644
@@ -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;
src/sna/sna_video.c +2 -0
index d1d5b52..2665536 100644
@@ -57,6 +57,8 @@
 #include "sna_reg.h"
 #include "sna_video.h"
 
+#include "intel_opts.h"
+
 #include <xf86xv.h>
 #include <X11/extensions/Xv.h>
 
src/sna/sna_video_overlay.c +2 -0
index a20c111..51173fb 100644
@@ -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
Signature · 1 line
1.7.7.1