From patchwork Thu Sep 27 18:41:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Lespiau X-Patchwork-Id: 1515481 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id B18493FC71 for ; Thu, 27 Sep 2012 18:45:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B102FA030B for ; Thu, 27 Sep 2012 11:45:14 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 02C209E789; Thu, 27 Sep 2012 11:41:20 -0700 (PDT) Received: by wiwc10 with SMTP id c10so876748wiw.0 for ; Thu, 27 Sep 2012 11:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=k+wvO0MQP9dqFs7gzcW2nxTsnkHh4m1a8pxH9qyTASw=; b=CkbuQKnC6WwzeitPsidXbU4XG754dByhOyXUdrCIMYJH/9vJ27hZBaJG1LyJ3AR6gr W1KEtgLyUYmaG7s/mzOPMZSAJ93mfcHrk7MUJtu5omjpI2iuDLyPeg/s+xJO4GcnLcW5 eyQ+vMtZI9uKiwV8+P89rjfI1Z/7KN4mjDiD0OVC8g7CDizr2ea5o1f7AWYv7JdqhkM9 Uzzcd5kY2QbqvInkUh4oZDNIiPmI/3cJROy+DcA/VvN6l4J8Flj7uAYy9GYVbrQFadiD RoDoCyVx+dv2vaIOGj0hSq6fE4Br33nR0cp0E/IsHilN0S0dYI5SszwqEawfNGooIGJj +q9A== Received: by 10.180.78.40 with SMTP id y8mr10167392wiw.7.1348771279931; Thu, 27 Sep 2012 11:41:19 -0700 (PDT) Received: from localhost.localdomain ([83.217.123.106]) by mx.google.com with ESMTPS id q7sm14624516wiy.11.2012.09.27.11.41.18 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 11:41:19 -0700 (PDT) From: Damien Lespiau To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm: Add an "expose 3d modes" property Date: Thu, 27 Sep 2012 19:41:06 +0100 Message-Id: <1348771268-3436-2-git-send-email-damien.lespiau@gmail.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348771268-3436-1-git-send-email-damien.lespiau@gmail.com> References: <1348771268-3436-1-git-send-email-damien.lespiau@gmail.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+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Damien Lespiau The "expose 3D modes" property can be attached to connectors to allow user space to indicate it can deal with 3D modes and that the drm driver should expose those 3D modes. Signed-off-by: Damien Lespiau Reviewed-by: Rodrigo Vivi Tested-by: Rodrigo Vivi --- drivers/gpu/drm/drm_crtc.c | 35 ++++++++++++++++++++++++++++++++++- include/drm/drm_crtc.h | 6 ++++++ include/drm/drm_mode.h | 4 ++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 6fbfc24..10a289c 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -841,6 +841,35 @@ int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes, } EXPORT_SYMBOL(drm_mode_create_tv_properties); +static const struct drm_prop_enum_list expose_3d_modes_list[] = +{ + { DRM_MODE_EXPOSE_3D_MODES_OFF, "Off" }, + { DRM_MODE_EXPOSE_3D_MODES_ON, "On" } +}; + +/** + * drm_mode_create_s3d_properties - create stereo 3D properties + * @dev: DRM device + * + * This functions create properties that are used by the stereo 3D code. Those + * properties must be attached to the desired connectors afterwards. + */ +int drm_mode_create_s3d_properties(struct drm_device *dev) +{ + struct drm_property *prop; + + if (dev->mode_config.s3d_expose_modes_property) + return 0; + + prop = drm_property_create_enum(dev, 0, "expose 3D modes", + expose_3d_modes_list, + ARRAY_SIZE(expose_3d_modes_list)); + dev->mode_config.s3d_expose_modes_property = prop; + + return 0; +} +EXPORT_SYMBOL(drm_mode_create_s3d_properties); + /** * drm_mode_create_scaling_mode_property - create scaling mode property * @dev: DRM device @@ -3170,12 +3199,16 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj, { int ret = -EINVAL; struct drm_connector *connector = obj_to_connector(obj); + struct drm_device *dev = connector->dev; /* Do DPMS ourselves */ - if (property == connector->dev->mode_config.dpms_property) { + if (property == dev->mode_config.dpms_property) { if (connector->funcs->dpms) (*connector->funcs->dpms)(connector, (int)value); ret = 0; + } else if (property == dev->mode_config.s3d_expose_modes_property) { + connector->expose_3d_modes = value; + ret = 0; } else if (connector->funcs->set_property) ret = connector->funcs->set_property(connector, property, value); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index bfacf0d..34372cb 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -578,6 +578,8 @@ struct drm_connector { /* requested DPMS state */ int dpms; + int expose_3d_modes; + void *helper_private; /* forced on connector */ @@ -802,6 +804,9 @@ struct drm_mode_config { struct drm_property *tv_saturation_property; struct drm_property *tv_hue_property; + /* Stereo 3D properties */ + struct drm_property *s3d_expose_modes_property; + /* Optional properties */ struct drm_property *scaling_mode_property; struct drm_property *dithering_mode_property; @@ -950,6 +955,7 @@ extern int drm_property_add_enum(struct drm_property *property, int index, extern int drm_mode_create_dvi_i_properties(struct drm_device *dev); extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, char *formats[]); +extern int drm_mode_create_s3d_properties(struct drm_device *dev); extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); extern int drm_mode_create_dithering_property(struct drm_device *dev); extern int drm_mode_create_dirty_info_property(struct drm_device *dev); diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 3d6301b..45b19c6 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h @@ -83,6 +83,10 @@ #define DRM_MODE_DIRTY_ON 1 #define DRM_MODE_DIRTY_ANNOTATE 2 +/* Expose 3D modes */ +#define DRM_MODE_EXPOSE_3D_MODES_OFF 0 +#define DRM_MODE_EXPOSE_3D_MODES_ON 1 + struct drm_mode_modeinfo { __u32 clock; __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;