From patchwork Mon Nov 27 20:57:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 10078055 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 A601A602BD for ; Mon, 27 Nov 2017 20:58:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98E6829060 for ; Mon, 27 Nov 2017 20:58:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DD0529064; Mon, 27 Nov 2017 20:58:29 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 039B429060 for ; Mon, 27 Nov 2017 20:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=AIqC7a+VPVcNdaf8R/KiXyPKbx0vnZm8+Kth6I6Dl6E=; b=au3sssDjEIaUyPlWRgi7mEVAJk VfsTzg2wFzO8aJ9P4E1ISLENtUrp91KJZx95ZsFDwFLNSKZ2knkEZUkjQUymuL9o+h7UYN9t3/Tpc g+wn/ac2PzvHDSHhrVdOvq84a3KrNHEUhvNyzCbe3qkX6ywG20tQfH3YOgzure6e2FFjJ4RbEpp3M qwBEQQO6SK8PfeUbBiRq9unGTw7642giDrU1WsQrHaX7EcvbY+KWyIFnO68TaYfdqohbqc2ZmRzF6 TwU4rKydka4NYnjALPoLAOeS0/b+HW9cB004GIweJWxzO813S481TSzJkJzbZxjczAOAq74HcURso 2vDRtqqQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eJQTy-00018s-Nh; Mon, 27 Nov 2017 20:58:26 +0000 Received: from mailoutvs3.siol.net ([213.250.19.136] helo=mail.siol.net) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eJQTu-0000wH-5K for linux-arm-kernel@lists.infradead.org; Mon, 27 Nov 2017 20:58:25 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 5D8E0521748; Mon, 27 Nov 2017 21:58:03 +0100 (CET) X-Virus-Scanned: amavisd-new at psrvmta09.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta09.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 3L7npzWTSjax; Mon, 27 Nov 2017 21:58:02 +0100 (CET) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 91B8052174A; Mon, 27 Nov 2017 21:58:02 +0100 (CET) Received: from localhost.localdomain (cpe-86-58-68-135.ftth.triera.net [86.58.68.135]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id 35EFC521745; Mon, 27 Nov 2017 21:58:00 +0100 (CET) From: Jernej Skrabec To: maxime.ripard@free-electrons.com Subject: [PATCH 02/17] drm/sun4i: Start using layer id in DE2 driver Date: Mon, 27 Nov 2017 21:57:35 +0100 Message-Id: <20171127205750.19277-3-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171127205750.19277-1-jernej.skrabec@siol.net> References: <20171127205750.19277-1-jernej.skrabec@siol.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171127_125822_661944_BFD75269 X-CRM114-Status: GOOD ( 13.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, wens@csie.org, linux-arm-kernel@lists.infradead.org, icenowy@aosc.io MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Till now, plane selection was hardcoded to first overlay in first UI channel. It turns out that overlays don't fit well in current DRM design, because they can't be blended together or scaled independetly when they are set to same channel. Beause of that, always use only first overlay in each channel. This simplifies things, since layer parameter can be then used as channel selection. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_layer.c | 2 +- drivers/gpu/drm/sun4i/sun8i_mixer.c | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c b/drivers/gpu/drm/sun4i/sun8i_layer.c index 23810ff72684..5b2d45a9db8a 100644 --- a/drivers/gpu/drm/sun4i/sun8i_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c @@ -126,7 +126,7 @@ struct drm_plane **sun8i_layers_init(struct drm_device *drm, return ERR_CAST(layer); }; - layer->id = i; + layer->id = mixer->cfg->vi_num + i; planes[i] = &layer->plane; }; diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index 015943c0ed5a..37eb5f6f8ee8 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -41,11 +41,8 @@ void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer, int layer, bool enable) { u32 val; - /* Currently the first UI channel is used */ - int chan = mixer->cfg->vi_num; - DRM_DEBUG_DRIVER("%sabling layer %d in channel %d\n", - enable ? "En" : "Dis", layer, chan); + DRM_DEBUG_DRIVER("%sabling layer %d\n", enable ? "En" : "Dis", layer); if (enable) val = SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN; @@ -53,17 +50,17 @@ void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer, val = 0; regmap_update_bits(mixer->engine.regs, - SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(layer, 0), SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN, val); if (enable) - val = SUN8I_MIXER_BLEND_PIPE_CTL_EN(chan); + val = SUN8I_MIXER_BLEND_PIPE_CTL_EN(layer); else val = 0; regmap_update_bits(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL, - SUN8I_MIXER_BLEND_PIPE_CTL_EN(chan), val); + SUN8I_MIXER_BLEND_PIPE_CTL_EN(layer), val); } static int sun8i_mixer_drm_format_to_layer(struct drm_plane *plane, @@ -94,8 +91,6 @@ int sun8i_mixer_update_layer_coord(struct sun8i_mixer *mixer, { struct drm_plane_state *state = plane->state; struct drm_framebuffer *fb = state->fb; - /* Currently the first UI channel is used */ - int chan = mixer->cfg->vi_num; DRM_DEBUG_DRIVER("Updating layer %d\n", layer); @@ -107,7 +102,7 @@ int sun8i_mixer_update_layer_coord(struct sun8i_mixer *mixer, state->crtc_h)); DRM_DEBUG_DRIVER("Updating blender size\n"); regmap_write(mixer->engine.regs, - SUN8I_MIXER_BLEND_ATTR_INSIZE(chan), + SUN8I_MIXER_BLEND_ATTR_INSIZE(layer), SUN8I_MIXER_SIZE(state->crtc_w, state->crtc_h)); regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_OUTSIZE, @@ -115,7 +110,7 @@ int sun8i_mixer_update_layer_coord(struct sun8i_mixer *mixer, state->crtc_h)); DRM_DEBUG_DRIVER("Updating channel size\n"); regmap_write(mixer->engine.regs, - SUN8I_MIXER_CHAN_UI_OVL_SIZE(chan), + SUN8I_MIXER_CHAN_UI_OVL_SIZE(layer), SUN8I_MIXER_SIZE(state->crtc_w, state->crtc_h)); } @@ -123,21 +118,21 @@ int sun8i_mixer_update_layer_coord(struct sun8i_mixer *mixer, /* Set the line width */ DRM_DEBUG_DRIVER("Layer line width: %d bytes\n", fb->pitches[0]); regmap_write(mixer->engine.regs, - SUN8I_MIXER_CHAN_UI_LAYER_PITCH(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_PITCH(layer, 0), fb->pitches[0]); /* Set height and width */ DRM_DEBUG_DRIVER("Layer size W: %u H: %u\n", state->crtc_w, state->crtc_h); regmap_write(mixer->engine.regs, - SUN8I_MIXER_CHAN_UI_LAYER_SIZE(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_SIZE(layer, 0), SUN8I_MIXER_SIZE(state->crtc_w, state->crtc_h)); /* Set base coordinates */ DRM_DEBUG_DRIVER("Layer coordinates X: %d Y: %d\n", state->crtc_x, state->crtc_y); regmap_write(mixer->engine.regs, - SUN8I_MIXER_CHAN_UI_LAYER_COORD(chan, layer), + SUN8I_MIXER_BLEND_ATTR_COORD(layer), SUN8I_MIXER_COORD(state->crtc_x, state->crtc_y)); return 0; @@ -150,8 +145,6 @@ int sun8i_mixer_update_layer_formats(struct sun8i_mixer *mixer, struct drm_framebuffer *fb = state->fb; bool interlaced = false; u32 val; - /* Currently the first UI channel is used */ - int chan = mixer->cfg->vi_num; int ret; if (plane->state->crtc) @@ -175,7 +168,7 @@ int sun8i_mixer_update_layer_formats(struct sun8i_mixer *mixer, val <<= SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET; regmap_update_bits(mixer->engine.regs, - SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(layer, 0), SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK, val); return 0; @@ -188,8 +181,6 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer *mixer, struct drm_framebuffer *fb = state->fb; struct drm_gem_cma_object *gem; dma_addr_t paddr; - /* Currently the first UI channel is used */ - int chan = mixer->cfg->vi_num; int bpp; /* Get the physical address of the buffer in memory */ @@ -221,7 +212,7 @@ int sun8i_mixer_update_layer_buffer(struct sun8i_mixer *mixer, DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr); regmap_write(mixer->engine.regs, - SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(layer, 0), lower_32_bits(paddr)); return 0;