From patchwork Thu Apr 20 09:13:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 97728 Delivered-To: patch@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp629079obc; Thu, 20 Apr 2017 02:14:20 -0700 (PDT) X-Received: by 10.99.119.195 with SMTP id s186mr7049229pgc.179.1492679660902; Thu, 20 Apr 2017 02:14:20 -0700 (PDT) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id i194si5755117pgd.257.2017.04.20.02.14.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Apr 2017 02:14:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A43D06E366; Thu, 20 Apr 2017 09:14:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 520636E35C for ; Thu, 20 Apr 2017 09:14:11 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OOP00NI2AZK3920@mailout4.w1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 20 Apr 2017 10:14:08 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170420091407eucas1p12dea025d96097894d93b5d58af306155~3EDs0qven0631506315eucas1p13; Thu, 20 Apr 2017 09:14:07 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id C4.02.04459.FDB78F85; Thu, 20 Apr 2017 10:14:07 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170420091407eucas1p2da1e16aa00e6d0bf8bd305422c3a9ba9~3EDsKcpYL1335313353eucas1p2V; Thu, 20 Apr 2017 09:14:07 +0000 (GMT) X-AuditID: cbfec7f1-f796e6d00000116b-d1-58f87bdf8c2e Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 0E.69.17452.16C78F85; Thu, 20 Apr 2017 10:16:17 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OOP00DTXAZACLB0@eusync2.samsung.com>; Thu, 20 Apr 2017 10:14:07 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [RFC 2/4] drm: Add support for vendor specific DRM objects with custom properties Date: Thu, 20 Apr 2017 11:13:38 +0200 Message-id: <1492679620-12792-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1492679620-12792-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDIsWRmVeSWpSXmKPExsWy7djP87r3q39EGHw9q2Vxa905VouNM9az WvzfNpHZ4srX92wWk+5PYLGYcX4fk8XaI3fZLZ4v/MFsMWPySzaLttUfWB24PPZ+W8DisXPW XXaP+93HmTz+HWP36NuyitHj8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X7q1n62Lk4hASWMIoceDvc7CEkEATk8TyRdkgNpuAoUTX2y42EFtEwE2i6fBM VhCbWeAck8S9xb4gtrBAjETnpdlgNSwCqhJ3zy9nArF5BTwkZq9fygaxTE7i5LHJYL2cAp4S h88uZoLY5SHRffMU0wRG3gWMDKsYRVJLi3PTc4sN9YoTc4tL89L1kvNzNzECA37bsZ+bdzBe 2hh8iFGAg1GJhzci7XuEEGtiWXFl7iFGCQ5mJRFexfIfEUK8KYmVValF+fFFpTmpxYcYTYGO msgsJZqcD4zGvJJ4QxNDc0tDI2MLC3MjIyVx3pIPV8KFBNITS1KzU1MLUotg+pg4OKUaGCtT 8mK99Te4fJt8fMGG99kXE/++4puaaXj3lmhJhG7NE0bdSwpJySvO39urwPdGuf+hasHsa/yH Gt8bWp1c+E+X1+t8xGWl09fnGBppSEjnfxK6bHc3PWHpHoYMCe18Xr2A1gNXBQ5dLuHbJyCl tbdP90P55EATrbf2GvZrJ25VetuRcpn/kBJLcUaioRZzUXEiAIOOlRmOAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170420091407eucas1p2da1e16aa00e6d0bf8bd305422c3a9ba9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170420091407eucas1p2da1e16aa00e6d0bf8bd305422c3a9ba9 X-RootMTR: 20170420091407eucas1p2da1e16aa00e6d0bf8bd305422c3a9ba9 References: <1492679620-12792-1-git-send-email-m.szyprowski@samsung.com> Cc: Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Tobias Jakobi , Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a DRM_MODE_PROP_VENDOR flag, which allows to create DRM properties for vendor, custom DRM objects. This allows to create OBJECT type properties, which were reserved only for ATOMIC mode sets. This flag is also checked in drm_object_property_get_value() function to let userspace to get default value for such properties instead of calling the atomic path. This change, together with ability of registering custom DRM objects from the device drivers allows exposing some driver specific entities as DRM objects, which can be then queried with standard DRM_IOCTL_MODE_OBJ_GETPROPERTIES and DRM_IOCTL_MODE_GETPROPERTY ioctls. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/drm_mode_object.c | 9 +++++---- drivers/gpu/drm/drm_property.c | 2 +- include/drm/drm_property.h | 7 +++++++ include/uapi/drm/drm_mode.h | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index 052dcabe26af..3cbefc1a7f4c 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c @@ -268,12 +268,13 @@ int drm_object_property_get_value(struct drm_mode_object *obj, { int i; - /* read-only properties bypass atomic mechanism and still store - * their value in obj->properties->values[].. mostly to avoid - * having to deal w/ EDID and similar props in atomic paths: + /* custom vendor or read-only properties bypass atomic mechanism + * and still store their value in obj->properties->values[].. mostly + * to avoid having to deal w/ EDID and similar props in atomic paths: */ if (drm_drv_uses_atomic_modeset(property->dev) && - !(property->flags & DRM_MODE_PROP_IMMUTABLE)) + !(property->flags & + (DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_VENDOR))) return drm_atomic_get_property(obj, property, val); for (i = 0; i < obj->properties->count; i++) { diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index 3e88fa24eab3..a3fd496665de 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -318,7 +318,7 @@ struct drm_property *drm_property_create_object(struct drm_device *dev, flags |= DRM_MODE_PROP_OBJECT; - if (WARN_ON(!(flags & DRM_MODE_PROP_ATOMIC))) + if (WARN_ON(!(flags & (DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_VENDOR)))) return NULL; property = drm_property_create(dev, flags, name, 1); diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h index 13e8c17d1c79..d9a3d6450ffe 100644 --- a/include/drm/drm_property.h +++ b/include/drm/drm_property.h @@ -152,6 +152,13 @@ struct drm_property { * properties. This is generally used to expose probe state to * usersapce, e.g. the EDID, or the connector path property on DP * MST sinks. + * + * DRM_MODE_PROP_VENDOR + * Set for vendor specific properties, for non-modeset vendor + * specific objects, which can be accessed by + * DRM_IOCTL_MODE_GETPROPERTY and DRM_IOCTL_MODE_OBJ_GETPROPERTIES, + * properties are not exposed to legacy userspace. + * */ uint32_t flags; diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 8c67fc03d53d..2100afc1328a 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -322,6 +322,7 @@ struct drm_mode_get_connector { * witout being aware that this could be triggering a lengthy modeset. */ #define DRM_MODE_PROP_ATOMIC 0x80000000 +#define DRM_MODE_PROP_VENDOR 0x40000000 struct drm_mode_property_enum { __u64 value;