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

Karolina Stolarek karolina.stolarek at intel.com
Thu Apr 11 12:20:47 UTC 2024


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 at intel.com>


More information about the dri-devel mailing list