From patchwork Wed Dec 14 02:19:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 5648 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 BAF4323E19 for ; Wed, 14 Dec 2011 02:19:44 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id A2A04A18011 for ; Wed, 14 Dec 2011 02:19:44 +0000 (UTC) Received: by eaa13 with SMTP id 13so447859eaa.11 for ; Tue, 13 Dec 2011 18:19:44 -0800 (PST) Received: by 10.204.156.208 with SMTP id y16mr131241bkw.72.1323829184412; Tue, 13 Dec 2011 18:19:44 -0800 (PST) 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.205.129.2 with SMTP id hg2cs98703bkc; Tue, 13 Dec 2011 18:19:44 -0800 (PST) Received: by 10.236.176.137 with SMTP id b9mr8347500yhm.33.1323829182403; Tue, 13 Dec 2011 18:19:42 -0800 (PST) Received: from mail-yx0-f178.google.com (mail-yx0-f178.google.com [209.85.213.178]) by mx.google.com with ESMTPS id g7si6042069yba.88.2011.12.13.18.19.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Dec 2011 18:19:42 -0800 (PST) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.213.178 as permitted sender) client-ip=209.85.213.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.213.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by yenm5 with SMTP id m5so282473yen.37 for ; Tue, 13 Dec 2011 18:19:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=Umer8no01bTBf4LzKGv5E2W+/yYQid7R2UH4I6Km/Nc=; b=w/w/UR0fQ/aATDx8pKJ9HvrFtDi8HD8J7FXUeyel+FplL5UtKEe+l7bPY5KxP+Ky7o M4Cq/grK9O/Uh88zhqwTYOKBn5MHLOtZPjcs6mxNTKePesm1FQU2tkODmIWAcCanSQ0i 805nNLxCFRxNK7iLhCcudSsw5OUOehVph61nM= Received: by 10.236.155.40 with SMTP id i28mr8218776yhk.130.1323829181781; Tue, 13 Dec 2011 18:19:41 -0800 (PST) Received: from localhost (ppp-70-253-156-7.dsl.rcsntx.swbell.net. [70.253.156.7]) by mx.google.com with ESMTPS id i32sm2884545anm.6.2011.12.13.18.19.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Dec 2011 18:19:41 -0800 (PST) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, Rob Clark Subject: [PATCH 2/2] drm: add support for private planes Date: Tue, 13 Dec 2011 20:19:36 -0600 Message-Id: <1323829176-4543-2-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1323829176-4543-1-git-send-email-rob.clark@linaro.org> References: <1323829176-4543-1-git-send-email-rob.clark@linaro.org> From: Rob Clark In cases where the scanout hw is sufficiently similar between "overlay" and traditional crtc layers, it might be convenient to allow the driver to create internal drm_plane helper objects used by the drm_crtc implementation, rather than duplicate code between the plane and crtc. A private plane is not exposed to userspace. Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_crtc.c | 22 +++++++++++++++++----- include/drm/drm_crtc.h | 3 ++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 6dad421..d73746e 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -557,7 +557,8 @@ EXPORT_SYMBOL(drm_encoder_cleanup); int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned long possible_crtcs, const struct drm_plane_funcs *funcs, - uint32_t *formats, uint32_t format_count) + const uint32_t *formats, uint32_t format_count, + bool priv) { mutex_lock(&dev->mode_config.mutex); @@ -576,8 +577,16 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, plane->format_count = format_count; plane->possible_crtcs = possible_crtcs; - list_add_tail(&plane->head, &dev->mode_config.plane_list); - dev->mode_config.num_plane++; + /* private planes are not exposed to userspace, but depending on + * display hardware, might be convenient to allow sharing programming + * for the scanout engine with the crtc implementation. + */ + if (!priv) { + list_add_tail(&plane->head, &dev->mode_config.plane_list); + dev->mode_config.num_plane++; + } else { + INIT_LIST_HEAD(&plane->head); + } mutex_unlock(&dev->mode_config.mutex); @@ -592,8 +601,11 @@ void drm_plane_cleanup(struct drm_plane *plane) mutex_lock(&dev->mode_config.mutex); kfree(plane->format_types); drm_mode_object_put(dev, &plane->base); - list_del(&plane->head); - dev->mode_config.num_plane--; + /* if not added to a list, it must be a private plane */ + if (!list_empty(&plane->head)) { + list_del(&plane->head); + dev->mode_config.num_plane--; + } mutex_unlock(&dev->mode_config.mutex); } EXPORT_SYMBOL(drm_plane_cleanup); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index dd55727..1354ef5 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -828,7 +828,8 @@ extern int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned long possible_crtcs, const struct drm_plane_funcs *funcs, - uint32_t *formats, uint32_t format_count); + const uint32_t *formats, uint32_t format_count, + bool private); extern void drm_plane_cleanup(struct drm_plane *plane); extern void drm_encoder_cleanup(struct drm_encoder *encoder);