[Intel-gfx] [PATCH v2 3/6] drm/i915: Implement LRI based FBC tracking

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Nov 6 18:51:14 CET 2013


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 at linux.intel.com wrote:
> > +bool intel_fb_obj_has_fbc(struct drm_i915_gem_object *obj)
> > +{
> > +	struct drm_device *dev = obj->base.dev;
> > +	struct drm_i915_private *dev_priv = dev->dev_private;
> > +	struct drm_crtc *crtc;
> > +
> > +	/* check for potential scanout */
> > +	if (!obj->pin_display)
> > +		return false;
> 
> 	if (dev_oriv->fbc.plane == -1)
> 		return false;
> 
> 	crtc = dev_priv->plane_to_crtc[dev_priv->fbc.plane];
> 
> 	mutex_lock(&crtc->mutex);
> 	has_fbc = crtc->fb && to_intel_framebuffer(crtc->fb)->obj == 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älä
Intel OTC



More information about the Intel-gfx mailing list