From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [RFC] drm: implement DRM_IOCTL_MODE_SETROTATION Date: Thu, 05 Jan 2012 16:44:09 +0000 Message-ID: References: <1325780183-23690-1-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1325780183-23690-1-git-send-email-przanoni@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: przanoni@gmail.com, dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org On Thu, 5 Jan 2012 14:16:23 -0200, przanoni@gmail.com wrote: > From: Paulo Zanoni > > 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