Re: [PATCH v10 3/9] drm/ttm/tests: Test simple BO creation and validation

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

 



On 10.04.2024 16:01, Matthew Auld wrote:
On 22/03/2024 14:29, Karolina Stolarek wrote:
+static void ttm_bo_validate_pinned(struct kunit *test)
+{
+    enum ttm_bo_type bo_type = ttm_bo_type_device;
+    uint32_t size = ALIGN(BO_SIZE, PAGE_SIZE);
+    struct ttm_operation_ctx ctx = { };
+    uint32_t mem_type = TTM_PL_SYSTEM;
+    struct ttm_placement *placement;
+    struct ttm_buffer_object *bo;
+    struct ttm_place *place;
+    int err;
+
+    place = ttm_place_kunit_init(test, mem_type, 0);
+    placement = ttm_placement_kunit_init(test, place, 1);
+
+    bo = ttm_bo_kunit_init(test, test->priv, size);
+    bo->type = bo_type;
+
+    ttm_bo_reserve(bo, false, false, NULL);
+    ttm_bo_pin(bo);
+    err = ttm_bo_validate(bo, placement, &ctx);
+    dma_resv_unlock(bo->base.resv);
+
+    KUNIT_EXPECT_EQ(test, err, -EINVAL);

ttm_bo_put(bo) ?

Good catch, I'll unpin the buffer and release it, thanks!

All the best,
Karolina


Reviewed-by: Matthew Auld <matthew.auld@xxxxxxxxx>



[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