drm/simple-kms: Drop drm_simple_kms_format_mod_supported.
Subsystems (2)
PATCH 1/1 drm/simple-kms: Drop drm_simple_kms_format_mod_supported.
The check was introduced to make sure that only the DRM_FORMAT_MOD_LINEAR modifier is accepted by tinydrm.
However, if .format_mod_supported is not hooked up to drm_simple_kms_format_mod_supported then the core will simply validate modifiers against the format_modifiers list passed into drm_simple_display_pipe_init() or drm_universal_plane_init() and perform the same validation as drm_simple_kms_format_mod_supported() would have done.
Additionally, if a kms driver / plane does not support modifiers, it will not reject fb updates with no modifiers/ DRM_FORMAT_MOD_INVALID. This is important, because some simple drm drivers, e.g., pl111, pass NULL as format_modifiers list, so modifier support is disabled for these drivers, userspace would fall back to drmAddFB() without modifiers, and ergo the current drm_simple_kms_format_mod_supported() function would reject valid modifier-less fb's.
So this should fix display on non-tinydrm drivers like pl111, and probably also for non-atomic clients?
The Mesa vc4 gallium driver mentions pl111 as one possible display driver in render_only mode, so i assume this matters for some SoC's?
The background for the patch that introduced this was to fix atomic modesetting in the X-Servers modesetting-ddx, but with atomic modesetting and format modifiers disabled in modesetting-ddx (and also current kernels when interacting with modesetting-ddx), i assume this should fix some panels.
Note that i don't have any of the hw required for testing this, this is purely based on looking at the code, so this patch is only compile-tested.
For more reference, this fix was motivated by some discussions around broken page-flipping on VideoCore6 / RaspberryPi 4 with current Raspbian OS, so the experts may want to weigh in on that Mesa bug report as well, under the following link:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3601
--- drivers/gpu/drm/drm_simple_kms_helper.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/drm_simple_kms_helper.c +0 -8
@@ -229,13 +229,6 @@ static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane, pipe->funcs->cleanup_fb (pipe, state); } -static bool drm_simple_kms_format_mod_supported (struct drm_plane *plane, -uint32_t format, -uint64_t modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR ; -} -static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { .prepare_fb = drm_simple_kms_plane_prepare_fb, .cleanup_fb = drm_simple_kms_plane_cleanup_fb,
@@ -250,7 +243,6 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, - .format_mod_supported = drm_simple_kms_format_mod_supported, };/**
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 71 lines · Mario Kleiner
The check was introduced to make sure that only the
DRM_FORMAT_MOD_LINEARmodifier is accepted by tinydrm.However, if .format_mod_supported is not hooked up to
drm_simple_kms_format_mod_supportedthen the core will simply validate modifiers against theformat_modifierslist passed intodrm_simple_display_pipe_init()ordrm_universal_plane_init()and perform the same validation asdrm_simple_kms_format_mod_supported()would have done.Additionally, if a kms driver / plane does not support modifiers, it will not reject fb updates with no modifiers/
DRM_FORMAT_MOD_INVALID. This is important, because some simple drm drivers, e.g., pl111, pass NULL asformat_modifierslist, so modifier support is disabled for these drivers, userspace would fall back todrmAddFB()without modifiers, and ergo the currentdrm_simple_kms_format_mod_supported()function would reject valid modifier-less fb's.So this should fix display on non-tinydrm drivers like pl111, and probably also for non-atomic clients?
The Mesa vc4 gallium driver mentions pl111 as one possible display driver in
render_onlymode, so i assume this matters for some SoC's?The background for the patch that introduced this was to fix atomic modesetting in the X-Servers modesetting-ddx, but with atomic modesetting and format modifiers disabled in modesetting-ddx (and also current kernels when interacting with modesetting-ddx), i assume this should fix some panels.
Note that i don't have any of the hw required for testing this, this is purely based on looking at the code, so this patch is only compile-tested.
For more reference, this fix was motivated by some discussions around broken page-flipping on VideoCore6 / RaspberryPi 4 with current Raspbian OS, so the experts may want to weigh in on that Mesa bug report as well, under the following link:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3601
Fixes dff906c3f91c ("drm/tinydrm: Advertise that we can do only DRM_FORMAT_MOD_LINEAR.")Signed-off-by Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Noralf Trønnes <[email protected]>Cc Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_simple_kms_helper.c | 8 -------- 1 file changed, 8 deletions(-)drivers/gpu/drm/drm_simple_kms_helper.c +0
-7@@ -229,13 +229,6 @@ static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane, pipe->funcs->cleanup_fb (pipe, state); } -static bool drm_simple_kms_format_mod_supported (struct drm_plane *plane, -uint32_t format, -uint64_t modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR ; -} -static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { .prepare_fb = drm_simple_kms_plane_prepare_fb, .cleanup_fb = drm_simple_kms_plane_cleanup_fb,
drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { · line 253
Quoted 4 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-1@@ -250,7 +243,6 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, - .format_mod_supported = drm_simple_kms_format_mod_supported,
This will now cause also this driver to report a totally borked IN_FORMATS blob.
Would need this
https://patchwork.freedesktop.org/series/83018/
but IIRC the bikeshed around that kinda suggested we should just implement .format_mod_support() always. Can't quite recall the details anymore.
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 82 lines · Ville Syrjälä
Quoted 36 lines · Mario Kleiner
The check was introduced to make sure that only the
DRM_FORMAT_MOD_LINEARmodifier is accepted by tinydrm.However, if .format_mod_supported is not hooked up to
drm_simple_kms_format_mod_supportedthen the core will simply validate modifiers against theformat_modifierslist passed intodrm_simple_display_pipe_init()ordrm_universal_plane_init()and perform the same validation asdrm_simple_kms_format_mod_supported()would have done.Additionally, if a kms driver / plane does not support modifiers, it will not reject fb updates with no modifiers/
DRM_FORMAT_MOD_INVALID. This is important, because some simple drm drivers, e.g., pl111, pass NULL asformat_modifierslist, so modifier support is disabled for these drivers, userspace would fall back todrmAddFB()without modifiers, and ergo the currentdrm_simple_kms_format_mod_supported()function would reject valid modifier-less fb's.So this should fix display on non-tinydrm drivers like pl111, and probably also for non-atomic clients?
The Mesa vc4 gallium driver mentions pl111 as one possible display driver in
render_onlymode, so i assume this matters for some SoC's?The background for the patch that introduced this was to fix atomic modesetting in the X-Servers modesetting-ddx, but with atomic modesetting and format modifiers disabled in modesetting-ddx (and also current kernels when interacting with modesetting-ddx), i assume this should fix some panels.
Note that i don't have any of the hw required for testing this, this is purely based on looking at the code, so this patch is only compile-tested.
Quoted 8 lines
For more reference, this fix was motivated by some discussions around broken page-flipping on VideoCore6 / RaspberryPi 4 with current Raspbian OS, so the experts may want to weigh in on that Mesa bug report as well, under the following link:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3601
Fixes dff906c3f91c ("drm/tinydrm: Advertise that we can do only
DRM_FORMAT_MOD_LINEAR.")Review
Quoted 9 lines
Signed-off-by Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Noralf Trønnes <[email protected]>Cc Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_simple_kms_helper.c | 8 -------- 1 file changed, 8 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_simple_kms_helper.cdrivers/gpu/drm/drm_simple_kms_helper.c static void drm_simple_kms_plane_cleanup_fb(struct
Quoted 4 lines
index
743e57c1b44f..5f3e30553172100644drivers/gpu/drm/drm_simple_kms_helper.c +0
-0@@ -229,13 +229,6 @@ static void drm_simple_kms_plane_cleanup_fb(struct
drm_plane*plane,drivers/gpu/drm/drm_simple_kms_helper.c static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane,
Quoted 11 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-7pipe->funcs->cleanup_fb (pipe, state); } -static bool drm_simple_kms_format_mod_supported (struct drm_plane *plane, -uint32_t format, -uint64_t modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR ; -} - static const struct drm_plane_helper_funcs
drm_simple_kms_plane_helper_funcs= {drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs
Quoted 3 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-0.prepare_fb = drm_simple_kms_plane_prepare_fb, .cleanup_fb = drm_simple_kms_plane_cleanup_fb,@@ -250,7 +243,6 @@ static const struct drm_plane_funcs
drm_simple_kms_plane_funcs= {drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { · line 253
Quoted 4 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-1.reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, - .format_mod_supported = drm_simple_kms_format_mod_supported,
Quoted 7 lines
This will now cause also this driver to report a totally borked
IN_FORMATSblob.Would need this
https://patchwork.freedesktop.org/series/83018/
The slight problem with that (see my comments in the linked Mesa bug report), is that at least one common userspace driver - modesetting-ddx - treat a lack of an IN_FORMATS blob not as "don't use modifiers for drm_framebuffers", but as "everything goes" -- Use every modifier and tiling format that the graphics driver exposes also for scanout buffers. I'm arguing in that bug report that modesetting-ddx shouldn't use atomic or modifiers at all, given how broken that driver is atm. in that area, so i'm not sure if my argument here is valid. Just saying that doing the "every modifier is valid for every format" in absence of format_mod_supported() would probably be less harmful to some existing userspace. Ofc. then there's a reason why atomic gets rejected by the kernel for current modesetting-ddx...
I'm not sure if I'm arguing pro or contra your patch here btw. Just pointing out one possible victim if it were applied.
but IIRC the bikeshed around that kinda suggested we should just
Quoted 4 lines
implement .format_mod_support() always. Can't quite recall the details anymore.
I see. But if .format_mod_supported() is always implemented, then we'd need to handle the case modifier == DRM_FORMAT_MOD_INVALID in the core or in each format_mod_supported() implementation, because currently iff this is hooked up, it gets always used, even if the user-space does not use modifiers. The X-Servers modesetting-ddx, e.g., does not use atomic or modifiers by default, and the linked Mesa bug report shows why - or at least why it shouldn't atm. I think none of the X drivers does.
The softer alternative solution instead of my patch would be to also accept modifier == DRM_FORMAT_MOD_INVALID as valid for simple kms drivers. -mario
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 105 lines · Mario Kleiner
Quoted 82 lines · Ville Syrjälä
Quoted 36 lines · Mario Kleiner
The check was introduced to make sure that only the
DRM_FORMAT_MOD_LINEARmodifier is accepted by tinydrm.However, if .format_mod_supported is not hooked up to
drm_simple_kms_format_mod_supportedthen the core will simply validate modifiers against theformat_modifierslist passed intodrm_simple_display_pipe_init()ordrm_universal_plane_init()and perform the same validation asdrm_simple_kms_format_mod_supported()would have done.Additionally, if a kms driver / plane does not support modifiers, it will not reject fb updates with no modifiers/
DRM_FORMAT_MOD_INVALID. This is important, because some simple drm drivers, e.g., pl111, pass NULL asformat_modifierslist, so modifier support is disabled for these drivers, userspace would fall back todrmAddFB()without modifiers, and ergo the currentdrm_simple_kms_format_mod_supported()function would reject valid modifier-less fb's.So this should fix display on non-tinydrm drivers like pl111, and probably also for non-atomic clients?
The Mesa vc4 gallium driver mentions pl111 as one possible display driver in
render_onlymode, so i assume this matters for some SoC's?The background for the patch that introduced this was to fix atomic modesetting in the X-Servers modesetting-ddx, but with atomic modesetting and format modifiers disabled in modesetting-ddx (and also current kernels when interacting with modesetting-ddx), i assume this should fix some panels.
Note that i don't have any of the hw required for testing this, this is purely based on looking at the code, so this patch is only compile-tested.
Quoted 8 lines
For more reference, this fix was motivated by some discussions around broken page-flipping on VideoCore6 / RaspberryPi 4 with current Raspbian OS, so the experts may want to weigh in on that Mesa bug report as well, under the following link:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3601
Fixes dff906c3f91c ("drm/tinydrm: Advertise that we can do only
DRM_FORMAT_MOD_LINEAR.")Review
Quoted 9 lines
Signed-off-by Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Noralf Trønnes <[email protected]>Cc Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_simple_kms_helper.c | 8 -------- 1 file changed, 8 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_simple_kms_helper.cdrivers/gpu/drm/drm_simple_kms_helper.c static void drm_simple_kms_plane_cleanup_fb(struct
Quoted 4 lines
index
743e57c1b44f..5f3e30553172100644drivers/gpu/drm/drm_simple_kms_helper.c +0
-0@@ -229,13 +229,6 @@ static void drm_simple_kms_plane_cleanup_fb(struct
drm_plane*plane,drivers/gpu/drm/drm_simple_kms_helper.c static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane,
Quoted 11 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-7pipe->funcs->cleanup_fb (pipe, state); } -static bool drm_simple_kms_format_mod_supported (struct drm_plane *plane, -uint32_t format, -uint64_t modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR ; -} - static const struct drm_plane_helper_funcs
drm_simple_kms_plane_helper_funcs= {drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs
Quoted 3 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-0.prepare_fb = drm_simple_kms_plane_prepare_fb, .cleanup_fb = drm_simple_kms_plane_cleanup_fb,@@ -250,7 +243,6 @@ static const struct drm_plane_funcs
drm_simple_kms_plane_funcs= {drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { · line 253
Quoted 4 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-1.reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, - .format_mod_supported = drm_simple_kms_format_mod_supported,Quoted 7 lines
This will now cause also this driver to report a totally borked
IN_FORMATSblob.Would need this
https://patchwork.freedesktop.org/series/83018/The slight problem with that (see my comments in the linked Mesa bug report), is that at least one common userspace driver - modesetting-ddx - treat a lack of an
IN_FORMATSblob not as "don't use modifiers fordrm_framebuffers", but as "everything goes" -- Use every modifier and tiling format that the graphics driver exposes also for scanout buffers. I'm arguing in that bug report that modesetting-ddx shouldn't use atomic or modifiers at all, given how broken that driver is atm. in that area, so i'm not sure if my argument here is valid. Just saying that doing the "every modifier is valid for every format" in absence offormat_mod_supported()would probably be less harmful to some existing userspace. Ofc. then there's a reason why atomic gets rejected by the kernel for current modesetting-ddx...
Quoted 2 lines
I'm not sure if I'm arguing pro or contra your patch here btw. Just pointing out one possible victim if it were applied.
I have no idea how anything would get broken by it.
Currently:
- the broken IN_FORMAT blob says nothing is supported at all, so if someone consults it they won't be able to find a working pixel format
- if they ignore the broken IN_FORMAT blob then it doesn't matter if it's present or not.
I guess the only way somehting might be affected is if they just use the presence of the IN_FORMATS blob as a hint for something but never actually look at the contents.
Quoted 14 lines
but IIRC the bikeshed around that kinda suggested we should just
Quoted 4 lines
implement .format_mod_support() always. Can't quite recall the details anymore.
I see. But if .format_mod_supported() is always implemented, then we'd need to handle the case modifier ==
DRM_FORMAT_MOD_INVALIDin the core or in eachformat_mod_supported()implementation, because currently iff this is hooked up, it gets always used, even if the user-space does not use modifiers. The X-Servers modesetting-ddx, e.g., does not use atomic or modifiers by default, and the linked Mesa bug report shows why - or at least why it shouldn't atm. I think none of the X drivers does.
Quoted 2 lines
The softer alternative solution instead of my patch would be to also accept modifier ==
DRM_FORMAT_MOD_INVALIDas valid for simple kms drivers.
DRM_FORMAT_MOD_INVALID is not a valid modifier.
What kind of broken code is using it?
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 116 lines · Ville Syrjälä
Quoted 1 line · Mario Kleiner
On Mon, Jan 25, 2021 at 1:13 PM Ville Syrjälä <
Quoted 56 lines
Quoted 54 lines · wrote:
Quoted 36 lines · Mario Kleiner
The check was introduced to make sure that only the
DRM_FORMAT_MOD_LINEARmodifier is accepted by tinydrm.However, if .format_mod_supported is not hooked up to
drm_simple_kms_format_mod_supportedthen the core will simply validate modifiers against theformat_modifierslist passed intodrm_simple_display_pipe_init()ordrm_universal_plane_init()and perform the same validation asdrm_simple_kms_format_mod_supported()would have done.Additionally, if a kms driver / plane does not support modifiers, it will not reject fb updates with no modifiers/
DRM_FORMAT_MOD_INVALID. This is important, because some simple drm drivers, e.g., pl111, pass NULL asformat_modifierslist, so modifier support is disabled for these drivers, userspace would fall back todrmAddFB()without modifiers, and ergo the currentdrm_simple_kms_format_mod_supported()function would reject valid modifier-less fb's.So this should fix display on non-tinydrm drivers like pl111, and probably also for non-atomic clients?
The Mesa vc4 gallium driver mentions pl111 as one possible display driver in
render_onlymode, so i assume this matters for some SoC's?The background for the patch that introduced this was to fix atomic modesetting in the X-Servers modesetting-ddx, but with atomic modesetting and format modifiers disabled in modesetting-ddx (and also current kernels when interacting with modesetting-ddx), i assume this should fix some panels.
Note that i don't have any of the hw required for testing this, this is purely based on looking at the code, so this patch is only compile-tested.
Quoted 8 lines
For more reference, this fix was motivated by some discussions around broken page-flipping on VideoCore6 / RaspberryPi 4 with current Raspbian OS, so the experts may want to weigh in on that Mesa bug report as well, under the following link:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3601
Fixes dff906c3f91c ("drm/tinydrm: Advertise that we can do only
DRM_FORMAT_MOD_LINEAR.")Quoted 8 lines
Signed-off-by Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Noralf Trønnes <[email protected]>Cc Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_simple_kms_helper.c | 8 -------- 1 file changed, 8 deletions(-)Quoted 6 lines
Quoted 6 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/drm_simple_kms_helper.cdrivers/gpu/drm/drm_simple_kms_helper.c static void
Quoted 4 lines
index
743e57c1b44f..5f3e30553172100644drivers/gpu/drm/drm_simple_kms_helper.c +0
-0@@ -229,13 +229,6 @@ static voiddrm_simple_kms_plane_cleanup_fb(struct
Quoted 5 lines
Quoted 5 lines
drm_plane*plane,Quoted 4 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-1pipe->funcs->cleanup_fb (pipe, state); } -static bool drm_simple_kms_format_mod_supported(struct drm_plane*plane,
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_simple_kms_helper.c static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane,
Quoted 7 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-6- uint32_t format, - uint64_t modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR ; -} - static const struct drm_plane_helper_funcs
drm_simple_kms_plane_helper_funcs= {Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs
Quoted 3 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-0.prepare_fb = drm_simple_kms_plane_prepare_fb, .cleanup_fb = drm_simple_kms_plane_cleanup_fb,@@ -250,7 +243,6 @@ static const struct drm_plane_funcs
drm_simple_kms_plane_funcs= {Quoted 2 lines
drivers/gpu/drm/drm_simple_kms_helper.c +0
-0.reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state =
drm_atomic_helper_plane_duplicate_state,Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs · line 245
Quoted 1 line
drivers/gpu/drm/drm_simple_kms_helper.c +0
-0.atomic_destroy_state =
drm_atomic_helper_plane_destroy_state,Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { · line 253
Quoted 1 line
drivers/gpu/drm/drm_simple_kms_helper.c +0
-1- .format_mod_supported = drm_simple_kms_format_mod_supported,This will now cause also this driver to report a totally borked
IN_FORMATSblob.Would need this
https://patchwork.freedesktop.org/series/83018/Quoted 6 lines
The slight problem with that (see my comments in the linked Mesa bug report), is that at least one common userspace driver - modesetting-ddx - treat a lack of an
IN_FORMATSblob not as "don't use modifiers fordrm_framebuffers", but as "everything goes" -- Use every modifier and tiling format that the graphics driver exposes also for scanout buffers. I'm arguing in that bug report that modesetting-ddx shouldn't use atomicor
Quoted 1 line
modifiers at all, given how broken that driver is atm. in that area, so
i'm
Quoted 8 lines
not sure if my argument here is valid. Just saying that doing the "every modifier is valid for every format" in absence of
format_mod_supported()would probably be less harmful to some existing userspace. Ofc. then there's a reason why atomic gets rejected by the kernel for current modesetting-ddx...I'm not sure if I'm arguing pro or contra your patch here btw. Just pointing out one possible victim if it were applied.
Quoted 10 lines
I have no idea how anything would get broken by it.
Currently:
- the brokenIN_FORMATblob says nothing is supported at all, so if someone consults it they won't be able to find a working pixel format
- if they ignore the brokenIN_FORMATblob then it doesn't matter if it's present or not.
Yes. What modesetting-ddx does iff xorg.conf Option "Debug" "dmabuf_capable" is set, is it tries to get the list of display capable modifiers. If the list is empty (due to broken IN_FORMAT blob, because .format_mod_supported == NULL for a kms driver in the current kernel), or because the IN_FORMAT blob doesn't exist (if your patch is applied and .format_mod_supported == NULL) or if it can't query in the first place (because use of atomic uapi is disabled or rejected by the kernel - as is the case for current kernels on modesetting-ddx), then it will unfortunately not decide not to use modifiers, but instead will consider all dmabuf modifiers exposed by the render driver as scanout capable, also tiled formats and pass those back to Mesa's DRI3/Present backend or Vulkan/WSI-X11 where things can go sideways, at least as so far shown for v3d / Broadcom VideoCore6 / RPi-4.
Anyway, yes it probably could only break a broken userspace driver more. But that is what modesetting-ddx is atm. iff one decided to enable the dmabuf_capable option, which is what Raspbian currently does, for an underwhelming RPi4 out of the box visual experience.
Looking at your patch i'd suggest to also reset
config->allow_fb_modifiers = false;
if .format_mod_supported == NULL, so clients that check for the DRM_CAP_ADDFB2_MODIFIERS capability will more likely stay away from modifiers. At least modesetting-ddx would fall back to drmModeAddFB instead of drmModeAddFBWithModifiers, which would be better, but probably still broken. It's complicated...
I guess the only way somehting might be affected is if they just use
Quoted 3 lines
the presence of the
IN_FORMATSblob as a hint for something but never actually look at the contents.
Or at DRM_CAP_ADDFB2_MODIFIERS query result, see above.
Quoted 16 lines
Quoted 8 lines
but IIRC the bikeshed around that kinda suggested we should just
Quoted 4 lines
implement .format_mod_support() always. Can't quite recall the details anymore.
I see. But if .format_mod_supported() is always implemented, then we'd
need
Quoted 7 lines
to handle the case modifier ==
DRM_FORMAT_MOD_INVALIDin the core or in eachformat_mod_supported()implementation, because currently iff this is hooked up, it gets always used, even if the user-space does not use modifiers. The X-Servers modesetting-ddx, e.g., does not use atomic or modifiers by default, and the linked Mesa bug report shows why - or at least why it shouldn't atm. I think none of the X drivers does.
Quoted 8 lines
Quoted 1 line
The softer alternative solution instead of my patch would be to also
accept
Quoted 1 line
modifier ==
DRM_FORMAT_MOD_INVALIDas valid for simple kms drivers.
DRM_FORMAT_MOD_INVALIDis not a valid modifier.
What kind of broken code is using it?
Oh sorry, i meant DRM_FORMAT_MOD_NONE (==0) ie. what is in fb->modifier if userspace doesn't assign a modifier, e.g., drmModeAddFB().
But now after looking again, i just realized that DRM_FORMAT_MOD_NONE is identical to DRM_FORMAT_MOD_LINEAR, ie. both are zero, so i guess my point is moot.
That actually means this whole patch of mine is not needed and I was hunting a ghost :/. It also means that simple drm drivers should probably work with RPi if they revert that dmabuf_capable patch on Raspbian's modesetting-ddx with no need for extra kernel fixes, so this is not wasted.
Thanks for helping me think!
-mario
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel