summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/virtio
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2016-05-31 08:50:47 +0200
committerGerd Hoffmann <kraxel@redhat.com>2016-06-07 10:33:12 +0200
commite7cf0963f816fa44190caaf51aeffaa614c340c6 (patch)
treec3cd394a59ecd254f0b4f01cf4dc5e9177cbaddf /drivers/gpu/drm/virtio
parentvirtio-gpu: fix output lookup (diff)
downloadlinux-e7cf0963f816fa44190caaf51aeffaa614c340c6.tar.xz
linux-e7cf0963f816fa44190caaf51aeffaa614c340c6.zip
virtio-gpu: add atomic_commit function
Do modesets first, then call drm_atomic_helper_commit_planes with active_only = true. That way the outputs doesn't get disabled temporarly on atomic commits. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/virtio')
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_display.c22
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_drv.h1
2 files changed, 22 insertions, 1 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index d4305da88f44..c5d33e051f5c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -466,10 +466,30 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
return &virtio_gpu_fb->base;
}
+static int vgdev_atomic_commit(struct drm_device *dev,
+ struct drm_atomic_state *state,
+ bool nonblock)
+{
+ if (nonblock)
+ return -EBUSY;
+
+ drm_atomic_helper_swap_state(dev, state);
+ drm_atomic_helper_wait_for_fences(dev, state);
+
+ drm_atomic_helper_commit_modeset_disables(dev, state);
+ drm_atomic_helper_commit_modeset_enables(dev, state);
+ drm_atomic_helper_commit_planes(dev, state, true);
+
+ drm_atomic_helper_wait_for_vblanks(dev, state);
+ drm_atomic_helper_cleanup_planes(dev, state);
+ drm_atomic_state_free(state);
+ return 0;
+}
+
static const struct drm_mode_config_funcs virtio_gpu_mode_funcs = {
.fb_create = virtio_gpu_user_framebuffer_create,
.atomic_check = drm_atomic_helper_check,
- .atomic_commit = drm_atomic_helper_commit,
+ .atomic_commit = vgdev_atomic_commit,
};
int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev)
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 0a54f43f846a..ecd1c4398e93 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -33,6 +33,7 @@
#include <drm/drmP.h>
#include <drm/drm_gem.h>
+#include <drm/drm_atomic.h>
#include <drm/drm_crtc_helper.h>
#include <ttm/ttm_bo_api.h>
#include <ttm/ttm_bo_driver.h>