Re: [Spice-devel] [PATCH v2 06/11] drm/qxl: add qxl_bo_vmap/qxl_bo_vunmap

2021-02-17 Thread Thomas Zimmermann
Am 17.02.21 um 13:32 schrieb Gerd Hoffmann: Add vmap/vunmap variants which reserve (and pin) the bo. They can be used in case the caller doesn't hold a reservation for the bo. Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann --- drivers/gpu/drm/qxl/qxl_object.h | 2 ++ driver

Re: [Spice-devel] [PATCH v2 05/11] drm/qxl: rename qxl_bo_kmap -> qxl_bo_vmap_locked

2021-02-17 Thread Thomas Zimmermann
Am 17.02.21 um 13:32 schrieb Gerd Hoffmann: Append _locked to Make clear that these functions should be called with reserved bo's only. While being at it also rename kmap -> vmap. No functional change. Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann --- drivers/gpu/drm/qxl/q

Re: [Spice-devel] [PATCH v2 04/11] drm/qxl: fix lockdep issue in qxl_alloc_release_reserved

2021-02-17 Thread Thomas Zimmermann
Am 17.02.21 um 13:32 schrieb Gerd Hoffmann: Call qxl_bo_unpin (which does a reservation) without holding the release_mutex lock. Fixes lockdep (correctly) warning on a possible deadlock. Fixes: 65ffea3c6e73 ("drm/qxl: unpin release objects") Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zi

Re: [Spice-devel] [PATCH v2 03/11] drm/qxl: use ttm bo priorities

2021-02-17 Thread Thomas Zimmermann
Am 17.02.21 um 13:32 schrieb Gerd Hoffmann: Allow to set priorities for buffer objects. Use priority 1 for surface and cursor command releases. Use priority 0 for drawing command releases. That way the short-living drawing commands are first in line when it comes to eviction, making it *much

Re: [Spice-devel] [PATCH v2 02/11] drm/qxl: more fence wait rework

2021-02-17 Thread Thomas Zimmermann
Am 17.02.21 um 13:32 schrieb Gerd Hoffmann: Move qxl_io_notify_oom() call into wait condition. That way the driver will call it again if one call wasn't enough. Also allows to remove the extra dma_fence_is_signaled() check and the goto. Fixes: 5a838e5d5825 ("drm/qxl: simplify qxl_fence_wait")

[Spice-devel] [PATCH v2 01/11] drm/qxl: properly handle device init failures

2021-02-17 Thread Gerd Hoffmann
Specifically do not try release resources which where not allocated in the first place. Cc: Tong Zhang Tested-by: Tong Zhang Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann --- drivers/gpu/drm/qxl/qxl_display.c | 3 +++ drivers/gpu/drm/qxl/qxl_kms.c | 4 2 files changed, 7 i

[Spice-devel] [PATCH v2 11/11] drm/qxl: add lock asserts to qxl_bo_vmap_locked + qxl_bo_vunmap_locked

2021-02-17 Thread Gerd Hoffmann
Try avoid re-introducing locking bugs. Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann --- drivers/gpu/drm/qxl/qxl_object.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 82c3bf195ad6..6e26d70f2f07 10064

[Spice-devel] [PATCH v2 05/11] drm/qxl: rename qxl_bo_kmap -> qxl_bo_vmap_locked

2021-02-17 Thread Gerd Hoffmann
Append _locked to Make clear that these functions should be called with reserved bo's only. While being at it also rename kmap -> vmap. No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- drivers/gpu/drm/qxl/qxl_display.c | 14 +++--- dri

[Spice-devel] [PATCH v2 07/11] drm/qxl: fix prime vmap

2021-02-17 Thread Gerd Hoffmann
Use the correct vmap variant. We don't have a reservation here, so we can't use the _locked version. Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann --- drivers/gpu/drm/qxl/qxl_prime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_prim

[Spice-devel] [PATCH v2 08/11] drm/qxl: fix monitors object vmap

2021-02-17 Thread Gerd Hoffmann
Use the correct vmap variant. We don't hold a reservation here, so we can't use the _locked variant. We can drop the pin because qxl_bo_vmap will do that for us. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_display.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) dif

[Spice-devel] [PATCH v2 09/11] drm/qxl: move shadow handling to new qxl_prepare_shadow()

2021-02-17 Thread Gerd Hoffmann
Pure code motion, no functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_display.c | 61 +-- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index f106da9178

[Spice-devel] [PATCH v2 10/11] drm/qxl: rework cursor plane

2021-02-17 Thread Gerd Hoffmann
Add helper functions to create and move the cursor. Create the cursor_bo in prepare_fb callback, in the atomic_commit callback we only send the update command to the host. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_display.c | 248 -- 1 file changed, 133

[Spice-devel] [PATCH v2 06/11] drm/qxl: add qxl_bo_vmap/qxl_bo_vunmap

2021-02-17 Thread Gerd Hoffmann
Add vmap/vunmap variants which reserve (and pin) the bo. They can be used in case the caller doesn't hold a reservation for the bo. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_object.h | 2 ++ drivers/gpu/drm/qxl/qxl_object.c | 36 2 files changed,

[Spice-devel] [PATCH v2 02/11] drm/qxl: more fence wait rework

2021-02-17 Thread Gerd Hoffmann
Move qxl_io_notify_oom() call into wait condition. That way the driver will call it again if one call wasn't enough. Also allows to remove the extra dma_fence_is_signaled() check and the goto. Fixes: 5a838e5d5825 ("drm/qxl: simplify qxl_fence_wait") Signed-off-by: Gerd Hoffmann --- drivers/gpu/

[Spice-devel] [PATCH v2 03/11] drm/qxl: use ttm bo priorities

2021-02-17 Thread Gerd Hoffmann
Allow to set priorities for buffer objects. Use priority 1 for surface and cursor command releases. Use priority 0 for drawing command releases. That way the short-living drawing commands are first in line when it comes to eviction, making it *much* less likely that ttm_bo_mem_force_space() pick

[Spice-devel] [PATCH v2 04/11] drm/qxl: fix lockdep issue in qxl_alloc_release_reserved

2021-02-17 Thread Gerd Hoffmann
Call qxl_bo_unpin (which does a reservation) without holding the release_mutex lock. Fixes lockdep (correctly) warning on a possible deadlock. Fixes: 65ffea3c6e73 ("drm/qxl: unpin release objects") Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_release.c | 13 ++--- 1 file cha

Re: [Spice-devel] [PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks.

2021-02-17 Thread Thomas Zimmermann
Hi Am 17.02.21 um 11:02 schrieb Gerd Hoffmann: On Tue, Feb 16, 2021 at 02:46:21PM +0100, Thomas Zimmermann wrote: Am 16.02.21 um 14:27 schrieb Thomas Zimmermann: Hi this is a shadow-buffered plane. Did you consider using the new helpers for shadow-buffered planes? They will map the user BO

Re: [Spice-devel] [PATCH 09/10] drm/qxl: map/unmap framebuffers in prepare_fb+cleanup_fb callbacks.

2021-02-17 Thread Gerd Hoffmann
On Tue, Feb 16, 2021 at 02:46:21PM +0100, Thomas Zimmermann wrote: > > > Am 16.02.21 um 14:27 schrieb Thomas Zimmermann: > > Hi > > > > this is a shadow-buffered plane. Did you consider using the new helpers > > for shadow-buffered planes? They will map the user BO for you and > > provide the ma