diff options
author | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2021-10-03 21:20:02 -0700 |
---|---|---|
committer | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2021-10-03 22:26:53 -0700 |
commit | 242d0848546dd6397c609042559ebcc0f7f41bf5 (patch) | |
tree | 015008ef12273c53bd076963b51cba40301884e6 /lib/intel_bufops.c | |
parent | 1bf33aec92671a1cdf80f4fa84216845a31f73b2 (diff) |
lib: Partially revert 22643ce4014a
In 22643ce4014a ("Return allocated size in gem_create_in_memory_regions()
and friends") we modified __gem_create_in_memory_regions and
gem_create_in_memory_regions to return the allocated size for buffer
objects. However, this also unnecessarily complicates programming in the
majority of cases where the allocated size is not needed. For example in
several cases it requires tracking the requested and allocated sizes
separately, the size used must be strictly uint64_t etc.
In order to simplify things and provide greater flexibility, here we change
22643ce4014a to follow the same scheme followed in gem_create_ext (and in
gem_create) where __gem_create_ext returns the allocated size but
gem_create_ext doesn't. With this change, __gem_create_in_memory_regions
returns the allocated size for situations where it is needed but in the
majority of cases where the allocated size is not needed we can just use
gem_create_in_memory_regions for casual use as before.
v2: Store requested not allocated bo size in intel_buf->size (Zbigniew)
Reviewed-by: Zbigniew KempczyĆski <zbigniew.kempczynski@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Diffstat (limited to 'lib/intel_bufops.c')
-rw-r--r-- | lib/intel_bufops.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c index 0cb76142..52794c1a 100644 --- a/lib/intel_bufops.c +++ b/lib/intel_bufops.c @@ -813,6 +813,9 @@ static void __intel_buf_init(struct buf_ops *bops, size = bo_size; } + /* Store real bo size to avoid mistakes in calculating it again */ + buf->size = size; + if (handle) buf->handle = handle; else { @@ -822,9 +825,6 @@ static void __intel_buf_init(struct buf_ops *bops, buf->handle = gem_create(bops->fd, size); } - /* Store real bo size to avoid mistakes in calculating it again */ - buf->size = size; - set_hw_tiled(bops, buf); } |