drm/i915: Emit to ringbuffer directly
Tvrtko Ursulin
maintainerPATCH 1/1 drm/i915: Emit to ringbuffer directly
From: Tvrtko Ursulin <[email protected]>
This removes the usage of intel_ring_emit in favour of directly writing to the ring buffer.
intel_ring_emit was preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.
It had no useful purpose since all ringbuffer operations are started and ended with intel_ring_begin and intel_ring_advance respectively, with no bail out in the middle possible, so it is fine to increment the tail in intel_ring_begin and let the code manage the pointer itself.
Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return from intel_ring_begin to error pointer by popular demand.
* Move tail increment to intel_ring_advance to enable some error checking.
v3:
* Move tail advance back into intel_ring_begin.
* Rebase and tidy.
v4:
* Complete rebase after a few months since v3.
--- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 ++- drivers/gpu/drm/i915/i915_gem_gtt.c | 69 ++-- drivers/gpu/drm/i915/i915_gem_request.c | 6 +- drivers/gpu/drm/i915/intel_display.c | 132 ++++---- drivers/gpu/drm/i915/intel_lrc.c | 156 +++++---- drivers/gpu/drm/i915/intel_mocs.c | 51 ++- drivers/gpu/drm/i915/intel_overlay.c | 79 ++--- drivers/gpu/drm/i915/intel_ringbuffer.c | 487 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 19 +- 10 files changed, 514 insertions(+), 601 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +34 -42
@@ -584,10 +584,9 @@ static inline int mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) {struct drm_i915_private *dev_priv = req->i915; -struct intel_ring *ring = req->ring;struct intel_engine_cs *engine = req->engine;enum intel_engine_id id; -u32 flags = hw_flags |MI_MM_SPACE_GTT ; +u32 *out, flags = hw_flags |MI_MM_SPACE_GTT ;const int num_rings =/* Use an extended w/a on ivb+ if signalling from other rings */ i915.semaphores ?
@@ -617,99 +616,92 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags)if (INTEL_GEN (dev_priv) >=7 ) len +=2 + (num_rings ?4 *num_rings +6 :0 ); - ret =intel_ring_begin (req, len); -if (ret) -return ret; + out =intel_ring_begin (req, len); +if (IS_ERR (out)) +return PTR_ERR (out);/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ if (INTEL_GEN (dev_priv) >=7 ) { -intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_DISABLE ;if (num_rings) {struct intel_engine_cs *signaller; -intel_ring_emit (ring, -MI_LOAD_REGISTER_IMM (num_rings)); + *out++ =MI_LOAD_REGISTER_IMM (num_rings);for_each_engine (signaller, dev_priv, id) {if (signaller == engine)continue ; -intel_ring_emit_reg (ring, -RING_PSMI_CTL (signaller->mmio_base)); -intel_ring_emit (ring, -_MASKED_BIT_ENABLE (GEN6_PSMI_SLEEP_MSG_DISABLE )); + *out++ =i915_mmio_reg_offset ( +RING_PSMI_CTL (signaller->mmio_base)); + *out++ =_MASKED_BIT_ENABLE ( +GEN6_PSMI_SLEEP_MSG_DISABLE ); } } } -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_SET_CONTEXT ); -intel_ring_emit (ring, -i915_ggtt_offset (req->ctx->engine[RCS ].state) | flags); + *out++ =MI_NOOP ; + *out++ =MI_SET_CONTEXT ; + *out++ =i915_ggtt_offset (req->ctx->engine[RCS ].state) | flags;/* * w/a: MI_SET_CONTEXT must always be followed by MI_NOOP * WaMiSetContext_Hang:snb,ivb,vlv */ -intel_ring_emit (ring,MI_NOOP ); + *out++ =MI_NOOP ;if (INTEL_GEN (dev_priv) >=7 ) {if (num_rings) {struct intel_engine_cs *signaller;i915_reg_t last_reg = {};/* keep gcc quiet */ -intel_ring_emit (ring, -MI_LOAD_REGISTER_IMM (num_rings)); + *out++ =MI_LOAD_REGISTER_IMM (num_rings);for_each_engine (signaller, dev_priv, id) {if (signaller == engine)continue ; last_reg =RING_PSMI_CTL (signaller->mmio_base); -intel_ring_emit_reg (ring, last_reg); -intel_ring_emit (ring, -_MASKED_BIT_DISABLE (GEN6_PSMI_SLEEP_MSG_DISABLE )); + *out++ =i915_mmio_reg_offset (last_reg); + *out++ =_MASKED_BIT_DISABLE ( +GEN6_PSMI_SLEEP_MSG_DISABLE ); }/* Insert a delay before the next switch! */ -intel_ring_emit (ring, -MI_STORE_REGISTER_MEM | -MI_SRM_LRM_GLOBAL_GTT ); -intel_ring_emit_reg (ring, last_reg); -intel_ring_emit (ring, -i915_ggtt_offset (engine->scratch)); -intel_ring_emit (ring,MI_NOOP ); + *out++ =MI_STORE_REGISTER_MEM |MI_SRM_LRM_GLOBAL_GTT ; + *out++ =i915_mmio_reg_offset (last_reg); + *out++ =i915_ggtt_offset (engine->scratch); + *out++ =MI_NOOP ; } -intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_ENABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_ENABLE ; } -intel_ring_advance (ring); +intel_ring_advance (req, out);return ret; }static int remap_l3 (struct drm_i915_gem_request *req,int slice) { -u32 *remap_info = req->i915->l3_parity.remap_info[slice]; -struct intel_ring *ring = req->ring; -int i, ret; +u32 *out, *remap_info = req->i915->l3_parity.remap_info[slice]; +int i;if (!remap_info)return 0 ; - ret =intel_ring_begin (req,GEN7_L3LOG_SIZE /4 *2 +2 ); -if (ret) -return ret; + out =intel_ring_begin (req,GEN7_L3LOG_SIZE /4 *2 +2 ); +if (IS_ERR (out)) +return PTR_ERR (out);/* * Note: We do not worry about the concurrent register cacheline hang * here because no other code should access these registers other than * at initialization time. */ -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (GEN7_L3LOG_SIZE /4 )); + *out++ =MI_LOAD_REGISTER_IMM (GEN7_L3LOG_SIZE /4 );for (i =0 ; i <GEN7_L3LOG_SIZE /4 ; i++) { -intel_ring_emit_reg (ring,GEN7_L3LOG (slice, i)); -intel_ring_emit (ring, remap_info[i]); + *out++ =i915_mmio_reg_offset (GEN7_L3LOG (slice, i)); + *out++ = remap_info[i]; } -intel_ring_emit (ring,MI_NOOP ); -intel_ring_advance (ring); + *out++ =MI_NOOP ; +intel_ring_advance (req, out);return 0 ; }
drivers/gpu/drm/i915/i915_gem_execbuffer.c +19 -21
@@ -1336,25 +1336,25 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,static int i915_reset_gen7_sol_offsets (struct drm_i915_gem_request *req) { -struct intel_ring *ring = req->ring; -int ret, i; +u32 *out; +int i;if (!IS_GEN7 (req->i915) || req->engine->id !=RCS ) {DRM_DEBUG ("sol reset is gen7/rcs only\n" );return -EINVAL ; } - ret =intel_ring_begin (req,4 *3 ); -if (ret) -return ret; + out =intel_ring_begin (req,4 *3 ); +if (IS_ERR (out)) +return PTR_ERR (out);for (i =0 ; i <4 ; i++) { -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,GEN7_SO_WRITE_OFFSET (i)); -intel_ring_emit (ring,0 ); + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (GEN7_SO_WRITE_OFFSET (i)); + *out++ =0 ; } -intel_ring_advance (ring); +intel_ring_advance (req, out);return 0 ; }
@@ -1415,7 +1415,7 @@ execbuf_submit(struct i915_execbuffer_params *params,struct drm_i915_private *dev_priv = params->request->i915;u64 exec_start, exec_len;int instp_mode; -u32 instp_mask; +u32 instp_mask, *out;int ret; ret =i915_gem_execbuffer_move_to_gpu (params->request, vmas);
@@ -1461,17 +1461,15 @@ execbuf_submit(struct i915_execbuffer_params *params,if (params->engine->id ==RCS && instp_mode != dev_priv->relative_constants_mode) { -struct intel_ring *ring = params->request->ring; - - ret =intel_ring_begin (params->request,4 ); -if (ret) -return ret; - -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,INSTPM ); -intel_ring_emit (ring, instp_mask <<16 | instp_mode); -intel_ring_advance (ring); + out =intel_ring_begin (params->request,4 ); +if (IS_ERR (out)) +return PTR_ERR (out); + + *out++ =MI_NOOP ; + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (INSTPM ); + *out++ = instp_mask <<16 | instp_mode; +intel_ring_advance (params->request, out); dev_priv->relative_constants_mode = instp_mode; }
drivers/gpu/drm/i915/i915_gem_gtt.c +34 -35
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_request.c +3 -3
@@ -824,6 +824,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)struct intel_ring *ring = request->ring;struct intel_timeline *timeline = request->timeline;struct drm_i915_gem_request *prev; +u32 *out;int err;lockdep_assert_held (&request->i915->drm.struct_mutex);
@@ -862,10 +863,9 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + out =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (out));/* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during
drivers/gpu/drm/i915/intel_display.c +58 -74
220 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +76 -80
256 lines not on this page · raw message
drivers/gpu/drm/i915/intel_mocs.c +24 -27
100 lines not on this page · raw message
drivers/gpu/drm/i915/intel_overlay.c +34 -45
153 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.c +227 -260
779 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +5 -14
@@ -144,7 +144,6 @@ struct intel_ring {u32 head;u32 tail; - GEM_BUG_ONLY_DECLARE(u32 advance);int space;int size;
@@ -495,22 +494,14 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);void intel_legacy_submission_resume (struct drm_i915_private *dev_priv); -int __must_check intel_ring_begin (struct drm_i915_gem_request *req,int n);int __must_check intel_ring_cacheline_align (struct drm_i915_gem_request *req); -static inline void intel_ring_emit (struct intel_ring *ring,u32 data) -{ - *(uint32_t *)(ring->vaddr + ring->tail) = data; - ring->tail +=4 ; -} - -static inline void intel_ring_emit_reg (struct intel_ring *ring,i915_reg_t reg) -{ -intel_ring_emit (ring,i915_mmio_reg_offset (reg)); -} +u32 __must_check *intel_ring_begin (struct drm_i915_gem_request *req,int n); -static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *out) { +struct intel_ring *ring = req->ring;/* Dummy function. * * This serves as a placeholder in the code so that the reader
@@ -519,7 +510,7 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_BUG_ONLY_ON (ring->tail != ring->advance); +GEM_BUG_ON ((ring->vaddr + ring->tail) != out); }static inline u32 intel_ring_offset (struct intel_ring *ring,void *addr)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
drivers/gpu/drm/i915/intel_ringbuffer.c int intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) · line 2267
Quoted 5 lines · Tvrtko Ursulin
drivers/gpu/drm/i915/intel_ringbuffer.c +1
-0@@ -2288,32 +2264,33 @@ int intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) ring->space -= remain_actual; } + out = (u32 *)(ring->vaddr + ring->tail);
Checkpatch will complain about unaligned brackets, but I'll whine that this cast is unnecessary.
Quoted 9 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +3
-1-static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *out) { +struct intel_ring *ring = req->ring;/* Dummy function. * * This serves as a placeholder in the code so that the reader
drivers/gpu/drm/i915/intel_ringbuffer.h static inline void intel_ring_advance(struct intel_ring *ring) · line 513
Quoted 5 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +1
-1@@ -519,7 +510,7 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_BUG_ONLY_ON (ring->tail != ring->advance); +GEM_BUG_ON ((ring->vaddr + ring->tail) != out);
This will generate a warning for an unused var if !GEM_DEBUG, just use
GEM_BUG_ON(req->ring->vaddr + req->ring->tail != out);
it'll fit, the compiler will do CSE and it's only for debug...
The transformation looked good. I'd suggest we do a trybot with i915.mmio_flip=0 to force the MI_DISPLAY_FLIP paths to be exercised and aside from gen2/3 that should be all intel_ring_begin() covered.
In anticipation of those extra checks performed,
A couple of future steps, we can eliminate some dwords by inserting the MI_NOOP to align the tail in add_request. I s/intel_ring_begin/i915_gem_request_emit/ for the thin veneer of oop. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · Chris Wilson
drivers/gpu/drm/i915/intel_ringbuffer.c int intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) · line 2267
Quoted 5 lines · Tvrtko Ursulin
drivers/gpu/drm/i915/intel_ringbuffer.c +1
-0@@ -2288,32 +2264,33 @@ int intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) ring->space -= remain_actual; } + out = (u32 *)(ring->vaddr + ring->tail);Checkpatch will complain about unaligned brackets, but I'll whine that this cast is unnecessary.
Quoted 9 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +3
-1-static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *out) { +struct intel_ring *ring = req->ring;/* Dummy function. * * This serves as a placeholder in the code so that the reader drivers/gpu/drm/i915/intel_ringbuffer.h static inline void intel_ring_advance(struct intel_ring *ring) · line 513
Quoted 5 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +1
-1@@ -519,7 +510,7 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_BUG_ONLY_ON (ring->tail != ring->advance); +GEM_BUG_ON ((ring->vaddr + ring->tail) != out);This will generate a warning for an unused var if !GEM_DEBUG, just use
Quoted 6 lines
GEM_BUG_ON(req->ring->vaddr + req->ring->tail != out);it'll fit, the compiler will do CSE and it's only for debug...
The transformation looked good. I'd suggest we do a trybot with i915.mmio_flip=0 to force the
MI_DISPLAY_FLIPpaths to be exercised and aside from gen2/3 that should be allintel_ring_begin()covered.
Oh, that forgets that atomic took over and we can't run the CS flips anymore.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v5 1/1 drm/i915: Emit to ringbuffer directly
In reply to Chris WilsonFrom: Tvrtko Ursulin <[email protected]>
This removes the usage of intel_ring_emit in favour of directly writing to the ring buffer.
intel_ring_emit was preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.
It had no useful purpose since all ringbuffer operations are started and ended with intel_ring_begin and intel_ring_advance respectively, with no bail out in the middle possible, so it is fine to increment the tail in intel_ring_begin and let the code manage the pointer itself.
Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return from intel_ring_begin to error pointer by popular demand.
* Move tail increment to intel_ring_advance to enable some error checking.
v3:
* Move tail advance back into intel_ring_begin.
* Rebase and tidy.
v4:
* Complete rebase after a few months since v3.
v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 ++- drivers/gpu/drm/i915/i915_gem_gtt.c | 69 ++-- drivers/gpu/drm/i915/i915_gem_request.c | 6 +- drivers/gpu/drm/i915/intel_display.c | 132 ++++---- drivers/gpu/drm/i915/intel_lrc.c | 156 +++++---- drivers/gpu/drm/i915/intel_mocs.c | 51 ++- drivers/gpu/drm/i915/intel_overlay.c | 79 ++--- drivers/gpu/drm/i915/intel_ringbuffer.c | 487 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 18 +- 10 files changed, 513 insertions(+), 601 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +34 -42
@@ -584,10 +584,9 @@ static inline int mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) {struct drm_i915_private *dev_priv = req->i915; -struct intel_ring *ring = req->ring;struct intel_engine_cs *engine = req->engine;enum intel_engine_id id; -u32 flags = hw_flags |MI_MM_SPACE_GTT ; +u32 *out, flags = hw_flags |MI_MM_SPACE_GTT ;const int num_rings =/* Use an extended w/a on ivb+ if signalling from other rings */ i915.semaphores ?
@@ -617,99 +616,92 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags)if (INTEL_GEN (dev_priv) >=7 ) len +=2 + (num_rings ?4 *num_rings +6 :0 ); - ret =intel_ring_begin (req, len); -if (ret) -return ret; + out =intel_ring_begin (req, len); +if (IS_ERR (out)) +return PTR_ERR (out);/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ if (INTEL_GEN (dev_priv) >=7 ) { -intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_DISABLE ;if (num_rings) {struct intel_engine_cs *signaller; -intel_ring_emit (ring, -MI_LOAD_REGISTER_IMM (num_rings)); + *out++ =MI_LOAD_REGISTER_IMM (num_rings);for_each_engine (signaller, dev_priv, id) {if (signaller == engine)continue ; -intel_ring_emit_reg (ring, -RING_PSMI_CTL (signaller->mmio_base)); -intel_ring_emit (ring, -_MASKED_BIT_ENABLE (GEN6_PSMI_SLEEP_MSG_DISABLE )); + *out++ =i915_mmio_reg_offset ( +RING_PSMI_CTL (signaller->mmio_base)); + *out++ =_MASKED_BIT_ENABLE ( +GEN6_PSMI_SLEEP_MSG_DISABLE ); } } } -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_SET_CONTEXT ); -intel_ring_emit (ring, -i915_ggtt_offset (req->ctx->engine[RCS ].state) | flags); + *out++ =MI_NOOP ; + *out++ =MI_SET_CONTEXT ; + *out++ =i915_ggtt_offset (req->ctx->engine[RCS ].state) | flags;/* * w/a: MI_SET_CONTEXT must always be followed by MI_NOOP * WaMiSetContext_Hang:snb,ivb,vlv */ -intel_ring_emit (ring,MI_NOOP ); + *out++ =MI_NOOP ;if (INTEL_GEN (dev_priv) >=7 ) {if (num_rings) {struct intel_engine_cs *signaller;i915_reg_t last_reg = {};/* keep gcc quiet */ -intel_ring_emit (ring, -MI_LOAD_REGISTER_IMM (num_rings)); + *out++ =MI_LOAD_REGISTER_IMM (num_rings);for_each_engine (signaller, dev_priv, id) {if (signaller == engine)continue ; last_reg =RING_PSMI_CTL (signaller->mmio_base); -intel_ring_emit_reg (ring, last_reg); -intel_ring_emit (ring, -_MASKED_BIT_DISABLE (GEN6_PSMI_SLEEP_MSG_DISABLE )); + *out++ =i915_mmio_reg_offset (last_reg); + *out++ =_MASKED_BIT_DISABLE ( +GEN6_PSMI_SLEEP_MSG_DISABLE ); }/* Insert a delay before the next switch! */ -intel_ring_emit (ring, -MI_STORE_REGISTER_MEM | -MI_SRM_LRM_GLOBAL_GTT ); -intel_ring_emit_reg (ring, last_reg); -intel_ring_emit (ring, -i915_ggtt_offset (engine->scratch)); -intel_ring_emit (ring,MI_NOOP ); + *out++ =MI_STORE_REGISTER_MEM |MI_SRM_LRM_GLOBAL_GTT ; + *out++ =i915_mmio_reg_offset (last_reg); + *out++ =i915_ggtt_offset (engine->scratch); + *out++ =MI_NOOP ; } -intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_ENABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_ENABLE ; } -intel_ring_advance (ring); +intel_ring_advance (req, out);return ret; }static int remap_l3 (struct drm_i915_gem_request *req,int slice) { -u32 *remap_info = req->i915->l3_parity.remap_info[slice]; -struct intel_ring *ring = req->ring; -int i, ret; +u32 *out, *remap_info = req->i915->l3_parity.remap_info[slice]; +int i;if (!remap_info)return 0 ; - ret =intel_ring_begin (req,GEN7_L3LOG_SIZE /4 *2 +2 ); -if (ret) -return ret; + out =intel_ring_begin (req,GEN7_L3LOG_SIZE /4 *2 +2 ); +if (IS_ERR (out)) +return PTR_ERR (out);/* * Note: We do not worry about the concurrent register cacheline hang * here because no other code should access these registers other than * at initialization time. */ -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (GEN7_L3LOG_SIZE /4 )); + *out++ =MI_LOAD_REGISTER_IMM (GEN7_L3LOG_SIZE /4 );for (i =0 ; i <GEN7_L3LOG_SIZE /4 ; i++) { -intel_ring_emit_reg (ring,GEN7_L3LOG (slice, i)); -intel_ring_emit (ring, remap_info[i]); + *out++ =i915_mmio_reg_offset (GEN7_L3LOG (slice, i)); + *out++ = remap_info[i]; } -intel_ring_emit (ring,MI_NOOP ); -intel_ring_advance (ring); + *out++ =MI_NOOP ; +intel_ring_advance (req, out);return 0 ; }
drivers/gpu/drm/i915/i915_gem_execbuffer.c +19 -21
@@ -1336,25 +1336,25 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,static int i915_reset_gen7_sol_offsets (struct drm_i915_gem_request *req) { -struct intel_ring *ring = req->ring; -int ret, i; +u32 *out; +int i;if (!IS_GEN7 (req->i915) || req->engine->id !=RCS ) {DRM_DEBUG ("sol reset is gen7/rcs only\n" );return -EINVAL ; } - ret =intel_ring_begin (req,4 *3 ); -if (ret) -return ret; + out =intel_ring_begin (req,4 *3 ); +if (IS_ERR (out)) +return PTR_ERR (out);for (i =0 ; i <4 ; i++) { -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,GEN7_SO_WRITE_OFFSET (i)); -intel_ring_emit (ring,0 ); + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (GEN7_SO_WRITE_OFFSET (i)); + *out++ =0 ; } -intel_ring_advance (ring); +intel_ring_advance (req, out);return 0 ; }
@@ -1415,7 +1415,7 @@ execbuf_submit(struct i915_execbuffer_params *params,struct drm_i915_private *dev_priv = params->request->i915;u64 exec_start, exec_len;int instp_mode; -u32 instp_mask; +u32 instp_mask, *out;int ret; ret =i915_gem_execbuffer_move_to_gpu (params->request, vmas);
@@ -1461,17 +1461,15 @@ execbuf_submit(struct i915_execbuffer_params *params,if (params->engine->id ==RCS && instp_mode != dev_priv->relative_constants_mode) { -struct intel_ring *ring = params->request->ring; - - ret =intel_ring_begin (params->request,4 ); -if (ret) -return ret; - -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,INSTPM ); -intel_ring_emit (ring, instp_mask <<16 | instp_mode); -intel_ring_advance (ring); + out =intel_ring_begin (params->request,4 ); +if (IS_ERR (out)) +return PTR_ERR (out); + + *out++ =MI_NOOP ; + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (INSTPM ); + *out++ = instp_mask <<16 | instp_mode; +intel_ring_advance (params->request, out); dev_priv->relative_constants_mode = instp_mode; }
drivers/gpu/drm/i915/i915_gem_gtt.c +34 -35
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_request.c +3 -3
@@ -824,6 +824,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)struct intel_ring *ring = request->ring;struct intel_timeline *timeline = request->timeline;struct drm_i915_gem_request *prev; +u32 *out;int err;lockdep_assert_held (&request->i915->drm.struct_mutex);
@@ -862,10 +863,9 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + out =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (out));/* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during
drivers/gpu/drm/i915/intel_display.c +58 -74
220 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +76 -80
256 lines not on this page · raw message
drivers/gpu/drm/i915/intel_mocs.c +24 -27
100 lines not on this page · raw message
drivers/gpu/drm/i915/intel_overlay.c +34 -45
153 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.c +227 -260
779 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +4 -14
@@ -144,7 +144,6 @@ struct intel_ring {u32 head;u32 tail; - GEM_BUG_ONLY_DECLARE(u32 advance);int space;int size;
@@ -495,21 +494,12 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);void intel_legacy_submission_resume (struct drm_i915_private *dev_priv); -int __must_check intel_ring_begin (struct drm_i915_gem_request *req,int n);int __must_check intel_ring_cacheline_align (struct drm_i915_gem_request *req); -static inline void intel_ring_emit (struct intel_ring *ring,u32 data) -{ - *(uint32_t *)(ring->vaddr + ring->tail) = data; - ring->tail +=4 ; -} - -static inline void intel_ring_emit_reg (struct intel_ring *ring,i915_reg_t reg) -{ -intel_ring_emit (ring,i915_mmio_reg_offset (reg)); -} +u32 __must_check *intel_ring_begin (struct drm_i915_gem_request *req,int n); -static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *out) {/* Dummy function. *
@@ -519,7 +509,7 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_BUG_ONLY_ON (ring->tail != ring->advance); +GEM_BUG_ON ((req->ring->vaddr + req->ring->tail) != out); }static inline u32 intel_ring_offset (struct intel_ring *ring,void *addr)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Just recording a couple of BUG_ON for posterity, would be nice additions to this patch:
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -0
@@ -2264,6 +2264,7 @@ u32 *intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) ring->space -= remain_actual; } +GEM_BUG_ON (ring->tail > ring->size - bytes); out = (u32 *)(ring->vaddr + ring->tail); ring->tail += bytes; ring->space -= bytes;
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -0
@@ -526,6 +526,7 @@ static inline u32 intel_ring_offset(struct intel_ring *ring, void *addr) {/* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */ u32 offset = addr - ring->vaddr; +GEM_BUG_ON (offset > ring->size);return offset & (ring->size -1 ); }
Review void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) · line 868
Quoted 10 lines · Tvrtko Ursulin
(quoted diff) +2
-3@@ -862,10 +863,9 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) * GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err = intel_ring_begin(request, engine->emit_breadcrumb_sz); - GEM_BUG_ON(err); request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz * sizeof(u32); + out = intel_ring_begin(request, engine->emit_breadcrumb_sz); + GEM_BUG_ON(IS_ERR(out));
A test for BAT :)
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v6 1/1 drm/i915: Emit to ringbuffer directly
From: Tvrtko Ursulin <[email protected]>
This removes the usage of intel_ring_emit in favour of directly writing to the ring buffer.
intel_ring_emit was preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.
It had no useful purpose since all ringbuffer operations are started and ended with intel_ring_begin and intel_ring_advance respectively, with no bail out in the middle possible, so it is fine to increment the tail in intel_ring_begin and let the code manage the pointer itself.
Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return from intel_ring_begin to error pointer by popular demand.
* Move tail increment to intel_ring_advance to enable some error checking.
v3:
* Move tail advance back into intel_ring_begin.
* Rebase and tidy.
v4:
* Complete rebase after a few months since v3.
v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)
v6:
* Make intel_ring_offset take request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)
--- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 ++- drivers/gpu/drm/i915/i915_gem_gtt.c | 69 ++-- drivers/gpu/drm/i915/i915_gem_request.c | 10 +- drivers/gpu/drm/i915/intel_display.c | 132 ++++---- drivers/gpu/drm/i915/intel_lrc.c | 162 +++++----- drivers/gpu/drm/i915/intel_mocs.c | 51 ++- drivers/gpu/drm/i915/intel_overlay.c | 79 ++--- drivers/gpu/drm/i915/intel_ringbuffer.c | 492 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 26 +- 10 files changed, 527 insertions(+), 610 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +34 -42
@@ -584,10 +584,9 @@ static inline int mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) {struct drm_i915_private *dev_priv = req->i915; -struct intel_ring *ring = req->ring;struct intel_engine_cs *engine = req->engine;enum intel_engine_id id; -u32 flags = hw_flags |MI_MM_SPACE_GTT ; +u32 *out, flags = hw_flags |MI_MM_SPACE_GTT ;const int num_rings =/* Use an extended w/a on ivb+ if signalling from other rings */ i915.semaphores ?
@@ -617,99 +616,92 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags)if (INTEL_GEN (dev_priv) >=7 ) len +=2 + (num_rings ?4 *num_rings +6 :0 ); - ret =intel_ring_begin (req, len); -if (ret) -return ret; + out =intel_ring_begin (req, len); +if (IS_ERR (out)) +return PTR_ERR (out);/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ if (INTEL_GEN (dev_priv) >=7 ) { -intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_DISABLE ;if (num_rings) {struct intel_engine_cs *signaller; -intel_ring_emit (ring, -MI_LOAD_REGISTER_IMM (num_rings)); + *out++ =MI_LOAD_REGISTER_IMM (num_rings);for_each_engine (signaller, dev_priv, id) {if (signaller == engine)continue ; -intel_ring_emit_reg (ring, -RING_PSMI_CTL (signaller->mmio_base)); -intel_ring_emit (ring, -_MASKED_BIT_ENABLE (GEN6_PSMI_SLEEP_MSG_DISABLE )); + *out++ =i915_mmio_reg_offset ( +RING_PSMI_CTL (signaller->mmio_base)); + *out++ =_MASKED_BIT_ENABLE ( +GEN6_PSMI_SLEEP_MSG_DISABLE ); } } } -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_SET_CONTEXT ); -intel_ring_emit (ring, -i915_ggtt_offset (req->ctx->engine[RCS ].state) | flags); + *out++ =MI_NOOP ; + *out++ =MI_SET_CONTEXT ; + *out++ =i915_ggtt_offset (req->ctx->engine[RCS ].state) | flags;/* * w/a: MI_SET_CONTEXT must always be followed by MI_NOOP * WaMiSetContext_Hang:snb,ivb,vlv */ -intel_ring_emit (ring,MI_NOOP ); + *out++ =MI_NOOP ;if (INTEL_GEN (dev_priv) >=7 ) {if (num_rings) {struct intel_engine_cs *signaller;i915_reg_t last_reg = {};/* keep gcc quiet */ -intel_ring_emit (ring, -MI_LOAD_REGISTER_IMM (num_rings)); + *out++ =MI_LOAD_REGISTER_IMM (num_rings);for_each_engine (signaller, dev_priv, id) {if (signaller == engine)continue ; last_reg =RING_PSMI_CTL (signaller->mmio_base); -intel_ring_emit_reg (ring, last_reg); -intel_ring_emit (ring, -_MASKED_BIT_DISABLE (GEN6_PSMI_SLEEP_MSG_DISABLE )); + *out++ =i915_mmio_reg_offset (last_reg); + *out++ =_MASKED_BIT_DISABLE ( +GEN6_PSMI_SLEEP_MSG_DISABLE ); }/* Insert a delay before the next switch! */ -intel_ring_emit (ring, -MI_STORE_REGISTER_MEM | -MI_SRM_LRM_GLOBAL_GTT ); -intel_ring_emit_reg (ring, last_reg); -intel_ring_emit (ring, -i915_ggtt_offset (engine->scratch)); -intel_ring_emit (ring,MI_NOOP ); + *out++ =MI_STORE_REGISTER_MEM |MI_SRM_LRM_GLOBAL_GTT ; + *out++ =i915_mmio_reg_offset (last_reg); + *out++ =i915_ggtt_offset (engine->scratch); + *out++ =MI_NOOP ; } -intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_ENABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_ENABLE ; } -intel_ring_advance (ring); +intel_ring_advance (req, out);return ret; }static int remap_l3 (struct drm_i915_gem_request *req,int slice) { -u32 *remap_info = req->i915->l3_parity.remap_info[slice]; -struct intel_ring *ring = req->ring; -int i, ret; +u32 *out, *remap_info = req->i915->l3_parity.remap_info[slice]; +int i;if (!remap_info)return 0 ; - ret =intel_ring_begin (req,GEN7_L3LOG_SIZE /4 *2 +2 ); -if (ret) -return ret; + out =intel_ring_begin (req,GEN7_L3LOG_SIZE /4 *2 +2 ); +if (IS_ERR (out)) +return PTR_ERR (out);/* * Note: We do not worry about the concurrent register cacheline hang * here because no other code should access these registers other than * at initialization time. */ -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (GEN7_L3LOG_SIZE /4 )); + *out++ =MI_LOAD_REGISTER_IMM (GEN7_L3LOG_SIZE /4 );for (i =0 ; i <GEN7_L3LOG_SIZE /4 ; i++) { -intel_ring_emit_reg (ring,GEN7_L3LOG (slice, i)); -intel_ring_emit (ring, remap_info[i]); + *out++ =i915_mmio_reg_offset (GEN7_L3LOG (slice, i)); + *out++ = remap_info[i]; } -intel_ring_emit (ring,MI_NOOP ); -intel_ring_advance (ring); + *out++ =MI_NOOP ; +intel_ring_advance (req, out);return 0 ; }
drivers/gpu/drm/i915/i915_gem_execbuffer.c +19 -21
@@ -1336,25 +1336,25 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,static int i915_reset_gen7_sol_offsets (struct drm_i915_gem_request *req) { -struct intel_ring *ring = req->ring; -int ret, i; +u32 *out; +int i;if (!IS_GEN7 (req->i915) || req->engine->id !=RCS ) {DRM_DEBUG ("sol reset is gen7/rcs only\n" );return -EINVAL ; } - ret =intel_ring_begin (req,4 *3 ); -if (ret) -return ret; + out =intel_ring_begin (req,4 *3 ); +if (IS_ERR (out)) +return PTR_ERR (out);for (i =0 ; i <4 ; i++) { -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,GEN7_SO_WRITE_OFFSET (i)); -intel_ring_emit (ring,0 ); + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (GEN7_SO_WRITE_OFFSET (i)); + *out++ =0 ; } -intel_ring_advance (ring); +intel_ring_advance (req, out);return 0 ; }
@@ -1415,7 +1415,7 @@ execbuf_submit(struct i915_execbuffer_params *params,struct drm_i915_private *dev_priv = params->request->i915;u64 exec_start, exec_len;int instp_mode; -u32 instp_mask; +u32 instp_mask, *out;int ret; ret =i915_gem_execbuffer_move_to_gpu (params->request, vmas);
@@ -1461,17 +1461,15 @@ execbuf_submit(struct i915_execbuffer_params *params,if (params->engine->id ==RCS && instp_mode != dev_priv->relative_constants_mode) { -struct intel_ring *ring = params->request->ring; - - ret =intel_ring_begin (params->request,4 ); -if (ret) -return ret; - -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,INSTPM ); -intel_ring_emit (ring, instp_mask <<16 | instp_mode); -intel_ring_advance (ring); + out =intel_ring_begin (params->request,4 ); +if (IS_ERR (out)) +return PTR_ERR (out); + + *out++ =MI_NOOP ; + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (INSTPM ); + *out++ = instp_mask <<16 | instp_mode; +intel_ring_advance (params->request, out); dev_priv->relative_constants_mode = instp_mode; }
drivers/gpu/drm/i915/i915_gem_gtt.c +34 -35
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_request.c +6 -4
@@ -830,6 +830,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)struct intel_ring *ring = request->ring;struct intel_timeline *timeline = request->timeline;struct drm_i915_gem_request *prev; +u32 *out;int err;lockdep_assert_held (&request->i915->drm.struct_mutex);
@@ -868,10 +869,11 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); - request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + out =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (out)); +GEM_BUG_ON (engine->emit_breadcrumb_sz *sizeof (u32) > ring->tail); + request->postfix = ring->tail - + engine->emit_breadcrumb_sz *sizeof (u32);/* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during
drivers/gpu/drm/i915/intel_display.c +58 -74
220 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +79 -83
280 lines not on this page · raw message
drivers/gpu/drm/i915/intel_mocs.c +24 -27
100 lines not on this page · raw message
drivers/gpu/drm/i915/intel_overlay.c +34 -45
153 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.c +230 -262
796 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +9 -17
@@ -144,7 +144,6 @@ struct intel_ring {u32 head;u32 tail; - GEM_BUG_ONLY_DECLARE(u32 advance);int space;int size;
@@ -495,21 +494,12 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);void intel_legacy_submission_resume (struct drm_i915_private *dev_priv); -int __must_check intel_ring_begin (struct drm_i915_gem_request *req,int n);int __must_check intel_ring_cacheline_align (struct drm_i915_gem_request *req); -static inline void intel_ring_emit (struct intel_ring *ring,u32 data) -{ - *(uint32_t *)(ring->vaddr + ring->tail) = data; - ring->tail +=4 ; -} - -static inline void intel_ring_emit_reg (struct intel_ring *ring,i915_reg_t reg) -{ -intel_ring_emit (ring,i915_mmio_reg_offset (reg)); -} +u32 __must_check *intel_ring_begin (struct drm_i915_gem_request *req,int n); -static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *out) {/* Dummy function. *
@@ -519,14 +509,16 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_BUG_ONLY_ON (ring->tail != ring->advance); +GEM_BUG_ON ((req->ring->vaddr + req->ring->tail) != out); } -static inline u32 intel_ring_offset (struct intel_ring *ring,void *addr) +static inline +u32 intel_ring_offset (struct drm_i915_gem_request *req,void *addr) {/* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */ -u32 offset = addr - ring->vaddr; -return offset & (ring->size -1 ); +u32 offset = addr - req->ring->vaddr; +GEM_BUG_ON (offset > req->ring->size); +return offset & (req->ring->size -1 ); }int __intel_ring_space (int head,int tail,int size);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
drivers/gpu/drm/i915/i915_gem_request.c void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) · line 876
Quoted 13 lines · Tvrtko Ursulin
drivers/gpu/drm/i915/i915_gem_request.c +5
-4@@ -868,10 +869,11 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); - request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + out =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (out)); +GEM_BUG_ON (engine->emit_breadcrumb_sz *sizeof (u32) > ring->tail); + request->postfix = ring->tail - + engine->emit_breadcrumb_sz *sizeof (u32);
request->postfix = intel_ring_offset(req, out); ?
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v7 1/1 drm/i915: Emit to ringbuffer directly
From: Tvrtko Ursulin <[email protected]>
This removes the usage of intel_ring_emit in favour of directly writing to the ring buffer.
intel_ring_emit was preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.
It had no useful purpose since all ringbuffer operations are started and ended with intel_ring_begin and intel_ring_advance respectively, with no bail out in the middle possible, so it is fine to increment the tail in intel_ring_begin and let the code manage the pointer itself.
Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return from intel_ring_begin to error pointer by popular demand.
* Move tail increment to intel_ring_advance to enable some error checking.
v3:
* Move tail advance back into intel_ring_begin.
* Rebase and tidy.
v4:
* Complete rebase after a few months since v3.
v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)
v6:
* Make intel_ring_offset take request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)
v7:
* Use intel_ring_offset to get the postfix. (Chris Wilson)
* Convert GVT code as well.
---
Zhi, could you please check that they way I handled the GVT code makes sense.
I changed copy_gma_to_hva to return error or number of bytes copied since that makes it easier for the new flavour of intel_ring_begin and intel_ring_advance to work.
I was only able to compile test it.
Thanks,
Tvrtko
--- drivers/gpu/drm/i915/gvt/cmd_parser.c | 36 +-- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 ++- drivers/gpu/drm/i915/i915_gem_gtt.c | 69 ++-- drivers/gpu/drm/i915/i915_gem_request.c | 8 +- drivers/gpu/drm/i915/intel_display.c | 132 ++++---- drivers/gpu/drm/i915/intel_lrc.c | 162 +++++----- drivers/gpu/drm/i915/intel_mocs.c | 51 ++- drivers/gpu/drm/i915/intel_overlay.c | 79 ++--- drivers/gpu/drm/i915/intel_ringbuffer.c | 492 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 26 +- 11 files changed, 540 insertions(+), 631 deletions(-)
drivers/gpu/drm/i915/gvt/cmd_parser.c +15 -21
@@ -1512,7 +1512,7 @@ static int copy_gma_to_hva(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm, len += copy_len; gma += copy_len; } -return 0 ; +return len; }
@@ -1626,7 +1626,7 @@ static int perform_bb_shadow(struct parser_exec_state *s) ret =copy_gma_to_hva (s->vgpu, s->vgpu->gtt.ggtt_mm, gma, gma + bb_size, dst); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" ); goto unmap_src; }
@@ -2590,11 +2590,8 @@ static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)static int shadow_workload_ring_buffer (struct intel_vgpu_workload *workload) {struct intel_vgpu *vgpu = workload->vgpu; -int ring_id = workload->ring_id; -struct i915_gem_context *shadow_ctx = vgpu->shadow_ctx; -struct intel_ring *ring = shadow_ctx->engine[ring_id].ring;unsigned long gma_head, gma_tail, gma_top, guest_rb_size; -unsigned int copy_len =0 ; +u32 *out;int ret; guest_rb_size =_RING_CTL_BUF_SIZE (workload->rb_ctl);
@@ -2608,36 +2605,33 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) gma_top = workload->rb_start + guest_rb_size;/* allocate shadow ring buffer */ - ret =intel_ring_begin (workload->req, workload->rb_len /4 ); -if (ret) -return ret; + out =intel_ring_begin (workload->req, workload->rb_len /sizeof (u32)); +if (IS_ERR (out)) +return PTR_ERR (out);/* get shadow ring buffer va */ - workload->shadow_ring_buffer_va = ring->vaddr + ring->tail; + workload->shadow_ring_buffer_va = out;/* head > tail --> copy head <-> top */ if (gma_head > gma_tail) { ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_top, - workload->shadow_ring_buffer_va); -if (ret) { + gma_head, gma_top, out); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - copy_len = gma_top - gma_head; + out += ret /sizeof (u32); gma_head = workload->rb_start; }/* copy head or start <-> tail */ - ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_tail, - workload->shadow_ring_buffer_va + copy_len); -if (ret) { + ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, out); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - ring->tail += workload->rb_len; -intel_ring_advance (ring); + out += ret /sizeof (u32); +intel_ring_advance (workload->req, out);return 0 ; }
@@ -2691,7 +2685,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) wa_ctx->workload->vgpu->gtt.ggtt_mm, guest_gma, guest_gma + ctx_size, map); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest indirect ctx\n" ); goto unmap_src; }
drivers/gpu/drm/i915/i915_gem_context.c +34 -42
143 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_execbuffer.c +19 -21
@@ -1336,25 +1336,25 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,static int i915_reset_gen7_sol_offsets (struct drm_i915_gem_request *req) { -struct intel_ring *ring = req->ring; -int ret, i; +u32 *out; +int i;if (!IS_GEN7 (req->i915) || req->engine->id !=RCS ) {DRM_DEBUG ("sol reset is gen7/rcs only\n" );return -EINVAL ; } - ret =intel_ring_begin (req,4 *3 ); -if (ret) -return ret; + out =intel_ring_begin (req,4 *3 ); +if (IS_ERR (out)) +return PTR_ERR (out);for (i =0 ; i <4 ; i++) { -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,GEN7_SO_WRITE_OFFSET (i)); -intel_ring_emit (ring,0 ); + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (GEN7_SO_WRITE_OFFSET (i)); + *out++ =0 ; } -intel_ring_advance (ring); +intel_ring_advance (req, out);return 0 ; }
@@ -1415,7 +1415,7 @@ execbuf_submit(struct i915_execbuffer_params *params,struct drm_i915_private *dev_priv = params->request->i915;u64 exec_start, exec_len;int instp_mode; -u32 instp_mask; +u32 instp_mask, *out;int ret; ret =i915_gem_execbuffer_move_to_gpu (params->request, vmas);
@@ -1461,17 +1461,15 @@ execbuf_submit(struct i915_execbuffer_params *params,if (params->engine->id ==RCS && instp_mode != dev_priv->relative_constants_mode) { -struct intel_ring *ring = params->request->ring; - - ret =intel_ring_begin (params->request,4 ); -if (ret) -return ret; - -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,INSTPM ); -intel_ring_emit (ring, instp_mask <<16 | instp_mode); -intel_ring_advance (ring); + out =intel_ring_begin (params->request,4 ); +if (IS_ERR (out)) +return PTR_ERR (out); + + *out++ =MI_NOOP ; + *out++ =MI_LOAD_REGISTER_IMM (1 ); + *out++ =i915_mmio_reg_offset (INSTPM ); + *out++ = instp_mask <<16 | instp_mode; +intel_ring_advance (params->request, out); dev_priv->relative_constants_mode = instp_mode; }
drivers/gpu/drm/i915/i915_gem_gtt.c +34 -35
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_request.c +4 -4
@@ -830,6 +830,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)struct intel_ring *ring = request->ring;struct intel_timeline *timeline = request->timeline;struct drm_i915_gem_request *prev; +u32 *out;int err;lockdep_assert_held (&request->i915->drm.struct_mutex);
@@ -868,10 +869,9 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); - request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + out =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (out)); + request->postfix =intel_ring_offset (request, out);/* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during
drivers/gpu/drm/i915/intel_display.c +58 -74
220 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +79 -83
280 lines not on this page · raw message
drivers/gpu/drm/i915/intel_mocs.c +24 -27
100 lines not on this page · raw message
drivers/gpu/drm/i915/intel_overlay.c +34 -45
153 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.c +230 -262
796 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +9 -17
@@ -144,7 +144,6 @@ struct intel_ring {u32 head;u32 tail; - GEM_BUG_ONLY_DECLARE(u32 advance);int space;int size;
@@ -495,21 +494,12 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);void intel_legacy_submission_resume (struct drm_i915_private *dev_priv); -int __must_check intel_ring_begin (struct drm_i915_gem_request *req,int n);int __must_check intel_ring_cacheline_align (struct drm_i915_gem_request *req); -static inline void intel_ring_emit (struct intel_ring *ring,u32 data) -{ - *(uint32_t *)(ring->vaddr + ring->tail) = data; - ring->tail +=4 ; -} - -static inline void intel_ring_emit_reg (struct intel_ring *ring,i915_reg_t reg) -{ -intel_ring_emit (ring,i915_mmio_reg_offset (reg)); -} +u32 __must_check *intel_ring_begin (struct drm_i915_gem_request *req,int n); -static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *out) {/* Dummy function. *
@@ -519,14 +509,16 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_BUG_ONLY_ON (ring->tail != ring->advance); +GEM_BUG_ON ((req->ring->vaddr + req->ring->tail) != out); } -static inline u32 intel_ring_offset (struct intel_ring *ring,void *addr) +static inline +u32 intel_ring_offset (struct drm_i915_gem_request *req,void *addr) {/* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */ -u32 offset = addr - ring->vaddr; -return offset & (ring->size -1 ); +u32 offset = addr - req->ring->vaddr; +GEM_BUG_ON (offset > req->ring->size); +return offset & (req->ring->size -1 ); }int __intel_ring_space (int head,int tail,int size);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 97 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)v7:
* Useintel_ring_offsetto get the postfix. (Chris Wilson)
* Convert GVT code as well.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Zhi Wang <[email protected]>---
Zhi, could you please check that they way I handled the GVT code makes sense.
I changed
copy_gma_to_hvato return error or number of bytes copied since that makes it easier for the new flavour ofintel_ring_beginandintel_ring_advanceto work.I was only able to compile test it.
Thanks,
Tvrtko
---drivers/gpu/drm/i915/gvt/cmd_parser.c +6
-8@@ -2608,36 +2605,33 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) gma_top = workload->rb_start + guest_rb_size;/* allocate shadow ring buffer */ - ret =intel_ring_begin (workload->req, workload->rb_len /4 ); -if (ret) -return ret; + out =intel_ring_begin (workload->req, workload->rb_len /sizeof (u32)); +if (IS_ERR (out)) +return PTR_ERR (out);/* get shadow ring buffer va */ - workload->shadow_ring_buffer_va = ring->vaddr + ring->tail; + workload->shadow_ring_buffer_va = out;/* head > tail --> copy head <-> top */ if (gma_head > gma_tail) { ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_top, - workload->shadow_ring_buffer_va); -if (ret) { + gma_head, gma_top, out); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - copy_len = gma_top - gma_head;
drivers/gpu/drm/i915/gvt/cmd_parser.c static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) · line 2628
Quoted 10 lines
drivers/gpu/drm/i915/gvt/cmd_parser.c +2
-4+ out += ret /sizeof (u32); gma_head = workload->rb_start; }/* copy head or start <-> tail */ - ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_tail, - workload->shadow_ring_buffer_va + copy_len); -if (ret) { + ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, out);
I would have done
out = copy_gma_to_have(... out);
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v8 1/1 drm/i915: Emit to ringbuffer directly
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
This removes the usage of intel_ring_emit in favour of directly writing to the ring buffer.
intel_ring_emit was preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.
It had no useful purpose since all ringbuffer operations are started and ended with intel_ring_begin and intel_ring_advance respectively, with no bail out in the middle possible, so it is fine to increment the tail in intel_ring_begin and let the code manage the pointer itself.
Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return from intel_ring_begin to error pointer by popular demand.
* Move tail increment to intel_ring_advance to enable some error checking.
v3:
* Move tail advance back into intel_ring_begin.
* Rebase and tidy.
v4:
* Complete rebase after a few months since v3.
v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)
v6:
* Make intel_ring_offset take request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)
v7:
* Use intel_ring_offset to get the postfix. (Chris Wilson)
* Convert GVT code as well.
v8:
* Rename *out++ to *cs++.
--- drivers/gpu/drm/i915/gvt/cmd_parser.c | 36 +- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 +- drivers/gpu/drm/i915/i915_gem_gtt.c | 69 ++-- drivers/gpu/drm/i915/i915_gem_request.c | 8 +- drivers/gpu/drm/i915/intel_display.c | 131 +++---- drivers/gpu/drm/i915/intel_lrc.c | 207 +++++----- drivers/gpu/drm/i915/intel_mocs.c | 51 ++- drivers/gpu/drm/i915/intel_overlay.c | 79 ++-- drivers/gpu/drm/i915/intel_ringbuffer.c | 592 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 30 +- 11 files changed, 608 insertions(+), 711 deletions(-)
drivers/gpu/drm/i915/gvt/cmd_parser.c +15 -21
@@ -1512,7 +1512,7 @@ static int copy_gma_to_hva(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm, len += copy_len; gma += copy_len; } -return 0 ; +return len; }
@@ -1626,7 +1626,7 @@ static int perform_bb_shadow(struct parser_exec_state *s) ret =copy_gma_to_hva (s->vgpu, s->vgpu->gtt.ggtt_mm, gma, gma + bb_size, dst); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" ); goto unmap_src; }
@@ -2590,11 +2590,8 @@ static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)static int shadow_workload_ring_buffer (struct intel_vgpu_workload *workload) {struct intel_vgpu *vgpu = workload->vgpu; -int ring_id = workload->ring_id; -struct i915_gem_context *shadow_ctx = vgpu->shadow_ctx; -struct intel_ring *ring = shadow_ctx->engine[ring_id].ring;unsigned long gma_head, gma_tail, gma_top, guest_rb_size; -unsigned int copy_len =0 ; +u32 *cs;int ret; guest_rb_size =_RING_CTL_BUF_SIZE (workload->rb_ctl);
@@ -2608,36 +2605,33 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) gma_top = workload->rb_start + guest_rb_size;/* allocate shadow ring buffer */ - ret =intel_ring_begin (workload->req, workload->rb_len /4 ); -if (ret) -return ret; + cs =intel_ring_begin (workload->req, workload->rb_len /sizeof (u32)); +if (IS_ERR (cs)) +return PTR_ERR (cs);/* get shadow ring buffer va */ - workload->shadow_ring_buffer_va = ring->vaddr + ring->tail; + workload->shadow_ring_buffer_va = cs;/* head > tail --> copy head <-> top */ if (gma_head > gma_tail) { ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_top, - workload->shadow_ring_buffer_va); -if (ret) { + gma_head, gma_top, cs); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - copy_len = gma_top - gma_head; + cs += ret /sizeof (u32); gma_head = workload->rb_start; }/* copy head or start <-> tail */ - ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_tail, - workload->shadow_ring_buffer_va + copy_len); -if (ret) { + ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, out); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - ring->tail += workload->rb_len; -intel_ring_advance (ring); + cs += ret /sizeof (u32); +intel_ring_advance (workload->req, cs);return 0 ; }
@@ -2691,7 +2685,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) wa_ctx->workload->vgpu->gtt.ggtt_mm, guest_gma, guest_gma + ctx_size, map); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest indirect ctx\n" ); goto unmap_src; }
drivers/gpu/drm/i915/i915_gem_context.c +34 -42
143 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_execbuffer.c +19 -21
@@ -1336,25 +1336,25 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,static int i915_reset_gen7_sol_offsets (struct drm_i915_gem_request *req) { -struct intel_ring *ring = req->ring; -int ret, i; +u32 *cs; +int i;if (!IS_GEN7 (req->i915) || req->engine->id !=RCS ) {DRM_DEBUG ("sol reset is gen7/rcs only\n" );return -EINVAL ; } - ret =intel_ring_begin (req,4 *3 ); -if (ret) -return ret; + cs =intel_ring_begin (req,4 *3 ); +if (IS_ERR (cs)) +return PTR_ERR (cs);for (i =0 ; i <4 ; i++) { -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,GEN7_SO_WRITE_OFFSET (i)); -intel_ring_emit (ring,0 ); + *cs++ =MI_LOAD_REGISTER_IMM (1 ); + *cs++ =i915_mmio_reg_offset (GEN7_SO_WRITE_OFFSET (i)); + *cs++ =0 ; } -intel_ring_advance (ring); +intel_ring_advance (req, cs);return 0 ; }
@@ -1415,7 +1415,7 @@ execbuf_submit(struct i915_execbuffer_params *params,struct drm_i915_private *dev_priv = params->request->i915;u64 exec_start, exec_len;int instp_mode; -u32 instp_mask; +u32 instp_mask, *cs;int ret; ret =i915_gem_execbuffer_move_to_gpu (params->request, vmas);
@@ -1461,17 +1461,15 @@ execbuf_submit(struct i915_execbuffer_params *params,if (params->engine->id ==RCS && instp_mode != dev_priv->relative_constants_mode) { -struct intel_ring *ring = params->request->ring; - - ret =intel_ring_begin (params->request,4 ); -if (ret) -return ret; - -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,INSTPM ); -intel_ring_emit (ring, instp_mask <<16 | instp_mode); -intel_ring_advance (ring); + cs =intel_ring_begin (params->request,4 ); +if (IS_ERR (cs)) +return PTR_ERR (cs); + + *cs++ =MI_NOOP ; + *cs++ =MI_LOAD_REGISTER_IMM (1 ); + *cs++ =i915_mmio_reg_offset (INSTPM ); + *cs++ = instp_mask <<16 | instp_mode; +intel_ring_advance (params->request, cs); dev_priv->relative_constants_mode = instp_mode; }
drivers/gpu/drm/i915/i915_gem_gtt.c +34 -35
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_request.c +4 -4
@@ -824,6 +824,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)struct intel_ring *ring = request->ring;struct intel_timeline *timeline = request->timeline;struct drm_i915_gem_request *prev; +u32 *cs;int err;lockdep_assert_held (&request->i915->drm.struct_mutex);
@@ -862,10 +863,9 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); - request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + cs =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (cs)); + request->postfix =intel_ring_offset (request, cs);/* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during
drivers/gpu/drm/i915/intel_display.c +57 -74
219 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +100 -107
334 lines not on this page · raw message
drivers/gpu/drm/i915/intel_mocs.c +24 -27
100 lines not on this page · raw message
drivers/gpu/drm/i915/intel_overlay.c +34 -45
153 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.c +276 -316
942 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +11 -19
@@ -144,7 +144,6 @@ struct intel_ring {u32 head;u32 tail; - GEM_DEBUG_DECL(u32 advance);int space;int size;
@@ -290,7 +289,7 @@ struct intel_engine_cs {#define I915_DISPATCH_PINNED BIT(1)#define I915_DISPATCH_RS BIT(2)void (*emit_breadcrumb)(struct drm_i915_gem_request *req, -u32 *out); +u32 *cs);int emit_breadcrumb_sz;/* Pass the request to the hardware queue (e.g. directly into
@@ -373,7 +372,7 @@ struct intel_engine_cs {/* AKA wait() */ int (*sync_to)(struct drm_i915_gem_request *req,struct drm_i915_gem_request *signal); -u32 *(*signal)(struct drm_i915_gem_request *req,u32 *out); +u32 *(*signal)(struct drm_i915_gem_request *req,u32 *cs); } semaphore;/* Execlists */
@@ -495,21 +494,12 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);void intel_legacy_submission_resume (struct drm_i915_private *dev_priv); -int __must_check intel_ring_begin (struct drm_i915_gem_request *req,int n);int __must_check intel_ring_cacheline_align (struct drm_i915_gem_request *req); -static inline void intel_ring_emit (struct intel_ring *ring,u32 data) -{ - *(uint32_t *)(ring->vaddr + ring->tail) = data; - ring->tail +=4 ; -} +u32 __must_check *intel_ring_begin (struct drm_i915_gem_request *req,int n); -static inline void intel_ring_emit_reg (struct intel_ring *ring,i915_reg_t reg) -{ -intel_ring_emit (ring,i915_mmio_reg_offset (reg)); -} - -static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *cs) {/* Dummy function. *
@@ -519,14 +509,16 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_DEBUG_BUG_ON (ring->tail != ring->advance); +GEM_BUG_ON ((req->ring->vaddr + req->ring->tail) != cs); } -static inline u32 intel_ring_offset (struct intel_ring *ring,void *addr) +static inline u32 +intel_ring_offset (struct drm_i915_gem_request *req,void *addr) {/* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */ -u32 offset = addr - ring->vaddr; -return offset & (ring->size -1 ); +u32 offset = addr - req->ring->vaddr; +GEM_BUG_ON (offset > req->ring->size); +return offset & (req->ring->size -1 ); }int __intel_ring_space (int head,int tail,int size);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v9 1/1 drm/i915: Emit to ringbuffer directly
From: Tvrtko Ursulin <[email protected]>
This removes the usage of intel_ring_emit in favour of directly writing to the ring buffer.
intel_ring_emit was preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.
It had no useful purpose since all ringbuffer operations are started and ended with intel_ring_begin and intel_ring_advance respectively, with no bail out in the middle possible, so it is fine to increment the tail in intel_ring_begin and let the code manage the pointer itself.
Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return from intel_ring_begin to error pointer by popular demand.
* Move tail increment to intel_ring_advance to enable some error checking.
v3:
* Move tail advance back into intel_ring_begin.
* Rebase and tidy.
v4:
* Complete rebase after a few months since v3.
v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)
v6:
* Make intel_ring_offset take request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)
v7:
* Use intel_ring_offset to get the postfix. (Chris Wilson)
* Convert GVT code as well.
v8:
* Rename *out++ to *cs++.
v9:
* Fix GVT out to cs conversion in GVT.
--- drivers/gpu/drm/i915/gvt/cmd_parser.c | 36 +- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 +- drivers/gpu/drm/i915/i915_gem_gtt.c | 69 ++-- drivers/gpu/drm/i915/i915_gem_request.c | 8 +- drivers/gpu/drm/i915/intel_display.c | 131 +++---- drivers/gpu/drm/i915/intel_lrc.c | 207 +++++----- drivers/gpu/drm/i915/intel_mocs.c | 51 ++- drivers/gpu/drm/i915/intel_overlay.c | 79 ++-- drivers/gpu/drm/i915/intel_ringbuffer.c | 592 ++++++++++++++--------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 30 +- 11 files changed, 608 insertions(+), 711 deletions(-)
drivers/gpu/drm/i915/gvt/cmd_parser.c +15 -21
@@ -1512,7 +1512,7 @@ static int copy_gma_to_hva(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm, len += copy_len; gma += copy_len; } -return 0 ; +return len; }
@@ -1626,7 +1626,7 @@ static int perform_bb_shadow(struct parser_exec_state *s) ret =copy_gma_to_hva (s->vgpu, s->vgpu->gtt.ggtt_mm, gma, gma + bb_size, dst); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" ); goto unmap_src; }
@@ -2590,11 +2590,8 @@ static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)static int shadow_workload_ring_buffer (struct intel_vgpu_workload *workload) {struct intel_vgpu *vgpu = workload->vgpu; -int ring_id = workload->ring_id; -struct i915_gem_context *shadow_ctx = vgpu->shadow_ctx; -struct intel_ring *ring = shadow_ctx->engine[ring_id].ring;unsigned long gma_head, gma_tail, gma_top, guest_rb_size; -unsigned int copy_len =0 ; +u32 *cs;int ret; guest_rb_size =_RING_CTL_BUF_SIZE (workload->rb_ctl);
@@ -2608,36 +2605,33 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) gma_top = workload->rb_start + guest_rb_size;/* allocate shadow ring buffer */ - ret =intel_ring_begin (workload->req, workload->rb_len /4 ); -if (ret) -return ret; + cs =intel_ring_begin (workload->req, workload->rb_len /sizeof (u32)); +if (IS_ERR (cs)) +return PTR_ERR (cs);/* get shadow ring buffer va */ - workload->shadow_ring_buffer_va = ring->vaddr + ring->tail; + workload->shadow_ring_buffer_va = cs;/* head > tail --> copy head <-> top */ if (gma_head > gma_tail) { ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_top, - workload->shadow_ring_buffer_va); -if (ret) { + gma_head, gma_top, cs); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - copy_len = gma_top - gma_head; + cs += ret /sizeof (u32); gma_head = workload->rb_start; }/* copy head or start <-> tail */ - ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_tail, - workload->shadow_ring_buffer_va + copy_len); -if (ret) { + ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, cs); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - ring->tail += workload->rb_len; -intel_ring_advance (ring); + cs += ret /sizeof (u32); +intel_ring_advance (workload->req, cs);return 0 ; }
@@ -2691,7 +2685,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) wa_ctx->workload->vgpu->gtt.ggtt_mm, guest_gma, guest_gma + ctx_size, map); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest indirect ctx\n" ); goto unmap_src; }
drivers/gpu/drm/i915/i915_gem_context.c +34 -42
143 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_execbuffer.c +19 -21
@@ -1336,25 +1336,25 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,static int i915_reset_gen7_sol_offsets (struct drm_i915_gem_request *req) { -struct intel_ring *ring = req->ring; -int ret, i; +u32 *cs; +int i;if (!IS_GEN7 (req->i915) || req->engine->id !=RCS ) {DRM_DEBUG ("sol reset is gen7/rcs only\n" );return -EINVAL ; } - ret =intel_ring_begin (req,4 *3 ); -if (ret) -return ret; + cs =intel_ring_begin (req,4 *3 ); +if (IS_ERR (cs)) +return PTR_ERR (cs);for (i =0 ; i <4 ; i++) { -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,GEN7_SO_WRITE_OFFSET (i)); -intel_ring_emit (ring,0 ); + *cs++ =MI_LOAD_REGISTER_IMM (1 ); + *cs++ =i915_mmio_reg_offset (GEN7_SO_WRITE_OFFSET (i)); + *cs++ =0 ; } -intel_ring_advance (ring); +intel_ring_advance (req, cs);return 0 ; }
@@ -1415,7 +1415,7 @@ execbuf_submit(struct i915_execbuffer_params *params,struct drm_i915_private *dev_priv = params->request->i915;u64 exec_start, exec_len;int instp_mode; -u32 instp_mask; +u32 instp_mask, *cs;int ret; ret =i915_gem_execbuffer_move_to_gpu (params->request, vmas);
@@ -1461,17 +1461,15 @@ execbuf_submit(struct i915_execbuffer_params *params,if (params->engine->id ==RCS && instp_mode != dev_priv->relative_constants_mode) { -struct intel_ring *ring = params->request->ring; - - ret =intel_ring_begin (params->request,4 ); -if (ret) -return ret; - -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,INSTPM ); -intel_ring_emit (ring, instp_mask <<16 | instp_mode); -intel_ring_advance (ring); + cs =intel_ring_begin (params->request,4 ); +if (IS_ERR (cs)) +return PTR_ERR (cs); + + *cs++ =MI_NOOP ; + *cs++ =MI_LOAD_REGISTER_IMM (1 ); + *cs++ =i915_mmio_reg_offset (INSTPM ); + *cs++ = instp_mask <<16 | instp_mode; +intel_ring_advance (params->request, cs); dev_priv->relative_constants_mode = instp_mode; }
drivers/gpu/drm/i915/i915_gem_gtt.c +34 -35
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_request.c +4 -4
@@ -824,6 +824,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)struct intel_ring *ring = request->ring;struct intel_timeline *timeline = request->timeline;struct drm_i915_gem_request *prev; +u32 *cs;int err;lockdep_assert_held (&request->i915->drm.struct_mutex);
@@ -862,10 +863,9 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); - request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + cs =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (cs)); + request->postfix =intel_ring_offset (request, cs);/* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during
drivers/gpu/drm/i915/intel_display.c +57 -74
219 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +100 -107
334 lines not on this page · raw message
drivers/gpu/drm/i915/intel_mocs.c +24 -27
100 lines not on this page · raw message
drivers/gpu/drm/i915/intel_overlay.c +34 -45
153 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.c +276 -316
942 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +11 -19
@@ -144,7 +144,6 @@ struct intel_ring {u32 head;u32 tail; - GEM_DEBUG_DECL(u32 advance);int space;int size;
@@ -290,7 +289,7 @@ struct intel_engine_cs {#define I915_DISPATCH_PINNED BIT(1)#define I915_DISPATCH_RS BIT(2)void (*emit_breadcrumb)(struct drm_i915_gem_request *req, -u32 *out); +u32 *cs);int emit_breadcrumb_sz;/* Pass the request to the hardware queue (e.g. directly into
@@ -373,7 +372,7 @@ struct intel_engine_cs {/* AKA wait() */ int (*sync_to)(struct drm_i915_gem_request *req,struct drm_i915_gem_request *signal); -u32 *(*signal)(struct drm_i915_gem_request *req,u32 *out); +u32 *(*signal)(struct drm_i915_gem_request *req,u32 *cs); } semaphore;/* Execlists */
@@ -495,21 +494,12 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);void intel_legacy_submission_resume (struct drm_i915_private *dev_priv); -int __must_check intel_ring_begin (struct drm_i915_gem_request *req,int n);int __must_check intel_ring_cacheline_align (struct drm_i915_gem_request *req); -static inline void intel_ring_emit (struct intel_ring *ring,u32 data) -{ - *(uint32_t *)(ring->vaddr + ring->tail) = data; - ring->tail +=4 ; -} +u32 __must_check *intel_ring_begin (struct drm_i915_gem_request *req,int n); -static inline void intel_ring_emit_reg (struct intel_ring *ring,i915_reg_t reg) -{ -intel_ring_emit (ring,i915_mmio_reg_offset (reg)); -} - -static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *cs) {/* Dummy function. *
@@ -519,14 +509,16 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_DEBUG_BUG_ON (ring->tail != ring->advance); +GEM_BUG_ON ((req->ring->vaddr + req->ring->tail) != cs); } -static inline u32 intel_ring_offset (struct intel_ring *ring,void *addr) +static inline u32 +intel_ring_offset (struct drm_i915_gem_request *req,void *addr) {/* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */ -u32 offset = addr - ring->vaddr; -return offset & (ring->size -1 ); +u32 offset = addr - req->ring->vaddr; +GEM_BUG_ON (offset > req->ring->size); +return offset & (req->ring->size -1 ); }int __intel_ring_space (int head,int tail,int size);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 51 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)v7:
* Useintel_ring_offsetto get the postfix. (Chris Wilson)
* Convert GVT code as well.
Quoted 5 lines
v8:
* Rename *out++ to *cs++.v9:
* Fix GVT out to cs conversion in GVT.
Lgtm, just to warn you I've added a new intel_ring_begin in drivers/gpu/drm/i915/selftests/i915_gem_coherency.c
Quoted 5 lines
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Zhi Wang <[email protected]>Reviewed-by Chris Wilson <[email protected]> (v7)
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin
maintainerPATCH v10 1/1 drm/i915: Emit to ringbuffer directly
From: Tvrtko Ursulin <[email protected]>
This removes the usage of intel_ring_emit in favour of directly writing to the ring buffer.
intel_ring_emit was preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.
It had no useful purpose since all ringbuffer operations are started and ended with intel_ring_begin and intel_ring_advance respectively, with no bail out in the middle possible, so it is fine to increment the tail in intel_ring_begin and let the code manage the pointer itself.
Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return from intel_ring_begin to error pointer by popular demand.
* Move tail increment to intel_ring_advance to enable some error checking.
v3:
* Move tail advance back into intel_ring_begin.
* Rebase and tidy.
v4:
* Complete rebase after a few months since v3.
v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)
v6:
* Make intel_ring_offset take request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)
v7:
* Use intel_ring_offset to get the postfix. (Chris Wilson)
* Convert GVT code as well.
v8:
* Rename *out++ to *cs++.
v9:
* Fix GVT out to cs conversion in GVT.
v10:
* Rebase for new intel_ring_begin in selftests.
--- drivers/gpu/drm/i915/gvt/cmd_parser.c | 36 +- drivers/gpu/drm/i915/i915_gem_context.c | 76 ++- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 +- drivers/gpu/drm/i915/i915_gem_gtt.c | 69 ++- drivers/gpu/drm/i915/i915_gem_request.c | 8 +- drivers/gpu/drm/i915/intel_display.c | 131 ++--- drivers/gpu/drm/i915/intel_lrc.c | 207 ++++--- drivers/gpu/drm/i915/intel_mocs.c | 51 +- drivers/gpu/drm/i915/intel_overlay.c | 79 ++- drivers/gpu/drm/i915/intel_ringbuffer.c | 592 ++++++++++----------- drivers/gpu/drm/i915/intel_ringbuffer.h | 30 +- .../gpu/drm/i915/selftests/i915_gem_coherency.c | 33 +- 12 files changed, 625 insertions(+), 727 deletions(-)
drivers/gpu/drm/i915/gvt/cmd_parser.c +15 -21
@@ -1512,7 +1512,7 @@ static int copy_gma_to_hva(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm, len += copy_len; gma += copy_len; } -return 0 ; +return len; }
@@ -1626,7 +1626,7 @@ static int perform_bb_shadow(struct parser_exec_state *s) ret =copy_gma_to_hva (s->vgpu, s->vgpu->gtt.ggtt_mm, gma, gma + bb_size, dst); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" ); goto unmap_src; }
@@ -2590,11 +2590,8 @@ static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)static int shadow_workload_ring_buffer (struct intel_vgpu_workload *workload) {struct intel_vgpu *vgpu = workload->vgpu; -int ring_id = workload->ring_id; -struct i915_gem_context *shadow_ctx = vgpu->shadow_ctx; -struct intel_ring *ring = shadow_ctx->engine[ring_id].ring;unsigned long gma_head, gma_tail, gma_top, guest_rb_size; -unsigned int copy_len =0 ; +u32 *cs;int ret; guest_rb_size =_RING_CTL_BUF_SIZE (workload->rb_ctl);
@@ -2608,36 +2605,33 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) gma_top = workload->rb_start + guest_rb_size;/* allocate shadow ring buffer */ - ret =intel_ring_begin (workload->req, workload->rb_len /4 ); -if (ret) -return ret; + cs =intel_ring_begin (workload->req, workload->rb_len /sizeof (u32)); +if (IS_ERR (cs)) +return PTR_ERR (cs);/* get shadow ring buffer va */ - workload->shadow_ring_buffer_va = ring->vaddr + ring->tail; + workload->shadow_ring_buffer_va = cs;/* head > tail --> copy head <-> top */ if (gma_head > gma_tail) { ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_top, - workload->shadow_ring_buffer_va); -if (ret) { + gma_head, gma_top, cs); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - copy_len = gma_top - gma_head; + cs += ret /sizeof (u32); gma_head = workload->rb_start; }/* copy head or start <-> tail */ - ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, - gma_head, gma_tail, - workload->shadow_ring_buffer_va + copy_len); -if (ret) { + ret =copy_gma_to_hva (vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, cs); +if (ret <0 ) {gvt_err ("fail to copy guest ring buffer\n" );return ret; } - ring->tail += workload->rb_len; -intel_ring_advance (ring); + cs += ret /sizeof (u32); +intel_ring_advance (workload->req, cs);return 0 ; }
@@ -2691,7 +2685,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) wa_ctx->workload->vgpu->gtt.ggtt_mm, guest_gma, guest_gma + ctx_size, map); -if (ret) { +if (ret <0 ) {gvt_err ("fail to copy guest indirect ctx\n" ); goto unmap_src; }
drivers/gpu/drm/i915/i915_gem_context.c +34 -42
143 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_execbuffer.c +19 -21
@@ -1336,25 +1336,25 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,static int i915_reset_gen7_sol_offsets (struct drm_i915_gem_request *req) { -struct intel_ring *ring = req->ring; -int ret, i; +u32 *cs; +int i;if (!IS_GEN7 (req->i915) || req->engine->id !=RCS ) {DRM_DEBUG ("sol reset is gen7/rcs only\n" );return -EINVAL ; } - ret =intel_ring_begin (req,4 *3 ); -if (ret) -return ret; + cs =intel_ring_begin (req,4 *3 ); +if (IS_ERR (cs)) +return PTR_ERR (cs);for (i =0 ; i <4 ; i++) { -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,GEN7_SO_WRITE_OFFSET (i)); -intel_ring_emit (ring,0 ); + *cs++ =MI_LOAD_REGISTER_IMM (1 ); + *cs++ =i915_mmio_reg_offset (GEN7_SO_WRITE_OFFSET (i)); + *cs++ =0 ; } -intel_ring_advance (ring); +intel_ring_advance (req, cs);return 0 ; }
@@ -1415,7 +1415,7 @@ execbuf_submit(struct i915_execbuffer_params *params,struct drm_i915_private *dev_priv = params->request->i915;u64 exec_start, exec_len;int instp_mode; -u32 instp_mask; +u32 instp_mask, *cs;int ret; ret =i915_gem_execbuffer_move_to_gpu (params->request, vmas);
@@ -1461,17 +1461,15 @@ execbuf_submit(struct i915_execbuffer_params *params,if (params->engine->id ==RCS && instp_mode != dev_priv->relative_constants_mode) { -struct intel_ring *ring = params->request->ring; - - ret =intel_ring_begin (params->request,4 ); -if (ret) -return ret; - -intel_ring_emit (ring,MI_NOOP ); -intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); -intel_ring_emit_reg (ring,INSTPM ); -intel_ring_emit (ring, instp_mask <<16 | instp_mode); -intel_ring_advance (ring); + cs =intel_ring_begin (params->request,4 ); +if (IS_ERR (cs)) +return PTR_ERR (cs); + + *cs++ =MI_NOOP ; + *cs++ =MI_LOAD_REGISTER_IMM (1 ); + *cs++ =i915_mmio_reg_offset (INSTPM ); + *cs++ = instp_mask <<16 | instp_mode; +intel_ring_advance (params->request, cs); dev_priv->relative_constants_mode = instp_mode; }
drivers/gpu/drm/i915/i915_gem_gtt.c +34 -35
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_request.c +4 -4
@@ -824,6 +824,7 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)struct intel_ring *ring = request->ring;struct intel_timeline *timeline = request->timeline;struct drm_i915_gem_request *prev; +u32 *cs;int err;lockdep_assert_held (&request->i915->drm.struct_mutex);
@@ -862,10 +863,9 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)* GPU processing the request, we never over-estimate the * position of the ring's HEAD. */ - err =intel_ring_begin (request, engine->emit_breadcrumb_sz); -GEM_BUG_ON (err); - request->postfix = ring->tail; - ring->tail += engine->emit_breadcrumb_sz *sizeof (u32); + cs =intel_ring_begin (request, engine->emit_breadcrumb_sz); +GEM_BUG_ON (IS_ERR (cs)); + request->postfix =intel_ring_offset (request, cs);/* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during
drivers/gpu/drm/i915/intel_display.c +57 -74
219 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +100 -107
334 lines not on this page · raw message
drivers/gpu/drm/i915/intel_mocs.c +24 -27
100 lines not on this page · raw message
drivers/gpu/drm/i915/intel_overlay.c +34 -45
153 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.c +276 -316
942 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +11 -19
@@ -145,7 +145,6 @@ struct intel_ring {u32 head;u32 tail; - GEM_DEBUG_DECL(u32 advance);int space;int size;
@@ -292,7 +291,7 @@ struct intel_engine_cs {#define I915_DISPATCH_PINNED BIT(1)#define I915_DISPATCH_RS BIT(2)void (*emit_breadcrumb)(struct drm_i915_gem_request *req, -u32 *out); +u32 *cs);int emit_breadcrumb_sz;/* Pass the request to the hardware queue (e.g. directly into
@@ -375,7 +374,7 @@ struct intel_engine_cs {/* AKA wait() */ int (*sync_to)(struct drm_i915_gem_request *req,struct drm_i915_gem_request *signal); -u32 *(*signal)(struct drm_i915_gem_request *req,u32 *out); +u32 *(*signal)(struct drm_i915_gem_request *req,u32 *cs); } semaphore;/* Execlists */
@@ -497,21 +496,12 @@ void intel_engine_cleanup(struct intel_engine_cs *engine);void intel_legacy_submission_resume (struct drm_i915_private *dev_priv); -int __must_check intel_ring_begin (struct drm_i915_gem_request *req,int n);int __must_check intel_ring_cacheline_align (struct drm_i915_gem_request *req); -static inline void intel_ring_emit (struct intel_ring *ring,u32 data) -{ - *(uint32_t *)(ring->vaddr + ring->tail) = data; - ring->tail +=4 ; -} +u32 __must_check *intel_ring_begin (struct drm_i915_gem_request *req,int n); -static inline void intel_ring_emit_reg (struct intel_ring *ring,i915_reg_t reg) -{ -intel_ring_emit (ring,i915_mmio_reg_offset (reg)); -} - -static inline void intel_ring_advance (struct intel_ring *ring) +static inline void +intel_ring_advance (struct drm_i915_gem_request *req,u32 *cs) {/* Dummy function. *
@@ -521,14 +511,16 @@ static inline void intel_ring_advance(struct intel_ring *ring)* reserved for the command packet (i.e. the value passed to * intel_ring_begin()). */ -GEM_DEBUG_BUG_ON (ring->tail != ring->advance); +GEM_BUG_ON ((req->ring->vaddr + req->ring->tail) != cs); } -static inline u32 intel_ring_offset (struct intel_ring *ring,void *addr) +static inline u32 +intel_ring_offset (struct drm_i915_gem_request *req,void *addr) {/* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */ -u32 offset = addr - ring->vaddr; -return offset & (ring->size -1 ); +u32 offset = addr - req->ring->vaddr; +GEM_BUG_ON (offset > req->ring->size); +return offset & (req->ring->size -1 ); }int __intel_ring_space (int head,int tail,int size);
drivers/gpu/drm/i915/selftests/i915_gem_coherency.c +17 -16
@@ -186,6 +186,7 @@ static int gpu_set(struct drm_i915_gem_object *obj,struct drm_i915_private *i915 =to_i915 (obj->base.dev);struct drm_i915_gem_request *rq;struct i915_vma *vma; +u32 *cs;int err; err =i915_gem_object_set_to_gtt_domain (obj, true);
@@ -202,30 +203,30 @@ static int gpu_set(struct drm_i915_gem_object *obj,return PTR_ERR (rq); } - err =intel_ring_begin (rq,4 ); -if (err) { + cs =intel_ring_begin (rq,4 ); +if (IS_ERR (cs)) {__i915_add_request (rq, false);i915_vma_unpin (vma); -return err; +return PTR_ERR (cs); }if (INTEL_GEN (i915) >=8 ) { -intel_ring_emit (rq->ring,MI_STORE_DWORD_IMM_GEN4 |1 <<22 ); -intel_ring_emit (rq->ring,lower_32_bits (i915_ggtt_offset (vma) + offset)); -intel_ring_emit (rq->ring,upper_32_bits (i915_ggtt_offset (vma) + offset)); -intel_ring_emit (rq->ring, v); + *cs++ =MI_STORE_DWORD_IMM_GEN4 |1 <<22 ; + *cs++ =lower_32_bits (i915_ggtt_offset (vma) + offset); + *cs++ =upper_32_bits (i915_ggtt_offset (vma) + offset); + *cs++ = v; }else if (INTEL_GEN (i915) >=4 ) { -intel_ring_emit (rq->ring,MI_STORE_DWORD_IMM_GEN4 |1 <<22 ); -intel_ring_emit (rq->ring,0 ); -intel_ring_emit (rq->ring,i915_ggtt_offset (vma) + offset); -intel_ring_emit (rq->ring, v); + *cs++ =MI_STORE_DWORD_IMM_GEN4 |1 <<22 ; + *cs++ =0 ; + *cs++ =i915_ggtt_offset (vma) + offset; + *cs++ = v; }else { -intel_ring_emit (rq->ring,MI_STORE_DWORD_IMM |1 <<22 ); -intel_ring_emit (rq->ring,i915_ggtt_offset (vma) + offset); -intel_ring_emit (rq->ring, v); -intel_ring_emit (rq->ring,MI_NOOP ); + *cs++ =MI_STORE_DWORD_IMM |1 <<22 ; + *cs++ =i915_ggtt_offset (vma) + offset; + *cs++ = v; + *cs++ =MI_NOOP ; } -intel_ring_advance (rq->ring); +intel_ring_advance (rq, cs);i915_vma_move_to_active (vma, rq,EXEC_OBJECT_WRITE );i915_vma_unpin (vma);
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 57 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)v7:
* Useintel_ring_offsetto get the postfix. (Chris Wilson)
* Convert GVT code as well.v8:
* Rename *out++ to *cs++.v9:
* Fix GVT out to cs conversion in GVT.
Quoted 8 lines
v10:
* Rebase for newintel_ring_beginin selftests.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Zhi Wang <[email protected]>Reviewed-by Chris Wilson <[email protected]> (v9)
Regards, joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 19 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Quoted 6 lines
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
Probably safe to drop this comment now. :)
Quoted 31 lines
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)v7:
* Useintel_ring_offsetto get the postfix. (Chris Wilson)
* Convert GVT code as well.v8:
* Rename *out++ to *cs++.v9:
* Fix GVT out to cs conversion in GVT.
Quoted 8 lines
v10:
* Rebase for newintel_ring_beginin selftests.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Zhi Wang <[email protected]>Reviewed-by Chris Wilson <[email protected]> (v9)
Looking good to me.
Joonas care to ack?
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerQuoted 49 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>
<SNIP>
Quoted 13 lines
drivers/gpu/drm/i915/i915_gem_context.c +0
-0@@ -617,99 +616,92 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) if (INTEL_GEN(dev_priv) >= 7) len += 2 + (num_rings ? 4*num_rings + 6 : 0);drivers/gpu/drm/i915/i915_gem_context.c +3
-3- ret =intel_ring_begin (req, len); -if (ret) -return ret; + out =intel_ring_begin (req, len); +if (IS_ERR (out)) +return PTR_ERR (out);
/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ if (INTEL_GEN(dev_priv)>= 7) {
drivers/gpu/drm/i915/i915_gem_context.c mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) · line 625
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_context.c +1
-1-intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_DISABLE ;
I expressed my concern in the previous iteration of this series months ago, and here goes again; Lets try to keep the writes easily greppable.
So intel_ring_emit (or better name) could remain as a wrapper
#define (something something)_emit(x, y) *(x)++ = (y)
Or, we make the name distinctive, "*ring++" would work for that.
Regards, Joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 72 lines · Joonas Lahtinen
Quoted 49 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]><SNIP>
Quoted 13 lines
drivers/gpu/drm/i915/i915_gem_context.c +0
-0@@ -617,99 +616,92 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) if (INTEL_GEN(dev_priv) >= 7) len += 2 + (num_rings ? 4*num_rings + 6 : 0);drivers/gpu/drm/i915/i915_gem_context.c +3
-3- ret =intel_ring_begin (req, len); -if (ret) -return ret; + out =intel_ring_begin (req, len); +if (IS_ERR (out)) +return PTR_ERR (out);
/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ if (INTEL_GEN(dev_priv)>= 7) {drivers/gpu/drm/i915/i915_gem_context.c mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) · line 625
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_context.c +1
-1-intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_DISABLE ;I expressed my concern in the previous iteration of this series months ago, and here goes again; Lets try to keep the writes easily greppable.
Quoted 3 lines
So
intel_ring_emit(or better name) could remain as a wrapper#define (something something)_emit(x, y) *(x)++ = (y)
My concern with intel_ring_emit() remaining is that we are no longer operating on the ring. The pointer to use for emitting is retrieved from the request, so I think pointer = i915_gem_request_emit(rq, num_dwords) is what we want in the near future.
I suppose if that was
ring = i915_gem_request_emit(rq, num_dwords); intel_ring_emit(ring, blah) intel_ring_advance(rq, ring); /* this still needs polish */
It'll just about do, problem being that intel_ring_foo() is not operating on an struct intel_ring. :|
s/intel_ring_emit/ring_emit/ ?
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 82 lines · Chris Wilson
Quoted 72 lines · Joonas Lahtinen
Quoted 49 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]><SNIP>
Quoted 13 lines
drivers/gpu/drm/i915/i915_gem_context.c +0
-0@@ -617,99 +616,92 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) if (INTEL_GEN(dev_priv) >= 7) len += 2 + (num_rings ? 4*num_rings + 6 : 0);drivers/gpu/drm/i915/i915_gem_context.c +3
-3- ret =intel_ring_begin (req, len); -if (ret) -return ret; + out =intel_ring_begin (req, len); +if (IS_ERR (out)) +return PTR_ERR (out);
/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ if (INTEL_GEN(dev_priv)>= 7) {drivers/gpu/drm/i915/i915_gem_context.c mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) · line 625
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_context.c +1
-1-intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_DISABLE ;I expressed my concern in the previous iteration of this series months ago, and here goes again; Lets try to keep the writes easily greppable.
Quoted 3 lines
So
intel_ring_emit(or better name) could remain as a wrapper#define (something something)_emit(x, y) *(x)++ = (y)
My concern with
intel_ring_emit()remaining is that we are no longer operating on the ring. The pointer to use for emitting is retrieved from the request, so I think pointer =i915_gem_request_emit(rq, num_dwords)is what we want in the near future.
Quoted 6 lines
I suppose if that was
ring = i915_gem_request_emit(rq, num_dwords); intel_ring_emit(ring, blah) intel_ring_advance(rq, ring); /* this still needs polish */
Going through request feels right. For ring_emit
we could use shorter:
cs_emit and cs_advance.
They are rings but for users at this level the distinction feels unimportant.
Just my few bikesheds.
-Mika
Quoted 12 lines
It'll just about do, problem being that
intel_ring_foo()is not operating on an structintel_ring. :|s/intel_ring_emit/ring_emit/ ?
-ChrisSignature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 94 lines · Mika Kuoppala
Quoted 82 lines · Chris Wilson
Quoted 72 lines · Joonas Lahtinen
Quoted 49 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
This removes the usage of
intel_ring_emitin favour of directly writing to the ring buffer.
intel_ring_emitwas preventing the compiler for optimising fetch and increment of the current ring buffer pointer and therefore generating very verbose code for every write.It had no useful purpose since all ringbuffer operations are started and ended with
intel_ring_beginandintel_ring_advancerespectively, with no bail out in the middle possible, so it is fine to increment the tail inintel_ring_beginand let the code manage the pointer itself.Useless instruction removal amounts to approximately two and half kilobytes of saved text on my build.
Not sure if this has any measurable performance implications but executing a ton of useless instructions on fast paths cannot be good.
Patch is not fully polished, but it compiles and runs on Gen9 at least.
v2:
* Change return fromintel_ring_beginto error pointer by popular demand.
* Move tail increment tointel_ring_advanceto enable some error checking.v3:
* Move tail advance back intointel_ring_begin.
* Rebase and tidy.v4:
* Complete rebase after a few months since v3.v5:
* Remove unecessary cast and fix !debug compile. (Chris Wilson)v6:
* Makeintel_ring_offsettake request as well.
* Fix recording of request postfix plus a sprinkle of asserts. (Chris Wilson)Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]><SNIP>
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_context.c +0
-1@@ -617,99 +616,92 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags)if (INTEL_GEN (dev_priv) >=7 ) len +=2 + (num_rings ?4 *num_rings +6 :0 ); - ret =intel_ring_begin (req, len);drivers/gpu/drm/i915/i915_gem_context.c mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) · line 625
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_context.c +4
-3-if (ret) -return ret; + out =intel_ring_begin (req, len); +if (IS_ERR (out)) +return PTR_ERR (out);/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ if (INTEL_GEN (dev_priv) >=7 ) { -intel_ring_emit (ring,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + *out++ =MI_ARB_ON_OFF |MI_ARB_DISABLE ;I expressed my concern in the previous iteration of this series months ago, and here goes again; Lets try to keep the writes easily greppable.
Quoted 3 lines
So
intel_ring_emit(or better name) could remain as a wrapper#define (something something)_emit(x, y) *(x)++ = (y)
My concern with
intel_ring_emit()remaining is that we are no longer operating on the ring. The pointer to use for emitting is retrieved from the request, so I think pointer =i915_gem_request_emit(rq, num_dwords)is what we want in the near future.Quoted 6 lines
I suppose if that was
ring = i915_gem_request_emit(rq, num_dwords); intel_ring_emit(ring, blah) intel_ring_advance(rq, ring); /* this still needs polish */Going through request feels right. For
ring_emit
we could use shorter:
Quoted 6 lines
cs_emitandcs_advance.They are rings but for users at this level the distinction feels unimportant.
Just my few bikesheds.
If the main concern is "grepability" then I am not sure that there is a problem with "*out++", be it out, batch, or something (just not ring!). There are no other such statements in the code base at the moment. So It would be completely unique for ring emission.
On top of that intel_ring_begin is also a current grep marker when looking for ring emission. Only exception is I think breadcrumb emission.
I can see one argument about helper being future proof, that if one day we decide to allow wrap or something, there would be no need to change it all back. It would mean having it as "out = intel_ring_emit(rq, out, dw)" though, so still a churny patch.
If the lasts thing is something we want to consider then OK, otherwise I am ambiguous whether we need a helper.
I am also not sure macro which increments the argument is that great.
1.
*out++ = MI_USER_INTERURPT;
*out++ = MI_NOOP;
I don't have a problem with this one.
2.ring_emit(out, MI_USER_INTERRUPT);ring_emit(out, MI_NOOP);
Don't like the automagicall increment.
3.ring_emit(out++, MI_USER_INTERRUPT);ring_emit(out++, MI_NOOP);
Better but for me doesn't beat 1 by a huge margin. Would it be a bit unsafe macro since we could put the argument in parentheses?
#define ring_emit(out, dw) *((out) - 1) = dw ?
Wonder what would happen with this one. :)
4.
out = ring_emit(out, MI_USER_INTERRUPT);
out = ring_emit(out, MI_NOOP);
Alternative to 3. but not sure if GCC would be able co completely optimize this. It should?
5.
out = ring_emit(rq, out, MI_USER_INTERURPT);
out = ring_emit(rq, out, MI_NOOP);
Future proof version?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 48 lines · Tvrtko Ursulin
Quoted 25 lines · Mika Kuoppala
Quoted 13 lines · Chris Wilson
Quoted 6 lines · Joonas Lahtinen
I expressed my concern in the previous iteration of this series months ago, and here goes again; Lets try to keep the writes easily greppable.
So
intel_ring_emit(or better name) could remain as a wrapper#define (something something)_emit(x, y) *(x)++ = (y)
My concern with
intel_ring_emit()remaining is that we are no longer operating on the ring. The pointer to use for emitting is retrieved from the request, so I think pointer =i915_gem_request_emit(rq, num_dwords)is what we want in the near future.Quoted 6 lines
I suppose if that was
ring = i915_gem_request_emit(rq, num_dwords); intel_ring_emit(ring, blah) intel_ring_advance(rq, ring); /* this still needs polish */Going through request feels right. For
ring_emit
we could use shorter:Quoted 6 lines
cs_emitandcs_advance.They are rings but for users at this level the distinction feels unimportant.
Just my few bikesheds.
If the main concern is "grepability" then I am not sure that there is a problem with "*out++", be it out, batch, or something (just not ring!). There are no other such statements in the code base at the moment. So It would be completely unique for ring emission.
On top of that
intel_ring_beginis also a current grep marker when looking for ring emission. Only exception is I think breadcrumb emission.I can see one argument about helper being future proof, that if one day we decide to allow wrap or something, there would be no need to change it all back. It would mean having it as "out =
intel_ring_emit(rq, out, dw)" though, so still a churny patch.
Quoted 8 lines
If the lasts thing is something we want to consider then OK, otherwise I am ambiguous whether we need a helper.
I am also not sure macro which increments the argument is that great.
1.
*out++ =MI_USER_INTERURPT;
*out++ =MI_NOOP;
I am quite happy with just a normal pointer assignment, and share concern over the simplest macro(2).
out = ring_emit(out, MI_USER_INTERRUPT);
if pushed, but the magic should never be in ring_emit itself but in the preparation of the CS mapping for the request. I think ring_emit() is a distraction.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Emit to ringbuffer directly (rev7)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev7)
URL : https://patchwork.freedesktop.org/series/12186/
State : failure
== Summary ==
LD net/ipv6/built-in.o
LD [M] sound/pci/hda/snd-hda-codec-generic.o
LD sound/pci/built-in.o
LD drivers/iommu/built-in.o
LD drivers/usb/storage/usb-storage.o
LD drivers/tty/serial/8250/8250.o
LD drivers/usb/storage/built-in.o
LD drivers/pci/pcie/aer/aerdriver.o
LD drivers/pci/pcie/aer/built-in.o
LD drivers/md/dm-mod.o
LD drivers/pci/pcie/built-in.o
LD drivers/video/fbdev/core/fb.o
LD sound/built-in.o
LD drivers/gpu/drm/drm.o
LD drivers/video/fbdev/core/built-in.o
LD [M] drivers/mmc/core/mmc_block.o
LD drivers/thermal/thermal_sys.o
AR lib/lib.a
LD drivers/mmc/built-in.o
LD drivers/thermal/built-in.o
EXPORTS lib/lib-ksyms.o
LD [M] drivers/net/ethernet/broadcom/genet/genet.o
LD drivers/video/fbdev/built-in.o
LD lib/built-in.o
LD [M] drivers/usb/serial/usbserial.o
LD drivers/pci/built-in.o
LD [M] drivers/net/ethernet/intel/igbvf/igbvf.o
LD drivers/tty/serial/8250/8250_base.o
LD drivers/tty/serial/8250/built-in.o
LD drivers/spi/built-in.o
LD drivers/video/console/built-in.o
LD drivers/video/built-in.o
drivers/gpu/drm/i915/gvt/cmd_parser.c: In function ‘shadow_workload_ring_buffer’:
drivers/gpu/drm/i915/gvt/cmd_parser.c:2611:6: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
ret = intel_ring_begin(workload->req, workload->rb_len / 4);
^
drivers/gpu/drm/i915/gvt/cmd_parser.c:2640:21: error: passing argument 1 of ‘intel_ring_advance’ from incompatible pointer type [-Werror=incompatible-pointer-types]
intel_ring_advance(ring);
^
In file included from drivers/gpu/drm/i915/intel_uc.h:29:0,
from drivers/gpu/drm/i915/i915_drv.h:60,
from drivers/gpu/drm/i915/gvt/cmd_parser.c:38:drivers/gpu/drm/i915/intel_ringbuffer.h:502:1: note: expected ‘struct drm_i915_gem_request *’ but argument is of type ‘struct intel_ring *’
intel_ring_advance(struct drm_i915_gem_request *req, u32 *out)
^drivers/gpu/drm/i915/gvt/cmd_parser.c:2640:2: error: too few arguments to function ‘intel_ring_advance’
intel_ring_advance(ring);
^
In file included from drivers/gpu/drm/i915/intel_uc.h:29:0,
from drivers/gpu/drm/i915/i915_drv.h:60,
from drivers/gpu/drm/i915/gvt/cmd_parser.c:38:drivers/gpu/drm/i915/intel_ringbuffer.h:502:1: note: declared here
intel_ring_advance(struct drm_i915_gem_request *req, u32 *out)
^
cc1: all warnings being treated as errorsscripts/Makefile.build:294: recipe for target 'drivers/gpu/drm/i915/gvt/cmd_parser.o' failed make[4]: *** [drivers/gpu/drm/i915/gvt/cmd_parser.o] Error 1
make[4]: *** Waiting for unfinished jobs....
LD drivers/tty/serial/built-in.o LD drivers/scsi/scsi_mod.o LD drivers/usb/gadget/udc/udc-core.o LD net/ipv4/built-in.o LD drivers/usb/gadget/udc/built-in.o LD drivers/usb/gadget/libcomposite.o LD drivers/usb/gadget/built-in.o LD drivers/scsi/sd_mod.o LD drivers/scsi/built-in.o LD [M] drivers/net/ethernet/intel/e1000/e1000.o LD fs/btrfs/btrfs.o LD fs/btrfs/built-in.o CC arch/x86/kernel/cpu/capflags.o LD arch/x86/kernel/cpu/built-in.o LD arch/x86/kernel/built-in.o LD [M] drivers/net/ethernet/intel/igb/igb.o LD drivers/tty/vt/built-in.o LD drivers/tty/built-in.o LD arch/x86/built-in.o LD drivers/usb/host/xhci-hcd.o LD drivers/usb/core/usbcore.o LD net/core/built-in.o LD drivers/usb/core/built-in.o LD net/built-in.o LD fs/ext4/ext4.o LD drivers/md/md-mod.o LD drivers/md/built-in.o LD fs/ext4/built-in.o LD fs/built-in.o LD drivers/usb/host/built-in.o LD drivers/usb/built-in.o LD [M] drivers/net/ethernet/intel/e1000e/e1000e.o LD drivers/net/ethernet/built-in.o LD drivers/net/built-in.o
scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2 scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2 scripts/Makefile.build:553: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:988: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Emit to ringbuffer directly (rev8)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev8)
URL : https://patchwork.freedesktop.org/series/12186/
State : failure
== Summary ==
Series 12186v8 drm/i915: Emit to ringbuffer directly
https://patchwork.freedesktop.org/api/1.0/series/12186/revisions/8/mbox/
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> INCOMPLETE (fi-snb-2600)fi-bdw-5557u total:252 pass:238 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:252 pass:230 dwarn:0 dfail:0 fail:0 skip:22 fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-ilk-650 total:252 pass:199 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:252 pass:231 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:252 pass:231 dwarn:0 dfail:0 fail:0 skip:21 fi-kbl-7500u total:252 pass:229 dwarn:0 dfail:0 fail:2 skip:21 fi-skl-6260u total:252 pass:239 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:252 pass:232 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:252 pass:227 dwarn:4 dfail:0 fail:0 skip:21 fi-skl-6770hq total:252 pass:239 dwarn:0 dfail:0 fail:0 skip:13 fi-snb-2520m total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-snb-2600 total:209 pass:182 dwarn:0 dfail:0 fail:0 skip:26
d55644c47e7068dcebf82c60332ea6d268897758 drm-tip: 2017y-02m-09d-08h-22m-32s UTC integration manifest b26b969 drm/i915: Emit to ringbuffer directly
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3750/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Emit to ringbuffer directly (rev8)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev8)
URL : https://patchwork.freedesktop.org/series/12186/
State : failure
== Summary ==
Series 12186v8 drm/i915: Emit to ringbuffer directly
https://patchwork.freedesktop.org/api/1.0/series/12186/revisions/8/mbox/
Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
pass -> FAIL (fi-skl-6770hq)fi-bdw-5557u total:252 pass:238 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:252 pass:230 dwarn:0 dfail:0 fail:0 skip:22 fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-ilk-650 total:252 pass:199 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:252 pass:231 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:252 pass:231 dwarn:0 dfail:0 fail:0 skip:21 fi-kbl-7500u total:252 pass:229 dwarn:0 dfail:0 fail:2 skip:21 fi-skl-6260u total:252 pass:239 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:252 pass:232 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:252 pass:227 dwarn:4 dfail:0 fail:0 skip:21 fi-skl-6770hq total:252 pass:238 dwarn:0 dfail:0 fail:1 skip:13 fi-snb-2520m total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-snb-2600 total:252 pass:220 dwarn:0 dfail:0 fail:0 skip:32
8ca0c2e06c85344b8fee2bd5c48d6f3571fc870a drm-tip: 2017y-02m-09d-13h-35m-52s UTC integration manifest 69ff6e6 drm/i915: Emit to ringbuffer directly
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3761/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for drm/i915: Emit to ringbuffer directly (rev8)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev8)
URL : https://patchwork.freedesktop.org/series/12186/
State : warning
== Summary ==
Series 12186v8 drm/i915: Emit to ringbuffer directly
https://patchwork.freedesktop.org/api/1.0/series/12186/revisions/8/mbox/
Test gem_busy:
Subgroup basic-hang-default:
pass -> DMESG-WARN (fi-hsw-4770r)fi-bdw-5557u total:252 pass:241 dwarn:0 dfail:0 fail:0 skip:11 fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16 fi-hsw-4770r total:252 pass:235 dwarn:1 dfail:0 fail:0 skip:16 fi-ilk-650 total:252 pass:202 dwarn:0 dfail:0 fail:0 skip:50 fi-ivb-3520m total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-ivb-3770 total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-kbl-7500u total:252 pass:232 dwarn:0 dfail:0 fail:2 skip:18 fi-skl-6260u total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-skl-6700hq total:252 pass:235 dwarn:0 dfail:0 fail:0 skip:17 fi-skl-6700k total:252 pass:230 dwarn:4 dfail:0 fail:0 skip:18 fi-skl-6770hq total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-snb-2520m total:252 pass:224 dwarn:0 dfail:0 fail:0 skip:28 fi-snb-2600 total:252 pass:223 dwarn:0 dfail:0 fail:0 skip:29
489a7596c9ab4d38c388ab583b571fd7874ead48 drm-tip: 2017y-02m-09d-22h-55m-24s UTC integration manifest 29c1451 drm/i915: Emit to ringbuffer directly
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3763/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Emit to ringbuffer directly (rev9)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev9)
URL : https://patchwork.freedesktop.org/series/12186/
State : failure
== Summary ==
CC [M] drivers/gpu/drm/i915/gvt/gvt.o
CC [M] drivers/gpu/drm/i915/gvt/trace_points.o
CC [M] drivers/gpu/drm/i915/gvt/firmware.o
CC [M] drivers/gpu/drm/i915/gvt/interrupt.o
CC [M] drivers/gpu/drm/i915/gvt/cfg_space.o
CC [M] drivers/gpu/drm/i915/gvt/gtt.o
CC [M] drivers/gpu/drm/i915/gvt/opregion.o
CC [M] drivers/gpu/drm/i915/gvt/mmio.o
CC [M] drivers/gpu/drm/i915/gvt/scheduler.o
CC [M] drivers/gpu/drm/i915/gvt/edid.o
CC [M] drivers/gpu/drm/i915/gvt/display.o
CC [M] drivers/gpu/drm/i915/gvt/execlist.o
CC [M] drivers/gpu/drm/i915/gvt/sched_policy.o
LD drivers/pci/pcie/aer/aerdriver.o
CC [M] drivers/gpu/drm/i915/intel_lpe_audio.o
CC [M] drivers/gpu/drm/i915/gvt/render.o
CC [M] drivers/gpu/drm/i915/gvt/cmd_parser.o
LD drivers/pci/pcie/aer/built-in.o
LD drivers/pci/pcie/built-in.o
LD net/packet/built-in.o
LD [M] drivers/misc/mei/mei-me.o
LD [M] drivers/mmc/core/mmc_block.o
LD drivers/misc/built-in.o
LD drivers/mmc/built-in.o
LD drivers/video/fbdev/core/fb.o
LD drivers/acpi/acpica/acpi.o
LD drivers/scsi/scsi_mod.o
LD net/xfrm/built-in.o
LD [M] sound/pci/hda/snd-hda-codec-generic.o
LD sound/pci/built-in.o
LD drivers/video/fbdev/core/built-in.o
LD drivers/tty/serial/8250/8250.o
LD drivers/rtc/built-in.o
LD drivers/acpi/acpica/built-in.o
LD drivers/video/fbdev/built-in.o
LD drivers/usb/storage/usb-storage.o
LD drivers/usb/storage/built-in.o
LD drivers/spi/built-in.o
LD sound/built-in.o
LD drivers/acpi/built-in.o
LD drivers/pci/built-in.o
LD drivers/usb/gadget/libcomposite.o
LD drivers/iommu/built-in.o
LD [M] drivers/net/ethernet/intel/igbvf/igbvf.o
LD net/ipv6/ipv6.o
drivers/gpu/drm/i915/gvt/cmd_parser.c: In function ‘shadow_workload_ring_buffer’:
drivers/gpu/drm/i915/gvt/cmd_parser.c:2628:69: error: ‘out’ undeclared (first use in this function)
ret = copy_gma_to_hva(vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, out);
^
drivers/gpu/drm/i915/gvt/cmd_parser.c:2628:69: note: each undeclared identifier is reported only once for each function it appears in
LD drivers/usb/gadget/udc/udc-core.o
LD drivers/usb/gadget/udc/built-in.o
LD drivers/video/console/built-in.o
LD net/ipv6/built-in.o
LD drivers/usb/gadget/built-in.o
LD drivers/video/built-in.o
LD drivers/scsi/sd_mod.o
scripts/Makefile.build:294: recipe for target 'drivers/gpu/drm/i915/gvt/cmd_parser.o' failed
make[4]: *** [drivers/gpu/drm/i915/gvt/cmd_parser.o] Error 1
make[4]: *** Waiting for unfinished jobs....
LD drivers/scsi/built-in.o
LD drivers/tty/serial/8250/8250_base.o
LD drivers/tty/serial/8250/built-in.o
LD drivers/tty/serial/built-in.o
LD [M] drivers/net/ethernet/intel/e1000/e1000.o
LD fs/btrfs/btrfs.o
LD drivers/usb/core/usbcore.o
LD drivers/usb/core/built-in.o
LD fs/btrfs/built-in.o
CC arch/x86/kernel/cpu/capflags.o
LD drivers/tty/vt/built-in.o
LD arch/x86/kernel/cpu/built-in.o
LD drivers/tty/built-in.o
LD arch/x86/kernel/built-in.o
LD [M] drivers/net/ethernet/broadcom/genet/genet.o
LD net/ipv4/built-in.o
LD arch/x86/built-in.o
LD drivers/usb/host/xhci-hcd.o
LD drivers/md/md-mod.o
LD drivers/usb/host/built-in.o
LD drivers/md/built-in.o
LD drivers/usb/built-in.o
LD net/core/built-in.o
LD [M] drivers/net/ethernet/intel/igb/igb.o
LD net/built-in.o
LD fs/ext4/ext4.o
LD fs/ext4/built-in.o
LD fs/built-in.o
LD [M] drivers/net/ethernet/intel/e1000e/e1000e.oscripts/Makefile.build:553: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2 scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2 scripts/Makefile.build:553: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
make[1]: *** Waiting for unfinished jobs....
LD drivers/net/ethernet/built-in.o
LD drivers/net/built-in.o
Makefile:988: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Emit to ringbuffer directly (rev10)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev10)
URL : https://patchwork.freedesktop.org/series/12186/
State : success
== Summary ==
Series 12186v10 drm/i915: Emit to ringbuffer directly
https://patchwork.freedesktop.org/api/1.0/series/12186/revisions/10/mbox/
fi-bdw-5557u total:252 pass:241 dwarn:0 dfail:0 fail:0 skip:11 fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16 fi-hsw-4770r total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16 fi-ilk-650 total:252 pass:202 dwarn:0 dfail:0 fail:0 skip:50 fi-ivb-3520m total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-ivb-3770 total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-kbl-7500u total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-skl-6260u total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-skl-6700hq total:252 pass:235 dwarn:0 dfail:0 fail:0 skip:17 fi-skl-6700k total:252 pass:230 dwarn:4 dfail:0 fail:0 skip:18 fi-skl-6770hq total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-snb-2520m total:252 pass:224 dwarn:0 dfail:0 fail:0 skip:28 fi-snb-2600 total:252 pass:223 dwarn:0 dfail:0 fail:0 skip:29
58294e4063fcc710bd7bc97349c9753f1978d5c1 drm-tip: 2017y-02m-13d-11h-20m-27s UTC integration manifest 28debe1 drm/i915: Emit to ringbuffer directly
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3790/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Emit to ringbuffer directly (rev11)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev11)
URL : https://patchwork.freedesktop.org/series/12186/
State : success
== Summary ==
Series 12186v11 drm/i915: Emit to ringbuffer directly
https://patchwork.freedesktop.org/api/1.0/series/12186/revisions/11/mbox/
fi-bdw-5557u total:252 pass:241 dwarn:0 dfail:0 fail:0 skip:11 fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16 fi-hsw-4770r total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16 fi-ilk-650 total:252 pass:202 dwarn:0 dfail:0 fail:0 skip:50 fi-ivb-3520m total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-ivb-3770 total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-kbl-7500u total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-skl-6260u total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-skl-6700hq total:252 pass:235 dwarn:0 dfail:0 fail:0 skip:17 fi-skl-6700k total:252 pass:230 dwarn:4 dfail:0 fail:0 skip:18 fi-skl-6770hq total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-snb-2520m total:252 pass:224 dwarn:0 dfail:0 fail:0 skip:28 fi-snb-2600 total:252 pass:223 dwarn:0 dfail:0 fail:0 skip:29
fd9871a3f519674bb9b29b219393a5a3d470a04b drm-tip: 2017y-02m-14d-12h-28m-14s UTC integration manifest 02cf3f5 drm/i915: Emit to ringbuffer directly
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3800/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✓ Fi.CI.BAT: success for drm/i915: Emit to ringbuffer directly (rev11)
Quoted 30 lines · Patchwork
== Series Details ==
Series: drm/i915: Emit to ringbuffer directly (rev11)
URL : https://patchwork.freedesktop.org/series/12186/
State : success== Summary ==
Series 12186v11 drm/i915: Emit to ringbuffer directly
https://patchwork.freedesktop.org/api/1.0/series/12186/revisions/11/mbox/fi-bdw-5557u total:252 pass:241 dwarn:0 dfail:0 fail:0 skip:11 fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19 fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16 fi-hsw-4770r total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16 fi-ilk-650 total:252 pass:202 dwarn:0 dfail:0 fail:0 skip:50 fi-ivb-3520m total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-ivb-3770 total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-kbl-7500u total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18 fi-skl-6260u total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-skl-6700hq total:252 pass:235 dwarn:0 dfail:0 fail:0 skip:17 fi-skl-6700k total:252 pass:230 dwarn:4 dfail:0 fail:0 skip:18 fi-skl-6770hq total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10 fi-snb-2520m total:252 pass:224 dwarn:0 dfail:0 fail:0 skip:28 fi-snb-2600 total:252 pass:223 dwarn:0 dfail:0 fail:0 skip:29
Quoted 2 lines
fd9871a3f519674bb9b29b219393a5a3d470a04bdrm-tip: 2017y-02m-14d-12h-28m-14s UTC integration manifest 02cf3f5 drm/i915: Emit to ringbuffer directly
Pushed, thanks for the review!
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx