From patchwork Tue Sep 30 12:15:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 5015451 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 816819F348 for ; Thu, 2 Oct 2014 03:58:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A9C72021A for ; Thu, 2 Oct 2014 03:58:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5787320200 for ; Thu, 2 Oct 2014 03:58:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AA686E6ED; Wed, 1 Oct 2014 20:57:34 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 55D686FB62 for ; Tue, 30 Sep 2014 05:15:14 -0700 (PDT) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s8UCFCM9025855; Tue, 30 Sep 2014 07:15:12 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8UCFB2w027160; Tue, 30 Sep 2014 07:15:12 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Tue, 30 Sep 2014 07:15:11 -0500 Received: from [172.22.232.54] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8UCF8q6001004; Tue, 30 Sep 2014 07:15:09 -0500 Message-ID: <542A9ECB.5080506@ti.com> Date: Tue, 30 Sep 2014 15:15:07 +0300 From: Tomi Valkeinen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Daniel Vetter Subject: Re: [PATCH] drm/omap: move rotation property to drm core mode_config References: <1407314424-8573-1-git-send-email-daniel.vetter@ffwll.ch> <542A9709.8070708@ti.com> <20140930114920.GL24667@phenom.ffwll.local> <20140930115205.GM24667@phenom.ffwll.local> In-Reply-To: <20140930115205.GM24667@phenom.ffwll.local> X-Mailman-Approved-At: Tue, 30 Sep 2014 18:09:53 -0700 Cc: Daniel Vetter , DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 30/09/14 14:52, Daniel Vetter wrote: > On Tue, Sep 30, 2014 at 01:49:20PM +0200, Daniel Vetter wrote: >> On Tue, Sep 30, 2014 at 02:42:01PM +0300, Tomi Valkeinen wrote: >>> On 06/08/14 11:40, Daniel Vetter wrote: >>>> This allows us to ditch the driver-private lastclose logic. >>>> >>>> Cc: Tomi Valkeinen >>>> Cc: Rob Clark >>>> Signed-off-by: Daniel Vetter >>>> >>>> -- >>>> >>>> Untested and atm only applies on top of drm-intel-nightly. >>> >>> I could give this a try if you point me to a git tree with the patch. >> >> I should apply on top of drm-next nowadays, prerequisites that went in >> through drm-intel are all merged now. I guess you'll take care of this one >> now? It didn't compile, but it was trivial to fix. And yes, I can pick it to my omapdrm patches, which I guess will be delayed until 3.19. > btw if this works you can drop the entire if (rotation_property) hunk from > lastclose, since the fbdev helper now takes care of this itself: > > commit 3a5f87c286515c54ff5c52c3e64d0c522b7570c0 > Author: Thomas Wood > Date: Wed Aug 20 14:45:00 2014 +0100 > > drm: fix plane rotation when restoring fbdev configuration I updated the patch, with the compile fix and removal of the lastclose stuff. Seems to work fine with a quick test: I exit X (after fiddling with xrandr rotation in there), and I see the rotation property restored to the default value. Tomi From afb37e165010fc5f3db82efdec9b883fb578deac Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Wed, 6 Aug 2014 10:40:24 +0200 Subject: [PATCH] drm/omap: move rotation property to drm core mode_config Move rotation property to drm core mode_config. This allows us to ditch the driver-private lastclose logic. Cc: Rob Clark Signed-off-by: Daniel Vetter Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 4 ++-- drivers/gpu/drm/omapdrm/omap_drv.c | 20 -------------------- drivers/gpu/drm/omapdrm/omap_drv.h | 1 - drivers/gpu/drm/omapdrm/omap_plane.c | 7 ++++--- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 2d28dc337cfb..1240fa61b397 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -385,9 +385,9 @@ static int omap_crtc_set_property(struct drm_crtc *crtc, struct drm_property *property, uint64_t val) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - struct omap_drm_private *priv = crtc->dev->dev_private; + struct drm_device *dev = crtc->dev; - if (property == priv->rotation_prop) { + if (property == dev->mode_config.rotation_property) { crtc->invert_dimensions = !!(val & ((1LL << DRM_ROTATE_90) | (1LL << DRM_ROTATE_270))); } diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 862ba03c236c..282f5ec4f1a2 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -560,8 +560,6 @@ static int dev_open(struct drm_device *dev, struct drm_file *file) */ static void dev_lastclose(struct drm_device *dev) { - int i; - /* we don't support vga-switcheroo.. so just make sure the fbdev * mode is active */ @@ -570,24 +568,6 @@ static void dev_lastclose(struct drm_device *dev) DBG("lastclose: dev=%p", dev); - if (priv->rotation_prop) { - /* need to restore default rotation state.. not sure - * if there is a cleaner way to restore properties to - * default state? Maybe a flag that properties should - * automatically be restored to default state on - * lastclose? - */ - for (i = 0; i < priv->num_crtcs; i++) { - drm_object_property_set_value(&priv->crtcs[i]->base, - priv->rotation_prop, 0); - } - - for (i = 0; i < priv->num_planes; i++) { - drm_object_property_set_value(&priv->planes[i]->base, - priv->rotation_prop, 0); - } - } - ret = drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); if (ret) DBG("failed to restore crtc mode"); diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 60e47b33c801..aa596504e662 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -111,7 +111,6 @@ struct omap_drm_private { bool has_dmm; /* properties: */ - struct drm_property *rotation_prop; struct drm_property *zorder_prop; /* irq handling: */ diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 891a4dc608af..3b5fad2a359c 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -306,7 +306,7 @@ void omap_plane_install_properties(struct drm_plane *plane, struct drm_property *prop; if (priv->has_dmm) { - prop = priv->rotation_prop; + prop = dev->mode_config.rotation_property; if (!prop) { prop = drm_mode_create_rotation_property(dev, BIT(DRM_ROTATE_0) | @@ -317,7 +317,7 @@ void omap_plane_install_properties(struct drm_plane *plane, BIT(DRM_REFLECT_Y)); if (prop == NULL) return; - priv->rotation_prop = prop; + dev->mode_config.rotation_property = prop; } drm_object_attach_property(obj, prop, 0); } @@ -337,9 +337,10 @@ int omap_plane_set_property(struct drm_plane *plane, { struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_drm_private *priv = plane->dev->dev_private; + struct drm_device *dev = omap_plane->base.dev; int ret = -EINVAL; - if (property == priv->rotation_prop) { + if (property == dev->mode_config.rotation_property) { DBG("%s: rotation: %02x", omap_plane->name, (uint32_t)val); omap_plane->win.rotation = val; ret = apply(plane);