Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp207630imk; Sat, 2 Jul 2022 16:14:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s6rN53j7PcdSJiI1lainQEg3qRZWlKZscyKVQSElJJfev1tyXZ/HsF4N6K9eD0qtMFejdC X-Received: by 2002:a17:906:b7c7:b0:722:fce6:4898 with SMTP id fy7-20020a170906b7c700b00722fce64898mr21305224ejb.320.1656803647114; Sat, 02 Jul 2022 16:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656803647; cv=none; d=google.com; s=arc-20160816; b=NoLC4XOfR0ZR3ygdYmHQfei1x9rpd0r4L925IulbcamD9ElR3mdMPFnPaNPQ7cMHRy ueC2748vsjakBlWLpvAI+ymIYwP+jm32s7WcAZ2QGXN4YPLUxu2rJgW1tVbBQO3EWGpt 6wgvLIQJGaFIXxw7kjJZ3SNjMLETA798gAPcRBe+AP2wXB74UkAkN8Bm71vIjok3B+PK beiV+pU24YKLmET47KqWirmPpSIAOk1Rasm5WXKIDNujiiWGAulV5Xfhxys7CLnowIrI 9g+2uXmbEieAtLs9NeFOCv1LDzWrD1dRdRHCkS8jpR5w70BiNXChruYwyQ9vl7Z7tRyY jBMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=92NWIXySgUrbyWE6mJHilDjq0xBHQsBRdrjwPSCu7a4=; b=fStteBrEnR2bRojZGQwKm7tU0d/OkRvBaysTaQSQsf6mzNAyqfe9Baqytm+fSesVQ0 ePkc1unwt+MiNEdxXxyI1WXKRJ9cQU8Ctj/f81Kzky0RUxlnfSwtr9yWMy+gAUs1Nwew aCHtBjYGhaxd/raVPc7Z4kh4chJaCM7vybCBasSxHWsc9LsrLxEduWjC35eKzaOiLoJs c94qEwCj/hHMNyic56az4KlewkWoipP+pXncZ/FdC9nxwbfkP1F7ngY7RanO2geMSRUy bd6mNJWqTLPTRvhetLvRXg91nzxJMh5xtLCyz60Edv3rkK16otoeOVUBWgfZjKBqLWYa AnmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=ORwy4kAl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020a170906341600b007262d20ea72si30182645ejb.179.2022.07.02.16.13.41; Sat, 02 Jul 2022 16:14:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=ORwy4kAl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbiGBXHn (ORCPT + 99 others); Sat, 2 Jul 2022 19:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbiGBXHl (ORCPT ); Sat, 2 Jul 2022 19:07:41 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EBCDBC08; Sat, 2 Jul 2022 16:07:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1656803257; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=92NWIXySgUrbyWE6mJHilDjq0xBHQsBRdrjwPSCu7a4=; b=ORwy4kAlzw9XFRM+JYaY+34fIMbtYbt4Q0GGZp4WE/xCeMWpJRi4ArT50/PT+84EmIfODo d3KnZoD7mBxAtwADAvgBilde8zw8xSMfrNP7jeangftG7/qVpKGZrJsH09BKWgqgcVQWJ+ RFG9zeRzMwxf+k3jWGda6cB3uPDjWXk= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: Sam Ravnborg , linux-mips@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, list@opendingux.net, Christophe Branchereau , Paul Cercueil , stable@vger.kernel.org Subject: [PATCH] drm/ingenic: Use the highest possible DMA burst size Date: Sun, 3 Jul 2022 00:07:27 +0100 Message-Id: <20220702230727.66704-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Until now, when running at the maximum resolution of 1280x720 at 32bpp on the JZ4770 SoC the output was garbled, the X/Y position of the top-left corner of the framebuffer warping to a random position with the whole image being offset accordingly, every time a new frame was being submitted. This problem can be eliminated by using a bigger burst size for the DMA. Set in each soc_info structure the maximum burst size supported by the corresponding SoC, and use it in the driver. Set the new value using regmap_update_bits() instead of regmap_set_bits(), since we do want to override the old value of the burst size. (Note that regmap_set_bits() wasn't really valid before for the same reason, but it never seemed to be a problem). Cc: Fixes: 90b86fcc47b4 ("DRM: Add KMS driver for the Ingenic JZ47xx SoCs") Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 10 ++++++++-- drivers/gpu/drm/ingenic/ingenic-drm.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 2c559885347a..8ad6080b32b2 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -70,6 +70,7 @@ struct jz_soc_info { bool map_noncoherent; bool use_extended_hwdesc; bool plane_f0_not_working; + u32 max_burst; unsigned int max_width, max_height; const u32 *formats_f0, *formats_f1; unsigned int num_formats_f0, num_formats_f1; @@ -319,8 +320,9 @@ static void ingenic_drm_crtc_update_timings(struct ingenic_drm *priv, regmap_write(priv->map, JZ_REG_LCD_REV, mode->htotal << 16); } - regmap_set_bits(priv->map, JZ_REG_LCD_CTRL, - JZ_LCD_CTRL_OFUP | JZ_LCD_CTRL_BURST_16); + regmap_update_bits(priv->map, JZ_REG_LCD_CTRL, + JZ_LCD_CTRL_OFUP | JZ_LCD_CTRL_BURST_MASK, + JZ_LCD_CTRL_OFUP | priv->soc_info->max_burst); /* * IPU restart - specify how much time the LCDC will wait before @@ -1519,6 +1521,7 @@ static const struct jz_soc_info jz4740_soc_info = { .map_noncoherent = false, .max_width = 800, .max_height = 600, + .max_burst = JZ_LCD_CTRL_BURST_16, .formats_f1 = jz4740_formats, .num_formats_f1 = ARRAY_SIZE(jz4740_formats), /* JZ4740 has only one plane */ @@ -1530,6 +1533,7 @@ static const struct jz_soc_info jz4725b_soc_info = { .map_noncoherent = false, .max_width = 800, .max_height = 600, + .max_burst = JZ_LCD_CTRL_BURST_16, .formats_f1 = jz4725b_formats_f1, .num_formats_f1 = ARRAY_SIZE(jz4725b_formats_f1), .formats_f0 = jz4725b_formats_f0, @@ -1542,6 +1546,7 @@ static const struct jz_soc_info jz4770_soc_info = { .map_noncoherent = true, .max_width = 1280, .max_height = 720, + .max_burst = JZ_LCD_CTRL_BURST_64, .formats_f1 = jz4770_formats_f1, .num_formats_f1 = ARRAY_SIZE(jz4770_formats_f1), .formats_f0 = jz4770_formats_f0, @@ -1556,6 +1561,7 @@ static const struct jz_soc_info jz4780_soc_info = { .plane_f0_not_working = true, /* REVISIT */ .max_width = 4096, .max_height = 2048, + .max_burst = JZ_LCD_CTRL_BURST_64, .formats_f1 = jz4770_formats_f1, .num_formats_f1 = ARRAY_SIZE(jz4770_formats_f1), .formats_f0 = jz4770_formats_f0, diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.h b/drivers/gpu/drm/ingenic/ingenic-drm.h index cb1d09b62588..e5bd007ea93d 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.h +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h @@ -106,6 +106,9 @@ #define JZ_LCD_CTRL_BURST_4 (0x0 << 28) #define JZ_LCD_CTRL_BURST_8 (0x1 << 28) #define JZ_LCD_CTRL_BURST_16 (0x2 << 28) +#define JZ_LCD_CTRL_BURST_32 (0x3 << 28) +#define JZ_LCD_CTRL_BURST_64 (0x4 << 28) +#define JZ_LCD_CTRL_BURST_MASK (0x7 << 28) #define JZ_LCD_CTRL_RGB555 BIT(27) #define JZ_LCD_CTRL_OFUP BIT(26) #define JZ_LCD_CTRL_FRC_GRAYSCALE_16 (0x0 << 24) -- 2.35.1