From patchwork Wed Sep 14 11:40:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Abriou X-Patchwork-Id: 9331317 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 8A7C2607FD for ; Wed, 14 Sep 2016 12:18:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BF6529D3B for ; Wed, 14 Sep 2016 12:18:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70AC829D4B; Wed, 14 Sep 2016 12:18:56 +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 9AB7C29D3B for ; Wed, 14 Sep 2016 12:18:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED9356E26F; Wed, 14 Sep 2016 12:18:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 2317 seconds by postgrey-1.35 at gabe; Wed, 14 Sep 2016 12:18:49 UTC Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by gabe.freedesktop.org (Postfix) with ESMTPS id 03A676E26F for ; Wed, 14 Sep 2016 12:18:48 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by m0046037.ppops.net (8.16.0.11/8.16.0.11) with SMTP id u8EBZGee017802; Wed, 14 Sep 2016 13:40:09 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-.pphosted.com with ESMTP id 25c7xrtnk1-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 14 Sep 2016 13:40:09 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CA2E23A; Wed, 14 Sep 2016 11:40:07 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 62217120D; Wed, 14 Sep 2016 11:40:07 +0000 (GMT) Received: from localhost (10.201.23.35) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.294.0; Wed, 14 Sep 2016 13:40:07 +0200 From: Vincent Abriou To: Subject: [PATCH] drm/sti: forbid plane on several mixer Date: Wed, 14 Sep 2016 13:40:02 +0200 Message-ID: <1473853202-19430-1-git-send-email-vincent.abriou@st.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.201.23.35] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-14_06:, , signatures=0 Cc: Vincent Abriou , Fabien Dessenne , kernel@stlinux.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When a plane is going to be enabled we re-evaluate the possible crtcs for the associated drm plane. Only the crtc on which the plane should be displayed is considered possible until the plane is disabled. Indeed STI hardware does not allow to dynamically change the plane's crtc/mixer assignment when the plane is in use (gdp is running). Signed-off-by: Vincent Abriou Acked-by: Benjamin Gaignard --- drivers/gpu/drm/sti/sti_gdp.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_plane.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 3fc62c1..f7cd671 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -71,6 +71,9 @@ static struct gdp_format_to_str { #define GDP_NODE_NB_BANK 2 #define GDP_NODE_PER_FIELD 2 +#define MAIN_CRTC_MASK BIT(0) +#define AUX_CRTC_MASK BIT(1) + struct sti_gdp_node { u32 gam_gdp_ctl; u32 gam_gdp_agc; @@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, } } + /* re-evaluate the possible crtcs */ + if (mixer->id == STI_MIXER_MAIN) + drm_plane->possible_crtcs = MAIN_CRTC_MASK; + else + drm_plane->possible_crtcs = AUX_CRTC_MASK; + DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n", crtc->base.id, sti_mixer_to_str(mixer), drm_plane->base.id, sti_plane_to_str(plane)); @@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane, { struct sti_plane *plane = to_sti_plane(drm_plane); + /* restore possible crtcs value with the initial value */ + drm_plane->possible_crtcs = plane->init_possible_crtcs; + if (!drm_plane->crtc) { DRM_DEBUG_DRIVER("drm plane:%d not enabled\n", drm_plane->base.id); @@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev, sti_gdp_init(gdp); + /* store the initial value of possible crtcs */ + gdp->plane.init_possible_crtcs = possible_crtcs; + res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, possible_crtcs, &sti_gdp_plane_helpers_funcs, diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h index ce3e8d6..70c5312 100644 --- a/drivers/gpu/drm/sti/sti_plane.h +++ b/drivers/gpu/drm/sti/sti_plane.h @@ -66,12 +66,14 @@ struct sti_fps_info { * @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane + * @init_possile_crtcs: store the initial possible crtc value * @fps_info: frame per second info */ struct sti_plane { struct drm_plane drm_plane; enum sti_plane_desc desc; enum sti_plane_status status; + u32 init_possible_crtcs; struct sti_fps_info fps_info; };