From: "Maíra Canal" <mcanal@igalia.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
Fabio Piparo <holofermes@gmail.com>,
Melissa Wen <mwen@igalia.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>,
dri-devel@lists.freedesktop.org
Subject: Re: drm/ssd130x: stale pixels when the GPU renders into the framebuffer
Date: Tue, 29 Sep 2026 18:50:47 -0300 [thread overview]
Message-ID: <cbf22c0b-b36e-4bec-8461-27dfcb171d7b@igalia.com> (raw)
In-Reply-To: <4a5917cb-d7d8-489a-85c1-a217b442a355@suse.de>
Hi Thomas,
On 29/09/26 06:04, Thomas Zimmermann wrote:
> (cc'ing v3d maintainers Maira and Melissa)
>
> Hi
>
> Am 23.09.26 um 18:00 schrieb Fabio Piparo:
>> Hi Thomas,
>>
>> Thanks for taking a look.
>>
>> On 14.09.26 10:43, Thomas Zimmermann wrote:
>>> I assume you write these frames quickly one after the other? As i2c is
>>> really slow, you might write to buffers that are still being transferred
>>> in the background.
>>>
>>> Do you read back the status of the page flips? DRM should tell you when
>>> it has completed transferring a frame. See [1]
>> The test renders with the GPU: two dumb buffers allocated on the
>> ssd130x device and shared with v3d over PRIME. It runs at 10 fps.
>> Before each flip it calls glFinish(), then flips with
>> DRM_MODE_PAGE_FLIP_EVENT and waits for the event before drawing into
>> the other buffer. The same test drawing with the CPU instead comes out
>> clean.
>
> A number of things come to my mind.
>
> - Dumb buffers (from ssd130x) are not meant for HW rendering. They are
> generally for software rendering only.
>
This reminded me of an issue I recently saw involving GPU rendering to
dumb buffers when combining simpledrm and Panthor. It had the same
symptom: this trail of glitches.
After investigating that issue, I noticed that, on platforms where the
GPU isn't DMA-coherent, when a shmem GEM buffer is exported via dma-
buf to a GPU for rendering, the CPU can read stale data from its cache
when later accessing the buffer, which manifests as rendering artifacts.
So, the GPU writes reach memory, but the CPU blit reads stale cache
lines. drm_gem_fb_begin_cpu_access() only syncs imported buffers, and
GEM dma_buf_ops have no begin/end_cpu_access, so nothing invalidates the
CPU cache before the blit and the CPU reads stale cached data.
I have a patch implementing begin/end_cpu_access to
drm_gem_prime_dmabuf_ops, which fixed the issue. However, I'm not sure
we would like to support this use case upstream because, as you
mentioned, dumb buffers are usually used for software-rendering only.
> - Hence, the ideomatic use for sharing graphics buffers is to model a
> producer-consumer relationship. Export the buffer from the device that
> generates the frame and import it to the buffer that displays it.
>
> - Since you're compositor's sharing happens in the opposite direction,
> ssd130x might not sync correctly. (I'm not sure of v3d requires a
> dedicated flush.)
>
> - Or maybe v3d needs to do a final cache flush after drawing to imported
> buffers.
I don't think so... Once the job completes, the GPU writes are in
memory. I believe the stale copy is in the CPU cache, so the
invalidation should happen on the CPU side.
Best regards,
- Maíra
>
> If nothing else helpers, we could use map_wc for shared buffers in
> ssd130x, but it seems like papering over something else.
>
> Best regards
> Thomas
>
>
>>
>> I'm happy to send the test program if it would help.
>>
>> Best regards,
>> Fabio
>
next prev parent reply other threads:[~2026-09-29 21:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 4:27 drm/ssd130x: stale pixels when the GPU renders into the framebuffer Fabio Piparo
2026-08-14 18:34 ` Javier Martinez Canillas
2026-09-14 8:43 ` Thomas Zimmermann
2026-09-23 16:00 ` Fabio Piparo
2026-09-29 9:04 ` Thomas Zimmermann
2026-09-29 21:50 ` Maíra Canal [this message]
2026-09-30 6:48 ` Thomas Zimmermann
2026-09-30 7:48 ` Javier Martinez Canillas
2026-09-30 8:32 ` Thomas Zimmermann
2026-09-30 13:49 ` Maíra Canal
2026-09-30 15:52 ` Javier Martinez Canillas
2026-09-30 18:45 ` Fabio Piparo
2026-10-02 8:18 ` Thomas Zimmermann
2026-09-30 19:57 ` Maíra Canal
2026-10-02 8:12 ` Thomas Zimmermann
2026-10-02 21:13 ` Maíra Canal
2026-10-06 6:50 ` Thomas Zimmermann
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=cbf22c0b-b36e-4bec-8461-27dfcb171d7b@igalia.com \
--to=mcanal@igalia.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=holofermes@gmail.com \
--cc=javierm@redhat.com \
--cc=mwen@igalia.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.