From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>, linux-kernel@vger.kernel.org
Cc: David Airlie <airlied@linux.ie>,
Jocelyn Falempe <jfalempe@redhat.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ssd130x: Iterate over damage clips instead of using a merged rect
Date: Fri, 30 Sep 2022 13:22:16 +0200 [thread overview]
Message-ID: <79e665bb-c51a-0ac1-3f2f-f0e5eba22388@redhat.com> (raw)
In-Reply-To: <65fd4526-f223-d425-3e69-04fe5485c87c@suse.de>
Hello Thomas,
On 9/30/22 12:11, Thomas Zimmermann wrote:
[...]
>>
>>>> +
>>>> + ssd130x_fb_blit_rect(plane_state->fb, &shadow_plane_state->data[0], &damage);
>>>
>>> In simpledrm, we adjust the destination address with dst_clip like this:
>>>
>>> iosys_map_incr(&dst, drm_fb_clip_offset(sdev->pitch, sdev->format,
>>> &dst_clip));
>>>
>>> How does this work in ssd130x? You never use dst_clip to adjust to the
>>> changed location. Won't you have out-of-bounds writes on the device?
>>>
>>
>> Right, in ssd130x what I do is:
>>
>> static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_map *vmap,
>> struct drm_rect *rect)
>> {
>> struct iosys_map dst;
>> ...
>> u8 *buf = NULL;
>> ...
>> buf = kcalloc(dst_pitch, drm_rect_height(rect), GFP_KERNEL);
>> ...
>> iosys_map_set_vaddr(&dst, buf);
>> drm_fb_xrgb8888_to_mono(&dst, &dst_pitch, vmap, fb, rect);
>> ...
>> ssd130x_update_rect(ssd130x, buf, rect);
>> }
>>
>> I understand that's correct too?
>
> From what I understand about ssd130x, blit_rect looks correct up to the
> call to update_rect. The values in the rect parameter are for the
> damage area of the plane. In update_rect, the destination coords x and y
> are also taken from rect. But they should come from dst_clip, which is
> the on-screen location. Does that make sense?
>
I believe you are correct. Then what I should do is to not pass the damage
area to ssd130x_fb_blit_rect() as the struct drm_rect argument but instead
the dst_clip as filled by drm_rect_intersect(). Does that sound correct ?
In other words, the following:
drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
drm_atomic_for_each_plane_damage(&iter, &damage) {
dst_clip = plane_state->dst;
if (!drm_rect_intersect(&dst_clip, &damage))
continue;
ssd130x_fb_blit_rect(plane_state->fb, &shadow_plane_state->data[0], &dst_clip);
}
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
prev parent reply other threads:[~2022-09-30 11:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 8:01 Javier Martinez Canillas
2022-09-30 8:26 ` Thomas Zimmermann
2022-09-30 9:25 ` Javier Martinez Canillas
2022-09-30 10:11 ` Thomas Zimmermann
2022-09-30 11:22 ` Javier Martinez Canillas [this message]
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=79e665bb-c51a-0ac1-3f2f-f0e5eba22388@redhat.com \
--to=javierm@redhat.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=jfalempe@redhat.com \
--cc=linux-kernel@vger.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®