Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp775593imm; Wed, 23 May 2018 05:28:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZps0AxehuZLzGcY0F4N4KVRhVcliFVC/uywhXTG/8YvP7CTFzr8WBPffCtLiEw+PIMCoqOG X-Received: by 2002:a17:902:1c8:: with SMTP id b66-v6mr2725876plb.156.1527078532278; Wed, 23 May 2018 05:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527078532; cv=none; d=google.com; s=arc-20160816; b=PqzH2SAPWkrDSm7PTw/TBsrhVn5kS6/bD5ZIXbR3+4CM/fdGK8SPnw5s7eoUA8vsDL Dox0FBNv0rp2D8KIr1eVTi4YRcuWDY/X8KfSEMZV2aNSU05+nbJ7WxS+qvwyvGFfen0Q KKM4WkaIKXYAevwTXtgl2doQvFxOasBEuJsNQFY3UwtTlj3YuVesk4nh2/XdKVAsn3KA 3ql5uud3a9TrYGpPFwecirYaU6PqLYJgkcGCGSPQJ3qDnnSm0Fbxp1y84tYy8IcxlbNx 2+Ko3u31ToOPjRyL95ogfSrYxT7t8UIv3aCGxkVGeb9hV01u/2jXj1E9R2jZD6lmDSwo mwnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=s6eC8/wMS0UEi3FJfCTtkBH8Ayh5oLEim2TVtLl44fU=; b=AgkMDebtNfz8WVprO+CmxzVqvUxmPRE68Yp8OLCXUQkrzzjeZA0pK52PzFRSjutVLo yzxFA5dB3K9nR5dACz4QW237s13A9EBpul4BprUvThW1e5c6jXzHKrEKedOVTZmMzqfA +gbQdD0pvd+l1TL0UicOI64ErSibXgzMWJm0/zjd8IVHMvSIzhVL75m0r6ODUlFfttj6 cTgUuY6eyrMWFGmrpp4eOaDZslOTy+uz3XzlEHjCLoXbk6h1GPWxb5i3H+2SWW19qRvL bYmtuFr9oqD5GKeeUgDGMv3JpwzSCtJLxHTbs+BTIvg0MELYrNP57ekCr6pyZqvwebRA QySg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6-v6si18818058pla.12.2018.05.23.05.28.35; Wed, 23 May 2018 05:28:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932654AbeEWM1W (ORCPT + 99 others); Wed, 23 May 2018 08:27:22 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54496 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932083AbeEWM1T (ORCPT ); Wed, 23 May 2018 08:27:19 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0FECB80D; Wed, 23 May 2018 05:27:19 -0700 (PDT) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B04193F24A; Wed, 23 May 2018 05:27:18 -0700 (PDT) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id 149B26801FA; Wed, 23 May 2018 13:27:17 +0100 (BST) Date: Wed, 23 May 2018 13:27:17 +0100 From: Liviu Dudau To: Maarten Lankhorst Cc: Gustavo Padovan , Sean Paul , Jonathan Corbet , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, David Airlie , Brian Starkey , Alexandru-Cosmin Gheorghe , Eric Anholt , Boris Brezillon , Maxime Ripard , Daniel Stone Subject: Re: [PATCH v8 3/3] drm: writeback: Add client capability for exposing writeback connectors Message-ID: <20180523122716.GF1582@e110455-lin.cambridge.arm.com> References: <20180518151743.29937-1-Liviu.Dudau@arm.com> <20180518151743.29937-4-Liviu.Dudau@arm.com> <7d0201a9-8eed-f332-b6cb-241560cd05c4@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7d0201a9-8eed-f332-b6cb-241560cd05c4@linux.intel.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 23, 2018 at 11:34:32AM +0200, Maarten Lankhorst wrote: > Op 18-05-18 om 17:17 schreef Liviu Dudau: > > 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 | 7 +++++++ > > drivers/gpu/drm/drm_mode_config.c | 5 +++++ > > include/drm/drm_file.h | 7 +++++++ > > include/uapi/drm/drm.h | 9 +++++++++ > > 4 files changed, 28 insertions(+) > > > > diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c > > index af782911c505d..59951ff3e3630 100644 > > --- a/drivers/gpu/drm/drm_ioctl.c > > +++ b/drivers/gpu/drm/drm_ioctl.c > > @@ -325,6 +325,13 @@ 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; > Wondering how you can set the atomic cap without DRIVER_ATOMIC. :) Caps can only be set one at a time. I was trying to cater for the cases where userspace can set the WRITEBACK_CONNECTORS client cap before or after setting the atomic cap. > > That part could be dropped I think. We should probably WARN when trying to create a writeback connector without the DRIVER_ATOMIC cap set. I could still keep the check for file_priv->atomic being set when accepting the DRM_CLIENT_CAP_WRITEBACK_CONNECTORS and would not need a warn. Best regards, Liviu > > + if (req->value > 1) > > + 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 e5c653357024d..21e353bd3948e 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 5176c3797680c..2a09b3c8965c6 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 6fdff5945c8a0..59f27ea928b42 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; > > ~Maarten > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯