[Intel-gfx] [v2 10/11] drm/i915: Add 180 degree primary plane rotation support

Damien Lespiau damien.lespiau at intel.com
Fri Jul 4 16:58:36 CEST 2014


On Fri, Jul 04, 2014 at 03:14:02PM +0530, sonika.jindal at intel.com wrote:
> +static int intel_primary_plane_set_property(struct drm_plane *plane,
> +				    struct drm_property *prop,
> +				    uint64_t val)
> +{
> +	struct drm_device *dev = plane->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_plane *intel_plane = to_intel_plane(plane);
> +	struct intel_crtc *intel_crtc = to_intel_crtc(plane->crtc);
> +	struct drm_crtc *crtc = &intel_crtc->base;
> +	uint64_t old_val;
> +
> +	if (prop == plane->rotation_property) {
> +		/* exactly one rotation angle please */
> +		if (hweight32(val & 0xf) != 1)
> +			return -EINVAL;
> +
> +		old_val = intel_plane->rotation;
> +		intel_plane->rotation = val;
> +
> +		if (intel_crtc->active && intel_crtc->primary_enabled) {
> +			intel_crtc_wait_for_pending_flips(crtc);
> +
> +		/* FBC does not work on some platforms for rotated planes */
> +			if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev)) {
> +				if (dev_priv->fbc.plane == intel_crtc->plane &&
> +					intel_plane->rotation != BIT(DRM_ROTATE_0))
> +					intel_disable_fbc(dev);
> +				/* If rotation was set earlier and new rotation is 0, we might
> +				 * have disabled fbc earlier. So update it now */
> +				else if (intel_plane->rotation == BIT(DRM_ROTATE_0) &&
> +					old_val != BIT(DRM_ROTATE_0))
> +					intel_update_fbc(dev);

I see a intel_update_fbc() called with the struct_mutext lock elsewhere,
don't we need it here as well?

        mutex_lock(&dev->struct_mutex);
        intel_update_fbc(dev);
        mutex_unlock(&dev->struct_mutex);

-- 
Damien



More information about the Intel-gfx mailing list