From: Daniel Vetter Subject: Re: [PATCH 4/4] drm/i915: Intel-specific primary plane handling (v6) Date: Thu, 15 May 2014 22:49:52 +0200 Message-ID: <20140515204952.GW8790@phenom.ffwll.local> References: <1398877623-16930-1-git-send-email-matthew.d.roper@intel.com> <1398877623-16930-5-git-send-email-matthew.d.roper@intel.com> <20140515155228.GF27580@intel.com> <20140515163755.GD23405@intel.com> <20140515170048.GG27580@intel.com> <20140515193517.GE23405@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f50.google.com (mail-ee0-f50.google.com [74.125.83.50]) by gabe.freedesktop.org (Postfix) with ESMTP id 422516EF10 for ; Thu, 15 May 2014 13:49:57 -0700 (PDT) Received: by mail-ee0-f50.google.com with SMTP id e51so982264eek.37 for ; Thu, 15 May 2014 13:49:56 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140515193517.GE23405@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Matt Roper Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, May 15, 2014 at 12:35:17PM -0700, Matt Roper wrote: > On Thu, May 15, 2014 at 08:00:48PM +0300, Ville Syrj=E4l=E4 wrote: > > On Thu, May 15, 2014 at 09:37:55AM -0700, Matt Roper wrote: > > > On Thu, May 15, 2014 at 06:52:28PM +0300, Ville Syrj=E4l=E4 wrote: > > > ... > > > > = > > > > > + }; > > > > > + bool visible; > > > > > + int ret; > > > > > + > > > > > + ret =3D drm_primary_helper_check_update(plane, crtc, fb, > > > > > + &src, &dest, &clip, > > > > > + DRM_PLANE_HELPER_NO_SCALING, > > > > > + DRM_PLANE_HELPER_NO_SCALING, > > > > > + false, true, &visible); > > > > > + if (ret) > > > > > + return ret; > > > > > + > > > > > + if (!visible) > > > > > + return intel_primary_plane_disable(plane); > > > > = > > > > Here we unpin the old fb... > > > > = > > > > > + > > > > > + /* > > > > > + * If the CRTC isn't enabled, we're just pinning the framebuffe= r, > > > > > + * updating the fb pointer, and returning without touching the > > > > > + * hardware. This allows us to later do a drmModeSetCrtc with = fb=3D-1 to > > > > > + * turn on the display with all planes setup as desired. > > > > > + */ > > > > > + if (!crtc->enabled) > > > > > + /* Pin and return without programming hardware */ > > > > > + return intel_pin_and_fence_fb_obj(dev, > > > > > + to_intel_framebuffer(fb)->obj, > > > > > + NULL); > > > > = > > > > ...but here we just pin the new fb and leave the old also pinned? > > > > = > > > > Something's a bit fishy here. Also a non-enabled crtc but visible p= rimary > > > > plane doesn't seem to make sense. We also need to remember that set= _base > > > > will always unpin the old_fb. So if something can result in set_base > > > > being called w/ old_fb!=3DNULL when it's not pinned, we'll be in de= ep > > > > doodoo. > > > = > > > Right, I guess we need to unpin the old fb, if any, here as well in c= ase > > > they perform several setplane() calls while the crtc is disabled. > > > = > > > Eventually the crtc will get reenabled by a drmModeSetCrtc call. If = we > > > do setcrtc(fb =3D -1), then it should keep whatever fb we've already > > > pinned via the setplane. If they provide a new fb, then the pinning > > > we're doing here will get unpinned by the set_base that gets called. > > > = > > > I don't see a way that you can hit set_base with an unpinned > > > old_fb!=3DNULL (since the disable plane case farther up also clears > > > primary->fb). > > = > > But it doesn't. > > = > = > Ah, you're right. I was conflating explicit disables (fb=3D0) with > implicit disables (clipped to invisible). I think the v7 I just sent > should handle this properly...for the implicit disable case we leave the > fb pinned and pointed to by primary->fb. So when we switch to another > fb (or explicitly disable with fb=3D0), we should unpin it properly. Do we have proper coverage for this fun in our primary plane helper tests? This is the kind of complexity that freaks me out ;-) -Daniel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch