From patchwork Mon Jan 22 10:35:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125389 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1081304ljf; Mon, 22 Jan 2018 02:36:51 -0800 (PST) X-Google-Smtp-Source: AH8x224zo6maZt+3VoIqjrOzIQZ0SsHLyop9ph2AgxtYt6grf4j6JBE5gvNXig9V1gQMr5J5lL3b X-Received: by 10.98.58.5 with SMTP id h5mr7983985pfa.169.1516617411273; Mon, 22 Jan 2018 02:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516617411; cv=none; d=google.com; s=arc-20160816; b=HLEbDVj/E6ET9XVM+4zGJcgjXJTRHuT8pJAeP2mMsaJQBrGgmZrBFE5aEDdIm6D/Rz 0OP62E9kptdGCgrDcNXw2qVazWv4WtnmhfAtn7CSnR1Ou9M9SZBF/txG9YtC+6qAYWgZ gn1CUUvHCd1PwT90wIA5f0b3+zXVHCNJPots90eqxiUQufRQ6FsxMXTDq8E2BMZutv6M cJ/YC3xwN49YRBo/y1CdLMHpM4swaT0VbZUVMkJqg7swq4bjerj9xxnFWiGnn28KAm7U rN26/8QpY6hANo6bXHsZeMyPhvck1iiLq0Po+hL6h0IdbinvsA4Zn4lggNsABPDwBOxQ XVLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=iO1qxDrIAL8Bov42eGg65pozCQIoSne9n7PZqDJqza8=; b=gt3iu0OKIr15IE+oApi2jnKMdfJBbi1u+RT74YLTsENW/XOmfDZpnkUl6d9yDwtEqx hJH7UOLp3hRX80XJr9LCnCDqU5vriMqt0Ju3WOlVoxtfWxSqkblLb8NltLoObvYfwdtF cNUYbDxyHoAkLwQEs7CPQNICl9msqEgIZnUhYvcYX8GuZbQMyByXTr+jVi0SPSDU6AtA VIG9xkAiVOj0Fn6RJjLk/GiUJQhkByFmzivjh+kexplpZR3HWJ+VCzdLRFpq0JS1OJJK oa8w5O7CdAMx3qKpAbfic8EKh16gXgdR8LiU0sD8J/+jZcLE7tEGu8sBEKYcNFvztw4k tc7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r16si15291899pfe.369.2018.01.22.02.36.51; Mon, 22 Jan 2018 02:36:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751477AbeAVKgt (ORCPT + 28 others); Mon, 22 Jan 2018 05:36:49 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:46570 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbeAVKgV (ORCPT ); Mon, 22 Jan 2018 05:36:21 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 9626A207F3; Mon, 22 Jan 2018 11:36:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id F017620724; Mon, 22 Jan 2018 11:35:55 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , daniel.vetter@intel.com, jani.nikula@linux.intel.com, seanpaul@chromium.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl Subject: [PATCH v2 14/19] drm/sun4i: backend: Add support for zpos Date: Mon, 22 Jan 2018 11:35:43 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Our various planes have a configurable zpos, that combined with the pipes allow to configure the composition. Since the interaction between the pipes, zpos and alphas framebuffers are not trivials, let's just enable the zpos as an immutable property for now, and use that zpos in our atomic_update part. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.c | 15 +++++++++++++++ drivers/gpu/drm/sun4i/sun4i_backend.h | 2 ++ drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 ++++ drivers/gpu/drm/sun4i/sun4i_layer.c | 3 +++ 4 files changed, 24 insertions(+) -- git-series 0.9.1 Reviewed-by: Chen-Yu Tsai diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index a18c86a15748..c4986054909b 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -272,6 +272,21 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend, return 0; } +int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, int layer, + struct drm_plane *plane) +{ + struct drm_plane_state *state = plane->state; + unsigned int priority = state->normalized_zpos; + + DRM_DEBUG_DRIVER("Setting layer %d priority to %d\n", layer, priority); + + regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_ATTCTL_REG0(layer), + SUN4I_BACKEND_ATTCTL_REG0_LAY_PRISEL_MASK, + SUN4I_BACKEND_ATTCTL_REG0_LAY_PRISEL(priority)); + + return 0; +} + static bool sun4i_backend_plane_uses_scaler(struct drm_plane_state *state) { u16 src_h = state->src_h >> 16; diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h index 1ca8b7db6807..04a4f11b87a8 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.h +++ b/drivers/gpu/drm/sun4i/sun4i_backend.h @@ -182,5 +182,7 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend, int layer, struct drm_plane *plane); int sun4i_backend_update_layer_frontend(struct sun4i_backend *backend, int layer, uint32_t in_fmt); +int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, + int layer, struct drm_plane *plane); #endif /* _SUN4I_BACKEND_H_ */ diff --git a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c index e68004844abe..5b3986437a50 100644 --- a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c +++ b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c @@ -35,6 +35,10 @@ static int sun4i_de_atomic_check(struct drm_device *dev, if (ret) return ret; + ret = drm_atomic_normalize_zpos(dev, state); + if (ret) + return ret; + return drm_atomic_helper_check_planes(dev, state); } diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index 03549646528a..fbf25d59cf88 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -115,6 +115,7 @@ static void sun4i_backend_layer_atomic_update(struct drm_plane *plane, } sun4i_backend_update_layer_coord(backend, layer->id, plane); + sun4i_backend_update_layer_zpos(backend, layer->id, plane); sun4i_backend_layer_enable(backend, layer->id, true); } @@ -237,6 +238,8 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm, return ERR_CAST(layer); }; + drm_plane_create_zpos_immutable_property(&layer->plane, i); + DRM_DEBUG_DRIVER("Assigning %s plane to pipe %d\n", i ? "overlay" : "primary", plane->pipe); regmap_update_bits(engine->regs, SUN4I_BACKEND_ATTCTL_REG0(i),