All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: intel-gfx@lists.freedesktop.org,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH 3/3] drm/i915: Add code comment on assumption of pipe==transcoder
Date: Tue, 20 Nov 2018 00:34:58 +0200	[thread overview]
Message-ID: <20181119223458.GA13354@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20181119220629.GA9928@ldmartin-desk.jf.intel.com>

On Mon, Nov 19, 2018 at 02:06:31PM -0800, Lucas De Marchi wrote:
> On Mon, Nov 19, 2018 at 08:43:27PM +0200, Imre Deak wrote:
> > On Mon, Nov 19, 2018 at 05:51:31PM +0200, Ville Syrjälä wrote:
> > > On Mon, Nov 19, 2018 at 04:41:09PM +0200, Imre Deak wrote:
> > > > Add a comment to the pipe and transcoder enum definitions about our
> > > > assumption in the code that pipe==transcoder for PIPE_A-C /
> > > > TRANSCODER_A-C. This means we have to keep the values for these
> > > > pipe/transcoder enums fixed.
> > > > 
> > > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > > > Cc: Mika Kahola <mika.kahola@intel.com>
> > > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/intel_display.h | 8 ++++++++
> > > >  1 file changed, 8 insertions(+)
> > > > 
> > > > diff --git a/drivers/gpu/drm/i915/intel_display.h b/drivers/gpu/drm/i915/intel_display.h
> > > > index 43eb4ebbcc35..cbb5d79d6a4c 100644
> > > > --- a/drivers/gpu/drm/i915/intel_display.h
> > > > +++ b/drivers/gpu/drm/i915/intel_display.h
> > > > @@ -43,6 +43,10 @@ enum i915_gpio {
> > > >  	GPIOM,
> > > >  };
> > > >  
> > > > +/*
> > > > + * Keep the PIPE_A-C values fixed, we assume that pipe==transcoder for
> > > > + * these pipes.
> > > > + */
> > > 
> > > I suspect the A-C part is going to bitrot. Also I'm sure we
> > > make more assupmtions about these values (PIPE_A == 0,
> > > PIPE_N+1 == n+1, etc.). We should probably try to spell it
> > > all out here.
> > 
> > Ok, can add instead:
> > 
> > /*
> >  * Keep the pipe enum values fixed: the code assumes that PIPE_A=0, the
> >  * rest have consecutive values and match the enum values of transcoders
> >  * with a 1:1 transcoder->pipe mapping.
> 
> 1:1 transcoder <-> pipe mapping, so it doesn't look like it's a pointer :)

You can only map from transcoder to pipe not the other way around (a pipe
can always be connected to any transcoder). But will add spaces around
'->'.

> 
> >  */
> > 
> > > 
> > > >  enum pipe {
> > > >  	INVALID_PIPE = -1,
> > > >  
> > > > @@ -56,6 +60,10 @@ enum pipe {
> > > >  
> > > >  #define pipe_name(p) ((p) + 'A')
> > > >  
> > > > +/*
> > > > + * Keep the TRANSCODER_A-C values fixed, we assume that pipe==transcoder for
> > > > + * these transcoders.
> > > > + */
> > > 
> > > Same issue with the A-C part perhaps.
> > 
> > and here:
> > 
> > > 
> > > >  enum transcoder {
> > 
> > /*
> >  * The following transcoders have a 1:1 transcoder->pipe mapping, keep
> >  * their values fixed: the code assumes that TRANSCODER_A=0, the rest
> >  * have consecutive values and match the enum values of the pipes they map
> >  * to.
> >  */
> > 
> > 
> > > >  	TRANSCODER_A = 0,
> > > >  	TRANSCODER_B,
> > > >     TRANSCODER_C,
> 
> could we additionally do like below?
> 
> TRANSCODER_A = PIPE_A,
> TRANSCODER_B = PIPE_B,
> TRANSCODER_C = PIPE_C,

Good idea, will change it.

> Or at least a BUILD_BUG_ON(TRANSCODER_A != PIPE_A || TRANSCODER_B != PIPE_B || TRANSCODER_C != PIPE_C)

This could get stale.

> 
> Lucas De Marchi
> 
> > 
> > /*
> >  * The following transcoders can map to any pipe, their enum value
> >  * doesn't need to stay fixed.
> >  */
> > 
> > > >     TRANSCODER_EDP,
> > > >     TRANSCODER_DSI_0,
> > > >     TRANSCODER_DSI_1,
> > 
> > 
> > > > -- 
> > > > 2.13.2
> > > 
> > > -- 
> > > Ville Syrjälä
> > > Intel
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-11-19 22:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 14:41 [PATCH 1/3] drm/i915: Make pipe/transcoder offsets not depend on enum values Imre Deak
2018-11-19 14:41 ` [PATCH 2/3] drm/i915: Make EDP PSR flags " Imre Deak
2018-11-19 20:46   ` [PATCH v2 " Imre Deak
2018-11-19 20:58     ` Ville Syrjälä
2018-11-19 21:56     ` [PATCH v3 " Imre Deak
2018-11-19 21:56       ` [PATCH v2 3/3] drm/i915: Add code comment on assumption of pipe==transcoder Imre Deak
2018-11-19 14:41 ` [PATCH " Imre Deak
2018-11-19 15:51   ` Ville Syrjälä
2018-11-19 18:43     ` Imre Deak
2018-11-19 18:55       ` Ville Syrjälä
2018-11-19 22:06       ` Lucas De Marchi
2018-11-19 22:34         ` Imre Deak [this message]
2018-11-19 15:11 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Make pipe/transcoder offsets not depend on enum values Patchwork
2018-11-19 15:29 ` [PATCH 1/3] " Ville Syrjälä
2018-11-19 18:54   ` Imre Deak
2018-11-20  2:38     ` Zhenyu Wang
2018-11-19 19:33 ` ✓ Fi.CI.IGT: success for series starting with [1/3] " Patchwork
2018-11-19 21:09 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Make pipe/transcoder offsets not depend on enum values (rev2) Patchwork
2018-11-19 22:32 ` ✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915: Make pipe/transcoder offsets not depend on enum values (rev4) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181119223458.GA13354@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.