From: Gustavo Padovan <gustavo@padovan.org>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm/i915: remove intel_pipe_set_base()
Date: Fri, 19 Sep 2014 18:31:25 -0300 [thread overview]
Message-ID: <20140919213125.GB10251@joana> (raw)
In-Reply-To: <20140919135129.GM12416@intel.com>
2014-09-19 Ville Syrjälä <ville.syrjala@linux.intel.com>:
> On Thu, Sep 18, 2014 at 04:43:16PM -0300, Gustavo Padovan wrote:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >
> > After some refactor intel_primary_plane_setplane() does the same
> > as intel_pipe_set_base() so we can get rid of it and replace the calls
> > with intel_primary_plane_setplane().
> >
> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > ---
> > drivers/gpu/drm/i915/intel_display.c | 79 ++++--------------------------------
> > 1 file changed, 8 insertions(+), 71 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 6c61c8f..2477587 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -2763,74 +2763,6 @@ static void intel_update_pipe_size(struct intel_crtc *crtc)
> > crtc->config.pipe_src_h = adjusted_mode->crtc_vdisplay;
> > }
> >
> > -static int
> > -intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
> > - struct drm_framebuffer *fb)
> > -{
> > - struct drm_device *dev = crtc->dev;
> > - struct drm_i915_private *dev_priv = dev->dev_private;
> > - struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > - enum pipe pipe = intel_crtc->pipe;
> > - struct drm_framebuffer *old_fb = crtc->primary->fb;
> > - struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> > - struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb);
> > - int ret;
> > -
> > - if (intel_crtc_has_pending_flip(crtc)) {
> > - DRM_ERROR("pipe is still busy with an old pageflip\n");
> > - return -EBUSY;
> > - }
> > -
> > - /* no fb bound */
> > - if (!fb) {
> > - DRM_ERROR("No FB bound\n");
> > - return 0;
> > - }
> > -
> > - if (intel_crtc->plane > INTEL_INFO(dev)->num_pipes) {
> > - DRM_ERROR("no plane for crtc: plane %c, num_pipes %d\n",
> > - plane_name(intel_crtc->plane),
> > - INTEL_INFO(dev)->num_pipes);
> > - return -EINVAL;
> > - }
> > -
> > - mutex_lock(&dev->struct_mutex);
> > - ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
> > - if (ret == 0)
> > - i915_gem_track_fb(old_obj, obj,
> > - INTEL_FRONTBUFFER_PRIMARY(pipe));
> > - mutex_unlock(&dev->struct_mutex);
> > - if (ret != 0) {
> > - DRM_ERROR("pin & fence failed\n");
> > - return ret;
> > - }
> > -
> > - intel_update_pipe_size(intel_crtc);
> > -
> > - dev_priv->display.update_primary_plane(crtc, fb, x, y);
> > -
> > - if (intel_crtc->active)
> > - intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
> > -
> > - crtc->primary->fb = fb;
> > - crtc->x = x;
> > - crtc->y = y;
> > -
> > - if (old_fb) {
> > - if (intel_crtc->active && old_fb != fb)
> > - intel_wait_for_vblank(dev, intel_crtc->pipe);
> > - mutex_lock(&dev->struct_mutex);
> > - intel_unpin_fb_obj(old_obj);
> > - mutex_unlock(&dev->struct_mutex);
> > - }
> > -
> > - mutex_lock(&dev->struct_mutex);
> > - intel_update_fbc(dev);
> > - mutex_unlock(&dev->struct_mutex);
> > -
> > - return 0;
> > -}
> > -
> > static void intel_fdi_normal_train(struct drm_crtc *crtc)
> > {
> > struct drm_device *dev = crtc->dev;
> > @@ -9797,6 +9729,7 @@ static int intel_crtc_commit_page_flip(struct drm_crtc *crtc,
> > struct drm_framebuffer *old_fb = crtc->primary->fb;
> > struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> > struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > + struct drm_plane *primary = crtc->primary;
> > enum pipe pipe = intel_crtc->pipe;
> > struct intel_unpin_work *work;
> > struct intel_engine_cs *ring;
> > @@ -9938,7 +9871,9 @@ free_work:
> > if (ret == -EIO) {
> > out_hang:
> > intel_crtc_wait_for_pending_flips(crtc);
> > - ret = intel_pipe_set_base(crtc, crtc->x, crtc->y, fb);
> > + ret = primary->funcs->update_plane(primary, crtc, fb,
> > + 0, 0, 0, 0,
> > + crtc->x, crtc->y, 0, 0);
>
> I think we want page flips to not change the current plane setup so
> these should be:
> intel_plane->crtc_x/y/w/h
> intel_plane->src_x/y/w/h
Okay.
>
> > if (ret == 0 && event) {
> > spin_lock_irq(&dev->event_lock);
> > drm_send_vblank_event(dev, pipe, event);
> > @@ -11475,11 +11410,13 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
> > set->x, set->y, set->fb);
> > } else if (config->fb_changed) {
> > struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);
> > + struct drm_plane *primary = set->crtc->primary;
> >
> > intel_crtc_wait_for_pending_flips(set->crtc);
> >
> > - ret = intel_pipe_set_base(set->crtc,
> > - set->x, set->y, set->fb);
> > + ret = primary->funcs->update_plane(primary, set->crtc, set->fb,
> > + 0, 0, 0, 0,
> > + set->x, set->y, 0, 0);
>
> And these should really be:
> 0, 0, hdisplay, vdisplay,
> set->x << 16, set->y << 16, hdisplay << 16, vdisplay << 16,
>
> Oh, one extra complication here is the stereo modes, so I think we'll be
> needing to borrow the stereo doubling trick from intel_modeset_pipe_config()
> to adjust hdisplay/vdisplay when appropriate.
I see, so just calling intel_modeset_pipe_config() and getting
pipe_config's pipe_src_w and pipe_src_h will fix the problem?
>
> And we'll be needing something also for the full modeset path
> so that intel_plane->crtc_* and intel_plane->src_* get initialized
> properly. Perhaps it's enough to rip out the fb pin/unpin stuff
> from __intel_set_mode() and just replace it with a call to
> ->update_plane().
I see. Is it okay to update the primary planes from there?
Gustavo
next prev parent reply other threads:[~2014-09-19 21:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 19:43 [PATCH 1/5] drm/i915: Merge of visible and !visible paths for primary planes Gustavo Padovan
2014-09-18 19:43 ` [PATCH 2/5] drm/i915: move checks of intel_crtc_cursor_set_obj() out Gustavo Padovan
2014-09-19 12:11 ` Ville Syrjälä
2014-09-18 19:43 ` [PATCH 3/5] drm/i915: remove intel_crtc_cursor_set_obj() Gustavo Padovan
2014-09-18 19:43 ` [PATCH 4/5] drm/i915: split intel_crtc_page_flip() into check() and commit() Gustavo Padovan
2014-09-18 19:43 ` [PATCH 5/5] drm/i915: remove intel_pipe_set_base() Gustavo Padovan
2014-09-19 13:51 ` Ville Syrjälä
2014-09-19 21:31 ` Gustavo Padovan [this message]
2014-09-22 10:58 ` Ville Syrjälä
2014-09-19 11:27 ` [PATCH 1/5] drm/i915: Merge of visible and !visible paths for primary planes Ville Syrjälä
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=20140919213125.GB10251@joana \
--to=gustavo@padovan.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo.padovan@collabora.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.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.