From patchwork Thu Dec 21 12:11:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 10127567 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 52F416019C for ; Thu, 21 Dec 2017 12:11:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4646C285A5 for ; Thu, 21 Dec 2017 12:11:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37F9A29C27; Thu, 21 Dec 2017 12:11:13 +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=-3.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, FUZZY_AMBIEN, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 C2019285A5 for ; Thu, 21 Dec 2017 12:11:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4528D6E61C; Thu, 21 Dec 2017 12:11:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 57A666E61C for ; Thu, 21 Dec 2017 12:11:10 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id vBLCB6n3011759; Thu, 21 Dec 2017 06:11:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513858266; bh=yLajs13RMkwIIZMcjSWraPCgYZmS+697eVAibjkJNAI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=op20SQ3eEx2qYLSRcjFPLRot9xPwCVsfiD85gGstKPE3FzAjzNMBrJYYz5ZZTI0dq 6q7kNrwLQFo9faFf7xvnYoQBe0ItmEIitHL8ShVaAyXENTOK6NoRupiO0VvyweWU9V uSsZWIbVzO10lF6YS0ClmMWt+LDXp1JAv+Uir+So= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBLCB6vK024576; Thu, 21 Dec 2017 06:11:06 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Thu, 21 Dec 2017 06:11:05 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Thu, 21 Dec 2017 06:11:06 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBLCB1mK017217; Thu, 21 Dec 2017 06:11:04 -0600 From: Peter Ujfalusi To: , Subject: [PATCH 1/2] drm/blend: Account also the primary plane of the crtc for normalized_zpos Date: Thu, 21 Dec 2017 14:11:00 +0200 Message-ID: <20171221121101.29161-2-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171221121101.29161-1-peter.ujfalusi@ti.com> References: <20171221121101.29161-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: airlied@linux.ie, jsarha@ti.com, dri-devel@lists.freedesktop.org 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 Make sure that the primary plane will get normalized_zpos=0 if it's zpos is set to 0, avoiding other planes to be placed in the background. If user space wants to move the primary plane forward, it can set the zpos of the plane. Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/drm_blend.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index 4c62dff14893..bdc4f714afb8 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -301,7 +301,11 @@ static int drm_atomic_state_zpos_cmp(const void *a, const void *b) const struct drm_plane_state *sa = *(struct drm_plane_state **)a; const struct drm_plane_state *sb = *(struct drm_plane_state **)b; - if (sa->zpos != sb->zpos) + if (sa->plane == sa->crtc->primary && sa->zpos == 0) + return -1; + else if (sb->plane == sb->crtc->primary && sb->zpos == 0) + return 1; + else if (sa->zpos != sb->zpos) return sa->zpos - sb->zpos; else return sa->plane->base.id - sb->plane->base.id;