diff mbox

[1/7] drm/i915: Convert execlist_submit_contexts() for requests

Message ID 1435932578-32209-2-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala July 3, 2015, 2:09 p.m. UTC
Pass around requests to carry context deeper in callchain.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

Comments

yu.dai@intel.com July 7, 2015, 4:49 p.m. UTC | #1
On 07/03/2015 07:09 AM, Mika Kuoppala wrote:
> Pass around requests to carry context deeper in callchain.
>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
>   1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 9b928ab..583210d 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -358,29 +358,29 @@ static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
>   	return 0;
>   }
>   
> -static void execlists_submit_contexts(struct intel_engine_cs *ring,
> -				      struct intel_context *to0, u32 tail0,
> -				      struct intel_context *to1, u32 tail1)
> +static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
> +				      struct drm_i915_gem_request *rq1)
>   {
> -	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
> -	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
> +	struct intel_engine_cs *ring = rq0->ring;
> +	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
>   	struct drm_i915_gem_object *ctx_obj1 = NULL;
> -	struct intel_ringbuffer *ringbuf1 = NULL;
>   
>   	BUG_ON(!ctx_obj0);
>   	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
> -	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
> +	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
>   
> -	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
> +	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,
Typo? Here it should be ctx_obj0.
> +				 rq0->ctx->ppgtt, rq0->tail);
> +
> +	if (rq1) {
> +		ctx_obj1 = rq1->ctx->engine[ring->id].state;
>   
> -	if (to1) {
> -		ringbuf1 = to1->engine[ring->id].ringbuf;
> -		ctx_obj1 = to1->engine[ring->id].state;
>   		BUG_ON(!ctx_obj1);
>   		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
> -		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
> +		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
>   
> -		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
> +		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
> +					 rq1->ctx->ppgtt, rq1->tail);
>   	}
>   
>   	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
> @@ -443,9 +443,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
>   
>   	WARN_ON(req1 && req1->elsp_submitted);
>   
> -	execlists_submit_contexts(ring, req0->ctx, req0->tail,
> -				  req1 ? req1->ctx : NULL,
> -				  req1 ? req1->tail : 0);
> +	execlists_submit_requests(req0, req1);
>   
>   	req0->elsp_submitted++;
>   	if (req1)
yu.dai@intel.com July 7, 2015, 9:44 p.m. UTC | #2
On 07/07/2015 09:49 AM, Yu Dai wrote:
> On 07/03/2015 07:09 AM, Mika Kuoppala wrote:
> > Pass around requests to carry context deeper in callchain.
> >
> > Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> > ---
> >   drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
> >   1 file changed, 14 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> > index 9b928ab..583210d 100644
> > --- a/drivers/gpu/drm/i915/intel_lrc.c
> > +++ b/drivers/gpu/drm/i915/intel_lrc.c
> > @@ -358,29 +358,29 @@ static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
> >   	return 0;
> >   }
> >
> > -static void execlists_submit_contexts(struct intel_engine_cs *ring,
> > -				      struct intel_context *to0, u32 tail0,
> > -				      struct intel_context *to1, u32 tail1)
> > +static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
> > +				      struct drm_i915_gem_request *rq1)
> >   {
> > -	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
> > -	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
> > +	struct intel_engine_cs *ring = rq0->ring;
> > +	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
> >   	struct drm_i915_gem_object *ctx_obj1 = NULL;
> > -	struct intel_ringbuffer *ringbuf1 = NULL;
> >
> >   	BUG_ON(!ctx_obj0);
> >   	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
> > -	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
> > +	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
> >
> > -	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
> > +	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,
> Typo? Here it should be ctx_obj0.

Never mind. Issue got fixed by patch 2/7.
Alex
> > +				 rq0->ctx->ppgtt, rq0->tail);
> > +
> > +	if (rq1) {
> > +		ctx_obj1 = rq1->ctx->engine[ring->id].state;
> >
> > -	if (to1) {
> > -		ringbuf1 = to1->engine[ring->id].ringbuf;
> > -		ctx_obj1 = to1->engine[ring->id].state;
> >   		BUG_ON(!ctx_obj1);
> >   		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
> > -		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
> > +		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
> >
> > -		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
> > +		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
> > +					 rq1->ctx->ppgtt, rq1->tail);
> >   	}
> >
> >   	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
> > @@ -443,9 +443,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
> >
> >   	WARN_ON(req1 && req1->elsp_submitted);
> >
> > -	execlists_submit_contexts(ring, req0->ctx, req0->tail,
> > -				  req1 ? req1->ctx : NULL,
> > -				  req1 ? req1->tail : 0);
> > +	execlists_submit_requests(req0, req1);
> >
> >   	req0->elsp_submitted++;
> >   	if (req1)
>
Mika Kuoppala July 8, 2015, 7:23 a.m. UTC | #3
Yu Dai <yu.dai@intel.com> writes:

> On 07/07/2015 09:49 AM, Yu Dai wrote:
>> On 07/03/2015 07:09 AM, Mika Kuoppala wrote:
>> > Pass around requests to carry context deeper in callchain.
>> >
>> > Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>> > ---
>> >   drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
>> >   1 file changed, 14 insertions(+), 16 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
>> > index 9b928ab..583210d 100644
>> > --- a/drivers/gpu/drm/i915/intel_lrc.c
>> > +++ b/drivers/gpu/drm/i915/intel_lrc.c
>> > @@ -358,29 +358,29 @@ static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
>> >   	return 0;
>> >   }
>> >
>> > -static void execlists_submit_contexts(struct intel_engine_cs *ring,
>> > -				      struct intel_context *to0, u32 tail0,
>> > -				      struct intel_context *to1, u32 tail1)
>> > +static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
>> > +				      struct drm_i915_gem_request *rq1)
>> >   {
>> > -	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
>> > -	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
>> > +	struct intel_engine_cs *ring = rq0->ring;
>> > +	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
>> >   	struct drm_i915_gem_object *ctx_obj1 = NULL;
>> > -	struct intel_ringbuffer *ringbuf1 = NULL;
>> >
>> >   	BUG_ON(!ctx_obj0);
>> >   	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
>> > -	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
>> > +	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
>> >
>> > -	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
>> > +	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,
>> Typo? Here it should be ctx_obj0.
>
> Never mind. Issue got fixed by patch 2/7.
> Alex

Well that will cause trouble for the bisecter :(

-Mika

>> > +				 rq0->ctx->ppgtt, rq0->tail);
>> > +
>> > +	if (rq1) {
>> > +		ctx_obj1 = rq1->ctx->engine[ring->id].state;
>> >
>> > -	if (to1) {
>> > -		ringbuf1 = to1->engine[ring->id].ringbuf;
>> > -		ctx_obj1 = to1->engine[ring->id].state;
>> >   		BUG_ON(!ctx_obj1);
>> >   		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
>> > -		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
>> > +		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
>> >
>> > -		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
>> > +		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
>> > +					 rq1->ctx->ppgtt, rq1->tail);
>> >   	}
>> >
>> >   	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
>> > @@ -443,9 +443,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
>> >
>> >   	WARN_ON(req1 && req1->elsp_submitted);
>> >
>> > -	execlists_submit_contexts(ring, req0->ctx, req0->tail,
>> > -				  req1 ? req1->ctx : NULL,
>> > -				  req1 ? req1->tail : 0);
>> > +	execlists_submit_requests(req0, req1);
>> >
>> >   	req0->elsp_submitted++;
>> >   	if (req1)
>>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 9b928ab..583210d 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -358,29 +358,29 @@  static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
 	return 0;
 }
 
-static void execlists_submit_contexts(struct intel_engine_cs *ring,
-				      struct intel_context *to0, u32 tail0,
-				      struct intel_context *to1, u32 tail1)
+static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
+				      struct drm_i915_gem_request *rq1)
 {
-	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
-	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
+	struct intel_engine_cs *ring = rq0->ring;
+	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
 	struct drm_i915_gem_object *ctx_obj1 = NULL;
-	struct intel_ringbuffer *ringbuf1 = NULL;
 
 	BUG_ON(!ctx_obj0);
 	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
-	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
+	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
 
-	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
+	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,
+				 rq0->ctx->ppgtt, rq0->tail);
+
+	if (rq1) {
+		ctx_obj1 = rq1->ctx->engine[ring->id].state;
 
-	if (to1) {
-		ringbuf1 = to1->engine[ring->id].ringbuf;
-		ctx_obj1 = to1->engine[ring->id].state;
 		BUG_ON(!ctx_obj1);
 		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
-		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
+		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
 
-		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
+		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
+					 rq1->ctx->ppgtt, rq1->tail);
 	}
 
 	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
@@ -443,9 +443,7 @@  static void execlists_context_unqueue(struct intel_engine_cs *ring)
 
 	WARN_ON(req1 && req1->elsp_submitted);
 
-	execlists_submit_contexts(ring, req0->ctx, req0->tail,
-				  req1 ? req1->ctx : NULL,
-				  req1 ? req1->tail : 0);
+	execlists_submit_requests(req0, req1);
 
 	req0->elsp_submitted++;
 	if (req1)