[igt-dev] [PATCH i-g-t] i915/intel_memory_region: Add missing forward declaration

Petri Latvala petri.latvala at intel.com
Tue Aug 10 08:48:50 UTC 2021


On Tue, Aug 10, 2021 at 10:14:40AM +0200, Janusz Krzysztofik wrote:
> Intel memory region header declares some functions with a pointer to a
> structure defined elsewhere as one of their arguments.  Forward declare
> that structure to avoid compiler warnings.
> 
> ../lib/i915/intel_memory_region.h:69:19: warning: ‘struct drm_i915_gem_memory_class_instance’ declared inside parameter list will not be visible outside of this definition or declaration
>    69 |            struct drm_i915_gem_memory_class_instance *mem_regions,
>       |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../lib/i915/intel_memory_region.h:73:15: warning: ‘struct drm_i915_gem_memory_class_instance’ declared inside parameter list will not be visible outside of this definition or declaration
>    73 |        struct drm_i915_gem_memory_class_instance *mem_regions,
>       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> ---
>  lib/i915/intel_memory_region.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/i915/intel_memory_region.h b/lib/i915/intel_memory_region.h
> index e9d1d66d4..8cd18ea0e 100644
> --- a/lib/i915/intel_memory_region.h
> +++ b/lib/i915/intel_memory_region.h
> @@ -62,6 +62,8 @@ uint8_t gem_get_lmem_region_count(int fd);
>  
>  bool gem_has_lmem(int fd);
>  
> +struct drm_i915_gem_memory_class_instance;
> +


You want to avoid an #include <i915_drm.h> ?


-- 
Petri Latvala



>  int __gem_create_in_memory_region_list(int fd, uint32_t *handle, uint64_t size,
>  				       struct drm_i915_gem_memory_class_instance *mem_regions,
>  				       int num_regions);
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list