diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-08 22:25:57 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-08 23:18:20 +0100 |
commit | 31b4110b5119ad1643f3e75c5e23a44c4ceb30fe (patch) | |
tree | 5d457c6b85edd2bfa73783164ac379f4a9922fcb /src | |
parent | 0f82c1a451a2d5763d9cf53b48f55200f7716966 (diff) |
sna: Use create2 to allocate a DISPLAY bo even if we have not enough stolen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/kgem.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index f06c6f2a..a04b9549 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -3802,8 +3802,7 @@ inline int kgem_bo_fenced_size(struct kgem *kgem, struct kgem_bo *bo) } static struct kgem_bo * -__kgem_bo_create_from_stolen(struct kgem *kgem, int size, int tiling, int pitch) - +__kgem_bo_create_as_display(struct kgem *kgem, int size, int tiling, int pitch) { struct local_i915_gem_create2 args; struct kgem_bo *bo; @@ -3818,8 +3817,11 @@ __kgem_bo_create_from_stolen(struct kgem *kgem, int size, int tiling, int pitch) args.tiling_mode = tiling; args.stride = pitch; - if (drmIoctl(kgem->fd, LOCAL_IOCTL_I915_GEM_CREATE2, &args)) - return NULL; + if (drmIoctl(kgem->fd, LOCAL_IOCTL_I915_GEM_CREATE2, &args)) { + args.placement = LOCAL_I915_CREATE_PLACEMENT_SYSTEM; + if (drmIoctl(kgem->fd, LOCAL_IOCTL_I915_GEM_CREATE2, &args)) + return NULL; + } bo = __kgem_bo_alloc(args.handle, size); if (bo == NULL) { @@ -3830,7 +3832,9 @@ __kgem_bo_create_from_stolen(struct kgem *kgem, int size, int tiling, int pitch) bo->unique_id = kgem_get_unique_id(kgem); bo->tiling = tiling; bo->pitch = pitch; - bo->purged = true; /* for asserts against CPU access */ + if (args.placement == LOCAL_I915_CREATE_PLACEMENT_STOLEN) { + bo->purged = true; /* for asserts against CPU access */ + } bo->reusable = false; /* so that unclaimed scanouts are freed */ bo->domain = DOMAIN_NONE; @@ -3931,7 +3935,7 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem, return last; } - bo = __kgem_bo_create_from_stolen(kgem, size, tiling, pitch); + bo = __kgem_bo_create_as_display(kgem, size, tiling, pitch); if (bo) return bo; } |