diff options
author | Dave Airlie <airlied@redhat.com> | 2016-09-27 23:23:07 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-09-27 23:23:07 -0400 |
commit | c0d5fb4d0d9224ccaad0475c9b58740873970e7e (patch) | |
tree | 202ee565e7d873f6580b85251aba75a00bac1fc2 /drivers/gpu/drm/qxl | |
parent | ca09fb9f60b5f3ab2d57e761aaeea89a5147d784 (diff) | |
parent | 30b9c96cf7b44d53b9165649c8be34ac234be324 (diff) |
Merge tag 'drm-qemu-20160921' of git://git.kraxel.org/linux into drm-next
bugfixes for qemu (bochs, qxl and virtio-gpu) drm drivers
* tag 'drm-qemu-20160921' of git://git.kraxel.org/linux:
drm/virtio: add real fence context and seqno
drm/virtio: drop virtio_gpu_execbuffer_ioctl() wrapping
virtio-gpu: avoid possible NULL pointer dereference
drm/qxl: reapply cursor after SetCrtc calls
bochs: ignore device if there isn't enougth memory
Diffstat (limited to 'drivers/gpu/drm/qxl')
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_display.c | 56 | ||||
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_drv.h | 1 |
2 files changed, 56 insertions, 1 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 3aef12742a53..a61c0d460ec2 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c | |||
@@ -211,6 +211,7 @@ static void qxl_crtc_destroy(struct drm_crtc *crtc) | |||
211 | struct qxl_crtc *qxl_crtc = to_qxl_crtc(crtc); | 211 | struct qxl_crtc *qxl_crtc = to_qxl_crtc(crtc); |
212 | 212 | ||
213 | drm_crtc_cleanup(crtc); | 213 | drm_crtc_cleanup(crtc); |
214 | qxl_bo_unref(&qxl_crtc->cursor_bo); | ||
214 | kfree(qxl_crtc); | 215 | kfree(qxl_crtc); |
215 | } | 216 | } |
216 | 217 | ||
@@ -296,6 +297,52 @@ qxl_hide_cursor(struct qxl_device *qdev) | |||
296 | return 0; | 297 | return 0; |
297 | } | 298 | } |
298 | 299 | ||
300 | static int qxl_crtc_apply_cursor(struct drm_crtc *crtc) | ||
301 | { | ||
302 | struct qxl_crtc *qcrtc = to_qxl_crtc(crtc); | ||
303 | struct drm_device *dev = crtc->dev; | ||
304 | struct qxl_device *qdev = dev->dev_private; | ||
305 | struct qxl_cursor_cmd *cmd; | ||
306 | struct qxl_release *release; | ||
307 | int ret = 0; | ||
308 | |||
309 | if (!qcrtc->cursor_bo) | ||
310 | return 0; | ||
311 | |||
312 | ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd), | ||
313 | QXL_RELEASE_CURSOR_CMD, | ||
314 | &release, NULL); | ||
315 | if (ret) | ||
316 | return ret; | ||
317 | |||
318 | ret = qxl_release_list_add(release, qcrtc->cursor_bo); | ||
319 | if (ret) | ||
320 | goto out_free_release; | ||
321 | |||
322 | ret = qxl_release_reserve_list(release, false); | ||
323 | if (ret) | ||
324 | goto out_free_release; | ||
325 | |||
326 | cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release); | ||
327 | cmd->type = QXL_CURSOR_SET; | ||
328 | cmd->u.set.position.x = qcrtc->cur_x + qcrtc->hot_spot_x; | ||
329 | cmd->u.set.position.y = qcrtc->cur_y + qcrtc->hot_spot_y; | ||
330 | |||
331 | cmd->u.set.shape = qxl_bo_physical_address(qdev, qcrtc->cursor_bo, 0); | ||
332 | |||
333 | cmd->u.set.visible = 1; | ||
334 | qxl_release_unmap(qdev, release, &cmd->release_info); | ||
335 | |||
336 | qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); | ||
337 | qxl_release_fence_buffer_objects(release); | ||
338 | |||
339 | return ret; | ||
340 | |||
341 | out_free_release: | ||
342 | qxl_release_free(qdev, release); | ||
343 | return ret; | ||
344 | } | ||
345 | |||
299 | static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, | 346 | static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, |
300 | struct drm_file *file_priv, | 347 | struct drm_file *file_priv, |
301 | uint32_t handle, | 348 | uint32_t handle, |
@@ -400,7 +447,8 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, | |||
400 | } | 447 | } |
401 | drm_gem_object_unreference_unlocked(obj); | 448 | drm_gem_object_unreference_unlocked(obj); |
402 | 449 | ||
403 | qxl_bo_unref(&cursor_bo); | 450 | qxl_bo_unref (&qcrtc->cursor_bo); |
451 | qcrtc->cursor_bo = cursor_bo; | ||
404 | 452 | ||
405 | return ret; | 453 | return ret; |
406 | 454 | ||
@@ -655,6 +703,12 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, | |||
655 | bo->surf.stride, bo->surf.format); | 703 | bo->surf.stride, bo->surf.format); |
656 | qxl_io_create_primary(qdev, 0, bo); | 704 | qxl_io_create_primary(qdev, 0, bo); |
657 | bo->is_primary = true; | 705 | bo->is_primary = true; |
706 | |||
707 | ret = qxl_crtc_apply_cursor(crtc); | ||
708 | if (ret) { | ||
709 | DRM_ERROR("could not set cursor after modeset"); | ||
710 | ret = 0; | ||
711 | } | ||
658 | } | 712 | } |
659 | 713 | ||
660 | if (bo->is_primary) { | 714 | if (bo->is_primary) { |
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 8e633caa4078..5f3e5ad99de7 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h | |||
@@ -137,6 +137,7 @@ struct qxl_crtc { | |||
137 | int cur_y; | 137 | int cur_y; |
138 | int hot_spot_x; | 138 | int hot_spot_x; |
139 | int hot_spot_y; | 139 | int hot_spot_y; |
140 | struct qxl_bo *cursor_bo; | ||
140 | }; | 141 | }; |
141 | 142 | ||
142 | struct qxl_output { | 143 | struct qxl_output { |