From patchwork Thu Oct 25 22:14:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 12527 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6867A23F58 for ; Thu, 25 Oct 2012 22:14:28 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id DA405A1833F for ; Thu, 25 Oct 2012 22:14:27 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so1656077iag.11 for ; Thu, 25 Oct 2012 15:14:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=/rq1DF5zP9Mu3B5m0o286EW8VdkjJUCvwUhFu4/oUX4=; b=gafMq8xYE9fCE/nYqJt/fQoIGcIMRj0Dnm5Siykz00rON6YkV894ssrls86H+8RH9e QhKnw219McQ+Sczzo/VgI0iF0s2UzL3JKgGgRzCywIRGEzHIRNoDYO/X3kei/KxJ+HYw XmEUZH0Hcvt0Q0UcW8oLFE74t/6GGpEdArY3S+LxhoBkrECcLST9H85oHeUz/r32o/iK WSS3b66S0xJffAzfScjjk04quDrxkk+t9pTNGH/QKdOdDkonpCnpYG20PTDh3uoMdUFa Kaha5Qvo5nzwOINxK8Fbwh71H7WEwSeRSdMsQC+vOrFan52quM4RI8yFnAIHnyep54A7 YXfg== Received: by 10.50.168.37 with SMTP id zt5mr152169igb.57.1351203267262; Thu, 25 Oct 2012 15:14:27 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp133697igt; Thu, 25 Oct 2012 15:14:26 -0700 (PDT) Received: by 10.182.154.70 with SMTP id vm6mr17415901obb.50.1351203266116; Thu, 25 Oct 2012 15:14:26 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id d4si20103625obk.7.2012.10.25.15.14.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 25 Oct 2012 15:14:25 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f178.google.com with SMTP id tb18so2560677obb.37 for ; Thu, 25 Oct 2012 15:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=/rq1DF5zP9Mu3B5m0o286EW8VdkjJUCvwUhFu4/oUX4=; b=kDPz0sRHFZ95/GACztoY1tErSXwmRa5r+hat4IL7G+zaIi8M6/KtMYENiDNDf26bA+ 2rdTgKrEiEZAKko/cQwXswwnGf9B5TGIPa0/VDKF3iiAng2Whl/ljNMyl4oWoV7ja5fs Km8zezxJsynJuuwwtwbql+28A9662r2254D/HHx4VsARjPa0qVYNdv9gqve6lbS7dUiA y4GZQ746ZHo3ZbncuyHbbnqcnDi3x2/4gKzwbyyWd0r4cEDhIXb0Js8ntuWvSvCdWG/E 8a99YnQAXWnWog8rKg+0L9JvO5WgEOC+S2nCvUqc4nJDv0v1/xskDAHPrYbXgq39QEQ3 DJhQ== Received: by 10.60.23.199 with SMTP id o7mr16370746oef.20.1351203264597; Thu, 25 Oct 2012 15:14:24 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id k8sm15314261oee.11.2012.10.25.15.14.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 25 Oct 2012 15:14:23 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org Cc: patches@linaro.org, Greg KH , Tomi Valkeinen , Andy Gross , Rob Clark Subject: [PATCH] drm/omap: only advertise rotation prop if supported Date: Thu, 25 Oct 2012 17:14:13 -0500 Message-Id: <1351203253-29142-1-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmgH1Bc6oESZQWhjr8KvmZaR3gTYvc4ocm1NzzuJn2iaHU4sYydjwAOrIErojmqY+uzYBEq From: Rob Clark For hardware that does not have DMM/TILER, there is no rotation, so no point in getting userspace's hopes up. Signed-off-by: Rob Clark --- drivers/staging/omapdrm/omap_drv.c | 27 +++++++++++++++------------ drivers/staging/omapdrm/omap_plane.c | 34 ++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c index 2bf7259..e4f3cd8 100644 --- a/drivers/staging/omapdrm/omap_drv.c +++ b/drivers/staging/omapdrm/omap_drv.c @@ -670,19 +670,22 @@ static void dev_lastclose(struct drm_device *dev) DBG("lastclose: dev=%p", dev); - /* 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); - } + 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); + 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(priv->fbdev); diff --git a/drivers/staging/omapdrm/omap_plane.c b/drivers/staging/omapdrm/omap_plane.c index 4bde639..1b3a9fe 100644 --- a/drivers/staging/omapdrm/omap_plane.c +++ b/drivers/staging/omapdrm/omap_plane.c @@ -416,23 +416,25 @@ void omap_plane_install_properties(struct drm_plane *plane, struct omap_drm_private *priv = dev->dev_private; struct drm_property *prop; - prop = priv->rotation_prop; - if (!prop) { - const struct drm_prop_enum_list props[] = { - { DRM_ROTATE_0, "rotate-0" }, - { DRM_ROTATE_90, "rotate-90" }, - { DRM_ROTATE_180, "rotate-180" }, - { DRM_ROTATE_270, "rotate-270" }, - { DRM_REFLECT_X, "reflect-x" }, - { DRM_REFLECT_Y, "reflect-y" }, - }; - prop = drm_property_create_bitmask(dev, 0, "rotation", - props, ARRAY_SIZE(props)); - if (prop == NULL) - return; - priv->rotation_prop = prop; + if (priv->has_dmm) { + prop = priv->rotation_prop; + if (!prop) { + const struct drm_prop_enum_list props[] = { + { DRM_ROTATE_0, "rotate-0" }, + { DRM_ROTATE_90, "rotate-90" }, + { DRM_ROTATE_180, "rotate-180" }, + { DRM_ROTATE_270, "rotate-270" }, + { DRM_REFLECT_X, "reflect-x" }, + { DRM_REFLECT_Y, "reflect-y" }, + }; + prop = drm_property_create_bitmask(dev, 0, "rotation", + props, ARRAY_SIZE(props)); + if (prop == NULL) + return; + priv->rotation_prop = prop; + } + drm_object_attach_property(obj, prop, 0); } - drm_object_attach_property(obj, prop, 0); prop = priv->zorder_prop; if (!prop) {