Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp16752893ybl; Wed, 1 Jan 2020 12:49:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyf1G5KDcQSvq5zLxBk9UzUDEvJYD1u0hlCrFxDHO9cd81GYoBJDcimf9RBjGLZnHLVdV71 X-Received: by 2002:a9d:133:: with SMTP id 48mr85414273otu.15.1577911778955; Wed, 01 Jan 2020 12:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577911778; cv=none; d=google.com; s=arc-20160816; b=FuKzSaGUYj5xstxK57JkdAzWzGXiYyojExZVDtac6RBlhoylK6wQnOqA1g3xbPa2Jp 3eWHchSuhXMvZKSK8TxJjZOWRfQ1bRUmw+a+9QMkO7dAW5nrMweUcin9G3ZZUjIAYjPL pqs4rKnURRQLNto3gnzaKfv63eGAV7nTfDwasjfr9etDmjrtRVo/UruF2NlsjtP/3fej 8IYBjlqjnJ1yL+Y1kzFDy1zJasTlUPXhHmxMMIqxpXEdObulX4xFel38s5HIUGukFNrb 3YMVSqOF83gvruY+Y9Q0ixyQIezmNTJEAKu61Ol4RwAgEoxXfrBo5yANXyPJ5crNz2fR qzYw== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=2SofJSOHMh3xU8jt0Vq5SjDaM8NbyGjoDZ2alxMEzaI=; b=AG6n1B3gevtu4QRv4PN976pQovyeanM+gk7/EnIAsFyecs8KXs2TUn2zSiUlu3I6gk sjPHYVBoxPfStpTsUhcFz2qW6TsnunFxaVsoJpwZaEo8szOc9EXT7oYC6AAOatTptM2e 9Od5lW3qu9MxKygGLzRGI8fwUyEDEJEckFgfd8apolCGXxq/8PBkfVCH5wELCXPL2VUV SbZbaZKeWrfu5pYWOsaQm2LIu3sMKNfEQy+BuT5mCIj6NbiXNhgzpGdivMdeey3qyQp+ 6leBMZmLHnJWaWiK2JKoA3fHlZoZR/1Iye5VQbbN7bkUiGqYu4mz6fiqTWb1mwvkHu3p BjiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@globallogic.com header.s=google header.b="TkDoA/GO"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=globallogic.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si25766950otk.251.2020.01.01.12.49.27; Wed, 01 Jan 2020 12:49:38 -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; dkim=pass header.i=@globallogic.com header.s=google header.b="TkDoA/GO"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=globallogic.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727348AbgAAUsO (ORCPT + 99 others); Wed, 1 Jan 2020 15:48:14 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39287 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727207AbgAAUsO (ORCPT ); Wed, 1 Jan 2020 15:48:14 -0500 Received: by mail-pf1-f193.google.com with SMTP id q10so21125109pfs.6 for ; Wed, 01 Jan 2020 12:48:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=globallogic.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2SofJSOHMh3xU8jt0Vq5SjDaM8NbyGjoDZ2alxMEzaI=; b=TkDoA/GOpLilfkhY45zdpROfXwaqSswl3PEiMomaAj61KJ2mPl7mZP4eoYd0D8cMbV koWhIsX4GgD9sXow8D3YnpagmMS9S3Zggr2taw+a4O2OxeMviQfz92w1IbqTFFy9EE07 Xd6LHQKPaDyGI8HHEIlc40SYq797WDKBfXQvtomfv8Zof7+6cTpfDNVexoPuhCYJkTU5 N6yOxF99DsuKns+Xry28KLYRYsFK/Nu5vcbb5xzuwo/UWaij5skCatk8MqZ8dDP/Zhox C0EmJSNdXTEcicCBbKTUWajjMGx9QTZpHpGaJFAmh6JCz2z9mAZJVXD3GcuZf+auztZD Xa8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2SofJSOHMh3xU8jt0Vq5SjDaM8NbyGjoDZ2alxMEzaI=; b=Ryz8rU6LAZlFG4rVzQKtlfZO8XfpBlVb3pW5q5hVvaPqR7RG1NkmK6N/ItW8xLNrJ5 Z+Cv0RPsQ+nHH3ssTo3nnPfLGaZCJnsWkt5E8OpxhuR7lqRFGnbKPxXs8VycdM8/dg0b UdlyU6z3WbyyqYG6PpQw+hrME08wNR/KgZtRJO61YCbEKNi2CSk9KpIlwWF8wS/MgDxU VV5SgNTYNy/QQ2+xnl2m3Ilw6dfen4xnBbQOOwcAJ4NYF0NV61WYXmMaXY20ZYV041WH H8cCJiLzOfJzsVrg0XMxcirYOnq3AKwazqQqhm1hJzUdNQYAEYwZvqnV5lPkqUNAHvL5 J98Q== X-Gm-Message-State: APjAAAX2u3LmNqZUeDOLY4ouYSCk2ju5/tYetTImGRDOQks+BK04NSqS vBIBBWHesRW8mt+cqb19KqxcLA== X-Received: by 2002:a63:2355:: with SMTP id u21mr84065943pgm.179.1577911692958; Wed, 01 Jan 2020 12:48:12 -0800 (PST) Received: from virtualhost-PowerEdge-R810.synapse.com ([195.238.92.107]) by smtp.gmail.com with ESMTPSA id z22sm53774752pfr.83.2020.01.01.12.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jan 2020 12:48:12 -0800 (PST) From: roman.stratiienko@globallogic.com To: mripard@kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jernej.skrabec@siol.net Cc: Roman Stratiienko Subject: [PATCH v3 2/2] drm/sun4i: Use CRTC size instead of PRIMARY plane size as mixer frame. Date: Wed, 1 Jan 2020 22:47:50 +0200 Message-Id: <20200101204750.50541-2-roman.stratiienko@globallogic.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200101204750.50541-1-roman.stratiienko@globallogic.com> References: <20200101204750.50541-1-roman.stratiienko@globallogic.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Stratiienko According to DRM documentation the only difference between PRIMARY and OVERLAY plane is that each CRTC must have PRIMARY plane and OVERLAY are optional. Allow PRIMARY plane to have dimension different from full-screen. Fixes: 5bb5f5dafa1a ("drm/sun4i: Reorganize UI layer code in DE2") Signed-off-by: Roman Stratiienko --- v2: - Split commit in 2 parts - Add Fixes line to the commit message v3: - Address review comments of v2 + removed 3 local varibles - Change 'Fixes' line Since I've put more changes from my side, please review/sign again. --- drivers/gpu/drm/sun4i/sun8i_mixer.c | 28 ++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 30 -------------------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index 8b803eb903b8..658cf442c121 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -257,6 +257,33 @@ const struct de2_fmt_info *sun8i_mixer_format_info(u32 format) return NULL; } +static void sun8i_mode_set(struct sunxi_engine *engine, + struct drm_display_mode *mode) +{ + u32 size = SUN8I_MIXER_SIZE(mode->crtc_hdisplay, mode->crtc_vdisplay); + struct sun8i_mixer *mixer = engine_to_sun8i_mixer(engine); + u32 bld_base = sun8i_blender_base(mixer); + u32 val; + + DRM_DEBUG_DRIVER("Mode change, updating global size W: %u H: %u\n", + mode->crtc_hdisplay, mode->crtc_vdisplay); + regmap_write(mixer->engine.regs, SUN8I_MIXER_GLOBAL_SIZE, size); + regmap_write(mixer->engine.regs, + SUN8I_MIXER_BLEND_OUTSIZE(bld_base), size); + + if (mode->flags & DRM_MODE_FLAG_INTERLACE) + val = SUN8I_MIXER_BLEND_OUTCTL_INTERLACED; + else + val = 0; + + regmap_update_bits(mixer->engine.regs, + SUN8I_MIXER_BLEND_OUTCTL(bld_base), + SUN8I_MIXER_BLEND_OUTCTL_INTERLACED, + val); + DRM_DEBUG_DRIVER("Switching display mixer interlaced mode %s\n", + val ? "on" : "off"); +} + static void sun8i_mixer_commit(struct sunxi_engine *engine) { DRM_DEBUG_DRIVER("Committing changes\n"); @@ -310,6 +337,7 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm, static const struct sunxi_engine_ops sun8i_engine_ops = { .commit = sun8i_mixer_commit, .layers_init = sun8i_layers_init, + .mode_set = sun8i_mode_set, }; static struct regmap_config sun8i_mixer_regmap_config = { diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c index 4343ea9f8cf8..f01ac55191f1 100644 --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c @@ -120,36 +120,6 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel, insize = SUN8I_MIXER_SIZE(src_w, src_h); outsize = SUN8I_MIXER_SIZE(dst_w, dst_h); - if (plane->type == DRM_PLANE_TYPE_PRIMARY) { - bool interlaced = false; - u32 val; - - DRM_DEBUG_DRIVER("Primary layer, updating global size W: %u H: %u\n", - dst_w, dst_h); - regmap_write(mixer->engine.regs, - SUN8I_MIXER_GLOBAL_SIZE, - outsize); - regmap_write(mixer->engine.regs, - SUN8I_MIXER_BLEND_OUTSIZE(bld_base), outsize); - - if (state->crtc) - interlaced = state->crtc->state->adjusted_mode.flags - & DRM_MODE_FLAG_INTERLACE; - - if (interlaced) - val = SUN8I_MIXER_BLEND_OUTCTL_INTERLACED; - else - val = 0; - - regmap_update_bits(mixer->engine.regs, - SUN8I_MIXER_BLEND_OUTCTL(bld_base), - SUN8I_MIXER_BLEND_OUTCTL_INTERLACED, - val); - - DRM_DEBUG_DRIVER("Switching display mixer interlaced mode %s\n", - interlaced ? "on" : "off"); - } - /* Set height and width */ DRM_DEBUG_DRIVER("Layer source offset X: %d Y: %d\n", state->src.x1 >> 16, state->src.y1 >> 16); -- 2.17.1