[Intel-gfx] [PATCH 2/3] drm/i915: Drop parameters to intel_update_sprite_watermarks()
Matt Roper
matthew.d.roper at intel.com
Wed May 6 18:39:27 PDT 2015
The values that ultimately get passed to
intel_update_sprite_watermarks() are pulled out of the plane state
(which has already been swapped into plane->state) as we update the
plane programming. Drop the function parameters and just pull the
relevant values out of the state structure inside the function.
This change will make it easier for us to extract the sprite WM
programming out of the low-level foo_update_plane() functions (which are
run under vblank evasion and shouldn't be calling potentially blocking
watermark functions).
Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 3 +--
drivers/gpu/drm/i915/intel_drv.h | 6 +-----
drivers/gpu/drm/i915/intel_pm.c | 17 ++++++++++++-----
drivers/gpu/drm/i915/intel_sprite.c | 21 ++++++---------------
4 files changed, 20 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2878924..a6a11aa 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13462,8 +13462,7 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc)
drm_for_each_legacy_plane(p, &dev->mode_config.plane_list)
if (intel_crtc->atomic.update_sprite_watermarks &
(1 << drm_plane_index(p)))
- intel_update_sprite_watermarks(p, crtc, 0, 0, 0,
- false, false);
+ intel_update_sprite_watermarks(p, crtc);
memset(&intel_crtc->atomic, 0, sizeof(intel_crtc->atomic));
}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cf701ed..c2cf17f 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1351,11 +1351,7 @@ void intel_suspend_hw(struct drm_device *dev);
int ilk_wm_max_level(const struct drm_device *dev);
void intel_update_watermarks(struct drm_crtc *crtc);
void intel_update_sprite_watermarks(struct drm_plane *plane,
- struct drm_crtc *crtc,
- uint32_t sprite_width,
- uint32_t sprite_height,
- int pixel_size,
- bool enabled, bool scaled);
+ struct drm_crtc *crtc);
void intel_init_pm(struct drm_device *dev);
void intel_pm_setup(struct drm_device *dev);
void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 7006f94..9e0ba53 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3703,13 +3703,20 @@ void intel_update_watermarks(struct drm_crtc *crtc)
}
void intel_update_sprite_watermarks(struct drm_plane *plane,
- struct drm_crtc *crtc,
- uint32_t sprite_width,
- uint32_t sprite_height,
- int pixel_size,
- bool enabled, bool scaled)
+ struct drm_crtc *crtc)
{
struct drm_i915_private *dev_priv = plane->dev->dev_private;
+ struct intel_plane_state *state = to_intel_plane_state(plane->state);
+ struct drm_framebuffer *fb = state->base.fb;
+ uint32_t sprite_width = drm_rect_width(&state->dst);
+ uint32_t sprite_height = drm_rect_height(&state->dst);
+ int pixel_size = fb ? drm_format_plane_cpp(fb->pixel_format, 0) : 0;
+ bool enabled = state->visible;
+ unsigned int src_w = drm_rect_width(&state->src) >> 16;
+ unsigned int src_h = drm_rect_height(&state->src) >> 16;
+ unsigned int dst_w = drm_rect_width(&state->dst);
+ unsigned int dst_h = drm_rect_height(&state->dst);
+ bool scaled = (src_w != dst_w || src_h != dst_h);
if (dev_priv->display.update_sprite_wm)
dev_priv->display.update_sprite_wm(plane, crtc,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 856395b..6e27fbb 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -192,7 +192,6 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
const int pipe = intel_plane->pipe;
const int plane = intel_plane->plane + 1;
u32 plane_ctl, stride_div, stride;
- int pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
const struct drm_intel_sprite_colorkey *key = &intel_plane->ckey;
unsigned long surf_addr;
u32 tile_height, plane_offset, plane_size;
@@ -210,9 +209,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
rotation = drm_plane->state->rotation;
plane_ctl |= skl_plane_ctl_rotation(rotation);
- intel_update_sprite_watermarks(drm_plane, crtc, src_w, src_h,
- pixel_size, true,
- src_w != crtc_w || src_h != crtc_h);
+ intel_update_sprite_watermarks(drm_plane, crtc);
stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
fb->pixel_format);
@@ -297,7 +294,7 @@ skl_disable_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc)
I915_WRITE(PLANE_SURF(pipe, plane), 0);
POSTING_READ(PLANE_SURF(pipe, plane));
- intel_update_sprite_watermarks(drm_plane, crtc, 0, 0, 0, false, false);
+ intel_update_sprite_watermarks(drm_plane, crtc);
}
static void
@@ -413,9 +410,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
if (obj->tiling_mode != I915_TILING_NONE)
sprctl |= SP_TILED;
- intel_update_sprite_watermarks(dplane, crtc, src_w, src_h,
- pixel_size, true,
- src_w != crtc_w || src_h != crtc_h);
+ intel_update_sprite_watermarks(dplane, crtc);
/* Sizes are 0 based */
src_w--;
@@ -489,7 +484,7 @@ vlv_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
intel_flush_primary_plane(dev_priv, intel_crtc->plane);
- intel_update_sprite_watermarks(dplane, crtc, 0, 0, 0, false, false);
+ intel_update_sprite_watermarks(dplane, crtc);
}
@@ -554,9 +549,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
if (IS_HASWELL(dev) || IS_BROADWELL(dev))
sprctl |= SPRITE_PIPE_CSC_ENABLE;
- intel_update_sprite_watermarks(plane, crtc, src_w, src_h, pixel_size,
- true,
- src_w != crtc_w || src_h != crtc_h);
+ intel_update_sprite_watermarks(plane, crtc);
/* Sizes are 0 based */
src_w--;
@@ -697,9 +690,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
if (IS_GEN6(dev))
dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */
- intel_update_sprite_watermarks(plane, crtc, src_w, src_h,
- pixel_size, true,
- src_w != crtc_w || src_h != crtc_h);
+ intel_update_sprite_watermarks(plane, crtc);
/* Sizes are 0 based */
src_w--;
--
1.8.5.1
More information about the Intel-gfx
mailing list