Message ID | 54deec2ec533e90544faa8c60a0c2518c58f3e9c.1689252746.git.geert@linux-m68k.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1829496vqm; Thu, 13 Jul 2023 06:35:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlGZJOLEQ7fqUNP1+WScPmGPm2Zjb/XS/JQdbwKVjk5aQiD0owbpobKCsoVEbs+M5PD8hasW X-Received: by 2002:a05:6358:5908:b0:134:c8cb:6a00 with SMTP id g8-20020a056358590800b00134c8cb6a00mr1824066rwf.12.1689255319555; Thu, 13 Jul 2023 06:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689255319; cv=none; d=google.com; s=arc-20160816; b=kS7WU8d1+VCMMUVpC7fFNL0VyMcSJ1J9mgyu1AeWDnGXXrVUCPrQlD8JbwyX/7bGGg AxpD4XCt5Q4d/+VEZvS7mS/E9W57z5pQb48A7mNQ6MPWfYgC1dyZHo1Yn3odMPT7mIHc 8VnRSDTQzJUmmxgcnfrI7UPWcSdiKak80zYGkgy0tANJcq2yL+cudXoeHKr2ipusdESu OGIDZw7KYw5AsuIBsTe4NPTdZEresnlCJKX1oBs6W73eu3+tzDXAA+dkIfYXaBpnVDIp iWtU1eM3pH4WqSrGpwQrsmCxseEnFsKMtk6clrO5MtRFJlldbXyFeV3x16JfU4G65pMk lHIA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=AD03TurK3yrna6bUlF5S7Xlqaw3WfrhUwhigUB5F+xs=; fh=wcJXU+GRAJ+lFf7so8itXL2pGJ6fujr2XomH/f1be3s=; b=ruHq3Hgs6MF0c4ovr3VAnY/RQp7dv4bB+FZSU/1/JEjGGz9BlVgmNtLUcNoPuma/FZ 64xgza4fUgU8RV6lCDxatfWiLpiXr53/17Q5uxnjSrlHUnvcmXgx5y+k5ALwBv8biaX3 HzUZ88BX1x/CrxFikT9veisQtTxQfdOeQyPkE2yKqnX8l19K3OCv7EHjVfPESAeCmkvi Q4SE+9FR6WLKrctDRMtcg1hjDhGP4/ZLkQ3ROjsdWiaZVkYUfAtBC1WsXV8tKd1QAOJv t4/UCc2L/oVFG3qdkwW0zJtfENs6K+8ICTQLsNizhPaWuKDzVWMuiMZJ9euY/UUkN/JR MRIw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m16-20020a63fd50000000b005578a320ea8si5173678pgj.867.2023.07.13.06.35.06; Thu, 13 Jul 2023 06:35:19 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234976AbjGMNRo (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 13 Jul 2023 09:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234791AbjGMNRb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Jul 2023 09:17:31 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A689271F for <linux-kernel@vger.kernel.org>; Thu, 13 Jul 2023 06:17:25 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:6264:77e5:42e2:477d]) by laurent.telenet-ops.be with bizsmtp id LdHN2A00P3wy6xv01dHNpY; Thu, 13 Jul 2023 15:17:23 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from <geert@linux-m68k.org>) id 1qJwC3-001Gqo-0L; Thu, 13 Jul 2023 15:17:22 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from <geert@linux-m68k.org>) id 1qJwCA-00GWyV-MV; Thu, 13 Jul 2023 15:17:22 +0200 From: Geert Uytterhoeven <geert@linux-m68k.org> To: Javier Martinez Canillas <javierm@redhat.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org> Subject: [PATCH 1/8] drm/ssd130x: Fix pitch calculation in ssd130x_fb_blit_rect() Date: Thu, 13 Jul 2023 15:17:09 +0200 Message-Id: <54deec2ec533e90544faa8c60a0c2518c58f3e9c.1689252746.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <cover.1689252746.git.geert@linux-m68k.org> References: <cover.1689252746.git.geert@linux-m68k.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771312585886604665 X-GMAIL-MSGID: 1771312585886604665 |
Series |
drm: fb-helper/ssd130x: Add support for DRM_FORMAT_R1
|
|
Commit Message
Geert Uytterhoeven
July 13, 2023, 1:17 p.m. UTC
The page height must be taken into account only for vertical coordinates
and heights, not for horizontal coordinates and widths.
Fixes: 179a790aaf2a0127 ("drm/ssd130x: Set the page height value in the device info data")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/gpu/drm/solomon/ssd130x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Geert Uytterhoeven <geert@linux-m68k.org> writes: Hello Geert, Thanks for your patch! > The page height must be taken into account only for vertical coordinates > and heights, not for horizontal coordinates and widths. > > Fixes: 179a790aaf2a0127 ("drm/ssd130x: Set the page height value in the device info data") > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> > --- > drivers/gpu/drm/solomon/ssd130x.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c > index afb08a8aa9fcdaf2..b4c376962629580b 100644 > --- a/drivers/gpu/drm/solomon/ssd130x.c > +++ b/drivers/gpu/drm/solomon/ssd130x.c > @@ -596,7 +596,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_m > rect->y1 = round_down(rect->y1, page_height); > rect->y2 = min_t(unsigned int, round_up(rect->y2, page_height), ssd130x->height); > > - dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), page_height); > + dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), 8); > That's true for ssd130x controllers that use R1, but when doing that change one of my goals was to prepare the driver for supporting the ssd132x family that use a 16-grayscale pixel format (R4). For those controllers, the pixels are encoded in 4-bit and each page has two pixels. So for those controllers the dst_pitch will need to be DIV_ROUND_UP(drm_rect_width(rect), 2) instead since the width is not 8 in that case. So I would prefer to skip this patch from your set, because otherwise we will need to revert it when adding support for SSD132x controllers.
Hi Javier, On Fri, Jul 14, 2023 at 11:34 AM Javier Martinez Canillas <javierm@redhat.com> wrote: > Geert Uytterhoeven <geert@linux-m68k.org> writes: > > The page height must be taken into account only for vertical coordinates > > and heights, not for horizontal coordinates and widths. > > > > Fixes: 179a790aaf2a0127 ("drm/ssd130x: Set the page height value in the device info data") > > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> > > --- a/drivers/gpu/drm/solomon/ssd130x.c > > +++ b/drivers/gpu/drm/solomon/ssd130x.c > > @@ -596,7 +596,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_m > > rect->y1 = round_down(rect->y1, page_height); > > rect->y2 = min_t(unsigned int, round_up(rect->y2, page_height), ssd130x->height); > > > > - dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), page_height); > > + dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), 8); > > > > That's true for ssd130x controllers that use R1, but when doing that > change one of my goals was to prepare the driver for supporting the > ssd132x family that use a 16-grayscale pixel format (R4). > > For those controllers, the pixels are encoded in 4-bit and each page > has two pixels. So for those controllers the dst_pitch will need to > be DIV_ROUND_UP(drm_rect_width(rect), 2) instead since the width is > not 8 in that case. > > So I would prefer to skip this patch from your set, because otherwise > we will need to revert it when adding support for SSD132x controllers. My point is that the 8 as used here is related to the number of bits per pixel, not to the page height. The page height might also be impacted by the number of bits per pixel, but that is orthogonal. Gr{oetje,eeting}s, Geert
Geert Uytterhoeven <geert@linux-m68k.org> writes: > Hi Javier, > > On Fri, Jul 14, 2023 at 11:34 AM Javier Martinez Canillas > <javierm@redhat.com> wrote: >> Geert Uytterhoeven <geert@linux-m68k.org> writes: >> > The page height must be taken into account only for vertical coordinates >> > and heights, not for horizontal coordinates and widths. >> > >> > Fixes: 179a790aaf2a0127 ("drm/ssd130x: Set the page height value in the device info data") >> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> > >> > --- a/drivers/gpu/drm/solomon/ssd130x.c >> > +++ b/drivers/gpu/drm/solomon/ssd130x.c >> > @@ -596,7 +596,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_m >> > rect->y1 = round_down(rect->y1, page_height); >> > rect->y2 = min_t(unsigned int, round_up(rect->y2, page_height), ssd130x->height); >> > >> > - dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), page_height); >> > + dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), 8); >> > >> >> That's true for ssd130x controllers that use R1, but when doing that >> change one of my goals was to prepare the driver for supporting the >> ssd132x family that use a 16-grayscale pixel format (R4). >> >> For those controllers, the pixels are encoded in 4-bit and each page >> has two pixels. So for those controllers the dst_pitch will need to >> be DIV_ROUND_UP(drm_rect_width(rect), 2) instead since the width is >> not 8 in that case. >> >> So I would prefer to skip this patch from your set, because otherwise >> we will need to revert it when adding support for SSD132x controllers. > > My point is that the 8 as used here is related to the number of bits per pixel, > not to the page height. The page height might also be impacted by the > number of bits per pixel, but that is orthogonal. > Ah, I see what you mean. Yes, you are right. We can later add a different variable when adding support for controllers using R4. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Javier Martinez Canillas <javierm@redhat.com> writes: Hello Geert, > Geert Uytterhoeven <geert@linux-m68k.org> writes: > [...] >> >> My point is that the 8 as used here is related to the number of bits per pixel, >> not to the page height. The page height might also be impacted by the >> number of bits per pixel, but that is orthogonal. >> > > Ah, I see what you mean. Yes, you are right. We can later add a > different variable when adding support for controllers using R4. > > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> > Pushed to drm-misc (drm-misc-next) since this fix is independent of the rest of the patches. Thanks!
diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c index afb08a8aa9fcdaf2..b4c376962629580b 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -596,7 +596,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_m rect->y1 = round_down(rect->y1, page_height); rect->y2 = min_t(unsigned int, round_up(rect->y2, page_height), ssd130x->height); - dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), page_height); + dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), 8); ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); if (ret)