diff options
-rw-r--r-- | src/sna/Makefile.am | 2 | ||||
-rw-r--r-- | src/sna/gen6_common.c | 95 | ||||
-rw-r--r-- | src/sna/gen6_common.h | 194 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 215 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 227 | ||||
-rw-r--r-- | src/sna/sna.h | 1 | ||||
-rw-r--r-- | src/sna/sna_render.h | 2 |
7 files changed, 308 insertions, 428 deletions
diff --git a/src/sna/Makefile.am b/src/sna/Makefile.am index 6e8dc94b..b0d24197 100644 --- a/src/sna/Makefile.am +++ b/src/sna/Makefile.am @@ -93,6 +93,8 @@ libsna_la_SOURCES = \ gen4_vertex.h \ gen5_render.c \ gen5_render.h \ + gen6_common.c \ + gen6_common.h \ gen6_render.c \ gen6_render.h \ gen7_render.c \ diff --git a/src/sna/gen6_common.c b/src/sna/gen6_common.c new file mode 100644 index 00000000..f4f02645 --- /dev/null +++ b/src/sna/gen6_common.c @@ -0,0 +1,95 @@ +/* + * Copyright © 2011-2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Chris Wilson <chris@chris-wilson.co.uk> + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gen6_common.h" +#include "gen4_vertex.h" + +void gen6_render_flush(struct sna *sna) +{ + gen4_vertex_close(sna); + + assert(sna->render.vb_id == 0); + assert(sna->render.vertex_offset == 0); +} + +void +gen6_render_context_switch(struct kgem *kgem, + int new_mode) +{ + if (kgem->nbatch) { + DBG(("%s: from %d to %d, submit batch\n", __FUNCTION__, kgem->mode, new_mode)); + _kgem_submit(kgem); + } + + if (kgem->nexec) { + DBG(("%s: from %d to %d, reset incomplete batch\n", __FUNCTION__, kgem->mode, new_mode)); + kgem_reset(kgem); + } + + assert(kgem->nbatch == 0); + assert(kgem->nreloc == 0); + assert(kgem->nexec == 0); + + kgem->ring = new_mode; +} + +void +gen6_render_retire(struct kgem *kgem) +{ + struct sna *sna; + + if (kgem->ring && (kgem->has_semaphores || !kgem->need_retire)) + kgem->ring = kgem->mode; + + sna = container_of(kgem, struct sna, kgem); + if (kgem->nbatch == 0 && sna->render.vbo && !kgem_bo_is_busy(sna->render.vbo)) { + DBG(("%s: resetting idle vbo\n", __FUNCTION__)); + sna->render.vertex_used = 0; + sna->render.vertex_index = 0; + } +} + +void +gen6_render_expire(struct kgem *kgem) +{ + struct sna *sna; + + sna = container_of(kgem, struct sna, kgem); + if (sna->render.vbo && !sna->render.vertex_used) { + DBG(("%s: discarding vbo\n", __FUNCTION__)); + kgem_bo_destroy(kgem, sna->render.vbo); + sna->render.vbo = NULL; + sna->render.vertices = sna->render.vertex_data; + sna->render.vertex_size = ARRAY_SIZE(sna->render.vertex_data); + sna->render.vertex_used = 0; + sna->render.vertex_index = 0; + } +} diff --git a/src/sna/gen6_common.h b/src/sna/gen6_common.h new file mode 100644 index 00000000..e5d78c07 --- /dev/null +++ b/src/sna/gen6_common.h @@ -0,0 +1,194 @@ +/* + * Copyright © 2011-2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Chris Wilson <chris@chris-wilson.co.uk> + * + */ + +#ifndef GEN6_COMMON_H +#define GEN6_COMMON_H + +#include "sna.h" + +#define NO_RING_SWITCH 0 +#define PREFER_RENDER 0 + +static inline bool is_uncached(struct sna *sna, + struct kgem_bo *bo) +{ + return bo->scanout && !sna->kgem.has_wt; +} + +inline static bool can_switch_to_blt(struct sna *sna, + struct kgem_bo *bo, + unsigned flags) +{ + if (sna->kgem.ring != KGEM_RENDER) + return true; + + if (NO_RING_SWITCH) + return false; + + if (!sna->kgem.has_semaphores) + return false; + + if (flags & COPY_LAST) + return true; + + if (bo && RQ_IS_BLT(bo->rq)) + return true; + + return kgem_ring_is_idle(&sna->kgem, KGEM_BLT); +} + +inline static bool can_switch_to_render(struct sna *sna, + struct kgem_bo *bo) +{ + if (sna->kgem.ring == KGEM_RENDER) + return true; + + if (NO_RING_SWITCH) + return false; + + if (!sna->kgem.has_semaphores) + return false; + + if (bo && !RQ_IS_BLT(bo->rq) && !is_uncached(sna, bo)) + return true; + + return !kgem_ring_is_idle(&sna->kgem, KGEM_RENDER); +} + +static inline bool untiled_tlb_miss(struct kgem_bo *bo) +{ + if (kgem_bo_is_render(bo)) + return false; + + return bo->tiling == I915_TILING_NONE && bo->pitch >= 4096; +} + +static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo) +{ + if (bo->rq) + return RQ_IS_BLT(bo->rq); + + if (sna->flags & SNA_POWERSAVE) + return true; + + return bo->tiling == I915_TILING_NONE || is_uncached(sna, bo); +} + +inline static bool force_blt_ring(struct sna *sna) +{ + if (sna->flags & SNA_POWERSAVE) + return true; + + if (sna->kgem.mode == KGEM_RENDER) + return false; + + if (sna->render_state.gt < 2) + return true; + + return false; +} + +inline static bool prefer_blt_ring(struct sna *sna, + struct kgem_bo *bo, + unsigned flags) +{ + assert(!force_blt_ring(sna)); + assert(!kgem_bo_is_render(bo)); + + return can_switch_to_blt(sna, bo, flags); +} + +inline static bool prefer_render_ring(struct sna *sna, + struct kgem_bo *bo) +{ + if (sna->flags & SNA_POWERSAVE) + return false; + + if (sna->render_state.gt < 2) + return false; + + return can_switch_to_render(sna, bo); +} + +inline static bool +prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp) +{ + if (untiled_tlb_miss(tmp->dst.bo) || + untiled_tlb_miss(tmp->src.bo)) + return true; + + if (force_blt_ring(sna)) + return true; + + if (kgem_bo_is_render(tmp->dst.bo) || + kgem_bo_is_render(tmp->src.bo)) + return false; + + if (prefer_render_ring(sna, tmp->dst.bo)) + return false; + + if (!prefer_blt_ring(sna, tmp->dst.bo, 0)) + return false; + + return prefer_blt_bo(sna, tmp->dst.bo) || prefer_blt_bo(sna, tmp->src.bo); +} + +static inline bool prefer_blt_fill(struct sna *sna, + struct kgem_bo *bo, + unsigned flags) +{ + if (PREFER_RENDER) + return PREFER_RENDER < 0; + + if (flags & (FILL_POINTS | FILL_SPANS) && + can_switch_to_blt(sna, bo, 0)) + return true; + + if (untiled_tlb_miss(bo)) + return true; + + if (force_blt_ring(sna)) + return true; + + if (kgem_bo_is_render(bo)) + return false; + + if (prefer_render_ring(sna, bo)) + return false; + + if (!prefer_blt_ring(sna, bo, 0)) + return false; + + return prefer_blt_bo(sna, bo); +} + +void gen6_render_flush(struct sna *sna); +void gen6_render_retire(struct kgem *kgem); +void gen6_render_expire(struct kgem *kgem); +void gen6_render_context_switch(struct kgem *kgem, int new_mode); + +#endif /* GEN6_COMMON_H */ diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 4084c58f..e456e6b7 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -42,6 +42,7 @@ #include "brw/brw.h" #include "gen6_render.h" +#include "gen6_common.h" #include "gen4_source.h" #include "gen4_vertex.h" @@ -54,9 +55,6 @@ #define NO_FILL_ONE 0 #define NO_FILL_CLEAR 0 -#define NO_RING_SWITCH 0 -#define PREFER_RENDER 0 - #define USE_8_PIXEL_DISPATCH 1 #define USE_16_PIXEL_DISPATCH 1 #define USE_32_PIXEL_DISPATCH 0 @@ -1868,101 +1866,6 @@ gen6_composite_set_target(struct sna *sna, return true; } -inline static bool can_switch_to_blt(struct sna *sna, - struct kgem_bo *bo, - unsigned flags) -{ - if (sna->kgem.ring != KGEM_RENDER) - return true; - - if (NO_RING_SWITCH) - return false; - - if (!sna->kgem.has_semaphores) - return false; - - if (flags & COPY_LAST) - return true; - - if (bo && RQ_IS_BLT(bo->rq)) - return true; - - return kgem_ring_is_idle(&sna->kgem, KGEM_BLT); -} - -inline static bool can_switch_to_render(struct sna *sna, - struct kgem_bo *bo) -{ - if (sna->kgem.ring == KGEM_RENDER) - return true; - - if (NO_RING_SWITCH) - return false; - - if (!sna->kgem.has_semaphores) - return false; - - if (bo && !RQ_IS_BLT(bo->rq) && !bo->scanout) - return true; - - return !kgem_ring_is_idle(&sna->kgem, KGEM_RENDER); -} - -static inline bool untiled_tlb_miss(struct kgem_bo *bo) -{ - if (kgem_bo_is_render(bo)) - return false; - - return bo->tiling == I915_TILING_NONE && bo->pitch >= 4096; -} - -static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo) -{ - if (bo->rq) - return RQ_IS_BLT(bo->rq); - - if (sna->flags & SNA_POWERSAVE) - return true; - - return bo->tiling == I915_TILING_NONE || bo->scanout; -} - -inline static bool force_blt_ring(struct sna *sna) -{ - if (sna->flags & SNA_POWERSAVE) - return true; - - if (sna->kgem.mode == KGEM_RENDER) - return false; - - if (sna->render_state.gen6.info->gt < 2) - return true; - - return false; -} - -inline static bool prefer_blt_ring(struct sna *sna, - struct kgem_bo *bo, - unsigned flags) -{ - assert(!force_blt_ring(sna)); - assert(!kgem_bo_is_render(bo)); - - return can_switch_to_blt(sna, bo, flags); -} - -inline static bool prefer_render_ring(struct sna *sna, - struct kgem_bo *bo) -{ - if (sna->flags & SNA_POWERSAVE) - return false; - - if (sna->render_state.gen6.info->gt < 2) - return false; - - return can_switch_to_render(sna, bo); -} - static bool try_blt(struct sna *sna, PicturePtr dst, PicturePtr src, @@ -2210,29 +2113,6 @@ reuse_source(struct sna *sna, } static bool -prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp) -{ - if (untiled_tlb_miss(tmp->dst.bo) || - untiled_tlb_miss(tmp->src.bo)) - return true; - - if (force_blt_ring(sna)) - return true; - - if (kgem_bo_is_render(tmp->dst.bo) || - kgem_bo_is_render(tmp->src.bo)) - return false; - - if (prefer_render_ring(sna, tmp->dst.bo)) - return false; - - if (!prefer_blt_ring(sna, tmp->dst.bo, 0)) - return false; - - return prefer_blt_bo(sna, tmp->dst.bo) || prefer_blt_bo(sna, tmp->src.bo); -} - -static bool gen6_render_composite(struct sna *sna, uint8_t op, PicturePtr src, @@ -3109,35 +2989,6 @@ gen6_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) gen6_emit_state(sna, op, offset | dirty); } -static inline bool prefer_blt_fill(struct sna *sna, - struct kgem_bo *bo, - unsigned flags) -{ - if (PREFER_RENDER) - return PREFER_RENDER < 0; - - if (flags & (FILL_POINTS | FILL_SPANS) && - can_switch_to_blt(sna, bo, 0)) - return true; - - if (untiled_tlb_miss(bo)) - return true; - - if (force_blt_ring(sna)) - return true; - - if (kgem_bo_is_render(bo)) - return false; - - if (prefer_render_ring(sna, bo)) - return false; - - if (!prefer_blt_ring(sna, bo, 0)) - return false; - - return prefer_blt_bo(sna, bo); -} - static bool gen6_render_fill_boxes(struct sna *sna, CARD8 op, @@ -3615,69 +3466,6 @@ gen6_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo) return true; } -static void gen6_render_flush(struct sna *sna) -{ - gen4_vertex_close(sna); - - assert(sna->render.vb_id == 0); - assert(sna->render.vertex_offset == 0); -} - -static void -gen6_render_context_switch(struct kgem *kgem, - int new_mode) -{ - if (kgem->nbatch) { - DBG(("%s: from %d to %d, submit batch\n", __FUNCTION__, kgem->mode, new_mode)); - _kgem_submit(kgem); - } - - if (kgem->nexec) { - DBG(("%s: from %d to %d, reset incomplete batch\n", __FUNCTION__, kgem->mode, new_mode)); - kgem_reset(kgem); - } - - assert(kgem->nbatch == 0); - assert(kgem->nreloc == 0); - assert(kgem->nexec == 0); - - kgem->ring = new_mode; -} - -static void -gen6_render_retire(struct kgem *kgem) -{ - struct sna *sna; - - if (kgem->ring && (kgem->has_semaphores || !kgem->need_retire)) - kgem->ring = kgem->mode; - - sna = container_of(kgem, struct sna, kgem); - if (kgem->nbatch == 0 && sna->render.vbo && !kgem_bo_is_busy(sna->render.vbo)) { - DBG(("%s: resetting idle vbo handle=%d\n", __FUNCTION__, sna->render.vbo->handle)); - sna->render.vertex_used = 0; - sna->render.vertex_index = 0; - } -} - -static void -gen6_render_expire(struct kgem *kgem) -{ - struct sna *sna; - - sna = container_of(kgem, struct sna, kgem); - if (sna->render.vbo && !sna->render.vertex_used) { - DBG(("%s: discarding vbo handle=%d\n", __FUNCTION__, sna->render.vbo->handle)); - kgem_bo_destroy(kgem, sna->render.vbo); - assert(!sna->render.active); - sna->render.vbo = NULL; - sna->render.vertices = sna->render.vertex_data; - sna->render.vertex_size = ARRAY_SIZE(sna->render.vertex_data); - sna->render.vertex_used = 0; - sna->render.vertex_index = 0; - } -} - static void gen6_render_reset(struct sna *sna) { sna->render_state.gen6.needs_invariant = true; @@ -3723,6 +3511,7 @@ static bool gen6_render_setup(struct sna *sna, int devid) state->info = >1_info; if (is_gt2(sna, devid)) state->info = >2_info; /* XXX requires GT_MODE WiZ disabled */ + state->gt = state->info->gt; sna_static_stream_init(&general); diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index e9295299..f6eef4aa 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -44,6 +44,7 @@ #include "gen7_render.h" #include "gen4_source.h" #include "gen4_vertex.h" +#include "gen6_common.h" #define ALWAYS_INVALIDATE 0 #define ALWAYS_FLUSH 0 @@ -2134,101 +2135,6 @@ gen7_composite_set_target(struct sna *sna, return true; } -inline static bool can_switch_to_blt(struct sna *sna, - struct kgem_bo *bo, - unsigned flags) -{ - if (sna->kgem.ring != KGEM_RENDER) - return true; - - if (NO_RING_SWITCH) - return false; - - if (!sna->kgem.has_semaphores) - return false; - - if (flags & COPY_LAST) - return true; - - if (bo && RQ_IS_BLT(bo->rq)) - return true; - - return kgem_ring_is_idle(&sna->kgem, KGEM_BLT); -} - -inline static bool can_switch_to_render(struct sna *sna, - struct kgem_bo *bo) -{ - if (sna->kgem.ring == KGEM_RENDER) - return true; - - if (NO_RING_SWITCH) - return false; - - if (!sna->kgem.has_semaphores) - return false; - - if (bo && !RQ_IS_BLT(bo->rq) && !(bo->scanout && !sna->kgem.has_wt)) - return true; - - return !kgem_ring_is_idle(&sna->kgem, KGEM_RENDER); -} - -static inline bool untiled_tlb_miss(struct kgem_bo *bo) -{ - if (kgem_bo_is_render(bo)) - return false; - - return bo->tiling == I915_TILING_NONE && bo->pitch >= 4096; -} - -static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo) -{ - if (bo->rq) - return RQ_IS_BLT(bo->rq); - - if (sna->flags & SNA_POWERSAVE) - return true; - - return bo->tiling == I915_TILING_NONE || (bo->scanout && !sna->kgem.has_wt); -} - -inline static bool force_blt_ring(struct sna *sna) -{ - if (sna->flags & SNA_POWERSAVE) - return true; - - if (sna->kgem.mode == KGEM_RENDER) - return false; - - if (sna->render_state.gen7.info->gt < 2) - return true; - - return false; -} - -inline static bool prefer_blt_ring(struct sna *sna, - struct kgem_bo *bo, - unsigned flags) -{ - assert(!force_blt_ring(sna)); - assert(!kgem_bo_is_render(bo)); - - return can_switch_to_blt(sna, bo, flags); -} - -inline static bool prefer_render_ring(struct sna *sna, - struct kgem_bo *bo) -{ - if (sna->flags & SNA_POWERSAVE) - return false; - - if (sna->render_state.gen7.info->gt < 2) - return false; - - return can_switch_to_render(sna, bo); -} - static bool try_blt(struct sna *sna, PicturePtr dst, PicturePtr src, @@ -2476,29 +2382,6 @@ reuse_source(struct sna *sna, } static bool -prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp) -{ - if (untiled_tlb_miss(tmp->dst.bo) || - untiled_tlb_miss(tmp->src.bo)) - return true; - - if (force_blt_ring(sna)) - return true; - - if (kgem_bo_is_render(tmp->dst.bo) || - kgem_bo_is_render(tmp->src.bo)) - return false; - - if (prefer_render_ring(sna, tmp->dst.bo)) - return false; - - if (!prefer_blt_ring(sna, tmp->dst.bo, 0)) - return false; - - return prefer_blt_bo(sna, tmp->dst.bo) || prefer_blt_bo(sna, tmp->src.bo); -} - -static bool gen7_render_composite(struct sna *sna, uint8_t op, PicturePtr src, @@ -2918,10 +2801,11 @@ gen7_emit_copy_state(struct sna *sna, gen7_emit_state(sna, op, offset); } -static inline bool prefer_blt_copy(struct sna *sna, - struct kgem_bo *src_bo, - struct kgem_bo *dst_bo, - unsigned flags) +static inline bool +prefer_blt_copy(struct sna *sna, + struct kgem_bo *src_bo, + struct kgem_bo *dst_bo, + unsigned flags) { if (sna->kgem.mode == KGEM_BLT) return true; @@ -3345,32 +3229,6 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) gen7_emit_state(sna, op, offset); } -static inline bool prefer_blt_fill(struct sna *sna, - struct kgem_bo *bo, - unsigned flags) -{ - if (flags & (FILL_POINTS | FILL_SPANS) && - can_switch_to_blt(sna, bo, 0)) - return true; - - if (untiled_tlb_miss(bo)) - return true; - - if (force_blt_ring(sna)) - return true; - - if (kgem_bo_is_render(bo)) - return false; - - if (prefer_render_ring(sna, bo)) - return false; - - if (!prefer_blt_ring(sna, bo, 0)) - return false; - - return prefer_blt_bo(sna, bo); -} - static bool gen7_render_fill_boxes(struct sna *sna, CARD8 op, @@ -3836,69 +3694,6 @@ gen7_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo) return true; } - -static void gen7_render_flush(struct sna *sna) -{ - gen4_vertex_close(sna); - - assert(sna->render.vb_id == 0); - assert(sna->render.vertex_offset == 0); -} - -static void -gen7_render_context_switch(struct kgem *kgem, - int new_mode) -{ - if (kgem->nbatch) { - DBG(("%s: from %d to %d, submit batch\n", __FUNCTION__, kgem->mode, new_mode)); - _kgem_submit(kgem); - } - - if (kgem->nexec) { - DBG(("%s: from %d to %d, reset incomplete batch\n", __FUNCTION__, kgem->mode, new_mode)); - kgem_reset(kgem); - } - - assert(kgem->nbatch == 0); - assert(kgem->nreloc == 0); - assert(kgem->nexec == 0); - - kgem->ring = new_mode; -} - -static void -gen7_render_retire(struct kgem *kgem) -{ - struct sna *sna; - - if (kgem->ring && (kgem->has_semaphores || !kgem->need_retire)) - kgem->ring = kgem->mode; - - sna = container_of(kgem, struct sna, kgem); - if (kgem->nbatch == 0 && sna->render.vbo && !kgem_bo_is_busy(sna->render.vbo)) { - DBG(("%s: resetting idle vbo\n", __FUNCTION__)); - sna->render.vertex_used = 0; - sna->render.vertex_index = 0; - } -} - -static void -gen7_render_expire(struct kgem *kgem) -{ - struct sna *sna; - - sna = container_of(kgem, struct sna, kgem); - if (sna->render.vbo && !sna->render.vertex_used) { - DBG(("%s: discarding vbo\n", __FUNCTION__)); - kgem_bo_destroy(kgem, sna->render.vbo); - sna->render.vbo = NULL; - sna->render.vertices = sna->render.vertex_data; - sna->render.vertex_size = ARRAY_SIZE(sna->render.vertex_data); - sna->render.vertex_used = 0; - sna->render.vertex_index = 0; - } -} - static void gen7_render_reset(struct sna *sna) { sna->render_state.gen7.emit_flush = false; @@ -3969,6 +3764,8 @@ static bool gen7_render_setup(struct sna *sna, int devid) } else return false; + state->gt = state->info->gt; + sna_static_stream_init(&general); /* Zero pad the start. If you see an offset of 0x0 in the batchbuffer @@ -4038,9 +3835,9 @@ const char *gen7_render_init(struct sna *sna, const char *backend) if (!gen7_render_setup(sna, devid)) return backend; - sna->kgem.context_switch = gen7_render_context_switch; - sna->kgem.retire = gen7_render_retire; - sna->kgem.expire = gen7_render_expire; + sna->kgem.context_switch = gen6_render_context_switch; + sna->kgem.retire = gen6_render_retire; + sna->kgem.expire = gen6_render_expire; #if !NO_COMPOSITE sna->render.composite = gen7_render_composite; @@ -4074,7 +3871,7 @@ const char *gen7_render_init(struct sna *sna, const char *backend) sna->render.clear = gen7_render_clear; #endif - sna->render.flush = gen7_render_flush; + sna->render.flush = gen6_render_flush; sna->render.reset = gen7_render_reset; sna->render.fini = gen7_render_fini; diff --git a/src/sna/sna.h b/src/sna/sna.h index 19728f1c..cf02e9e3 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -301,6 +301,7 @@ struct sna { uint32_t fill_alu; } blt_state; union { + unsigned gt; struct gen2_render_state gen2; struct gen3_render_state gen3; struct gen4_render_state gen4; diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h index 0262523b..c7ba1918 100644 --- a/src/sna/sna_render.h +++ b/src/sna/sna_render.h @@ -424,6 +424,7 @@ enum { }; struct gen6_render_state { + unsigned gt; const struct gt_info *info; struct kgem_bo *general_bo; @@ -473,6 +474,7 @@ enum { }; struct gen7_render_state { + unsigned gt; const struct gt_info *info; struct kgem_bo *general_bo; |