[PATCH 2/3] drm/vkms: Switch to shmem helpers
Chris Wilson
chris at chris-wilson.co.uk
Mon Oct 12 10:59:03 UTC 2020
Quoting Daniel Vetter (2020-10-10 00:21:55)
> Inspired by a patch by Chris Wilson for vgem. Plus this gives us vmap
> at the gem bo level, which we need for generic fbdev emulation.
>
> Luckily shmem also tracks ->vaddr, so we just need to adjust the code
> all over a bit to make this fit.
>
> Also wire up handle_to_fd, dunno why that was missing.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Maxime Ripard <mripard at kernel.org>
> Cc: Thomas Zimmermann <tzimmermann at suse.de>
> Cc: David Airlie <airlied at linux.ie>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>
> Cc: Melissa Wen <melissa.srw at gmail.com>
> Cc: Haneen Mohammed <hamohammed.sa at gmail.com>
> ---
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index 33c031f27c2c..66c6842d70db 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -5,6 +5,7 @@
> #include <drm/drm_atomic.h>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_gem_framebuffer_helper.h>
> +#include <drm/drm_gem_shmem_helper.h>
> #include <drm/drm_vblank.h>
> static void vkms_release(struct drm_device *dev)
> {
> @@ -91,9 +82,11 @@ static struct drm_driver vkms_driver = {
> .driver_features = DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
> .release = vkms_release,
> .fops = &vkms_driver_fops,
> - .dumb_create = vkms_dumb_create,
> + .dumb_create = drm_gem_shmem_dumb_create,
Something worth pointing out is that will create an uncached (well WC)
buffer, but since it is being exported with prime, that is probably for
the better. It might be worth using a memcpy_from_wc() for writeback/CRC
calculations. E.g.
> @@ -129,15 +130,15 @@ static void compose_cursor(struct vkms_composer *cursor_composer,
> void *vaddr_out)
> {
> + blend(vaddr_out, cursor_shmem_obj->vaddr,
> primary_composer, cursor_composer);
> }
>
> @@ -147,20 +148,20 @@ static int compose_planes(void **vaddr_out,
> {
> + memcpy(*vaddr_out, shmem_obj->vaddr, shmem_obj->base.size);
would benefit from WC accessors.
On the other hand, if the load is so small no one notices, it can wait.
Do we have anything that uses vkms in CI?
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the dri-devel
mailing list