From patchwork Thu Feb 15 12:20:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 10221043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA5A06055C for ; Thu, 15 Feb 2018 12:26:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D873229155 for ; Thu, 15 Feb 2018 12:26:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD49A29161; Thu, 15 Feb 2018 12:26:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D2FE29155 for ; Thu, 15 Feb 2018 12:26:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A02CB6E479; Thu, 15 Feb 2018 12:26:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id F05086E479 for ; Thu, 15 Feb 2018 12:26:34 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Feb 2018 04:26:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,517,1511856000"; d="scan'208";a="201347806" Received: from ankit-desktop.iind.intel.com ([10.223.161.14]) by orsmga005.jf.intel.com with ESMTP; 15 Feb 2018 04:26:32 -0800 From: "Nautiyal, Ankit K" To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 5/9] drm: Handle aspect-ratio info in getblob Date: Thu, 15 Feb 2018 17:50:58 +0530 Message-Id: <1518697262-3001-6-git-send-email-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518697262-3001-1-git-send-email-ankit.k.nautiyal@intel.com> References: <1518697262-3001-1-git-send-email-ankit.k.nautiyal@intel.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: Ankit Nautiyal MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Ankit Nautiyal If the user space does not support aspect-ratio, then getblob called with the blob id of a user mode, should clear the aspect ratio information in the blob data. Currently for a given blob id, there is no way to determine if the blob stores user mode or not. This can only be ascertained when the blob is used for an atomic modeset call. This patch: -adds a new field 'is_video_mode' in drm_property_blob to differentiate between the video mode blobs and the other blobs. -sets the field 'is_video_mode' when the blob is used for modeset. -removes the aspect-ratio info from the mode data if aspect ratio is not supported by the user, while returning the blob to the user, in getblob ioctl. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/drm_atomic.c | 1 + drivers/gpu/drm/drm_property.c | 6 ++++++ include/drm/drm_property.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 46733d5..86b483e 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -464,6 +464,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, else if (property == config->prop_mode_id) { struct drm_property_blob *mode = drm_property_lookup_blob(dev, val); + mode->is_video_mode = true; ret = drm_atomic_set_mode_prop_for_crtc(state, mode); drm_property_blob_put(mode); return ret; diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index bae50e6..639787c 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -746,6 +746,12 @@ int drm_mode_getblob_ioctl(struct drm_device *dev, if (!blob) return -ENOENT; + if (blob->is_video_mode && !file_priv->aspect_ratio_allowed) { + struct drm_mode_modeinfo *mode = + (struct drm_mode_modeinfo *) blob->data; + mode->flags &= (~DRM_MODE_FLAG_PIC_AR_MASK); + } + if (out_resp->length == blob->length) { if (copy_to_user(u64_to_user_ptr(out_resp->data), blob->data, diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h index 8a522b4..95e6e32 100644 --- a/include/drm/drm_property.h +++ b/include/drm/drm_property.h @@ -194,6 +194,7 @@ struct drm_property { * @head_global: entry on the global blob list in * &drm_mode_config.property_blob_list. * @head_file: entry on the per-file blob list in &drm_file.blobs list. + * @is_video_mode: flag to mark the blobs that contain drm_mode_modeinfo. * @length: size of the blob in bytes, invariant over the lifetime of the object * @data: actual data, embedded at the end of this structure * @@ -208,6 +209,7 @@ struct drm_property_blob { struct drm_device *dev; struct list_head head_global; struct list_head head_file; + bool is_video_mode; size_t length; unsigned char data[]; };