xf86-video-intel: 4 commits - src/intel_driver.c src/intel_options.c src/intel_options.h src/Makefile.am src/sna/kgem.h src/sna/sna_display.c src/sna/sna_dri.c src/sna/sna_driver.c src/sna/sna.h src/sna/sna_video_textured.c

Chris Wilson ickle at kemper.freedesktop.org
Fri May 25 07:52:35 PDT 2012


 src/Makefile.am              |    1 
 src/intel_driver.c           |    6 +----
 src/intel_options.c          |   47 +++++++++++++++++++++++++++++++++++++++++++
 src/intel_options.h          |   36 ++++----------------------------
 src/sna/kgem.h               |    1 
 src/sna/sna.h                |    2 -
 src/sna/sna_display.c        |   29 +++++++++++---------------
 src/sna/sna_dri.c            |    3 --
 src/sna/sna_driver.c         |   20 +++++-------------
 src/sna/sna_video_textured.c |    3 --
 10 files changed, 77 insertions(+), 71 deletions(-)

New commits:
commit 317bf05196086eb5dedb6436c07f253f01c9bf63
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri May 25 14:34:16 2012 +0100

    sna: Perform the selftest after probing
    
    We do no want to slow down the detection phase by performing our
    self-tests, so only running those before initialising the driver.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 0f43a46..f3f19e1 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -396,8 +396,6 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
 
 	DBG(("%s\n", __FUNCTION__));
 
-	sna_selftest();
-
 	if (scrn->numEntities != 1)
 		return FALSE;
 
@@ -408,6 +406,8 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
 	if (flags & PROBE_DETECT)
 		return TRUE;
 
+	sna_selftest();
+
 	sna = to_sna(scrn);
 	if (sna == NULL) {
 		sna = xnfcalloc(sizeof(struct sna), 1);
commit a5fe863e3f1a6750edaffb518c4e768e9bc11521
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri May 25 14:28:56 2012 +0100

    sna: Check the bus type before declaring probe success
    
    This should never fail, but still better to fail during detection rather
    than pretend it works.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 9c6994b..0f43a46 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -402,6 +402,8 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
 		return FALSE;
 
 	pEnt = xf86GetEntityInfo(scrn->entityList[0]);
+	if (pEnt->location.type != BUS_PCI)
+		return FALSE;
 
 	if (flags & PROBE_DETECT)
 		return TRUE;
@@ -419,9 +421,6 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
 
 	scrn->displayWidth = 640;	/* default it */
 
-	if (sna->pEnt->location.type != BUS_PCI)
-		return FALSE;
-
 	sna->PciInfo = xf86GetPciInfoForEntity(sna->pEnt->index);
 
 	fd = sna_open_drm_master(scrn);
commit 4094826aee76ef24dad13bc5a8a723bfe4a69162
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri May 25 08:55:13 2012 +0100

    sna: Trust the crtc-is-bound determination after modeset and hotplug
    
    As these should be the only time that they change and we now have the
    checks in place, we can drop the workaround of doing the check just
    before emitting the wait.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 0a95da7..fdabfae 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -141,7 +141,6 @@ struct kgem {
 	uint16_t nexec;
 	uint16_t nreloc;
 	uint16_t nfence;
-	uint16_t wait;
 	uint16_t batch_size;
 	uint16_t min_alignment;
 
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 5f7b526..1f2d085 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -299,6 +299,7 @@ extern void sna_mode_hotplug(struct sna *sna);
 extern void sna_mode_fini(struct sna *sna);
 
 extern int sna_crtc_id(xf86CrtcPtr crtc);
+extern bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc);
 extern int sna_output_dpms_status(xf86OutputPtr output);
 
 extern int sna_page_flip(struct sna *sna,
@@ -353,7 +354,6 @@ extern xf86CrtcPtr sna_covering_crtc(ScrnInfoPtr scrn,
 
 extern bool sna_wait_for_scanline(struct sna *sna, PixmapPtr pixmap,
 				  xf86CrtcPtr crtc, const BoxRec *clip);
-extern bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc);
 
 Bool sna_dri_open(struct sna *sna, ScreenPtr pScreen);
 void sna_dri_wakeup(struct sna *sna);
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index f1fcdbc..4b142a3 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -389,6 +389,19 @@ mode_to_kmode(drmModeModeInfoPtr kmode, DisplayModePtr mode)
 	kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
 }
 
+bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc)
+{
+	struct drm_mode_crtc mode;
+
+	mode.crtc_id = crtc_id(crtc->driver_private);
+	if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode))
+		return false;
+
+	DBG(("%s: mode valid?=%d, fb attached?=%d\n", __FUNCTION__,
+	     mode.mode_valid, sna->mode.fb_id == mode.fb_id));
+	return mode.mode_valid && sna->mode.fb_id == mode.fb_id;
+}
+
 static Bool
 sna_crtc_apply(xf86CrtcPtr crtc)
 {
@@ -2110,7 +2123,6 @@ static void sna_emit_wait_for_scanline_gen6(struct sna *sna,
 	b[1] = pipe;
 	b[2] = y2 - 1;
 	b[3] = MI_WAIT_FOR_EVENT | event;
-	sna->kgem.wait = sna->kgem.nbatch + 3;
 	kgem_advance_batch(&sna->kgem, 4);
 }
 
@@ -2140,7 +2152,6 @@ static void sna_emit_wait_for_scanline_gen4(struct sna *sna,
 	b[2] = b[0] = MI_LOAD_SCAN_LINES_INCL | pipe << 20;
 	b[3] = b[1] = (y1 << 16) | (y2-1);
 	b[4] = MI_WAIT_FOR_EVENT | event;
-	sna->kgem.wait = sna->kgem.nbatch + 4;
 	kgem_advance_batch(&sna->kgem, 5);
 }
 
@@ -2168,7 +2179,6 @@ static void sna_emit_wait_for_scanline_gen2(struct sna *sna,
 		b[4] = MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW;
 	else
 		b[4] = MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
-	sna->kgem.wait = sna->kgem.nbatch + 4;
 	kgem_advance_batch(&sna->kgem, 5);
 }
 
@@ -2233,19 +2243,6 @@ sna_wait_for_scanline(struct sna *sna,
 	return true;
 }
 
-bool sna_crtc_is_bound(struct sna *sna, xf86CrtcPtr crtc)
-{
-	struct drm_mode_crtc mode;
-
-	mode.crtc_id = crtc_id(crtc->driver_private);
-	if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode))
-		return false;
-
-	DBG(("%s: mode valid?=%d, fb attached?=%d\n", __FUNCTION__,
-	     mode.mode_valid, sna->mode.fb_id == mode.fb_id));
-	return mode.mode_valid && sna->mode.fb_id == mode.fb_id;
-}
-
 void sna_mode_hotplug(struct sna *sna)
 {
 	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn);
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 4fa4320..a1f671a 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -493,8 +493,7 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region,
 
 	DBG(("%s: flushing? %d\n", __FUNCTION__, flush));
 	if (flush) { /* STAT! */
-		if (!sna_crtc_is_bound(sna, crtc))
-			sna->kgem.batch[sna->kgem.wait] = 0;
+		assert(sna_crtc_is_bound(sna, ctrc));
 		kgem_submit(&sna->kgem);
 	}
 
diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
index 4975f55..9247e88 100644
--- a/src/sna/sna_video_textured.c
+++ b/src/sna/sna_video_textured.c
@@ -308,8 +308,7 @@ sna_video_textured_put_image(ScrnInfoPtr scrn,
 	 * we can hit the next vsync.
 	 */
 	if (flush) {
-		if (!sna_crtc_is_bound(sna, crtc))
-			sna->kgem.batch[sna->kgem.wait] = 0;
+		assert(sna_crtc_is_bound(sna, ctrc));
 		kgem_submit(&sna->kgem);
 	}
 
commit 8a9a585341e2dd43c649204fcf6d92a867671ba3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri May 25 08:50:33 2012 +0100

    Only create a single instance of the intel_options array
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/Makefile.am b/src/Makefile.am
index d057e43..a7043d1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -43,6 +43,7 @@ NULL:=#
 intel_drv_la_SOURCES = \
 	intel_list.h \
 	intel_options.h \
+	intel_options.c \
 	intel_module.c \
 	compat-api.h \
 	$(NULL)
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 60f43bb..fadc0a6 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -220,11 +220,9 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn)
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
 	/* Process the options */
-	xf86CollectOptions(scrn, NULL);
-	if (!(intel->Options = malloc(sizeof(intel_options))))
+	intel->Options = intel_options_get(scrn);
+	if (!intel->Options)
 		return FALSE;
-	memcpy(intel->Options, intel_options, sizeof(intel_options));
-	xf86ProcessOptions(scrn->scrnIndex, scrn->options, intel->Options);
 
 	intel->fallback_debug = xf86ReturnOptValBool(intel->Options,
 						     OPTION_FALLBACKDEBUG,
diff --git a/src/intel_options.c b/src/intel_options.c
new file mode 100644
index 0000000..80572be
--- /dev/null
+++ b/src/intel_options.c
@@ -0,0 +1,47 @@
+#include "intel_options.h"
+
+const OptionInfoRec intel_options[] = {
+	{OPTION_ACCEL_METHOD,	"AccelMethod",	OPTV_STRING,	{0},	0},
+	{OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	1},
+	{OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	0},
+	{OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	0},
+	{OPTION_TILING_2D,	"Tiling",	OPTV_BOOLEAN,	{0},	1},
+	{OPTION_TILING_FB,	"LinearFramebuffer",	OPTV_BOOLEAN,	{0},	0},
+	{OPTION_SHADOW,	"Shadow",	OPTV_BOOLEAN,	{0},	0},
+	{OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN,	{0},	1},
+	{OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN,	{0},	1},
+#ifdef INTEL_XVMC
+	{OPTION_XVMC,	"XvMC",		OPTV_BOOLEAN,	{0},	1},
+#endif
+	{OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, 0},
+	{OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, 0},
+	{OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, 0},
+	{OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, 0},
+	{OPTION_HOTPLUG,	"HotPlug",	OPTV_BOOLEAN,	{0},	1},
+	{OPTION_RELAXED_FENCING,	"RelaxedFencing",	OPTV_BOOLEAN,	{0},	1},
+#ifdef USE_SNA
+	{OPTION_THROTTLE,	"Throttle",	OPTV_BOOLEAN,	{0},	1},
+	{OPTION_VMAP,	"UseVmap",	OPTV_BOOLEAN,	{0},	1},
+	{OPTION_ZAPHOD,	"ZaphodHeads",	OPTV_STRING,	{0},	0},
+	{OPTION_DELAYED_FLUSH,	"DelayedFlush",	OPTV_BOOLEAN,	{0},	1},
+#endif
+#ifdef USE_UXA
+	{OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0},	0},
+	{OPTION_BUFFER_CACHE,       "BufferCache",  OPTV_BOOLEAN,   {0},    1},
+#endif
+	{-1,			NULL,		OPTV_NONE,	{0},	0}
+};
+
+OptionInfoPtr intel_options_get(ScrnInfoPtr scrn)
+{
+	OptionInfoPtr options;
+
+	xf86CollectOptions(scrn, NULL);
+	if (!(options = malloc(sizeof(intel_options))))
+		return NULL;
+
+	memcpy(options, intel_options, sizeof(intel_options));
+	xf86ProcessOptions(scrn->scrnIndex, scrn->options, options);
+
+	return options;
+}
diff --git a/src/intel_options.h b/src/intel_options.h
index 8863878..42a9e56 100644
--- a/src/intel_options.h
+++ b/src/intel_options.h
@@ -1,6 +1,9 @@
 #ifndef INTEL_OPTIONS_H
 #define INTEL_OPTIONS_H
 
+#include <xf86.h>
+#include <xf86Opt.h>
+
 /*
  * Note: "ColorKey" is provided for compatibility with the i810 driver.
  * However, the correct option name is "VideoKey".  "ColorKey" usually
@@ -40,36 +43,7 @@ enum intel_options {
 	NUM_OPTIONS,
 };
 
-static OptionInfoRec intel_options[] = {
-	{OPTION_ACCEL_METHOD,	"AccelMethod",	OPTV_STRING,	{0},	0},
-	{OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
-	{OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
-	{OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{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},
-#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
-#ifdef USE_UXA
-	{OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0},	FALSE},
-	{OPTION_BUFFER_CACHE,       "BufferCache",  OPTV_BOOLEAN,   {0},    TRUE},
-#endif
-	{-1,			NULL,		OPTV_NONE,	{0},	FALSE}
-};
+extern const OptionInfoRec intel_options[];
+OptionInfoPtr intel_options_get(ScrnInfoPtr scrn);
 
 #endif /* INTEL_OPTIONS_H */
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index fb54a24..9c6994b 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -259,15 +259,8 @@ static Bool sna_get_early_options(ScrnInfoPtr scrn)
 {
 	struct sna *sna = to_sna(scrn);
 
-	/* Process the options */
-	xf86CollectOptions(scrn, NULL);
-	if (!(sna->Options = malloc(sizeof(intel_options))))
-		return FALSE;
-
-	memcpy(sna->Options, intel_options, sizeof(intel_options));
-	xf86ProcessOptions(scrn->scrnIndex, scrn->options, sna->Options);
-
-	return TRUE;
+	sna->Options = intel_options_get(scrn);
+	return sna->Options != NULL;
 }
 
 struct sna_device {


More information about the xorg-commit mailing list