From patchwork Thu Feb 27 22:14:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 3736441 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 404F69F2F7 for ; Thu, 27 Feb 2014 22:14:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3181420221 for ; Thu, 27 Feb 2014 22:14:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4C8962021C for ; Thu, 27 Feb 2014 22:14:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C6AAFB96E; Thu, 27 Feb 2014 14:14:33 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E091FB96F for ; Thu, 27 Feb 2014 14:14:28 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 27 Feb 2014 14:14:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,557,1389772800"; d="scan'208";a="463720799" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by orsmga001.jf.intel.com with ESMTP; 27 Feb 2014 14:14:24 -0800 Received: from mattrope by mdroper-hswdev with local (Exim 4.80) (envelope-from ) id 1WJ9Ec-0001YC-9o; Thu, 27 Feb 2014 14:15:18 -0800 From: Matt Roper To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] drm: Add plane type property Date: Thu, 27 Feb 2014 14:14:41 -0800 Message-Id: <1393539283-5901-3-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1393539283-5901-1-git-send-email-matthew.d.roper@intel.com> References: <1393539283-5901-1-git-send-email-matthew.d.roper@intel.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a plane type property to allow userspace to distinguish sprite/overlay planes from primary planes. In the future we may extend this to cover cursor planes as well. Signed-off-by: Matt Roper --- drivers/gpu/drm/drm_crtc.c | 32 ++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 1 + include/uapi/drm/drm_mode.h | 3 +++ 3 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 21c6d4b..1032eaf 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -114,6 +114,14 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] = DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list) +static const struct drm_prop_enum_list drm_plane_type_enum_list[] = +{ + { DRM_MODE_PLANE_TYPE_SPRITE, "Sprite" }, + { DRM_MODE_PLANE_TYPE_PRIMARY, "Primary" }, +}; + +DRM_ENUM_NAME_FN(drm_get_plane_type, drm_plane_type_enum_list) + /* * Optional properties */ @@ -1046,6 +1054,10 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, INIT_LIST_HEAD(&plane->head); } + drm_object_attach_property(&plane->base, + dev->mode_config.plane_type_property, + DRM_MODE_PLANE_TYPE_SPRITE); + out: drm_modeset_unlock_all(dev); @@ -1114,6 +1126,10 @@ int drm_plane_set_primary(struct drm_device *dev, struct drm_plane *plane, dev->mode_config.num_primary_plane++; INIT_LIST_HEAD(&plane->head); + drm_object_attach_property(&plane->base, + dev->mode_config.plane_type_property, + DRM_MODE_PLANE_TYPE_PRIMARY); + out: drm_modeset_unlock_all(dev); @@ -1236,6 +1252,21 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev) return 0; } +static int drm_mode_create_standard_plane_properties(struct drm_device *dev) +{ + struct drm_property *type; + + /* + * Standard properties (apply to all planes) + */ + type = drm_property_create_enum(dev, 0, + "TYPE", drm_plane_type_enum_list, + ARRAY_SIZE(drm_plane_type_enum_list)); + dev->mode_config.plane_type_property = type; + + return 0; +} + /** * drm_mode_create_dvi_i_properties - create DVI-I specific connector properties * @dev: DRM device @@ -4211,6 +4242,7 @@ void drm_mode_config_init(struct drm_device *dev) drm_modeset_lock_all(dev); drm_mode_create_standard_connector_properties(dev); + drm_mode_create_standard_plane_properties(dev); drm_modeset_unlock_all(dev); /* Just to be sure */ diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 33a955b..d25cd9c 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -884,6 +884,7 @@ struct drm_mode_config { struct list_head property_blob_list; struct drm_property *edid_property; struct drm_property *dpms_property; + struct drm_property *plane_type_property; /* DVI-I properties */ struct drm_property *dvi_i_subconnector_property; diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index f104c26..c19705b 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -496,4 +496,7 @@ struct drm_mode_destroy_dumb { uint32_t handle; }; +#define DRM_MODE_PLANE_TYPE_SPRITE 0 +#define DRM_MODE_PLANE_TYPE_PRIMARY 1 + #endif