[igt-dev] [PATCH i-g-t 02/12] lib/i915: Mark gem_create as handling const memory regions

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Thu Sep 1 17:53:24 UTC 2022


On Thu, Sep 01, 2022 at 01:44:32PM +0200, Zbigniew Kempczyński wrote:
> From: Chris Wilson <chris.p.wilson at linux.intel.com>
> 
> Make the memory regions passed to gem_crate_in_memory_region_list() as
> being const.

Ok, no doubts it is better.

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

> 
> Signed-off-by: Chris Wilson <chris.p.wilson at linux.intel.com>
> ---
>  lib/i915/intel_memory_region.c | 4 ++--
>  lib/i915/intel_memory_region.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/i915/intel_memory_region.c b/lib/i915/intel_memory_region.c
> index 93a18982c1..568bace949 100644
> --- a/lib/i915/intel_memory_region.c
> +++ b/lib/i915/intel_memory_region.c
> @@ -198,7 +198,7 @@ bool gem_has_lmem(int fd)
>  /* A version of gem_create_in_memory_region_list which can be allowed to
>     fail so that the object creation can be retried */
>  int __gem_create_in_memory_region_list(int fd, uint32_t *handle, uint64_t *size, uint32_t flags,
> -				       struct drm_i915_gem_memory_class_instance *mem_regions,
> +				       const struct drm_i915_gem_memory_class_instance *mem_regions,
>  				       int num_regions)
>  {
>  	struct drm_i915_gem_create_ext_memory_regions ext_regions = {
> @@ -234,7 +234,7 @@ int __gem_create_in_memory_region_list(int fd, uint32_t *handle, uint64_t *size,
>   * @num_regions: @mem_regions length
>   */
>  uint32_t gem_create_in_memory_region_list(int fd, uint64_t size, uint32_t flags,
> -					  struct drm_i915_gem_memory_class_instance *mem_regions,
> +					  const struct drm_i915_gem_memory_class_instance *mem_regions,
>  					  int num_regions)
>  {
>  	uint32_t handle;
> diff --git a/lib/i915/intel_memory_region.h b/lib/i915/intel_memory_region.h
> index e1bfe0ca65..fd04df83b5 100644
> --- a/lib/i915/intel_memory_region.h
> +++ b/lib/i915/intel_memory_region.h
> @@ -65,11 +65,11 @@ unsigned int gem_get_lmem_region_count(int fd);
>  bool gem_has_lmem(int fd);
>  
>  int __gem_create_in_memory_region_list(int fd, uint32_t *handle, uint64_t *size, uint32_t flags,
> -				       struct drm_i915_gem_memory_class_instance *mem_regions,
> +				       const struct drm_i915_gem_memory_class_instance *mem_regions,
>  				       int num_regions);
>  
>  uint32_t gem_create_in_memory_region_list(int fd, uint64_t size, uint32_t flags,
> -					  struct drm_i915_gem_memory_class_instance *mem_regions,
> +					  const struct drm_i915_gem_memory_class_instance *mem_regions,
>  					  int num_regions);
>  
>  /*
> -- 
> 2.34.1
>


More information about the igt-dev mailing list