summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/kgem.h5
-rw-r--r--src/sna/sna_display.c6
-rw-r--r--src/sna/sna_dri.c4
3 files changed, 11 insertions, 4 deletions
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 7bc920af..7e48db53 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -390,8 +390,11 @@ static inline bool kgem_check_batch_with_surfaces(struct kgem *kgem,
static inline uint32_t *kgem_get_batch(struct kgem *kgem, int num_dwords)
{
- if (!kgem_check_batch(kgem, num_dwords))
+ if (!kgem_check_batch(kgem, num_dwords)) {
+ unsigned mode = kgem->mode;
_kgem_submit(kgem);
+ _kgem_set_mode(kgem, mode);
+ }
return kgem->batch + kgem->nbatch;
}
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 10a70954..87acb5d0 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2792,6 +2792,8 @@ static bool sna_emit_wait_for_scanline_gen4(struct sna *sna,
uint32_t event;
uint32_t *b;
+ assert(sna->kgem.mode != KGEM_NONE);
+
if (pipe == 0) {
if (full_height)
event = MI_WAIT_FOR_PIPEA_SVBLANK;
@@ -2804,7 +2806,6 @@ static bool sna_emit_wait_for_scanline_gen4(struct sna *sna,
event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW;
}
- kgem_set_mode(&sna->kgem, KGEM_BLT);
b = kgem_get_batch(&sna->kgem, 5);
/* The documentation says that the LOAD_SCAN_LINES command
* always comes in pairs. Don't ask me why. */
@@ -2822,6 +2823,8 @@ static bool sna_emit_wait_for_scanline_gen2(struct sna *sna,
{
uint32_t *b;
+ assert(sna->kgem.mode != KGEM_NONE);
+
/*
* Pre-965 doesn't have SVBLANK, so we need a bit
* of extra time for the blitter to start up and
@@ -2830,7 +2833,6 @@ static bool sna_emit_wait_for_scanline_gen2(struct sna *sna,
if (full_height)
y2 -= 2;
- kgem_set_mode(&sna->kgem, KGEM_BLT);
b = kgem_get_batch(&sna->kgem, 5);
/* The documentation says that the LOAD_SCAN_LINES command
* always comes in pairs. Don't ask me why. */
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 3abcbc22..83c79c13 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -485,8 +485,10 @@ static void sna_dri_select_mode(struct sna *sna, struct kgem_bo *src, bool sync)
struct drm_i915_gem_busy busy;
int mode;
- if (sna->kgem.gen < 60)
+ if (sna->kgem.gen < 60) {
+ kgem_set_mode(&sna->kgem, KGEM_BLT);
return;
+ }
if (sync) {
DBG(("%s: sync, force RENDER ring\n", __FUNCTION__));