[Intel-gfx] [PATCH 3/7] drm/i915: Pass in plane state when (un)pinning frame buffers
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Wed Mar 18 07:01:11 PDT 2015
On ti, 2015-03-17 at 15:45 +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> Plane state carries the rotation information which is needed for determining
> the appropriate GGTT view type.
>
> This just adds the parameter with the actual usage coming in future patches.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
> drivers/gpu/drm/i915/intel_drv.h | 1 +
> drivers/gpu/drm/i915/intel_fbdev.c | 2 +-
> 3 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 16f3443..862aa46 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2252,6 +2252,7 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,
> int
> intel_pin_and_fence_fb_obj(struct drm_plane *plane,
> struct drm_framebuffer *fb,
> + const struct drm_plane_state *plane_state,
Matter of taste, but I would have added the argument right before plane
argument.
> struct intel_engine_cs *pipelined)
> {
> struct drm_device *dev = fb->dev;
> @@ -2339,8 +2340,11 @@ err_interruptible:
> return ret;
> }
>
> -static void intel_unpin_fb_obj(struct drm_i915_gem_object *obj)
> +static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
> + const struct drm_plane_state *plane_state)
> {
> + struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> +
> WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
>
> i915_gem_object_unpin_fence(obj);
> @@ -9277,7 +9281,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
> enum pipe pipe = to_intel_crtc(work->crtc)->pipe;
>
> mutex_lock(&dev->struct_mutex);
> - intel_unpin_fb_obj(intel_fb_obj(work->old_fb));
> + intel_unpin_fb_obj(work->old_fb, work->crtc->primary->state);
> drm_gem_object_unreference(&work->pending_flip_obj->base);
>
> intel_fbc_update(dev);
> @@ -9985,7 +9989,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> ring = &dev_priv->ring[RCS];
> }
>
> - ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, ring);
> + ret = intel_pin_and_fence_fb_obj(crtc->primary, fb,
> + crtc->primary->state, ring);
> if (ret)
> goto cleanup_pending;
>
> @@ -10025,7 +10030,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> return 0;
>
> cleanup_unpin:
> - intel_unpin_fb_obj(obj);
> + intel_unpin_fb_obj(fb, crtc->primary->state);
> cleanup_pending:
> atomic_dec(&intel_crtc->unpin_work_count);
> mutex_unlock(&dev->struct_mutex);
> @@ -11981,7 +11986,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
> if (ret)
> DRM_DEBUG_KMS("failed to attach phys object\n");
> } else {
> - ret = intel_pin_and_fence_fb_obj(plane, fb, NULL);
> + ret = intel_pin_and_fence_fb_obj(plane, fb, new_state, NULL);
> }
>
> if (ret == 0)
> @@ -12013,7 +12018,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
> if (plane->type != DRM_PLANE_TYPE_CURSOR ||
> !INTEL_INFO(dev)->cursor_needs_physical) {
> mutex_lock(&dev->struct_mutex);
> - intel_unpin_fb_obj(obj);
> + intel_unpin_fb_obj(fb, old_state);
> mutex_unlock(&dev->struct_mutex);
> }
> }
> @@ -13906,6 +13911,7 @@ void intel_modeset_gem_init(struct drm_device *dev)
>
> if (intel_pin_and_fence_fb_obj(c->primary,
> c->primary->fb,
> + c->primary->state,
> NULL)) {
> DRM_ERROR("failed to pin boot fb on pipe %d\n",
> to_intel_crtc(c)->pipe);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 5254540..3721878 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -962,6 +962,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
> struct intel_load_detect_pipe *old);
> int intel_pin_and_fence_fb_obj(struct drm_plane *plane,
> struct drm_framebuffer *fb,
> + const struct drm_plane_state *plane_state,
> struct intel_engine_cs *pipelined);
> struct drm_framebuffer *
> __intel_framebuffer_create(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 757c0d2..4e7e7da 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -151,7 +151,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
> }
>
> /* Flush everything out, we'll be doing GTT only from now on */
> - ret = intel_pin_and_fence_fb_obj(NULL, fb, NULL);
> + ret = intel_pin_and_fence_fb_obj(NULL, fb, NULL, NULL);
> if (ret) {
> DRM_ERROR("failed to pin obj: %d\n", ret);
> goto out_fb;
More information about the Intel-gfx
mailing list