[Intel-gfx] [RFC] drm: implement DRM_IOCTL_MODE_SETROTATION

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 5 17:44:09 CET 2012


On Thu,  5 Jan 2012 14:16:23 -0200, przanoni at gmail.com wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
> 
> This ioctl is used to signal the drivers that the screen is rotated,
> not to make the drivers rotate the screen.
>  - add a driver-specific "rotation_set" function
>  - implement Intel's rotation_set by setting the right values to the
>    PIPECONF registers.
> 
> The idea is that when user-space does rotation, it can call this ioctl
> to inform the Kernel that we have a rotation. This feature is needed
> by the KVMr feature of VPro.

I'm interested to see how the fb is laid out in memory and how does this
integrate with mode configuration?

Comment inline.

> +int drm_crtc_rotation_set_ioctl(struct drm_device *dev, void *data,
> +				struct drm_file *file_priv)
> +{
> +	struct drm_mode_crtc_rotation *rotation = data;
> +	struct drm_mode_object *obj;
> +	struct drm_crtc *crtc;
> +	int ret = 0;
> +
> +	DRM_DEBUG_KMS("changing rotation to %d\n", rotation->rotation);
> +
> +	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +		return -EINVAL;
> +
> +	mutex_lock(&dev->mode_config.mutex);
> +	obj = drm_mode_object_find(dev, rotation->crtc_id, DRM_MODE_OBJECT_CRTC);
> +	if (!obj) {
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +	crtc = obj_to_crtc(obj);
> +
> +	if (crtc->funcs->rotation_set)
> +		crtc->funcs->rotation_set(crtc, rotation->rotation);

In the absence of an implementation, return ENOTTY, otherwise return an
error code from crtc->rotation_set(). Then userspace can simply try to
set a rotation or take the same recovery paths for unsupported
configuations/kernels.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list