Skip to contentSkip to conversation

drm/rockchip: fix fbdev on non-IOMMU devices

PATCH Applied John Keeping 2 participants 2 messages Oct 20, 2022 – Oct 29, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/rockchip: fix fbdev on non-IOMMU devices

When switching to the generic fbdev infrastructure, it was missed that framebuffers were created with the alloc_kmap parameter to rockchip_gem_create_object() set to true. The generic infrastructure calls this via the .dumb_create() driver operation and thus creates a buffer without an associated kmap.

alloc_kmap only makes a difference on devices without an IOMMU, but when it is missing rockchip_gem_prime_vmap() fails and the framebuffer cannot be used.

Detect the case where a buffer is being allocated for the framebuffer and ensure a kernel mapping is created in this case.

Fixes 24af7c34b290 ("drm/rockchip: use generic fbdev setup")
Cc Thomas Zimmermann <[email protected]>
---
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +4 -1
index 614e97aaac80..da8a69953706 100644
@@ -364,9 +364,12 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv,
 {
 	struct rockchip_gem_object *rk_obj;
 	struct drm_gem_object *obj;
+	bool is_framebuffer;
 	int ret;
 
-	rk_obj = rockchip_gem_create_object(drm, size, false);
+	is_framebuffer = drm->fb_helper && file_priv == drm->fb_helper->client.file;
+
+	rk_obj = rockchip_gem_create_object(drm, size, is_framebuffer);
 	if (IS_ERR(rk_obj))
 		return ERR_CAST(rk_obj);
 
Signature · 1 line
2.38.1
maintainer Applied
#1 lore raw
Quoted 11 lines · John Keeping

When switching to the generic fbdev infrastructure, it was missed that framebuffers were created with the alloc_kmap parameter to rockchip_gem_create_object() set to true. The generic infrastructure calls this via the .dumb_create() driver operation and thus creates a buffer without an associated kmap.

alloc_kmap only makes a difference on devices without an IOMMU, but when it is missing rockchip_gem_prime_vmap() fails and the framebuffer cannot be used.

[...]

Applied, thanks!

[1/1] drm/rockchip: fix fbdev on non-IOMMU devices

      commit: ab78c74cfc5a3caa2bbb7627cb8f3bca40bb5fb0

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>