RE: [PATCH 09/11] drm/ttm: audit bo->resource usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>-----Original Message-----
>From: dri-devel <dri-devel-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of
>Christian König
>Sent: Thursday, May 19, 2022 5:55 AM
>To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>Cc: matthew.william.auld@xxxxxxxxx; Christian König
><christian.koenig@xxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx
>Subject: [PATCH 09/11] drm/ttm: audit bo->resource usage
>
>Allow BOs to exist without backing store.

Took me a while to figure out that only the last line is related to this commit
message.

Could you add something like:

Refactor usage information.

Allow BOs to exist without backing store.

?

Would make this patch a little easier to decipher.

M

>Signed-off-by: Christian König <christian.koenig@xxxxxxx>
>---
> drivers/gpu/drm/ttm/ttm_bo.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>index 2b01cb30694a..a55564c8b57c 100644
>--- a/drivers/gpu/drm/ttm/ttm_bo.c
>+++ b/drivers/gpu/drm/ttm/ttm_bo.c
>@@ -117,12 +117,13 @@ static int ttm_bo_handle_move_mem(struct
>ttm_buffer_object *bo,
> 				  struct ttm_operation_ctx *ctx,
> 				  struct ttm_place *hop)
> {
>-	struct ttm_resource_manager *old_man, *new_man;
> 	struct ttm_device *bdev = bo->bdev;
>+	bool old_use_tt, new_use_tt;
> 	int ret;
>
>-	old_man = ttm_manager_type(bdev, bo->resource->mem_type);
>-	new_man = ttm_manager_type(bdev, mem->mem_type);
>+	old_use_tt = bo->resource &&
>+		ttm_manager_type(bdev, bo->resource->mem_type)-
>>use_tt;
>+	new_use_tt = ttm_manager_type(bdev, mem->mem_type)->use_tt;
>
> 	ttm_bo_unmap_virtual(bo);
>
>@@ -130,11 +131,11 @@ static int ttm_bo_handle_move_mem(struct
>ttm_buffer_object *bo,
> 	 * Create and bind a ttm if required.
> 	 */
>
>-	if (new_man->use_tt) {
>+	if (new_use_tt) {
> 		/* Zero init the new TTM structure if the old location should
> 		 * have used one as well.
> 		 */
>-		ret = ttm_tt_create(bo, old_man->use_tt);
>+		ret = ttm_tt_create(bo, old_use_tt);
> 		if (ret)
> 			goto out_err;
>
>@@ -160,8 +161,7 @@ static int ttm_bo_handle_move_mem(struct
>ttm_buffer_object *bo,
> 	return 0;
>
> out_err:
>-	new_man = ttm_manager_type(bdev, bo->resource->mem_type);
>-	if (!new_man->use_tt)
>+	if (!old_use_tt)
> 		ttm_bo_tt_destroy(bo);
>
> 	return ret;
>@@ -898,7 +898,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
> 	/*
> 	 * Check whether we need to move buffer.
> 	 */
>-	if (!ttm_resource_compat(bo->resource, placement)) {
>+	if (!bo->resource || !ttm_resource_compat(bo->resource,
>placement)) {
> 		ret = ttm_bo_move_buffer(bo, placement, ctx);
> 		if (ret)
> 			return ret;
>--
>2.25.1





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux