From patchwork Thu May 17 08:23:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 8703 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9767E23EB5 for ; Thu, 17 May 2012 08:23:56 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4B4BFA186B5 for ; Thu, 17 May 2012 08:23:56 +0000 (UTC) Received: by yenq6 with SMTP id q6so1859944yen.11 for ; Thu, 17 May 2012 01:23:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=jermyrqFsya/6jcjHzVbNYZP+NlEcSilThUSSp0ezPw=; b=cruxlpJBX4pXZvMFBqdluD77cXtb7WL4Xvq0QbWfClGZCigJcDoSwJ0FqWIImaFgu1 hf2k7hpG+Q+A58q6ltZNEo45iwomImDpgiPIKtSAGHLMRRcKyDMesYcMt4OkZ/Ls+02S 4Isdf2HJzL7P1TX/rpEs7GHbPwmmZODFcbnaPYth85/uvmaicxgH3p7glhzK3NQg4CIk fYR+ZG57Vseq4P4d1Z1uRWAb6UL59Ur40kkMr9TZ6BBtp59CjyoMFy8902f6jaaLK+lU WGjErJo140ACHBDE4CntIDTBmeJ30teHNyfsNqqg0YEU+MYJKOpCziEF0CY1nvIvYBAm HQcA== Received: by 10.50.154.169 with SMTP id vp9mr12302239igb.53.1337243035555; Thu, 17 May 2012 01:23:55 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.35.72 with SMTP id o8csp10966ibd; Thu, 17 May 2012 01:23:54 -0700 (PDT) Received: by 10.180.103.42 with SMTP id ft10mr7733258wib.18.1337243034278; Thu, 17 May 2012 01:23:54 -0700 (PDT) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id ep5si32366166wib.27.2012.05.17.01.23.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 May 2012 01:23:54 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 74.125.82.50 as permitted sender) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 74.125.82.50 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-wg0-f50.google.com with SMTP id ds11so1593171wgb.31 for ; Thu, 17 May 2012 01:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=jermyrqFsya/6jcjHzVbNYZP+NlEcSilThUSSp0ezPw=; b=O5SXUT+1sX9P6O7u7qKwTubi40DuZBrB+iMZhlViXatg6IyB0s6ab19VJ8Uoi77MY7 QaKy5UENBGwkLAxOkm3YXwEdAQvy8vlJbNoywTqJZemEAc00e9NrrluQj0GAwUrtwR+n xt6wz/LxKbVOWYmScuc6nf9n3kX07tDRRI31f2aPgbMPVHudJUpd7tNIdQ8GxRwZQHcF c3NSNbC9mdrC6NSZEGcV2w96QY0wAv4uz8HZdkBpIrogc+Z5g7ivrytKy4LKDQW5K28z I+k+fXk/WHJqyyVBy8sGyguZzTFvgtt8JAkExIkgV3qsnT9ruCgjVNUW4q71+M2RstsK l9yQ== Received: by 10.216.193.80 with SMTP id j58mr3829504wen.96.1337243033734; Thu, 17 May 2012 01:23:53 -0700 (PDT) Received: from localhost (host-92-29-250-134.as13285.net. [92.29.250.134]) by mx.google.com with ESMTPS id gb9sm2779721wib.8.2012.05.17.01.23.52 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 May 2012 01:23:53 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, Paulo Zanoni , Rob Clark Subject: [PATCH 2/2] drm: add plane properties Date: Thu, 17 May 2012 02:23:27 -0600 Message-Id: <1337243007-27493-3-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1337243007-27493-1-git-send-email-rob.clark@linaro.org> References: <1337243007-27493-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQnuLhwYl3BFfHgi2qAFPHmytbJayfhOnURgFfbJ5QPgZGzc1+xOcxSiI8kQI3nmz2m/0dwE From: Rob Clark The omapdrm driver uses this for setting per-overlay rotation. It is likely also useful for setting YUV->RGB colorspace conversion matrix, etc. Signed-off-by: Rob Clark Reviewed-by: Paulo Zanoni --- v1: original v2: fix codestyle issue drivers/gpu/drm/drm_crtc.c | 19 +++++++++++++++++++ include/drm/drm_crtc.h | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index bf2bb9b..5dcfe4e 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -606,6 +606,7 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, if (ret) goto out; + plane->base.properties = &plane->properties; plane->dev = dev; plane->funcs = funcs; plane->format_types = kmalloc(sizeof(uint32_t) * format_count, @@ -3156,6 +3157,21 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj, return ret; } +static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj, + struct drm_property *property, + uint64_t value) +{ + int ret = -EINVAL; + struct drm_plane *plane = obj_to_plane(obj); + + if (plane->funcs->set_property) + ret = plane->funcs->set_property(plane, property, value); + if (!ret) + drm_object_property_set_value(obj, property, value); + + return ret; +} + int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { @@ -3257,6 +3273,9 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, case DRM_MODE_OBJECT_CRTC: ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value); break; + case DRM_MODE_OBJECT_PLANE: + ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value); + break; } out: diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 9b53c14..0592714 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -608,6 +608,7 @@ struct drm_connector { * @update_plane: update the plane configuration * @disable_plane: shut down the plane * @destroy: clean up plane resources + * @set_property: called when a property is changed */ struct drm_plane_funcs { int (*update_plane)(struct drm_plane *plane, @@ -618,6 +619,9 @@ struct drm_plane_funcs { uint32_t src_w, uint32_t src_h); int (*disable_plane)(struct drm_plane *plane); void (*destroy)(struct drm_plane *plane); + + int (*set_property)(struct drm_plane *plane, + struct drm_property *property, uint64_t val); }; /** @@ -635,6 +639,7 @@ struct drm_plane_funcs { * @enabled: enabled flag * @funcs: helper functions * @helper_private: storage for drver layer + * @properties: property tracking for this plane */ struct drm_plane { struct drm_device *dev; @@ -657,6 +662,8 @@ struct drm_plane { const struct drm_plane_funcs *funcs; void *helper_private; + + struct drm_object_properties properties; }; /**