Message ID | 1444840154-7804-21-git-send-email-ville.syrjala@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Oct 14, 2015 at 07:29:12PM +0300, ville.syrjala@linux.intel.com wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > intel_compute_page_offsets() gets passed a bunch of the framebuffer > metadate sepearately. Just pass the framebuffer itself to make life > simpler for the caller, and make it less likely they would make a > mistake in the order of the arguments (as most as just unsigned ints and > such). > > We still pass the pitch explicitly since for 90/270 degree rotation > the caller has to pass in the right thing. > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> So very much, that long list of ints was scary! Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > drivers/gpu/drm/i915/intel_display.c | 15 +++++++-------- > drivers/gpu/drm/i915/intel_drv.h | 6 ++---- > drivers/gpu/drm/i915/intel_sprite.c | 9 +++------ > 3 files changed, 12 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index 0cfedf9..028dc4a 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -2515,13 +2515,14 @@ static void intel_adjust_page_offset(int *x, int *y, > * to be already rotated to match the rotated GTT view, and > * pitch is the tile_height aligned framebuffer height. > */ > -unsigned long intel_compute_page_offset(struct drm_i915_private *dev_priv, > - int *x, int *y, > - uint64_t fb_modifier, > - unsigned int cpp, > +unsigned long intel_compute_page_offset(int *x, int *y, > + const struct drm_framebuffer *fb, int plane, > unsigned int pitch, > unsigned int rotation) > { > + const struct drm_i915_private *dev_priv = to_i915(fb->dev); > + uint64_t fb_modifier = fb->modifier[plane]; > + unsigned int cpp = drm_format_plane_cpp(fb->pixel_format, plane); > unsigned int offset, alignment; > > alignment = intel_surf_alignment(dev_priv, fb_modifier); > @@ -2842,8 +2843,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, > > if (INTEL_INFO(dev)->gen >= 4) { > intel_crtc->dspaddr_offset = > - intel_compute_page_offset(dev_priv, &x, &y, > - fb->modifier[0], pixel_size, > + intel_compute_page_offset(&x, &y, fb, 0, > fb->pitches[0], rotation); > linear_offset -= intel_crtc->dspaddr_offset; > } else { > @@ -2948,8 +2948,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc, > > linear_offset = y * fb->pitches[0] + x * pixel_size; > intel_crtc->dspaddr_offset = > - intel_compute_page_offset(dev_priv, &x, &y, > - fb->modifier[0], pixel_size, > + intel_compute_page_offset(&x, &y, fb, 0, > fb->pitches[0], rotation); > linear_offset -= intel_crtc->dspaddr_offset; > if (rotation == BIT(DRM_ROTATE_180)) { > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index b0d92e0..36d049d 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -1134,10 +1134,8 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv, > void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state); > #define assert_pipe_enabled(d, p) assert_pipe(d, p, true) > #define assert_pipe_disabled(d, p) assert_pipe(d, p, false) > -unsigned long intel_compute_page_offset(struct drm_i915_private *dev_priv, > - int *x, int *y, > - uint64_t fb_modifier, > - unsigned int cpp, > +unsigned long intel_compute_page_offset(int *x, int *y, > + const struct drm_framebuffer *fb, int plane, > unsigned int pitch, > unsigned int rotation); > void intel_prepare_reset(struct drm_device *dev); > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c > index 8eaebce..828c3eb 100644 > --- a/drivers/gpu/drm/i915/intel_sprite.c > +++ b/drivers/gpu/drm/i915/intel_sprite.c > @@ -421,8 +421,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, > crtc_h--; > > linear_offset = y * fb->pitches[0] + x * pixel_size; > - sprsurf_offset = intel_compute_page_offset(dev_priv, &x, &y, > - fb->modifier[0], pixel_size, > + sprsurf_offset = intel_compute_page_offset(&x, &y, fb, 0, > fb->pitches[0], rotation); > linear_offset -= sprsurf_offset; > > @@ -554,8 +553,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, > sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h; > > linear_offset = y * fb->pitches[0] + x * pixel_size; > - sprsurf_offset = intel_compute_page_offset(dev_priv, &x, &y, > - fb->modifier[0], pixel_size, > + sprsurf_offset = intel_compute_page_offset(&x, &y, fb, 0, > fb->pitches[0], rotation); > linear_offset -= sprsurf_offset; > > @@ -692,8 +690,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, > dvsscale = DVS_SCALE_ENABLE | (src_w << 16) | src_h; > > linear_offset = y * fb->pitches[0] + x * pixel_size; > - dvssurf_offset = intel_compute_page_offset(dev_priv, &x, &y, > - fb->modifier[0], pixel_size, > + dvssurf_offset = intel_compute_page_offset(&x, &y, fb, 0, > fb->pitches[0], rotation); > linear_offset -= dvssurf_offset; > > -- > 2.4.9 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 0cfedf9..028dc4a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2515,13 +2515,14 @@ static void intel_adjust_page_offset(int *x, int *y, * to be already rotated to match the rotated GTT view, and * pitch is the tile_height aligned framebuffer height. */ -unsigned long intel_compute_page_offset(struct drm_i915_private *dev_priv, - int *x, int *y, - uint64_t fb_modifier, - unsigned int cpp, +unsigned long intel_compute_page_offset(int *x, int *y, + const struct drm_framebuffer *fb, int plane, unsigned int pitch, unsigned int rotation) { + const struct drm_i915_private *dev_priv = to_i915(fb->dev); + uint64_t fb_modifier = fb->modifier[plane]; + unsigned int cpp = drm_format_plane_cpp(fb->pixel_format, plane); unsigned int offset, alignment; alignment = intel_surf_alignment(dev_priv, fb_modifier); @@ -2842,8 +2843,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, if (INTEL_INFO(dev)->gen >= 4) { intel_crtc->dspaddr_offset = - intel_compute_page_offset(dev_priv, &x, &y, - fb->modifier[0], pixel_size, + intel_compute_page_offset(&x, &y, fb, 0, fb->pitches[0], rotation); linear_offset -= intel_crtc->dspaddr_offset; } else { @@ -2948,8 +2948,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc, linear_offset = y * fb->pitches[0] + x * pixel_size; intel_crtc->dspaddr_offset = - intel_compute_page_offset(dev_priv, &x, &y, - fb->modifier[0], pixel_size, + intel_compute_page_offset(&x, &y, fb, 0, fb->pitches[0], rotation); linear_offset -= intel_crtc->dspaddr_offset; if (rotation == BIT(DRM_ROTATE_180)) { diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index b0d92e0..36d049d 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1134,10 +1134,8 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv, void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state); #define assert_pipe_enabled(d, p) assert_pipe(d, p, true) #define assert_pipe_disabled(d, p) assert_pipe(d, p, false) -unsigned long intel_compute_page_offset(struct drm_i915_private *dev_priv, - int *x, int *y, - uint64_t fb_modifier, - unsigned int cpp, +unsigned long intel_compute_page_offset(int *x, int *y, + const struct drm_framebuffer *fb, int plane, unsigned int pitch, unsigned int rotation); void intel_prepare_reset(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 8eaebce..828c3eb 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -421,8 +421,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, crtc_h--; linear_offset = y * fb->pitches[0] + x * pixel_size; - sprsurf_offset = intel_compute_page_offset(dev_priv, &x, &y, - fb->modifier[0], pixel_size, + sprsurf_offset = intel_compute_page_offset(&x, &y, fb, 0, fb->pitches[0], rotation); linear_offset -= sprsurf_offset; @@ -554,8 +553,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h; linear_offset = y * fb->pitches[0] + x * pixel_size; - sprsurf_offset = intel_compute_page_offset(dev_priv, &x, &y, - fb->modifier[0], pixel_size, + sprsurf_offset = intel_compute_page_offset(&x, &y, fb, 0, fb->pitches[0], rotation); linear_offset -= sprsurf_offset; @@ -692,8 +690,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, dvsscale = DVS_SCALE_ENABLE | (src_w << 16) | src_h; linear_offset = y * fb->pitches[0] + x * pixel_size; - dvssurf_offset = intel_compute_page_offset(dev_priv, &x, &y, - fb->modifier[0], pixel_size, + dvssurf_offset = intel_compute_page_offset(&x, &y, fb, 0, fb->pitches[0], rotation); linear_offset -= dvssurf_offset;