diff options
author | Chia-I Wu <[email protected]> | 2014-03-09 21:55:23 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-03-10 16:42:42 +0800 |
commit | 0b462d3ab13af9bba9c9b21bf67de6d2b1857786 (patch) | |
tree | fcdca028f1308b5ec8418623de1c8e0c3f1e59a1 /src/gallium | |
parent | 42c1ce4c03c0c5f4fb61b981143cf2638d87c834 (diff) |
ilo: move ring types to winsys
It results in less code despite that i915_drm.h specifies the ring type as
part of the execution flags.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_3d.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_blitter_blt.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_common.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_cp.c | 22 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_cp.h | 13 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/winsys/intel/drm/intel_drm_winsys.c | 12 | ||||
-rw-r--r-- | src/gallium/winsys/intel/intel_winsys.h | 22 |
8 files changed, 30 insertions, 49 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index 218849a20d9..1e5ebbcabd8 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -157,7 +157,7 @@ ilo_3d_release_render_ring(struct ilo_cp *cp, void *data) void ilo_3d_own_render_ring(struct ilo_3d *hw3d) { - ilo_cp_set_ring(hw3d->cp, ILO_CP_RING_RENDER); + ilo_cp_set_ring(hw3d->cp, INTEL_RING_RENDER); if (ilo_cp_set_owner(hw3d->cp, &hw3d->owner, hw3d->owner_reserve)) ilo_3d_resume_queries(hw3d); @@ -775,7 +775,7 @@ ilo_texture_barrier(struct pipe_context *pipe) struct ilo_context *ilo = ilo_context(pipe); struct ilo_3d *hw3d = ilo->hw3d; - if (ilo->cp->ring != ILO_CP_RING_RENDER) + if (ilo->cp->ring != INTEL_RING_RENDER) return; ilo_3d_pipeline_emit_flush(hw3d->pipeline); diff --git a/src/gallium/drivers/ilo/ilo_blitter_blt.c b/src/gallium/drivers/ilo/ilo_blitter_blt.c index a230cb79228..d383b58d0bd 100644 --- a/src/gallium/drivers/ilo/ilo_blitter_blt.c +++ b/src/gallium/drivers/ilo/ilo_blitter_blt.c @@ -336,7 +336,7 @@ ilo_blitter_blt_begin(struct ilo_blitter *blitter, int max_cmd_size, uint32_t swctrl; /* change ring */ - ilo_cp_set_ring(ilo->cp, ILO_CP_RING_BLT); + ilo_cp_set_ring(ilo->cp, INTEL_RING_BLT); ilo_cp_set_owner(ilo->cp, NULL, 0); /* check aperture space */ diff --git a/src/gallium/drivers/ilo/ilo_common.h b/src/gallium/drivers/ilo/ilo_common.h index ae7896efc27..6a2649b354f 100644 --- a/src/gallium/drivers/ilo/ilo_common.h +++ b/src/gallium/drivers/ilo/ilo_common.h @@ -70,9 +70,9 @@ struct ilo_dev_info { int devid; int max_batch_size; bool has_llc; - bool has_gen7_sol_reset; bool has_address_swizzling; bool has_timestamp; + bool has_gen7_sol_reset; int gen; int gt; diff --git a/src/gallium/drivers/ilo/ilo_cp.c b/src/gallium/drivers/ilo/ilo_cp.c index cd94eec0fe5..49dc237d72f 100644 --- a/src/gallium/drivers/ilo/ilo_cp.c +++ b/src/gallium/drivers/ilo/ilo_cp.c @@ -182,27 +182,11 @@ static int ilo_cp_exec_bo(struct ilo_cp *cp) { const bool do_exec = !(ilo_debug & ILO_DEBUG_NOHW); - unsigned long flags; int err; - switch (cp->ring) { - case ILO_CP_RING_RENDER: - flags = INTEL_EXEC_RENDER; - break; - case ILO_CP_RING_BLT: - flags = INTEL_EXEC_BLT; - break; - default: - assert(!"unknown cp ring"); - flags = 0; - break; - } - - flags |= cp->one_off_flags; - if (likely(do_exec)) { - err = intel_winsys_submit_bo(cp->winsys, - cp->bo, cp->used * 4, cp->render_ctx, flags); + err = intel_winsys_submit_bo(cp->winsys, cp->ring, + cp->bo, cp->used * 4, cp->render_ctx, cp->one_off_flags); } else { err = 0; @@ -283,7 +267,7 @@ ilo_cp_create(struct intel_winsys *winsys, int size, bool direct_map) cp->winsys = winsys; cp->render_ctx = intel_winsys_create_context(winsys); - cp->ring = ILO_CP_RING_RENDER; + cp->ring = INTEL_RING_RENDER; cp->no_implicit_flush = false; cp->bo_size = size; diff --git a/src/gallium/drivers/ilo/ilo_cp.h b/src/gallium/drivers/ilo/ilo_cp.h index 1dcfab81cdf..15b66040f6e 100644 --- a/src/gallium/drivers/ilo/ilo_cp.h +++ b/src/gallium/drivers/ilo/ilo_cp.h @@ -34,13 +34,6 @@ struct ilo_cp; -enum ilo_cp_ring { - ILO_CP_RING_RENDER, - ILO_CP_RING_BLT, - - ILO_CP_RING_COUNT, -}; - typedef void (*ilo_cp_callback)(struct ilo_cp *cp, void *data); struct ilo_cp_owner { @@ -61,7 +54,7 @@ struct ilo_cp { const struct ilo_cp_owner *owner; int owner_reserve; - enum ilo_cp_ring ring; + enum intel_ring_type ring; bool no_implicit_flush; unsigned one_off_flags; @@ -98,7 +91,7 @@ ilo_cp_flush(struct ilo_cp *cp, const char *reason) { if (ilo_debug & ILO_DEBUG_FLUSH) { ilo_printf("cp flushed for %s with %d+%d DWords (%.1f%%) because of %s\n", - (cp->ring == ILO_CP_RING_RENDER) ? "render" : "blt", + (cp->ring == INTEL_RING_RENDER) ? "render" : "other", cp->used, cp->stolen, (float) (100 * (cp->used + cp->stolen)) / cp->bo_size, reason); @@ -153,7 +146,7 @@ ilo_cp_implicit_flush(struct ilo_cp *cp) * Set the ring buffer. */ static inline void -ilo_cp_set_ring(struct ilo_cp *cp, enum ilo_cp_ring ring) +ilo_cp_set_ring(struct ilo_cp *cp, enum intel_ring_type ring) { if (cp->ring != ring) { ilo_cp_implicit_flush(cp); diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 11a5be2ebf1..8656d18806f 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -650,9 +650,9 @@ init_dev(struct ilo_dev_info *dev, const struct intel_winsys_info *info) dev->devid = info->devid; dev->max_batch_size = info->max_batch_size; dev->has_llc = info->has_llc; - dev->has_gen7_sol_reset = info->has_gen7_sol_reset; dev->has_address_swizzling = info->has_address_swizzling; dev->has_timestamp = info->has_timestamp; + dev->has_gen7_sol_reset = info->has_gen7_sol_reset; /* * From the Sandy Bridge PRM, volume 4 part 2, page 18: diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c index 5cdf39fe32e..1dc9b1cfefc 100644 --- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c +++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c @@ -139,6 +139,7 @@ init_info(struct intel_winsys *winsys) get_param(winsys, I915_PARAM_HAS_LLC, &val); info->has_llc = val; + info->has_address_swizzling = test_address_swizzling(winsys); /* test TIMESTAMP read */ info->has_timestamp = test_reg_read(winsys, 0x2358); @@ -146,8 +147,6 @@ init_info(struct intel_winsys *winsys) get_param(winsys, I915_PARAM_HAS_GEN7_SOL_RESET, &val); info->has_gen7_sol_reset = val; - info->has_address_swizzling = test_address_swizzling(winsys); - return true; } @@ -380,21 +379,24 @@ intel_winsys_can_submit_bo(struct intel_winsys *winsys, int intel_winsys_submit_bo(struct intel_winsys *winsys, + enum intel_ring_type ring, struct intel_bo *bo, int used, struct intel_context *ctx, unsigned long flags) { + const unsigned long exec_flags = (unsigned long) ring | flags; + /* logical contexts are only available for the render ring */ - if ((flags & 0x7) > INTEL_EXEC_RENDER) + if (ring != INTEL_RING_RENDER) ctx = NULL; if (ctx) { return drm_intel_gem_bo_context_exec(gem_bo(bo), - (drm_intel_context *) ctx, used, flags); + (drm_intel_context *) ctx, used, exec_flags); } else { return drm_intel_bo_mrb_exec(gem_bo(bo), - used, NULL, 0, 0, flags); + used, NULL, 0, 0, exec_flags); } } diff --git a/src/gallium/winsys/intel/intel_winsys.h b/src/gallium/winsys/intel/intel_winsys.h index b5995fbb40f..c37fa1129e2 100644 --- a/src/gallium/winsys/intel/intel_winsys.h +++ b/src/gallium/winsys/intel/intel_winsys.h @@ -31,16 +31,15 @@ #include "pipe/p_compiler.h" /* this is compatible with i915_drm.h's definitions */ -enum intel_exec_flag { - /* bits[2:0]: ring type */ - INTEL_EXEC_DEFAULT = 0 << 0, - INTEL_EXEC_RENDER = 1 << 0, - INTEL_EXEC_BSD = 2 << 0, - INTEL_EXEC_BLT = 3 << 0, - - /* bits[7:6]: constant buffer addressing mode */ +enum intel_ring_type { + INTEL_RING_RENDER = 1, + INTEL_RING_BSD = 2, + INTEL_RING_BLT = 3, + INTEL_RING_VEBOX = 4, +}; - /* bits[8]: reset SO write offset register on GEN7+ */ +/* this is compatible with i915_drm.h's definitions */ +enum intel_exec_flag { INTEL_EXEC_GEN7_SOL_RESET = 1 << 8, }; @@ -72,11 +71,13 @@ struct intel_winsys_info { int max_batch_size; bool has_llc; - bool has_gen7_sol_reset; bool has_address_swizzling; /* valid registers for intel_winsys_read_reg() */ bool has_timestamp; + + /* valid flags for intel_winsys_submit_bo() */ + bool has_gen7_sol_reset; }; struct intel_winsys * @@ -183,6 +184,7 @@ intel_winsys_can_submit_bo(struct intel_winsys *winsys, */ int intel_winsys_submit_bo(struct intel_winsys *winsys, + enum intel_ring_type ring, struct intel_bo *bo, int used, struct intel_context *ctx, unsigned long flags); |