From: Javier Martinez Canillas <javierm@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Javier Martinez Canillas <javierm@redhat.com>,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
dri-devel@lists.freedesktop.org
Subject: [PATCH 4/8] drm/ssd13xx: Use drm_format_info_min_pitch() to calculate the dest_pitch
Date: Mon, 9 Oct 2023 20:34:18 +0200 [thread overview]
Message-ID: <20231009183522.543918-5-javierm@redhat.com> (raw)
In-Reply-To: <20231009183522.543918-1-javierm@redhat.com>
Don't assume bpp of 1 and instead compute the destination pitch using the
intermediate buffer pixel format info when doing a format conversion.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
drivers/gpu/drm/solomon/ssd13xx.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/solomon/ssd13xx.c b/drivers/gpu/drm/solomon/ssd13xx.c
index d29be17665b5..9747f8656636 100644
--- a/drivers/gpu/drm/solomon/ssd13xx.c
+++ b/drivers/gpu/drm/solomon/ssd13xx.c
@@ -148,6 +148,8 @@ struct ssd13xx_plane_state {
struct drm_shadow_plane_state base;
/* Intermediate buffer to convert pixels from XRGB8888 to HW format */
u8 *buffer;
+ /* Pixel format info for the intermediate buffer */
+ const struct drm_format_info *fi;
};
static inline struct ssd13xx_crtc_state *to_ssd13xx_crtc_state(struct drm_crtc_state *state)
@@ -602,8 +604,9 @@ static void ssd13xx_clear_screen(struct ssd13xx_device *ssd13xx, u8 *data_array)
static int ssd13xx_fb_blit_rect(struct drm_framebuffer *fb,
const struct iosys_map *vmap,
- struct drm_rect *rect,
- u8 *buf, u8 *data_array)
+ struct drm_rect *rect, u8 *buf,
+ const struct drm_format_info *fi,
+ u8 *data_array)
{
struct ssd13xx_device *ssd13xx = drm_to_ssd13xx(fb->dev);
struct iosys_map dst;
@@ -614,7 +617,7 @@ static int ssd13xx_fb_blit_rect(struct drm_framebuffer *fb,
rect->y1 = round_down(rect->y1, SSD130X_PAGE_HEIGHT);
rect->y2 = min_t(unsigned int, round_up(rect->y2, SSD130X_PAGE_HEIGHT), ssd13xx->height);
- dst_pitch = DIV_ROUND_UP(drm_rect_width(rect), 8);
+ dst_pitch = drm_format_info_min_pitch(fi, 0, drm_rect_width(rect));
ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
if (ret)
@@ -664,6 +667,8 @@ static int ssd13xx_primary_plane_atomic_check(struct drm_plane *plane,
if (!ssd13xx_state->buffer)
return -ENOMEM;
+ ssd13xx_state->fi = fi;
+
return 0;
}
@@ -695,6 +700,7 @@ static void ssd13xx_primary_plane_atomic_update(struct drm_plane *plane,
ssd13xx_fb_blit_rect(fb, &shadow_plane_state->data[0], &dst_clip,
ssd13xx_plane_state->buffer,
+ ssd13xx_plane_state->fi,
ssd13xx_crtc_state->data_array);
}
--
2.41.0
next prev parent reply other threads:[~2023-10-09 18:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 18:34 [PATCH 0/8] drm/solomon: Add support for the SSD132x controller family Javier Martinez Canillas
2023-10-09 18:34 ` [PATCH 1/8] drm/solomon: Rename ssd130x driver to ssd13xx Javier Martinez Canillas
2023-10-10 8:09 ` Maxime Ripard
2023-10-10 8:38 ` Javier Martinez Canillas
2023-10-09 18:34 ` [PATCH 2/8] drm/ssd13xx: Rename data structures and functions prefixes Javier Martinez Canillas
2023-10-09 18:34 ` [PATCH 3/8] drm/ssd13xx: Replace .page_height field in device info with a constant Javier Martinez Canillas
2023-10-11 7:39 ` Geert Uytterhoeven
2023-10-11 8:33 ` Javier Martinez Canillas
2023-10-09 18:34 ` Javier Martinez Canillas [this message]
2023-10-11 7:59 ` [PATCH 4/8] drm/ssd13xx: Use drm_format_info_min_pitch() to calculate the dest_pitch Geert Uytterhoeven
2023-10-11 8:37 ` Javier Martinez Canillas
2023-10-09 18:34 ` [PATCH 5/8] drm/ssd13xx: Add a per controller family functions table Javier Martinez Canillas
2023-10-11 8:09 ` Geert Uytterhoeven
2023-10-11 8:48 ` Javier Martinez Canillas
2023-10-09 18:34 ` [PATCH 6/8] drm/ssd13xx: Rename commands that are shared across chip families Javier Martinez Canillas
2023-10-09 18:34 ` [PATCH 7/8] drm/ssd13xx: Add support for the SSD132x OLED controller family Javier Martinez Canillas
2023-10-11 8:13 ` Geert Uytterhoeven
2023-10-11 8:49 ` Javier Martinez Canillas
2023-10-09 18:34 ` [PATCH 8/8] dt-bindings: display: Add SSD132x OLED controllers Javier Martinez Canillas
2023-10-10 16:31 ` Conor Dooley
2023-10-11 6:34 ` Javier Martinez Canillas
2023-10-11 15:50 ` Conor Dooley
2023-10-10 16:58 ` Rob Herring
2023-10-11 6:39 ` Javier Martinez Canillas
2023-10-11 7:34 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231009183522.543918-5-javierm@redhat.com \
--to=javierm@redhat.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®