From: Tony Lindgren <tony@atomide.com> Date: 2024-02-25 06:47:31
Here are two fixes for omapdrm console.
Regards,
Tony
Changes since v1:
- Add FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS to use with
FB_DEFAULT_DEFERRED_OPS as suggested by Thomas
Tony Lindgren (2):
drm/omapdrm: Fix console by implementing fb_dirty
drm/omapdrm: Fix console with deferred ops
drivers/gpu/drm/omapdrm/omap_fbdev.c | 39 +++++++++++++++++++---------
include/linux/fb.h | 4 +++
2 files changed, 31 insertions(+), 12 deletions(-)
--
2.43.1
From: Tony Lindgren <tony@atomide.com> Date: 2024-02-25 06:47:57
The framebuffer console stopped updating with commit f231af498c29
("drm/fb-helper: Disconnect damage worker from update logic").
Let's fix the issue by implementing fb_dirty similar to what was done
with commit 039a72ce7e57 ("drm/i915/fbdev: Implement fb_dirty for intel
custom fb helper").
Fixes: f231af498c29 ("drm/fb-helper: Disconnect damage worker from update logic")
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/gpu/drm/omapdrm/omap_fbdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
From: Tony Lindgren <tony@atomide.com> Date: 2024-02-25 06:48:23
Commit 95da53d63dcf ("drm/omapdrm: Use regular fbdev I/O helpers")
broke console because there is no damage handling in fb_sys_write()
unlike we have in drm_fb_helper_sys_write().
Let's fix the issue by adding FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS to
use with FB_DEFAULT_DEFERRED_OPS as suggested by Thomas. We no longer
need omap_fbdev_fb_mmap() as FB_DEFAULT_DEFERRED_OPS sets it to
fb_deferred_io_mmap().
Fixes: 95da53d63dcf ("drm/omapdrm: Use regular fbdev I/O helpers")
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/gpu/drm/omapdrm/omap_fbdev.c | 27 +++++++++++++++------------
include/linux/fb.h | 4 ++++
2 files changed, 19 insertions(+), 12 deletions(-)
@@ -213,6 +207,15 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,fbi->fix.smem_start=dma_addr;fbi->fix.smem_len=bo->size;+/* deferred I/O */+helper->fbdefio.delay=HZ/20;+helper->fbdefio.deferred_io=drm_fb_helper_deferred_io;++fbi->fbdefio=&helper->fbdefio;+ret=fb_deferred_io_init(fbi);+if(ret)+gotofail;+/* if we have DMM, then we can use it for scrolling by just*shufflingpagesaroundinDMMratherthandoingswblit.*/
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2024-02-26 08:21:54
Hi,
looks good. For the series:
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Am 25.02.24 um 07:46 schrieb Tony Lindgren:
Here are two fixes for omapdrm console.
Regards,
Tony
Changes since v1:
- Add FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS to use with
FB_DEFAULT_DEFERRED_OPS as suggested by Thomas
Tony Lindgren (2):
drm/omapdrm: Fix console by implementing fb_dirty
drm/omapdrm: Fix console with deferred ops
drivers/gpu/drm/omapdrm/omap_fbdev.c | 39 +++++++++++++++++++---------
include/linux/fb.h | 4 +++
2 files changed, 31 insertions(+), 12 deletions(-)
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Date: 2024-02-26 08:26:43
Hi Tony,
On 25/02/2024 08:46, Tony Lindgren wrote:
Here are two fixes for omapdrm console.
How is it broken? I don't usually use the console (or fbdev) but
enabling it now, it seems to work fine for me, on DRA76 EVM with HDMI
output.
Tomi
Regards,
Tony
Changes since v1:
- Add FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS to use with
FB_DEFAULT_DEFERRED_OPS as suggested by Thomas
Tony Lindgren (2):
drm/omapdrm: Fix console by implementing fb_dirty
drm/omapdrm: Fix console with deferred ops
drivers/gpu/drm/omapdrm/omap_fbdev.c | 39 +++++++++++++++++++---------
include/linux/fb.h | 4 +++
2 files changed, 31 insertions(+), 12 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2024-02-26 09:10:47
Hi
Am 26.02.24 um 10:01 schrieb Tomi Valkeinen:
On 26/02/2024 10:26, Tomi Valkeinen wrote:
quoted
Hi Tony,
On 25/02/2024 08:46, Tony Lindgren wrote:
quoted
Here are two fixes for omapdrm console.
How is it broken? I don't usually use the console (or fbdev) but
enabling it now, it seems to work fine for me, on DRA76 EVM with HDMI
output.
Omapdrm implements drm_framebuffer_funcs.dirty
withomap_framebuffer_dirty(). AFAIK DRM semantics requires to run the
dirty helper after writing to the framebuffer's memory. Userspace does
this via the DIRTYFB ioctl. [1] But (at least) for correctness the
console needs to do the same.
[1]
https://elixir.bootlin.com/linux/v6.7.6/source/drivers/gpu/drm/drm_ioctl.c#L679
After applying your patches, I see a lot of cache-related artifacts on
the screen when updating the fb.
I guess we might need a dma-specific mmap helper to make this work
correctly.
Best regards
Thomas
Tomi
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
From: Tony Lindgren <tony@atomide.com> Date: 2024-02-26 11:26:19
* Thomas Zimmermann [off-list ref] [240226 09:10]:
Hi
Am 26.02.24 um 10:01 schrieb Tomi Valkeinen:
quoted
On 26/02/2024 10:26, Tomi Valkeinen wrote:
quoted
Hi Tony,
On 25/02/2024 08:46, Tony Lindgren wrote:
quoted
Here are two fixes for omapdrm console.
How is it broken? I don't usually use the console (or fbdev) but
enabling it now, it seems to work fine for me, on DRA76 EVM with
HDMI output.
Omapdrm implements drm_framebuffer_funcs.dirty withomap_framebuffer_dirty().
AFAIK DRM semantics requires to run the dirty helper after writing to the
framebuffer's memory. Userspace does this via the DIRTYFB ioctl. [1] But (at
least) for correctness the console needs to do the same.
[1] https://elixir.bootlin.com/linux/v6.7.6/source/drivers/gpu/drm/drm_ioctl.c#L679
Yes I noticed console not updating and bisected it down to the two
commits listed. I did the bisect on a droid4 though with command mode
LCD. I did not test with HDMI, will give that a try too.
quoted
After applying your patches, I see a lot of cache-related artifacts on
the screen when updating the fb.
I guess we might need a dma-specific mmap helper to make this work
correctly.
I can easily test this if you have some suggested patch to try.
Hmm so I wonder if we now have double updates happening on HDMI?
Regards,
Tony
From: Tony Lindgren <tony@atomide.com> Date: 2024-02-27 07:06:55
* Tony Lindgren [off-list ref] [240226 13:26]:
* Thomas Zimmermann [off-list ref] [240226 09:10]:
quoted
Am 26.02.24 um 10:01 schrieb Tomi Valkeinen:
quoted
On 26/02/2024 10:26, Tomi Valkeinen wrote:
quoted
How is it broken? I don't usually use the console (or fbdev) but
enabling it now, it seems to work fine for me, on DRA76 EVM with
HDMI output.
Omapdrm implements drm_framebuffer_funcs.dirty withomap_framebuffer_dirty().
AFAIK DRM semantics requires to run the dirty helper after writing to the
framebuffer's memory. Userspace does this via the DIRTYFB ioctl. [1] But (at
least) for correctness the console needs to do the same.
[1] https://elixir.bootlin.com/linux/v6.7.6/source/drivers/gpu/drm/drm_ioctl.c#L679
Yes I noticed console not updating and bisected it down to the two
commits listed. I did the bisect on a droid4 though with command mode
LCD. I did not test with HDMI, will give that a try too.
I can reproduce the cache issue with Tomi's omapfb-tests [2] below:
while true;
do dd if=/dev/urandom of=/dev/fb0
~/src/omapfb-tests/test
sleep 1
done
That produces short random data stripes on the test image.
quoted
quoted
After applying your patches, I see a lot of cache-related artifacts on
the screen when updating the fb.
I guess we might need a dma-specific mmap helper to make this work
correctly.
Comparing the difference between drm_gem_mmap_obj() and
fb_deferred_io_mmap(), the following test patch makes the cache issue
go away for me. Not sure if this can be set based on some flag, or if
we need a separate fb_deferred_io_wc_mmap() or something like that?
Regards,
Tony
[2] https://github.com/tomba/omapfb-tests
8< --------------------
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2024-02-27 07:56:20
Hi
Am 27.02.24 um 08:06 schrieb Tony Lindgren:
quoted hunk
* Tony Lindgren [off-list ref] [240226 13:26]:
quoted
* Thomas Zimmermann [off-list ref] [240226 09:10]:
quoted
Am 26.02.24 um 10:01 schrieb Tomi Valkeinen:
quoted
On 26/02/2024 10:26, Tomi Valkeinen wrote:
quoted
How is it broken? I don't usually use the console (or fbdev) but
enabling it now, it seems to work fine for me, on DRA76 EVM with
HDMI output.
Omapdrm implements drm_framebuffer_funcs.dirty withomap_framebuffer_dirty().
AFAIK DRM semantics requires to run the dirty helper after writing to the
framebuffer's memory. Userspace does this via the DIRTYFB ioctl. [1] But (at
least) for correctness the console needs to do the same.
[1] https://elixir.bootlin.com/linux/v6.7.6/source/drivers/gpu/drm/drm_ioctl.c#L679
Yes I noticed console not updating and bisected it down to the two
commits listed. I did the bisect on a droid4 though with command mode
LCD. I did not test with HDMI, will give that a try too.
I can reproduce the cache issue with Tomi's omapfb-tests [2] below:
while true;
do dd if=/dev/urandom of=/dev/fb0
~/src/omapfb-tests/test
sleep 1
done
That produces short random data stripes on the test image.
quoted
quoted
quoted
After applying your patches, I see a lot of cache-related artifacts on
the screen when updating the fb.
I guess we might need a dma-specific mmap helper to make this work
correctly.
Comparing the difference between drm_gem_mmap_obj() and
fb_deferred_io_mmap(), the following test patch makes the cache issue
go away for me. Not sure if this can be set based on some flag, or if
we need a separate fb_deferred_io_wc_mmap() or something like that?
Regards,
Tony
[2] https://github.com/tomba/omapfb-tests
8< --------------------
Great, that's exactly what I had in mind!
My proposal is to add this mmap function directly to omapdrm. I'll later
take care of integrating this into the overall framework. I have a few
other ideas in mind that are related to this issue. Ok?
Best regards
Thomas
From: Tony Lindgren <tony@atomide.com> Date: 2024-02-27 08:02:14
* Thomas Zimmermann [off-list ref] [240227 07:56]:
Am 27.02.24 um 08:06 schrieb Tony Lindgren:
quoted
* Tony Lindgren [off-list ref] [240226 13:26]:
quoted
* Thomas Zimmermann [off-list ref] [240226 09:10]:
quoted
Am 26.02.24 um 10:01 schrieb Tomi Valkeinen:
quoted
On 26/02/2024 10:26, Tomi Valkeinen wrote:
quoted
How is it broken? I don't usually use the console (or fbdev) but
enabling it now, it seems to work fine for me, on DRA76 EVM with
HDMI output.
Omapdrm implements drm_framebuffer_funcs.dirty withomap_framebuffer_dirty().
AFAIK DRM semantics requires to run the dirty helper after writing to the
framebuffer's memory. Userspace does this via the DIRTYFB ioctl. [1] But (at
least) for correctness the console needs to do the same.
[1] https://elixir.bootlin.com/linux/v6.7.6/source/drivers/gpu/drm/drm_ioctl.c#L679
Yes I noticed console not updating and bisected it down to the two
commits listed. I did the bisect on a droid4 though with command mode
LCD. I did not test with HDMI, will give that a try too.
I can reproduce the cache issue with Tomi's omapfb-tests [2] below:
while true;
do dd if=/dev/urandom of=/dev/fb0
~/src/omapfb-tests/test
sleep 1
done
That produces short random data stripes on the test image.
quoted
quoted
quoted
After applying your patches, I see a lot of cache-related artifacts on
the screen when updating the fb.
I guess we might need a dma-specific mmap helper to make this work
correctly.
Comparing the difference between drm_gem_mmap_obj() and
fb_deferred_io_mmap(), the following test patch makes the cache issue
go away for me. Not sure if this can be set based on some flag, or if
we need a separate fb_deferred_io_wc_mmap() or something like that?
[2] https://github.com/tomba/omapfb-tests
8< --------------------
My proposal is to add this mmap function directly to omapdrm. I'll later
take care of integrating this into the overall framework. I have a few other
ideas in mind that are related to this issue. Ok?
OK that sounds good to me, I'll post v3 set of patches.
Regards,
Tony
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2024-02-27 09:16:09
Hi
Am 27.02.24 um 09:01 schrieb Tony Lindgren:
* Thomas Zimmermann [off-list ref] [240227 07:56]:
quoted
Am 27.02.24 um 08:06 schrieb Tony Lindgren:
quoted
* Tony Lindgren [off-list ref] [240226 13:26]:
quoted
* Thomas Zimmermann [off-list ref] [240226 09:10]:
quoted
Am 26.02.24 um 10:01 schrieb Tomi Valkeinen:
quoted
On 26/02/2024 10:26, Tomi Valkeinen wrote:
quoted
How is it broken? I don't usually use the console (or fbdev) but
enabling it now, it seems to work fine for me, on DRA76 EVM with
HDMI output.
Omapdrm implements drm_framebuffer_funcs.dirty withomap_framebuffer_dirty().
AFAIK DRM semantics requires to run the dirty helper after writing to the
framebuffer's memory. Userspace does this via the DIRTYFB ioctl. [1] But (at
least) for correctness the console needs to do the same.
[1] https://elixir.bootlin.com/linux/v6.7.6/source/drivers/gpu/drm/drm_ioctl.c#L679
Yes I noticed console not updating and bisected it down to the two
commits listed. I did the bisect on a droid4 though with command mode
LCD. I did not test with HDMI, will give that a try too.
I can reproduce the cache issue with Tomi's omapfb-tests [2] below:
while true;
do dd if=/dev/urandom of=/dev/fb0
~/src/omapfb-tests/test
sleep 1
done
That produces short random data stripes on the test image.
quoted
quoted
quoted
After applying your patches, I see a lot of cache-related artifacts on
the screen when updating the fb.
I guess we might need a dma-specific mmap helper to make this work
correctly.
Comparing the difference between drm_gem_mmap_obj() and
fb_deferred_io_mmap(), the following test patch makes the cache issue
go away for me. Not sure if this can be set based on some flag, or if
we need a separate fb_deferred_io_wc_mmap() or something like that?
[2] https://github.com/tomba/omapfb-tests
8< --------------------
My proposal is to add this mmap function directly to omapdrm. I'll later
take care of integrating this into the overall framework. I have a few other
ideas in mind that are related to this issue. Ok?
OK that sounds good to me, I'll post v3 set of patches.
@@ -213,6 +220,15 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,fbi->fix.smem_start=dma_addr;fbi->fix.smem_len=bo->size;+/* deferred I/O */+helper->fbdefio.delay=HZ/20;+helper->fbdefio.deferred_io=drm_fb_helper_deferred_io;++fbi->fbdefio=&helper->fbdefio;+ret=fb_deferred_io_init(fbi);+if(ret)+gotofail;+/* if we have DMM, then we can use it for scrolling by just*shufflingpagesaroundinDMMratherthandoingswblit.*/
@@ -213,6 +220,15 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,fbi->fix.smem_start=dma_addr;fbi->fix.smem_len=bo->size;+/* deferred I/O */+helper->fbdefio.delay=HZ/20;+helper->fbdefio.deferred_io=drm_fb_helper_deferred_io;++fbi->fbdefio=&helper->fbdefio;+ret=fb_deferred_io_init(fbi);+if(ret)+gotofail;+/* if we have DMM, then we can use it for scrolling by just*shufflingpagesaroundinDMMratherthandoingswblit.*/