[Intel-gfx] [PATCH 3/3] drm/i915/dumb: return the allocated memory size
Ramalingam C
ramalingam.c at intel.com
Mon Dec 30 13:23:51 UTC 2019
On successful allocation, instead returning the requested size
return the total size of allocated pages.
Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 7f39df3fab7f..5a53de797852 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -241,7 +241,9 @@ i915_gem_dumb_create(struct drm_file *file,
{
enum intel_memory_type mem_type = INTEL_MEMORY_SYSTEM;
int cpp = DIV_ROUND_UP(args->bpp, 8);
+ struct intel_memory_region *mr;
u32 format;
+ int ret;
switch (cpp) {
case 1:
@@ -270,8 +272,15 @@ i915_gem_dumb_create(struct drm_file *file,
if (HAS_LMEM(to_i915(dev)))
mem_type = INTEL_MEMORY_LOCAL;
- return i915_gem_create(file, to_i915(dev), mem_type,
- &args->size, &args->handle);
+ ret = i915_gem_create(file, to_i915(dev), mem_type,
+ &args->size, &args->handle);
+ if (ret)
+ goto out;
+
+ mr = intel_memory_region_by_type(to_i915(dev), mem_type);
+ args->size = ALIGN(args->size, mr->min_page_size);
+out:
+ return ret;
}
/**
--
2.20.1
More information about the Intel-gfx
mailing list