From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH v3 09/11] drm/i915: create a prepare phase for sprite plane updates Date: Tue, 7 Oct 2014 18:51:20 +0300 Message-ID: <20141007155120.GB32511@intel.com> References: <1411579232-8668-1-git-send-email-gustavo@padovan.org> <1411579232-8668-9-git-send-email-gustavo@padovan.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1411579232-8668-9-git-send-email-gustavo@padovan.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Gustavo Padovan Cc: intel-gfx@lists.freedesktop.org, Gustavo Padovan , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Wed, Sep 24, 2014 at 02:20:30PM -0300, Gustavo Padovan wrote: > From: Gustavo Padovan > = > take out pin_fb code so the commit phase can't fail anymore. Yeah making commit() void is a good step. For patches 8 and 9: Reviewed-by: Ville Syrj=E4l=E4 > = > Signed-off-by: Gustavo Padovan > --- > drivers/gpu/drm/i915/intel_sprite.c | 63 +++++++++++++++++++++++--------= ------ > 1 file changed, 40 insertions(+), 23 deletions(-) > = > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/i= ntel_sprite.c > index 750b634..8e5445b 100644 > --- a/drivers/gpu/drm/i915/intel_sprite.c > +++ b/drivers/gpu/drm/i915/intel_sprite.c > @@ -1189,34 +1189,18 @@ intel_check_sprite_plane(struct drm_plane *plane, > } > = > static int > -intel_commit_sprite_plane(struct drm_plane *plane, > - struct intel_plane_state *state) > +intel_prepare_sprite_plane(struct drm_plane *plane, > + struct intel_plane_state *state) > { > struct drm_device *dev =3D plane->dev; > struct drm_crtc *crtc =3D state->crtc; > struct intel_crtc *intel_crtc =3D to_intel_crtc(crtc); > - struct intel_plane *intel_plane =3D to_intel_plane(plane); > enum pipe pipe =3D intel_crtc->pipe; > struct drm_framebuffer *fb =3D state->fb; > - struct intel_framebuffer *intel_fb =3D to_intel_framebuffer(fb); > - struct drm_i915_gem_object *obj =3D intel_fb->obj; > - struct drm_i915_gem_object *old_obj =3D intel_plane->obj; > - int crtc_x, crtc_y; > - unsigned int crtc_w, crtc_h; > - uint32_t src_x, src_y, src_w, src_h; > - struct drm_rect *dst =3D &state->dst; > - const struct drm_rect *clip =3D &state->clip; > - bool primary_enabled; > + struct drm_i915_gem_object *obj =3D intel_fb_obj(fb); > + struct drm_i915_gem_object *old_obj =3D intel_fb_obj(plane->fb); > int ret; > = > - /* > - * If the sprite is completely covering the primary plane, > - * we can disable the primary and save power. > - */ > - primary_enabled =3D !drm_rect_equals(dst, clip) || colorkey_enabled(int= el_plane); > - WARN_ON(!primary_enabled && !state->visible && intel_crtc->active); > - > - > if (old_obj !=3D obj) { > mutex_lock(&dev->struct_mutex); > = > @@ -1235,6 +1219,36 @@ intel_commit_sprite_plane(struct drm_plane *plane, > return ret; > } > = > + return 0; > +} > + > +static void > +intel_commit_sprite_plane(struct drm_plane *plane, > + struct intel_plane_state *state) > +{ > + struct drm_device *dev =3D plane->dev; > + struct drm_crtc *crtc =3D state->crtc; > + struct intel_crtc *intel_crtc =3D to_intel_crtc(crtc); > + struct intel_plane *intel_plane =3D to_intel_plane(plane); > + enum pipe pipe =3D intel_crtc->pipe; > + struct drm_framebuffer *fb =3D state->fb; > + struct intel_framebuffer *intel_fb =3D to_intel_framebuffer(fb); > + struct drm_i915_gem_object *obj =3D intel_fb->obj; > + struct drm_i915_gem_object *old_obj =3D intel_plane->obj; > + int crtc_x, crtc_y; > + unsigned int crtc_w, crtc_h; > + uint32_t src_x, src_y, src_w, src_h; > + struct drm_rect *dst =3D &state->dst; > + const struct drm_rect *clip =3D &state->clip; > + bool primary_enabled; > + > + /* > + * If the sprite is completely covering the primary plane, > + * we can disable the primary and save power. > + */ > + primary_enabled =3D !drm_rect_equals(dst, clip) || colorkey_enabled(int= el_plane); > + WARN_ON(!primary_enabled && !state->visible && intel_crtc->active); > + > intel_plane->crtc_x =3D state->orig_dst.x1; > intel_plane->crtc_y =3D state->orig_dst.y1; > intel_plane->crtc_w =3D drm_rect_width(&state->orig_dst); > @@ -1295,8 +1309,6 @@ intel_commit_sprite_plane(struct drm_plane *plane, > intel_unpin_fb_obj(old_obj); > mutex_unlock(&dev->struct_mutex); > } > - > - return 0; > } > = > static int > @@ -1336,7 +1348,12 @@ intel_update_plane(struct drm_plane *plane, struct= drm_crtc *crtc, > if (ret) > return ret; > = > - return intel_commit_sprite_plane(plane, &state); > + ret =3D intel_prepare_sprite_plane(plane, &state); > + if (ret) > + return ret; > + > + intel_commit_sprite_plane(plane, &state); > + return 0; > } > = > static int > -- = > 1.9.3 > = > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- = Ville Syrj=E4l=E4 Intel OTC