diff mbox series

[39/40] drm/i915/execlists: Refactor out can_merge_rq()

Message ID 20180919195544.1511-39-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [01/40] drm: Use default dma_fence hooks where possible for null syncobj | expand

Commit Message

Chris Wilson Sept. 19, 2018, 7:55 p.m. UTC
In the next patch, we add another user that wants to check whether
requests can be merge into a single HW execution, and in the future we
want to add more conditions under which requests from the same context
cannot be merge. In preparation, extract out can_merge_rq().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_lrc.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Tvrtko Ursulin Sept. 27, 2018, 11:32 a.m. UTC | #1
On 19/09/2018 20:55, Chris Wilson wrote:
> In the next patch, we add another user that wants to check whether
> requests can be merge into a single HW execution, and in the future we
> want to add more conditions under which requests from the same context
> cannot be merge. In preparation, extract out can_merge_rq().
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/intel_lrc.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index be7dbdd7fc2c..679ce521be16 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -478,6 +478,15 @@ static bool can_merge_ctx(const struct intel_context *prev,
>   	return true;
>   }
>   
> +static bool can_merge_rq(const struct i915_request *prev,
> +			 const struct i915_request *next)
> +{
> +	if (!can_merge_ctx(prev->hw_context, next->hw_context))
> +		return false;
> +
> +	return true;

Not just return can_merge_ctx(..) ?

Regards,

Tvrtko

> +}
> +
>   static void port_assign(struct execlist_port *port, struct i915_request *rq)
>   {
>   	GEM_BUG_ON(rq == port_request(port));
> @@ -639,8 +648,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
>   			 * second request, and so we never need to tell the
>   			 * hardware about the first.
>   			 */
> -			if (last &&
> -			    !can_merge_ctx(rq->hw_context, last->hw_context)) {
> +			if (last && !can_merge_rq(rq, last)) {
>   				/*
>   				 * If we are on the second port and cannot
>   				 * combine this request with the last, then we
>
Chris Wilson Sept. 28, 2018, 8:11 p.m. UTC | #2
Quoting Tvrtko Ursulin (2018-09-27 12:32:54)
> 
> On 19/09/2018 20:55, Chris Wilson wrote:
> > In the next patch, we add another user that wants to check whether
> > requests can be merge into a single HW execution, and in the future we
> > want to add more conditions under which requests from the same context
> > cannot be merge. In preparation, extract out can_merge_rq().
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >   drivers/gpu/drm/i915/intel_lrc.c | 12 ++++++++++--
> >   1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> > index be7dbdd7fc2c..679ce521be16 100644
> > --- a/drivers/gpu/drm/i915/intel_lrc.c
> > +++ b/drivers/gpu/drm/i915/intel_lrc.c
> > @@ -478,6 +478,15 @@ static bool can_merge_ctx(const struct intel_context *prev,
> >       return true;
> >   }
> >   
> > +static bool can_merge_rq(const struct i915_request *prev,
> > +                      const struct i915_request *next)
> > +{
> > +     if (!can_merge_ctx(prev->hw_context, next->hw_context))
> > +             return false;
> > +
> > +     return true;
> 
> Not just return can_merge_ctx(..) ?

Makes you think I have plans to add more tests here... If you look in
the archives you can even have a seek peek ;)
-Chris
Tvrtko Ursulin Oct. 1, 2018, 8:14 a.m. UTC | #3
On 28/09/2018 21:11, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-09-27 12:32:54)
>>
>> On 19/09/2018 20:55, Chris Wilson wrote:
>>> In the next patch, we add another user that wants to check whether
>>> requests can be merge into a single HW execution, and in the future we
>>> want to add more conditions under which requests from the same context
>>> cannot be merge. In preparation, extract out can_merge_rq().
>>>
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> ---
>>>    drivers/gpu/drm/i915/intel_lrc.c | 12 ++++++++++--
>>>    1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
>>> index be7dbdd7fc2c..679ce521be16 100644
>>> --- a/drivers/gpu/drm/i915/intel_lrc.c
>>> +++ b/drivers/gpu/drm/i915/intel_lrc.c
>>> @@ -478,6 +478,15 @@ static bool can_merge_ctx(const struct intel_context *prev,
>>>        return true;
>>>    }
>>>    
>>> +static bool can_merge_rq(const struct i915_request *prev,
>>> +                      const struct i915_request *next)
>>> +{
>>> +     if (!can_merge_ctx(prev->hw_context, next->hw_context))
>>> +             return false;
>>> +
>>> +     return true;
>>
>> Not just return can_merge_ctx(..) ?
> 
> Makes you think I have plans to add more tests here... If you look in
> the archives you can even have a seek peek ;)

I don't see anything in Virtual Engine / Frame Split work, where to look?

Regards,

Tvrtko
Chris Wilson Oct. 1, 2018, 8:18 a.m. UTC | #4
Quoting Tvrtko Ursulin (2018-10-01 09:14:52)
> 
> On 28/09/2018 21:11, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2018-09-27 12:32:54)
> >>
> >> On 19/09/2018 20:55, Chris Wilson wrote:
> >>> In the next patch, we add another user that wants to check whether
> >>> requests can be merge into a single HW execution, and in the future we
> >>> want to add more conditions under which requests from the same context
> >>> cannot be merge. In preparation, extract out can_merge_rq().
> >>>
> >>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >>> ---
> >>>    drivers/gpu/drm/i915/intel_lrc.c | 12 ++++++++++--
> >>>    1 file changed, 10 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> >>> index be7dbdd7fc2c..679ce521be16 100644
> >>> --- a/drivers/gpu/drm/i915/intel_lrc.c
> >>> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> >>> @@ -478,6 +478,15 @@ static bool can_merge_ctx(const struct intel_context *prev,
> >>>        return true;
> >>>    }
> >>>    
> >>> +static bool can_merge_rq(const struct i915_request *prev,
> >>> +                      const struct i915_request *next)
> >>> +{
> >>> +     if (!can_merge_ctx(prev->hw_context, next->hw_context))
> >>> +             return false;
> >>> +
> >>> +     return true;
> >>
> >> Not just return can_merge_ctx(..) ?
> > 
> > Makes you think I have plans to add more tests here... If you look in
> > the archives you can even have a seek peek ;)
> 
> I don't see anything in Virtual Engine / Frame Split work, where to look?

Per-context frequency control to allow the rps range to change between
requests.
-Chris
Tvrtko Ursulin Oct. 1, 2018, 10:18 a.m. UTC | #5
On 01/10/2018 09:18, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-10-01 09:14:52)
>>
>> On 28/09/2018 21:11, Chris Wilson wrote:
>>> Quoting Tvrtko Ursulin (2018-09-27 12:32:54)
>>>>
>>>> On 19/09/2018 20:55, Chris Wilson wrote:
>>>>> In the next patch, we add another user that wants to check whether
>>>>> requests can be merge into a single HW execution, and in the future we
>>>>> want to add more conditions under which requests from the same context
>>>>> cannot be merge. In preparation, extract out can_merge_rq().
>>>>>
>>>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>>>> ---
>>>>>     drivers/gpu/drm/i915/intel_lrc.c | 12 ++++++++++--
>>>>>     1 file changed, 10 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
>>>>> index be7dbdd7fc2c..679ce521be16 100644
>>>>> --- a/drivers/gpu/drm/i915/intel_lrc.c
>>>>> +++ b/drivers/gpu/drm/i915/intel_lrc.c
>>>>> @@ -478,6 +478,15 @@ static bool can_merge_ctx(const struct intel_context *prev,
>>>>>         return true;
>>>>>     }
>>>>>     
>>>>> +static bool can_merge_rq(const struct i915_request *prev,
>>>>> +                      const struct i915_request *next)
>>>>> +{
>>>>> +     if (!can_merge_ctx(prev->hw_context, next->hw_context))
>>>>> +             return false;
>>>>> +
>>>>> +     return true;
>>>>
>>>> Not just return can_merge_ctx(..) ?
>>>
>>> Makes you think I have plans to add more tests here... If you look in
>>> the archives you can even have a seek peek ;)
>>
>> I don't see anything in Virtual Engine / Frame Split work, where to look?
> 
> Per-context frequency control to allow the rps range to change between
> requests.

Who knows when will that be at the head of the queue but OK, it's a 
style issue only so:

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index be7dbdd7fc2c..679ce521be16 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -478,6 +478,15 @@  static bool can_merge_ctx(const struct intel_context *prev,
 	return true;
 }
 
+static bool can_merge_rq(const struct i915_request *prev,
+			 const struct i915_request *next)
+{
+	if (!can_merge_ctx(prev->hw_context, next->hw_context))
+		return false;
+
+	return true;
+}
+
 static void port_assign(struct execlist_port *port, struct i915_request *rq)
 {
 	GEM_BUG_ON(rq == port_request(port));
@@ -639,8 +648,7 @@  static void execlists_dequeue(struct intel_engine_cs *engine)
 			 * second request, and so we never need to tell the
 			 * hardware about the first.
 			 */
-			if (last &&
-			    !can_merge_ctx(rq->hw_context, last->hw_context)) {
+			if (last && !can_merge_rq(rq, last)) {
 				/*
 				 * If we are on the second port and cannot
 				 * combine this request with the last, then we