From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH v2 3/6] drm/i915: Implement LRI based FBC tracking Date: Wed, 6 Nov 2013 19:51:14 +0200 Message-ID: <20131106175114.GH5986@intel.com> References: <20131106160629.GA26123@nuc-i3427.alporthouse.com> <1383758605-21440-1-git-send-email-ville.syrjala@linux.intel.com> <20131106173601.GB26123@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E209F0735 for ; Wed, 6 Nov 2013 09:51:17 -0800 (PST) Content-Disposition: inline In-Reply-To: <20131106173601.GB26123@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Wed, Nov 06, 2013 at 05:36:01PM +0000, Chris Wilson wrote: > On Wed, Nov 06, 2013 at 07:23:25PM +0200, ville.syrjala@linux.intel.com w= rote: > > +bool intel_fb_obj_has_fbc(struct drm_i915_gem_object *obj) > > +{ > > + struct drm_device *dev =3D obj->base.dev; > > + struct drm_i915_private *dev_priv =3D dev->dev_private; > > + struct drm_crtc *crtc; > > + > > + /* check for potential scanout */ > > + if (!obj->pin_display) > > + return false; > = > if (dev_oriv->fbc.plane =3D=3D -1) > return false; > = > crtc =3D dev_priv->plane_to_crtc[dev_priv->fbc.plane]; > = > mutex_lock(&crtc->mutex); > has_fbc =3D crtc->fb && to_intel_framebuffer(crtc->fb)->obj =3D=3D obj; > mutex_unlock(&crtc->mutex); > = > return has_fbc > } > = > Perhaps? Oh yeah, much nicer. Except now the locking I came up here sucks. Need to rethink that part somehow. Maybe I'll just slap an ACCESS_ONCE(crtc->fb) there. Hmm, but I guess I'd also need to grab a reference to the fb to avoid it disappearing while were looking at it. This is starting to be a bit hairy. So maybe I should just stick our current fbc scanout object to dev_priv->fbc.obj, and update it when doing page flips/modeset. I really didn't want to start messing about with fbc locking but looks like there's no way around it. -- = Ville Syrj=E4l=E4 Intel OTC