From patchwork Fri May 28 20:30:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Stratiienko X-Patchwork-Id: 12287855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 888B0C4708E for ; Sat, 29 May 2021 10:14:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45902610A2 for ; Sat, 29 May 2021 10:14:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45902610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 174746E196; Sat, 29 May 2021 10:14:13 +0000 (UTC) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CD1C6F62A for ; Fri, 28 May 2021 20:31:06 +0000 (UTC) Received: by mail-lf1-x12a.google.com with SMTP id a5so7141210lfm.0 for ; Fri, 28 May 2021 13:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v8xVloNSwUArvoTMkBR5f76XblNpfoHgt5cDxTC0lU8=; b=qmiGFj0YDzYpAbQdR8x5Yzw+RgFdcINbUhgY4M21l4IJXs3PC9WFQmgtnicUC17QC3 tvEQFiPhz/LgUV+zVIz0f9bOc1eLNAqHT9nqdkTw2BKI4riBH5yLSiVtYkgjXJWadpQM eZc5uIH934rlRmuMCTXpUqAmsYEaJqUW3h9grB9YcF9jr4ccC0kfzXMQj8dnmzIwQ7GQ LkhbfM51jjv6rf0ohZQfwv/wd5T8gQlbTXG7M+IjmN4+LR7i0MLmQphbH7MZ3h+sR/Wb Et4zhpi32ekhRkJE3WQ82gV+ZZFhsZrlePlKJwudDsCAKn6tNFacB878DtYadF+U/GZu /1og== 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:mime-version:content-transfer-encoding; bh=v8xVloNSwUArvoTMkBR5f76XblNpfoHgt5cDxTC0lU8=; b=W70H6i8HvETn2IFQNTB0BCs0NqeJW0AVCwDNoCdz4gl0+8O7DEwTSXrUvItwd7aaNA rLJxl3LVdt68ywQ7TjjD447KnVZXXCze4SDQDX/1MWavEzCLjZX7p0DXbE/9pWY3sSEw yQPu8TWFWNmAa+zYNVROOaetYdQ2Z3D+8RazcTC7xDTmgDJxVSTC9ohDvl4ThXw3Ljwc cpkOl3GtMDZdY2cmvV4BzbUWFcB2WUEHW+O+jI0ZSDFKG3lOMsy4Xg27MkOn0VRTB2Dh w0e+zg+JpTH1z1Ni7xJf0IfOHc28/6gHO5Zx6uTHqanMTfa1D9qoKApzKuy65JDLCS6A sfQg== X-Gm-Message-State: AOAM531HXwG4nYXwqHy3Cs5wugKa5LBFP4G2biSHcuOuTjPQOsY8dPQ+ GmAC9lGEknvOXE9iINOUr5Q= X-Google-Smtp-Source: ABdhPJxvftq8FIoOxl5fmCcw1FqBhlWR+H/WUS+YRoLHTZHCt928nPBZeARvGEfkoohxkBgbI7JSYA== X-Received: by 2002:a05:6512:31c2:: with SMTP id j2mr6708560lfe.69.1622233864968; Fri, 28 May 2021 13:31:04 -0700 (PDT) Received: from roman-S500CA.. (72-28-179-94.pool.ukrtel.net. [94.179.28.72]) by smtp.gmail.com with ESMTPSA id a12sm655820ljk.34.2021.05.28.13.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 13:31:04 -0700 (PDT) From: Roman Stratiienko To: linux-kernel@vger.kernel.org Subject: [PATCH v4 2/2] drm/sun4i: Use CRTC size instead of primary plane size as mixer frame Date: Fri, 28 May 2021 23:30:36 +0300 Message-Id: <20210528203036.17999-3-r.stratiienko@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210528203036.17999-1-r.stratiienko@gmail.com> References: <20210528203036.17999-1-r.stratiienko@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 29 May 2021 10:14:11 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: megous@megous.com, jernej.skrabec@siol.net, linux-sunxi@googlegroups.com, dri-devel@lists.freedesktop.org, wens@csie.org, Roman Stratiienko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Fixes corrupted display picture when primary plane isn't full-screen. Signed-off-by: Roman Stratiienko --- 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 5b42cf25cc86..810c731566c0 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -248,6 +248,33 @@ int sun8i_mixer_drm_format_to_hw(u32 format, u32 *hw_format) return -EINVAL; } +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"); @@ -301,6 +328,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 const 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 0db164a774a1..d66fff582278 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);