From patchwork Wed Feb 28 16:50:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 130012 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp1754516edc; Wed, 28 Feb 2018 08:51:12 -0800 (PST) X-Google-Smtp-Source: AH8x226vYkutrHVFS20DECpaV1nZ+fhCB5oXgzwpQiYQM5UzHXkkSyhWk0chgkmaQZ/rdLlyJRNs X-Received: by 2002:a17:902:4222:: with SMTP id g31-v6mr18164141pld.335.1519836672395; Wed, 28 Feb 2018 08:51:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519836672; cv=none; d=google.com; s=arc-20160816; b=E5+DJzHTFG8PCr9kvxBaP6fKbaEz+d+9oCvqpoP5xxWzRGVUwAC5vlpWUg2cRU5lQT sYCHbf5MoSth2vejupxLJVR6b/tEm4QoKE26Y2xRzBReVlqlShpt+CFLaqWerXh1Aps8 U3wwGnG4v9sCbYARw7CyXWfiJcQ1a2/xwCcH5Ah7x4/6yZFPVy7ss4oPyGfzh1pWuwae jJkHPTrxGY89hyQyklvycteqdqXlr8JMWXvv38B5IDk8Ojj1z3A+W/79Rwg5bBXTL/oY C+O0QLMRjeCB1Rne+uj5r+Hz6qmzo374TT2/vJ82tWClRLVeh8wcx8/+wteztDO9mIlq uU1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:delivered-to:arc-authentication-results; bh=dSWhUhlWlFKNW2V1akK2yLwbH/cjhlixaXG3Fp3i32g=; b=CudB6jg+Q9wQ8h6tYNIzi1mcDgBhBrRTExDgR1Fmot0noFiAza290EfZFqkynOaK7l /E/JSvd/JD3MOlwQ+K23x0ncJpdc8lncp3J6shzO3HV7EhOSLFL+Ch27ivqTBEXTq8Wh KZMoHXeh+8haoaOOnQ+gin5K98LnHgwUawXv8nAdMLJcY8TkHzyBCWkfI/gOHDS1HyVM yJVfiNig9tbwcOWSuX+GXHL/NPv3uuJEMBSOlrqqOVstVMenMW3f95M4qkOsHOoloR6S eCZmIcqmtFcYLDk46KxOOKsuFPfhUNPTfytLn3gCCn6rm2Gcp6hRiPp+g/Uy7dad4IX7 73Gg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u64si1240362pgc.295.2018.02.28.08.51.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 08:51:12 -0800 (PST) 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 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B5B56EACF; Wed, 28 Feb 2018 16:51:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 14F006EAD3 for ; Wed, 28 Feb 2018 16:51:07 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.15]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w1SGovZF010975; Wed, 28 Feb 2018 16:50:59 GMT From: Liviu Dudau To: DRI-devel Subject: [PATCH v6 3/3] drm: writeback: Add client capability for exposing writeback connectors Date: Wed, 28 Feb 2018 16:50:57 +0000 Message-Id: <20180228165057.26856-4-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180228165057.26856-1-Liviu.Dudau@arm.com> References: <20180228165057.26856-1-Liviu.Dudau@arm.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , LKML , Boris Brezillon , Mali DP Maintainers , Liviu Dudau MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Due to the fact that writeback connectors behave in a special way in DRM (they always report being disconnected) we might confuse some userspace. Add a client capability for writeback connectors that will filter them out for clients that don't understand the capability. Re-requested-by: Sean Paul Cc: Brian Starkey Signed-off-by: Liviu Dudau --- drivers/gpu/drm/drm_ioctl.c | 5 +++++ drivers/gpu/drm/drm_mode_config.c | 5 +++++ include/drm/drm_file.h | 7 +++++++ include/uapi/drm/drm.h | 9 +++++++++ 4 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 02ffa0e8d77b..48895a469963 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -322,6 +322,11 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv) file_priv->atomic = req->value; file_priv->universal_planes = req->value; break; + case DRM_CLIENT_CAP_WRITEBACK_CONNECTORS: + if (!file_priv->atomic || !drm_core_check_feature(dev, DRIVER_ATOMIC)) + return -EINVAL; + file_priv->writeback_connectors = req->value; + break; default: return -EINVAL; } diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index e5c653357024..21e353bd3948 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -145,6 +145,11 @@ int drm_mode_getresources(struct drm_device *dev, void *data, count = 0; connector_id = u64_to_user_ptr(card_res->connector_id_ptr); drm_for_each_connector_iter(connector, &conn_iter) { + /* only expose writeback connectors if userspace understands them */ + if (!file_priv->writeback_connectors && + (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)) + continue; + if (drm_lease_held(file_priv, connector->base.id)) { if (count < card_res->count_connectors && put_user(connector->base.id, connector_id + count)) { diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index 5176c3797680..2a09b3c8965c 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -181,6 +181,13 @@ struct drm_file { /** @atomic: True if client understands atomic properties. */ unsigned atomic:1; + /** + * @writeback_connectors: + * + * True if client understands writeback connectors + */ + unsigned writeback_connectors:1; + /** * @is_master: * diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 6fdff5945c8a..59f27ea928b4 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -680,6 +680,15 @@ struct drm_get_cap { */ #define DRM_CLIENT_CAP_ATOMIC 3 +/** + * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS + * + * If set to 1, the DRM core will expose special connectors to be used for + * writing back to memory the scene setup in the commit. Depends on client + * also supporting DRM_CLIENT_CAP_ATOMIC + */ +#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 4 + /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { __u64 capability;