diff mbox

drm/i915: Generalize transcoder looping

Message ID 1509537051-5598-1-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kahola, Mika Nov. 1, 2017, 11:50 a.m. UTC
To make looping through transcoders in intel_ddi.c more generic, let's switch
to use 'for_each_pipe()' macro to do this.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jani Nikula Nov. 1, 2017, 3:26 p.m. UTC | #1
On Wed, 01 Nov 2017, Mika Kahola <mika.kahola@intel.com> wrote:
> To make looping through transcoders in intel_ddi.c more generic, let's switch
> to use 'for_each_pipe()' macro to do this.
>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index ace674c..3df991b 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1717,7 +1717,7 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
>  		goto out;
>  	}
>  
> -	for (i = TRANSCODER_A; i <= TRANSCODER_C; i++) {
> +	for_each_pipe(dev_priv, i) {

It gives me an uneasy feeling to conflate pipes and transcoders like
this. I think we've tried to be more clear about the distinction
elsewhere.

BR,
Jani.

>  		tmp = I915_READ(TRANS_DDI_FUNC_CTL(i));
>  
>  		if ((tmp & TRANS_DDI_PORT_MASK) == TRANS_DDI_SELECT_PORT(port)) {
Kahola, Mika Nov. 2, 2017, 11:05 a.m. UTC | #2
On Wed, 2017-11-01 at 17:26 +0200, Jani Nikula wrote:
> On Wed, 01 Nov 2017, Mika Kahola <mika.kahola@intel.com> wrote:
> > 
> > To make looping through transcoders in intel_ddi.c more generic,
> > let's switch
> > to use 'for_each_pipe()' macro to do this.
> > 
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_ddi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > b/drivers/gpu/drm/i915/intel_ddi.c
> > index ace674c..3df991b 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -1717,7 +1717,7 @@ bool intel_ddi_get_hw_state(struct
> > intel_encoder *encoder,
> >  		goto out;
> >  	}
> >  
> > -	for (i = TRANSCODER_A; i <= TRANSCODER_C; i++) {
> > +	for_each_pipe(dev_priv, i) {
> It gives me an uneasy feeling to conflate pipes and transcoders like
> this. I think we've tried to be more clear about the distinction
> elsewhere.
I had a same kind of feeling myself. First, I was thinking of creating
a new macro like for_each_transcoder() which would indicate that now we
are dealing with transcoders instead of pipes. Maybe going to that
direction here?

> 
> BR,
> Jani.
> 
> > 
> >  		tmp = I915_READ(TRANS_DDI_FUNC_CTL(i));
> >  
> >  		if ((tmp & TRANS_DDI_PORT_MASK) ==
> > TRANS_DDI_SELECT_PORT(port)) {
Jani Nikula Nov. 2, 2017, 11:18 a.m. UTC | #3
On Thu, 02 Nov 2017, Mika Kahola <mika.kahola@intel.com> wrote:
> On Wed, 2017-11-01 at 17:26 +0200, Jani Nikula wrote:
>> On Wed, 01 Nov 2017, Mika Kahola <mika.kahola@intel.com> wrote:
>> > 
>> > To make looping through transcoders in intel_ddi.c more generic,
>> > let's switch
>> > to use 'for_each_pipe()' macro to do this.
>> > 
>> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
>> > ---
>> >  drivers/gpu/drm/i915/intel_ddi.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> > 
>> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
>> > b/drivers/gpu/drm/i915/intel_ddi.c
>> > index ace674c..3df991b 100644
>> > --- a/drivers/gpu/drm/i915/intel_ddi.c
>> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
>> > @@ -1717,7 +1717,7 @@ bool intel_ddi_get_hw_state(struct
>> > intel_encoder *encoder,
>> >  		goto out;
>> >  	}
>> >  
>> > -	for (i = TRANSCODER_A; i <= TRANSCODER_C; i++) {
>> > +	for_each_pipe(dev_priv, i) {
>> It gives me an uneasy feeling to conflate pipes and transcoders like
>> this. I think we've tried to be more clear about the distinction
>> elsewhere.
> I had a same kind of feeling myself. First, I was thinking of creating
> a new macro like for_each_transcoder() which would indicate that now we
> are dealing with transcoders instead of pipes. Maybe going to that
> direction here?

That gets ugly fast too... just look at enum transcoder, and realize you
don't want to iterate them all. And there's special casing for
TRANSCODER_EDP above already.

Perhaps the easiest for now would be to use for_each_pipe() (and please
make the variable enum pipe p or something instead of int i) and then do
an explicit

	enum transcoder cpu_transcoder = (enum transcoder) p;

BR,
Jani.

>
>> 
>> BR,
>> Jani.
>> 
>> > 
>> >  		tmp = I915_READ(TRANS_DDI_FUNC_CTL(i));
>> >  
>> >  		if ((tmp & TRANS_DDI_PORT_MASK) ==
>> > TRANS_DDI_SELECT_PORT(port)) {
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index ace674c..3df991b 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1717,7 +1717,7 @@  bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
 		goto out;
 	}
 
-	for (i = TRANSCODER_A; i <= TRANSCODER_C; i++) {
+	for_each_pipe(dev_priv, i) {
 		tmp = I915_READ(TRANS_DDI_FUNC_CTL(i));
 
 		if ((tmp & TRANS_DDI_PORT_MASK) == TRANS_DDI_SELECT_PORT(port)) {