drm/qxl: Pin buffer objects for internal mappings
Subsystems (4)
Thomas Zimmermann
maintainerPATCH 1/1 drm/qxl: Pin buffer objects for internal mappings
Add qxl_bo_pin_and_vmap() that pins and vmaps a buffer object in one step. Update callers of the regular qxl_bo_vmap(). Fixes a bug where qxl accesses an unpinned buffer object while it is being moved; such as with the monitor-description BO. An typical error is shown below.
[ 4.303586] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.586883] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.904036] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65335296x16777216+0+0 [ 5.374347] [drm:qxl_release_from_id_locked] *ERROR* failed to find id in release_idr
Commit b33651a5c98d ("drm/qxl: Do not pin buffer objects for vmap") removed the implicit pin operation from qxl's vmap code. This is the correct behavior for GEM and PRIME interfaces, but the pin is still needed for qxl internal operation.
Also add a corresponding function qxl_bo_vunmap_and_unpin() and remove the old qxl_bo_vmap() helpers.
Future directions: BOs should not be pinned or vmapped unnecessarily. The pin-and-vmap operation should be removed from the driver and a temporary mapping should be established with a vmap_local-like helper. See the client helper drm_client_buffer_vmap_local() for semantics.
--- drivers/gpu/drm/qxl/qxl_display.c | 14 +++++++------- drivers/gpu/drm/qxl/qxl_object.c | 11 +++++++++-- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- 3 files changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/qxl/qxl_display.c +7 -7
@@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,if (ret) goto err; - ret =qxl_bo_vmap (cursor_bo, &cursor_map); + ret =qxl_bo_pin_and_vmap (cursor_bo, &cursor_map);if (ret) goto err_unref; - ret =qxl_bo_vmap (user_bo, &user_map); + ret =qxl_bo_pin_and_vmap (user_bo, &user_map);if (ret) goto err_unmap;
@@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev, user_map.vaddr, size); } -qxl_bo_vunmap (user_bo); -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (user_bo); +qxl_bo_vunmap_and_unpin (cursor_bo);return cursor_bo; err_unmap: -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (cursor_bo); err_unref:qxl_bo_unpin (cursor_bo);qxl_bo_unref (&cursor_bo);
@@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev) } qdev->monitors_config_bo =gem_to_qxl_bo (gobj); - ret =qxl_bo_vmap (qdev->monitors_config_bo, &map); + ret =qxl_bo_pin_and_vmap (qdev->monitors_config_bo, &map);if (ret)return ret;
@@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) qdev->monitors_config =NULL ; qdev->ram_header->monitors_config =0 ; - ret =qxl_bo_vunmap (qdev->monitors_config_bo); + ret =qxl_bo_vunmap_and_unpin (qdev->monitors_config_bo);if (ret)return ret;
drivers/gpu/drm/qxl/qxl_object.c +9 -2
@@ -182,7 +182,7 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map)return 0 ; } -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map) +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map) {int r;
@@ -190,7 +190,13 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)if (r)return r; + r =qxl_bo_pin_locked (bo); +if (r) +return r; + r =qxl_bo_vmap_locked (bo, map); +if (r) +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return r; }
@@ -241,7 +247,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo)ttm_bo_vunmap (&bo->tbo, &bo->map); } -int qxl_bo_vunmap (struct qxl_bo *bo) +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo) {int r;
@@ -250,6 +256,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo)return r;qxl_bo_vunmap_locked (bo); +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return 0 ; }
drivers/gpu/drm/qxl/qxl_object.h +2 -2
@@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev,u32 priority, struct qxl_surface *surf, struct qxl_bo **bo_ptr); -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map); +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map);int qxl_bo_vmap_locked (struct qxl_bo *bo,struct iosys_map *map); -int qxl_bo_vunmap (struct qxl_bo *bo); +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo);void qxl_bo_vunmap_locked (struct qxl_bo *bo);void *qxl_bo_kmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,int page_offset);void qxl_bo_kunmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,void *map);
Signature · 1 line
2.45.2
Thomas Zimmermann
maintainerHi,
ping for a review. This is a bugfix for a serious problem.
Best regards
Thomas
Am 02.07.24 um 16:20 schrieb Thomas Zimmermann:
Quoted 154 lines
Add
qxl_bo_pin_and_vmap()that pins and vmaps a buffer object in one step. Update callers of the regularqxl_bo_vmap(). Fixes a bug where qxl accesses an unpinned buffer object while it is being moved; such as with the monitor-description BO. An typical error is shown below.[ 4.303586] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.586883] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.904036] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65335296x16777216+0+0 [ 5.374347] [drm:qxl_release_from_id_locked] *ERROR* failed to find id in release_idrCommit
b33651a5c98d("drm/qxl: Do not pin buffer objects for vmap") removed the implicit pin operation from qxl's vmap code. This is the correct behavior for GEM and PRIME interfaces, but the pin is still needed for qxl internal operation.Also add a corresponding function
qxl_bo_vunmap_and_unpin()and remove the oldqxl_bo_vmap()helpers.Future directions: BOs should not be pinned or vmapped unnecessarily. The pin-and-vmap operation should be removed from the driver and a temporary mapping should be established with a vmap_local-like helper. See the client helper
drm_client_buffer_vmap_local()for semantics.Signed-off-by Thomas Zimmermann <[email protected]>Fixes b33651a5c98d ("drm/qxl: Do not pin buffer objects for vmap")Reported-by David Kaplan <[email protected]>Tested-by David Kaplan <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Christian König <[email protected]>Cc Zack Rusin <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>--- drivers/gpu/drm/qxl/qxl_display.c | 14 +++++++------- drivers/gpu/drm/qxl/qxl_object.c | 11 +++++++++-- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- 3 files changed, 18 insertions(+), 11 deletions(-)drivers/gpu/drm/qxl/qxl_display.c +7
-7@@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,if (ret) goto err; - ret =qxl_bo_vmap (cursor_bo, &cursor_map); + ret =qxl_bo_pin_and_vmap (cursor_bo, &cursor_map);if (ret) goto err_unref; - ret =qxl_bo_vmap (user_bo, &user_map); + ret =qxl_bo_pin_and_vmap (user_bo, &user_map);if (ret) goto err_unmap;@@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev, user_map.vaddr, size); } -qxl_bo_vunmap (user_bo); -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (user_bo); +qxl_bo_vunmap_and_unpin (cursor_bo);return cursor_bo; err_unmap: -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (cursor_bo); err_unref:qxl_bo_unpin (cursor_bo);qxl_bo_unref (&cursor_bo);@@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev) } qdev->monitors_config_bo =gem_to_qxl_bo (gobj); - ret =qxl_bo_vmap (qdev->monitors_config_bo, &map); + ret =qxl_bo_pin_and_vmap (qdev->monitors_config_bo, &map);if (ret)return ret;@@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) qdev->monitors_config =NULL ; qdev->ram_header->monitors_config =0 ; - ret =qxl_bo_vunmap (qdev->monitors_config_bo); + ret =qxl_bo_vunmap_and_unpin (qdev->monitors_config_bo);if (ret)return ret;drivers/gpu/drm/qxl/qxl_object.c +9
-2@@ -182,7 +182,7 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map)return 0 ; } -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map) +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map) {int r;@@ -190,7 +190,13 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)if (r)return r; + r =qxl_bo_pin_locked (bo); +if (r) +return r; + r =qxl_bo_vmap_locked (bo, map); +if (r) +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return r; }@@ -241,7 +247,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo)ttm_bo_vunmap (&bo->tbo, &bo->map); } -int qxl_bo_vunmap (struct qxl_bo *bo) +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo) {int r;@@ -250,6 +256,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo)return r;qxl_bo_vunmap_locked (bo); +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return 0 ; }drivers/gpu/drm/qxl/qxl_object.h +2
-2@@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev,u32 priority, struct qxl_surface *surf, struct qxl_bo **bo_ptr); -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map); +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map);int qxl_bo_vmap_locked (struct qxl_bo *bo,struct iosys_map *map); -int qxl_bo_vunmap (struct qxl_bo *bo); +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo);void qxl_bo_vunmap_locked (struct qxl_bo *bo);void *qxl_bo_kmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,int page_offset);void qxl_bo_kunmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,void *map);
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Daniel Vetter
Reviewed-byQuoted 3 lines · Thomas Zimmermann
Hi,
ping for a review. This is a bugfix for a serious problem.
I tried to look around whether there's any place where we could WARN_ON if we create a vmap but it's not pinned. But there's lots of places where we want the vmap only for the duration of the dma_resv locked section, so really can't do that. And your patch removes the unlocked vmap implementation, which would be the only place really.
Quoted 154 lines
Best regards
ThomasAm 02.07.24 um 16:20 schrieb Thomas Zimmermann:
Quoted 139 lines
Add
qxl_bo_pin_and_vmap()that pins and vmaps a buffer object in one step. Update callers of the regularqxl_bo_vmap(). Fixes a bug where qxl accesses an unpinned buffer object while it is being moved; such as with the monitor-description BO. An typical error is shown below.[ 4.303586] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.586883] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.904036] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65335296x16777216+0+0 [ 5.374347] [drm:qxl_release_from_id_locked] *ERROR* failed to find id in release_idrCommit
b33651a5c98d("drm/qxl: Do not pin buffer objects for vmap") removed the implicit pin operation from qxl's vmap code. This is the correct behavior for GEM and PRIME interfaces, but the pin is still needed for qxl internal operation.Also add a corresponding function
qxl_bo_vunmap_and_unpin()and remove the oldqxl_bo_vmap()helpers.Future directions: BOs should not be pinned or vmapped unnecessarily. The pin-and-vmap operation should be removed from the driver and a temporary mapping should be established with a vmap_local-like helper. See the client helper
drm_client_buffer_vmap_local()for semantics.Signed-off-by Thomas Zimmermann <[email protected]>Fixes b33651a5c98d ("drm/qxl: Do not pin buffer objects for vmap")Reported-by David Kaplan <[email protected]>Tested-by David Kaplan <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Christian König <[email protected]>Cc Zack Rusin <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>--- drivers/gpu/drm/qxl/qxl_display.c | 14 +++++++------- drivers/gpu/drm/qxl/qxl_object.c | 11 +++++++++-- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- 3 files changed, 18 insertions(+), 11 deletions(-)drivers/gpu/drm/qxl/qxl_display.c +7
-7@@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,if (ret) goto err; - ret =qxl_bo_vmap (cursor_bo, &cursor_map); + ret =qxl_bo_pin_and_vmap (cursor_bo, &cursor_map);if (ret) goto err_unref; - ret =qxl_bo_vmap (user_bo, &user_map); + ret =qxl_bo_pin_and_vmap (user_bo, &user_map);if (ret) goto err_unmap;@@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev, user_map.vaddr, size); } -qxl_bo_vunmap (user_bo); -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (user_bo); +qxl_bo_vunmap_and_unpin (cursor_bo);return cursor_bo; err_unmap: -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (cursor_bo); err_unref:qxl_bo_unpin (cursor_bo);qxl_bo_unref (&cursor_bo);@@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev) } qdev->monitors_config_bo =gem_to_qxl_bo (gobj); - ret =qxl_bo_vmap (qdev->monitors_config_bo, &map); + ret =qxl_bo_pin_and_vmap (qdev->monitors_config_bo, &map);if (ret)return ret;@@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) qdev->monitors_config =NULL ; qdev->ram_header->monitors_config =0 ; - ret =qxl_bo_vunmap (qdev->monitors_config_bo); + ret =qxl_bo_vunmap_and_unpin (qdev->monitors_config_bo);if (ret)return ret;drivers/gpu/drm/qxl/qxl_object.c +9
-2@@ -182,7 +182,7 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map)return 0 ; } -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map) +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map) {int r;@@ -190,7 +190,13 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)if (r)return r; + r =qxl_bo_pin_locked (bo); +if (r) +return r; + r =qxl_bo_vmap_locked (bo, map); +if (r) +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return r; }@@ -241,7 +247,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo)ttm_bo_vunmap (&bo->tbo, &bo->map); } -int qxl_bo_vunmap (struct qxl_bo *bo) +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo) {int r;@@ -250,6 +256,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo)return r;qxl_bo_vunmap_locked (bo); +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return 0 ; }drivers/gpu/drm/qxl/qxl_object.h +2
-2@@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev,u32 priority, struct qxl_surface *surf, struct qxl_bo **bo_ptr); -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map); +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map);int qxl_bo_vmap_locked (struct qxl_bo *bo,struct iosys_map *map); -int qxl_bo_vunmap (struct qxl_bo *bo); +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo);void qxl_bo_vunmap_locked (struct qxl_bo *bo);void *qxl_bo_kmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,int page_offset);void qxl_bo_kunmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,void *map);Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Thomas Zimmermann
maintainerHi
Am 08.07.24 um 10:58 schrieb Daniel Vetter:
Quoted 9 lines · Thomas Zimmermann
Quoted 3 lines
Hi,
ping for a review. This is a bugfix for a serious problem.
I tried to look around whether there's any place where we could
WARN_ONif we create a vmap but it's not pinned. But there's lots of places where we want the vmap only for the duration of thedma_resvlocked section, so really can't do that. And your patch removes the unlocked vmap implementation, which would be the only place really.
Yeah, we often don't want to pin for a vmap. The driver should hold the reservation lock while vmap-ing a buffer. That's why I suggested adding a local-map interface that creates and removes mappings within the same function. It's something for a separate patchset.
Quoted 2 lines
Reviewed-by Daniel Vetter <[email protected]>
Thanks.
Best regards
Thomas
Quoted 153 lines
Quoted 153 lines
Best regards
ThomasAm 02.07.24 um 16:20 schrieb Thomas Zimmermann:
Quoted 139 lines
Add
qxl_bo_pin_and_vmap()that pins and vmaps a buffer object in one step. Update callers of the regularqxl_bo_vmap(). Fixes a bug where qxl accesses an unpinned buffer object while it is being moved; such as with the monitor-description BO. An typical error is shown below.[ 4.303586] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.586883] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65376256x16777216+0+0 [ 4.904036] [drm:drm_atomic_helper_commit_planes] *ERROR* head 1 wrong: 65335296x16777216+0+0 [ 5.374347] [drm:qxl_release_from_id_locked] *ERROR* failed to find id in release_idrCommit
b33651a5c98d("drm/qxl: Do not pin buffer objects for vmap") removed the implicit pin operation from qxl's vmap code. This is the correct behavior for GEM and PRIME interfaces, but the pin is still needed for qxl internal operation.Also add a corresponding function
qxl_bo_vunmap_and_unpin()and remove the oldqxl_bo_vmap()helpers.Future directions: BOs should not be pinned or vmapped unnecessarily. The pin-and-vmap operation should be removed from the driver and a temporary mapping should be established with a vmap_local-like helper. See the client helper
drm_client_buffer_vmap_local()for semantics.Signed-off-by Thomas Zimmermann <[email protected]>Fixes b33651a5c98d ("drm/qxl: Do not pin buffer objects for vmap")Reported-by David Kaplan <[email protected]>Tested-by David Kaplan <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Christian König <[email protected]>Cc Zack Rusin <[email protected]>Cc Dave Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>--- drivers/gpu/drm/qxl/qxl_display.c | 14 +++++++------- drivers/gpu/drm/qxl/qxl_object.c | 11 +++++++++-- drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- 3 files changed, 18 insertions(+), 11 deletions(-)drivers/gpu/drm/qxl/qxl_display.c +7
-7@@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,if (ret) goto err; - ret =qxl_bo_vmap (cursor_bo, &cursor_map); + ret =qxl_bo_pin_and_vmap (cursor_bo, &cursor_map);if (ret) goto err_unref; - ret =qxl_bo_vmap (user_bo, &user_map); + ret =qxl_bo_pin_and_vmap (user_bo, &user_map);if (ret) goto err_unmap;@@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev, user_map.vaddr, size); } -qxl_bo_vunmap (user_bo); -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (user_bo); +qxl_bo_vunmap_and_unpin (cursor_bo);return cursor_bo; err_unmap: -qxl_bo_vunmap (cursor_bo); +qxl_bo_vunmap_and_unpin (cursor_bo); err_unref:qxl_bo_unpin (cursor_bo);qxl_bo_unref (&cursor_bo);@@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev) } qdev->monitors_config_bo =gem_to_qxl_bo (gobj); - ret =qxl_bo_vmap (qdev->monitors_config_bo, &map); + ret =qxl_bo_pin_and_vmap (qdev->monitors_config_bo, &map);if (ret)return ret;@@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) qdev->monitors_config =NULL ; qdev->ram_header->monitors_config =0 ; - ret =qxl_bo_vunmap (qdev->monitors_config_bo); + ret =qxl_bo_vunmap_and_unpin (qdev->monitors_config_bo);if (ret)return ret;drivers/gpu/drm/qxl/qxl_object.c +9
-2@@ -182,7 +182,7 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map)return 0 ; } -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map) +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map) {int r;@@ -190,7 +190,13 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)if (r)return r; + r =qxl_bo_pin_locked (bo); +if (r) +return r; + r =qxl_bo_vmap_locked (bo, map); +if (r) +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return r; }@@ -241,7 +247,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo)ttm_bo_vunmap (&bo->tbo, &bo->map); } -int qxl_bo_vunmap (struct qxl_bo *bo) +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo) {int r;@@ -250,6 +256,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo)return r;qxl_bo_vunmap_locked (bo); +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return 0 ; }drivers/gpu/drm/qxl/qxl_object.h +2
-2@@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev,u32 priority, struct qxl_surface *surf, struct qxl_bo **bo_ptr); -int qxl_bo_vmap (struct qxl_bo *bo,struct iosys_map *map); +int qxl_bo_pin_and_vmap (struct qxl_bo *bo,struct iosys_map *map);int qxl_bo_vmap_locked (struct qxl_bo *bo,struct iosys_map *map); -int qxl_bo_vunmap (struct qxl_bo *bo); +int qxl_bo_vunmap_and_unpin (struct qxl_bo *bo);void qxl_bo_vunmap_locked (struct qxl_bo *bo);void *qxl_bo_kmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,int page_offset);void qxl_bo_kunmap_atomic_page (struct qxl_device *qdev,struct qxl_bo *bo,void *map);Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
drivers/gpu/drm/qxl/qxl_object.c int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map) · line 195
Quoted 7 lines · Thomas Zimmermann
drivers/gpu/drm/qxl/qxl_object.c +3
-0@@ -190,7 +190,13 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)if (r)return r; + r =qxl_bo_pin_locked (bo); +if (r) +return r;
Is qxl_bo_unreserve() missing here?
Quoted 6 lines
drivers/gpu/drm/qxl/qxl_object.c +3
-0+ r =qxl_bo_vmap_locked (bo, map); +if (r) +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return r;
Signature · 2 lines
Best regards, Dmitry
Thomas Zimmermann
maintainerHi
Am 08.07.24 um 13:55 schrieb Dmitry Osipenko:
Quoted 9 lines · Thomas Zimmermann
drivers/gpu/drm/qxl/qxl_object.c int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map) · line 195
Quoted 7 lines
drivers/gpu/drm/qxl/qxl_object.c +3
-0@@ -190,7 +190,13 @@ int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)if (r)return r; + r =qxl_bo_pin_locked (bo); +if (r) +return r;Is
qxl_bo_unreserve()missing here?
Yeah, indeed. Thanks for reporting.
Best regards
Thomas
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/qxl/qxl_object.c +3
-0+ r =qxl_bo_vmap_locked (bo, map); +if (r) +qxl_bo_unpin_locked (bo);qxl_bo_unreserve (bo);return r;
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)