summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-05-25 08:55:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-05-25 10:06:57 +0100
commit4094826aee76ef24dad13bc5a8a723bfe4a69162 (patch)
tree767eb14fda66308b2bb8ab1e4c1a8be5a5d73910 /src/sna
parent8a9a585341e2dd43c649204fcf6d92a867671ba3 (diff)
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@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/kgem.h1
-rw-r--r--src/sna/sna.h2
-rw-r--r--src/sna/sna_display.c29
-rw-r--r--src/sna/sna_dri.c3
-rw-r--r--src/sna/sna_video_textured.c3
5 files changed, 16 insertions, 22 deletions
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 0a95da74..fdabfae9 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 5f7b526a..1f2d085d 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 f1fcdbc0..4b142a3e 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 4fa43209..a1f671ac 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 4975f55f..9247e88d 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);
}