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.
This commit is contained in:
Chia-I Wu
2014-03-09 21:55:23 +08:00
parent 42c1ce4c03
commit 0b462d3ab1
8 changed files with 30 additions and 49 deletions
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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;
+3 -19
View File
@@ -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;
+3 -10
View File
@@ -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);
+1 -1
View File
@@ -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:
@@ -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);
}
}
+12 -10
View File
@@ -30,17 +30,16 @@
#include "pipe/p_compiler.h"
/* this is compatible with i915_drm.h's definitions */
enum intel_ring_type {
INTEL_RING_RENDER = 1,
INTEL_RING_BSD = 2,
INTEL_RING_BLT = 3,
INTEL_RING_VEBOX = 4,
};
/* 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 */
/* bits[8]: reset SO write offset register on GEN7+ */
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);