* [PATCH] drm/virtio: inline drm_simple_encoder_init()
@ 2026-10-18 11:28 Melih Emik
2026-10-19 7:27 ` Thomas Zimmermann
0 siblings, 1 reply; 3+ messages in thread
From: Melih Emik @ 2026-10-18 11:28 UTC (permalink / raw)
To: airlied, kraxel, dmitry.osipenko
Cc: gurchetansingh, olvaffe, maarten.lankhorst, mripard, tzimmermann,
simona, dri-devel, virtualization, linux-kernel
The helper drm_simple_encoder_init() is deprecated because it adds an
unnecessary intermediate layer between atomic modesetting and DRM drivers,
as documented in Documentation/gpu/todo.rst.
Inline the functionality by calling drm_encoder_init() directly with a
local instance of struct drm_encoder_funcs. This allows removing the
dependency on <drm/drm_simple_kms_helper.h> in favor of
<drm/drm_encoder.h>.
Signed-off-by: Melih Emik <melihemik@noirlang.tr>
---
Tested:
- Compiled with W=1 on x86_64 with zero warnings or errors.
- Verified with lockdep and debug mutexes enabled
(CONFIG_PROVE_LOCKING=y, CONFIG_DEBUG_MUTEXES=y).
- Boot-tested full bzImage in QEMU with -device virtio-gpu-pci and
initcall_debug, confirming successful probe and initialization
(probe of virtio0 with driver virtio_gpu returned 0) and zero
lockdep/kernel warnings.
- Verified with scripts/checkpatch.pl (0 errors, 0 warnings).
drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index a1a875a0c706..1bdbf452d111 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -28,11 +28,11 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_edid.h>
+#include <drm/drm_encoder.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
-#include <drm/drm_simple_kms_helper.h>
#include <drm/drm_vblank.h>
#include <drm/drm_vblank_helper.h>
@@ -232,6 +232,10 @@ static enum drm_mode_status virtio_gpu_conn_mode_valid(struct drm_connector *con
return MODE_BAD;
}
+static const struct drm_encoder_funcs virtio_gpu_encoder_funcs = {
+ .destroy = drm_encoder_cleanup,
+};
+
static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = {
.mode_set = virtio_gpu_enc_mode_set,
.enable = virtio_gpu_enc_enable,
@@ -306,7 +310,10 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
if (vgdev->has_edid)
drm_connector_attach_edid_property(connector);
- drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
+ ret = drm_encoder_init(dev, encoder, &virtio_gpu_encoder_funcs,
+ DRM_MODE_ENCODER_VIRTUAL, NULL);
+ if (ret)
+ return ret;
drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);
encoder->possible_crtcs = 1 << index;
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/virtio: inline drm_simple_encoder_init()
2026-10-18 11:28 [PATCH] drm/virtio: inline drm_simple_encoder_init() Melih Emik
@ 2026-10-19 7:27 ` Thomas Zimmermann
2026-10-19 8:58 ` Melih Emik
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Zimmermann @ 2026-10-19 7:27 UTC (permalink / raw)
To: Melih Emik, airlied, kraxel, dmitry.osipenko
Cc: gurchetansingh, olvaffe, maarten.lankhorst, mripard, simona,
dri-devel, virtualization, linux-kernel
Hi
Am 18.10.26 um 13:28 schrieb Melih Emik:
> The helper drm_simple_encoder_init() is deprecated because it adds an
> unnecessary intermediate layer between atomic modesetting and DRM drivers,
> as documented in Documentation/gpu/todo.rst.
>
> Inline the functionality by calling drm_encoder_init() directly with a
> local instance of struct drm_encoder_funcs. This allows removing the
> dependency on <drm/drm_simple_kms_helper.h> in favor of
> <drm/drm_encoder.h>.
These have all been fixed already. You need to work on drm-tip, drm-misc
or a driver-specific git tree for development.
Best regards
Thomas
>
> Signed-off-by: Melih Emik <melihemik@noirlang.tr>
> ---
> Tested:
> - Compiled with W=1 on x86_64 with zero warnings or errors.
> - Verified with lockdep and debug mutexes enabled
> (CONFIG_PROVE_LOCKING=y, CONFIG_DEBUG_MUTEXES=y).
> - Boot-tested full bzImage in QEMU with -device virtio-gpu-pci and
> initcall_debug, confirming successful probe and initialization
> (probe of virtio0 with driver virtio_gpu returned 0) and zero
> lockdep/kernel warnings.
> - Verified with scripts/checkpatch.pl (0 errors, 0 warnings).
>
> drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
> index a1a875a0c706..1bdbf452d111 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -28,11 +28,11 @@
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_damage_helper.h>
> #include <drm/drm_edid.h>
> +#include <drm/drm_encoder.h>
> #include <drm/drm_fourcc.h>
> #include <drm/drm_gem_framebuffer_helper.h>
> #include <drm/drm_print.h>
> #include <drm/drm_probe_helper.h>
> -#include <drm/drm_simple_kms_helper.h>
> #include <drm/drm_vblank.h>
> #include <drm/drm_vblank_helper.h>
>
> @@ -232,6 +232,10 @@ static enum drm_mode_status virtio_gpu_conn_mode_valid(struct drm_connector *con
> return MODE_BAD;
> }
>
> +static const struct drm_encoder_funcs virtio_gpu_encoder_funcs = {
> + .destroy = drm_encoder_cleanup,
> +};
> +
> static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = {
> .mode_set = virtio_gpu_enc_mode_set,
> .enable = virtio_gpu_enc_enable,
> @@ -306,7 +310,10 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
> if (vgdev->has_edid)
> drm_connector_attach_edid_property(connector);
>
> - drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
> + ret = drm_encoder_init(dev, encoder, &virtio_gpu_encoder_funcs,
> + DRM_MODE_ENCODER_VIRTUAL, NULL);
> + if (ret)
> + return ret;
> drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);
> encoder->possible_crtcs = 1 << index;
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/virtio: inline drm_simple_encoder_init()
2026-10-19 7:27 ` Thomas Zimmermann
@ 2026-10-19 8:58 ` Melih Emik
0 siblings, 0 replies; 3+ messages in thread
From: Melih Emik @ 2026-10-19 8:58 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: David Airlie, Gerd Hoffmann, Dmitry Osipenko, gurchetansingh,
olvaffe, maarten.lankhorst, mripard, simona, dri-devel,
virtualization, linux-kernel
Hi Thomas,
Thanks for the pointer! I will base future DRM work on drm-misc/drm-tip.
Best regards,
Melih
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-19 8:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 11:28 [PATCH] drm/virtio: inline drm_simple_encoder_init() Melih Emik
2026-10-19 7:27 ` Thomas Zimmermann
2026-10-19 8:58 ` Melih Emik
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®