diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-07 10:35:04 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-07 18:54:57 +0100 |
commit | c01c66bca2c64ae2d77233b6ccdca26431ee51b8 (patch) | |
tree | 7629611aba420d02e54040344d20c9a49cb2b5de | |
parent | 6004870d53221caf05a330fcfc8a72e68b2b8898 (diff) |
sna: Update experimental create2 struct definition
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 8d59a2ec..3c324e56 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -135,13 +135,15 @@ search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags); #define LOCAL_IOCTL_I915_GEM_CREATE2 DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CREATE2, struct local_i915_gem_create2) struct local_i915_gem_create2 { uint64_t size; + uint32_t placement; +#define LOCAL_I915_CREATE_PLACEMENT_SYSTEM 0 +#define LOCAL_I915_CREATE_PLACEMENT_STOLEN 1 /* Cannot use CPU mmaps or pread/pwrite */ uint32_t domain; -#define LOCAL_I915_CREATE_DOMAIN_SYSTEM 0 -#define LOCAL_I915_CREATE_DOMAIN_STOLEN 1 uint32_t caching; uint32_t tiling_mode; uint32_t stride; uint32_t flags; + uint32_t pad; uint32_t handle; }; @@ -980,14 +982,8 @@ static bool test_has_create2(struct kgem *kgem) if (DBG_NO_CREATE2) return false; - VG_CLEAR(args); + memset(&args, 0, sizeof(args)); args.size = PAGE_SIZE; - args.domain = LOCAL_I915_CREATE_DOMAIN_SYSTEM; - args.caching = UNCACHED; - args.tiling_mode = I915_TILING_NONE; - args.stride = 0; - args.flags = 0; - args.handle = 0; if (drmIoctl(kgem->fd, LOCAL_IOCTL_I915_GEM_CREATE2, &args) == 0) gem_close(kgem->fd, args.handle); @@ -3818,13 +3814,12 @@ __kgem_bo_create_from_stolen(struct kgem *kgem, int size, int tiling, int pitch) if (!kgem->has_create2) return NULL; - VG_CLEAR(args); + memset(&args, 0, sizeof(args)); args.size = size * PAGE_SIZE; - args.domain = LOCAL_I915_CREATE_DOMAIN_STOLEN; + args.placement = LOCAL_I915_CREATE_PLACEMENT_STOLEN; args.caching = UNCACHED; args.tiling_mode = tiling; args.stride = pitch; - args.flags = 0; if (drmIoctl(kgem->fd, LOCAL_IOCTL_I915_GEM_CREATE2, &args)) return NULL; @@ -3840,6 +3835,12 @@ __kgem_bo_create_from_stolen(struct kgem *kgem, int size, int tiling, int pitch) bo->pitch = pitch; bo->purged = true; /* for asserts against CPU access */ bo->reusable = false; /* so that unclaimed scanouts are freed */ + bo->domain = DOMAIN_NONE; + + if (__kgem_busy(kgem, bo->handle)) { + list_add(&bo->request, &kgem->flushing); + bo->rq = (void *)kgem; + } assert_tiling(kgem, bo); debug_alloc__bo(kgem, bo); |