[igt-dev] [PATCH i-g-t] lib/intel_memory_region: Fix missing header inclusion
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Fri Jun 10 12:59:13 UTC 2022
Hi Kamil,
On Friday, 10 June 2022 14:12:45 CEST Kamil Konieczny wrote:
> Hi Janusz,
>
> On 2022-06-10 at 13:33:35 +0200, Janusz Krzysztofik wrote:
> > IGT commit 68efa99c62e2 ("i915/gem_eio: Exercise object creation while
> > wedged") extended lib/i915/intel_memory_region.h header with a definition
> > of new struct gem_memory_region. That structure contains a member of type
> > struct drm_i915_gem_memory_class_instance, but definition of that type is
> > not available unless "i915_drm.h" header is included. Include the missing
> > header.
> >
> > ../lib/i915/intel_memory_region.h:118:44: error: field ‘ci’ has incomplete type
> > 118 | struct drm_i915_gem_memory_class_instance ci;
>
> I don't see this error when I recompile i-g-t ?
As Petri already stated, current users do include i915_drm.h, explicitly or
implicitly, prior to intel_memory_region.h, that's why you can't see the
error. New code I'm working on doesn't require i915_drm.h but needs
intel_memory_region.h. Future code may have similar requirements.
> >
> > Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> > ---
> > lib/i915/intel_memory_region.h | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/lib/i915/intel_memory_region.h b/lib/i915/intel_memory_region.h
> > index f9af9401ea..a874172401 100644
> > --- a/lib/i915/intel_memory_region.h
> > +++ b/lib/i915/intel_memory_region.h
> > @@ -20,6 +20,7 @@
> > * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> > * IN THE SOFTWARE.
> > */
> > +#include "i915_drm.h"
> > #include "igt_collection.h"
> >
> > #ifndef INTEL_MEMORY_REGION_H
> > @@ -62,8 +63,6 @@ unsigned int gem_get_lmem_region_count(int fd);
> >
> > bool gem_has_lmem(int fd);
> >
> > -struct drm_i915_gem_memory_class_instance;
> > -
>
> Maybe this change caused error ?
This forward declaration was needed by definitions of functions which accept a
pointer to struct drm_i915_gem_memory_class_instance. My patch removes it as
no longer needed since now definition of the structure, needed by the change
introduced by commit commit 68efa99c62e2 ("i915/gem_eio: Exercise object
creation while wedged"), is pulled from i915_drm.h.
Thanks,
Janusz
>
> Regards,
> Kamil
>
> > 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);
>
More information about the igt-dev
mailing list