[PATCH 1/5] drm/msm/registers: Remove license/etc from generated headers

Rob Clark posted 5 patches 3 months, 1 week ago
[PATCH 1/5] drm/msm/registers: Remove license/etc from generated headers
Posted by Rob Clark 3 months, 1 week ago
Since these generated files are no longer checked in, either in mesa or
in the linux kernel, simplify things by dropping the verbose generated
comment.

These were semi-nerf'd on the kernel side, in the name of build
reproducibility, by commit ba64c6737f86 ("drivers: gpu: drm: msm:
registers: improve reproducibility"), but in a way that was semi-
kernel specific.  We can just reduce the divergence between kernel
and mesa by just dropping all of this.

Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
---
 drivers/gpu/drm/msm/registers/gen_header.py | 37 +--------------------
 1 file changed, 1 insertion(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
index a409404627c7..56273a810c1d 100644
--- a/drivers/gpu/drm/msm/registers/gen_header.py
+++ b/drivers/gpu/drm/msm/registers/gen_header.py
@@ -444,9 +444,6 @@ class Parser(object):
 		self.variants = set()
 		self.file = []
 		self.xml_files = []
-		self.copyright_year = None
-		self.authors = []
-		self.license = None
 
 	def error(self, message):
 		parser, filename = self.stack[-1]
@@ -686,10 +683,6 @@ class Parser(object):
 			self.parse_field(attrs["name"], attrs)
 		elif name == "database":
 			self.do_validate(attrs["xsi:schemaLocation"])
-		elif name == "copyright":
-			self.copyright_year = attrs["year"]
-		elif name == "author":
-			self.authors.append(attrs["name"] + " <" + attrs["email"] + "> " + attrs["name"])
 
 	def end_element(self, name):
 		if name == "domain":
@@ -706,8 +699,6 @@ class Parser(object):
 			self.current_array = self.current_array.parent
 		elif name == "enum":
 			self.current_enum = None
-		elif name == "license":
-			self.license = self.cdata
 
 	def character_data(self, data):
 		self.cdata += data
@@ -868,33 +859,7 @@ def dump_c(args, guard, func):
 
 	print("#ifndef %s\n#define %s\n" % (guard, guard))
 
-	print("""/* Autogenerated file, DO NOT EDIT manually!
-
-This file was generated by the rules-ng-ng gen_header.py tool in this git repository:
-http://gitlab.freedesktop.org/mesa/mesa/
-git clone https://gitlab.freedesktop.org/mesa/mesa.git
-
-The rules-ng-ng source files this header was generated from are:
-""")
-	maxlen = 0
-	for filepath in p.xml_files:
-		new_filepath = re.sub("^.+drivers","drivers",filepath)
-		maxlen = max(maxlen, len(new_filepath))
-	for filepath in p.xml_files:
-		pad = " " * (maxlen - len(new_filepath))
-		filesize = str(os.path.getsize(filepath))
-		filesize = " " * (7 - len(filesize)) + filesize
-		filetime = time.ctime(os.path.getmtime(filepath))
-		print("- " + new_filepath + pad + " (" + filesize + " bytes, from <stripped>)")
-	if p.copyright_year:
-		current_year = str(datetime.date.today().year)
-		print()
-		print("Copyright (C) %s-%s by the following authors:" % (p.copyright_year, current_year))
-		for author in p.authors:
-			print("- " + author)
-	if p.license:
-		print(p.license)
-	print("*/")
+	print("/* Autogenerated file, DO NOT EDIT manually! */")
 
 	print()
 	print("#ifdef __KERNEL__")
-- 
2.51.0
Re: [PATCH 1/5] drm/msm/registers: Remove license/etc from generated headers
Posted by Dmitry Baryshkov 3 months, 1 week ago
On Mon, Sep 08, 2025 at 12:30:04PM -0700, Rob Clark wrote:
> Since these generated files are no longer checked in, either in mesa or
> in the linux kernel, simplify things by dropping the verbose generated
> comment.
> 
> These were semi-nerf'd on the kernel side, in the name of build
> reproducibility, by commit ba64c6737f86 ("drivers: gpu: drm: msm:
> registers: improve reproducibility"), but in a way that was semi-
> kernel specific.  We can just reduce the divergence between kernel
> and mesa by just dropping all of this.
> 
> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
> ---
>  drivers/gpu/drm/msm/registers/gen_header.py | 37 +--------------------
>  1 file changed, 1 insertion(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
> index a409404627c7..56273a810c1d 100644
> --- a/drivers/gpu/drm/msm/registers/gen_header.py
> +++ b/drivers/gpu/drm/msm/registers/gen_header.py
> @@ -444,9 +444,6 @@ class Parser(object):
>  		self.variants = set()
>  		self.file = []
>  		self.xml_files = []
> -		self.copyright_year = None
> -		self.authors = []
> -		self.license = None
>  
>  	def error(self, message):
>  		parser, filename = self.stack[-1]
> @@ -686,10 +683,6 @@ class Parser(object):
>  			self.parse_field(attrs["name"], attrs)
>  		elif name == "database":
>  			self.do_validate(attrs["xsi:schemaLocation"])
> -		elif name == "copyright":
> -			self.copyright_year = attrs["year"]
> -		elif name == "author":
> -			self.authors.append(attrs["name"] + " <" + attrs["email"] + "> " + attrs["name"])
>  
>  	def end_element(self, name):
>  		if name == "domain":
> @@ -706,8 +699,6 @@ class Parser(object):
>  			self.current_array = self.current_array.parent
>  		elif name == "enum":
>  			self.current_enum = None
> -		elif name == "license":
> -			self.license = self.cdata
>  
>  	def character_data(self, data):
>  		self.cdata += data
> @@ -868,33 +859,7 @@ def dump_c(args, guard, func):
>  
>  	print("#ifndef %s\n#define %s\n" % (guard, guard))
>  
> -	print("""/* Autogenerated file, DO NOT EDIT manually!
> -
> -This file was generated by the rules-ng-ng gen_header.py tool in this git repository:
> -http://gitlab.freedesktop.org/mesa/mesa/
> -git clone https://gitlab.freedesktop.org/mesa/mesa.git
> -
> -The rules-ng-ng source files this header was generated from are:
> -""")
> -	maxlen = 0
> -	for filepath in p.xml_files:
> -		new_filepath = re.sub("^.+drivers","drivers",filepath)
> -		maxlen = max(maxlen, len(new_filepath))
> -	for filepath in p.xml_files:
> -		pad = " " * (maxlen - len(new_filepath))
> -		filesize = str(os.path.getsize(filepath))
> -		filesize = " " * (7 - len(filesize)) + filesize
> -		filetime = time.ctime(os.path.getmtime(filepath))
> -		print("- " + new_filepath + pad + " (" + filesize + " bytes, from <stripped>)")
> -	if p.copyright_year:
> -		current_year = str(datetime.date.today().year)
> -		print()
> -		print("Copyright (C) %s-%s by the following authors:" % (p.copyright_year, current_year))
> -		for author in p.authors:
> -			print("- " + author)
> -	if p.license:
> -		print(p.license)

IANAL, but I as the generated files contain C/C++ functions, I think we
need to have a corresponding licence in the file.

> -	print("*/")
> +	print("/* Autogenerated file, DO NOT EDIT manually! */")
>  
>  	print()
>  	print("#ifdef __KERNEL__")
> -- 
> 2.51.0
> 

-- 
With best wishes
Dmitry
Re: [PATCH 1/5] drm/msm/registers: Remove license/etc from generated headers
Posted by Rob Clark 3 months, 1 week ago
On Tue, Sep 9, 2025 at 8:01 AM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Mon, Sep 08, 2025 at 12:30:04PM -0700, Rob Clark wrote:
> > Since these generated files are no longer checked in, either in mesa or
> > in the linux kernel, simplify things by dropping the verbose generated
> > comment.
> >
> > These were semi-nerf'd on the kernel side, in the name of build
> > reproducibility, by commit ba64c6737f86 ("drivers: gpu: drm: msm:
> > registers: improve reproducibility"), but in a way that was semi-
> > kernel specific.  We can just reduce the divergence between kernel
> > and mesa by just dropping all of this.
> >
> > Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
> > ---
> >  drivers/gpu/drm/msm/registers/gen_header.py | 37 +--------------------
> >  1 file changed, 1 insertion(+), 36 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
> > index a409404627c7..56273a810c1d 100644
> > --- a/drivers/gpu/drm/msm/registers/gen_header.py
> > +++ b/drivers/gpu/drm/msm/registers/gen_header.py
> > @@ -444,9 +444,6 @@ class Parser(object):
> >               self.variants = set()
> >               self.file = []
> >               self.xml_files = []
> > -             self.copyright_year = None
> > -             self.authors = []
> > -             self.license = None
> >
> >       def error(self, message):
> >               parser, filename = self.stack[-1]
> > @@ -686,10 +683,6 @@ class Parser(object):
> >                       self.parse_field(attrs["name"], attrs)
> >               elif name == "database":
> >                       self.do_validate(attrs["xsi:schemaLocation"])
> > -             elif name == "copyright":
> > -                     self.copyright_year = attrs["year"]
> > -             elif name == "author":
> > -                     self.authors.append(attrs["name"] + " <" + attrs["email"] + "> " + attrs["name"])
> >
> >       def end_element(self, name):
> >               if name == "domain":
> > @@ -706,8 +699,6 @@ class Parser(object):
> >                       self.current_array = self.current_array.parent
> >               elif name == "enum":
> >                       self.current_enum = None
> > -             elif name == "license":
> > -                     self.license = self.cdata
> >
> >       def character_data(self, data):
> >               self.cdata += data
> > @@ -868,33 +859,7 @@ def dump_c(args, guard, func):
> >
> >       print("#ifndef %s\n#define %s\n" % (guard, guard))
> >
> > -     print("""/* Autogenerated file, DO NOT EDIT manually!
> > -
> > -This file was generated by the rules-ng-ng gen_header.py tool in this git repository:
> > -http://gitlab.freedesktop.org/mesa/mesa/
> > -git clone https://gitlab.freedesktop.org/mesa/mesa.git
> > -
> > -The rules-ng-ng source files this header was generated from are:
> > -""")
> > -     maxlen = 0
> > -     for filepath in p.xml_files:
> > -             new_filepath = re.sub("^.+drivers","drivers",filepath)
> > -             maxlen = max(maxlen, len(new_filepath))
> > -     for filepath in p.xml_files:
> > -             pad = " " * (maxlen - len(new_filepath))
> > -             filesize = str(os.path.getsize(filepath))
> > -             filesize = " " * (7 - len(filesize)) + filesize
> > -             filetime = time.ctime(os.path.getmtime(filepath))
> > -             print("- " + new_filepath + pad + " (" + filesize + " bytes, from <stripped>)")
> > -     if p.copyright_year:
> > -             current_year = str(datetime.date.today().year)
> > -             print()
> > -             print("Copyright (C) %s-%s by the following authors:" % (p.copyright_year, current_year))
> > -             for author in p.authors:
> > -                     print("- " + author)
> > -     if p.license:
> > -             print(p.license)
>
> IANAL, but I as the generated files contain C/C++ functions, I think we
> need to have a corresponding licence in the file.

I can't find anything that indicates a difference depending on the
contents of the generated file (ie. whether it be
functions/tables/prototypes/etc).  And AFAICT it is implicit that the
license of the generated file is inherited from the input to the
generator.

Some other points:
- the various *.mod.c files generated for each kernel module do not
contain a license
- various files generated by asn1_compiler do not contain a license
- other generated .c/.h files are a mixed bag, some contain a license
header and some do not

(In all of the cases the generated files should not be distributed,
IMHO.  Yocto should fix this.)

BR,
-R

>
> > -     print("*/")
> > +     print("/* Autogenerated file, DO NOT EDIT manually! */")
> >
> >       print()
> >       print("#ifdef __KERNEL__")
> > --
> > 2.51.0
> >
>
> --
> With best wishes
> Dmitry
Re: [PATCH 1/5] drm/msm/registers: Remove license/etc from generated headers
Posted by Dmitry Baryshkov 3 months ago
On Tue, Sep 09, 2025 at 10:25:52AM -0700, Rob Clark wrote:
> On Tue, Sep 9, 2025 at 8:01 AM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >
> > On Mon, Sep 08, 2025 at 12:30:04PM -0700, Rob Clark wrote:
> > > Since these generated files are no longer checked in, either in mesa or
> > > in the linux kernel, simplify things by dropping the verbose generated
> > > comment.
> > >
> > > These were semi-nerf'd on the kernel side, in the name of build
> > > reproducibility, by commit ba64c6737f86 ("drivers: gpu: drm: msm:
> > > registers: improve reproducibility"), but in a way that was semi-
> > > kernel specific.  We can just reduce the divergence between kernel
> > > and mesa by just dropping all of this.
> > >
> > > Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
> > > ---
> > >  drivers/gpu/drm/msm/registers/gen_header.py | 37 +--------------------
> > >  1 file changed, 1 insertion(+), 36 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
> > > index a409404627c7..56273a810c1d 100644
> > > --- a/drivers/gpu/drm/msm/registers/gen_header.py
> > > +++ b/drivers/gpu/drm/msm/registers/gen_header.py
> > > @@ -444,9 +444,6 @@ class Parser(object):
> > >               self.variants = set()
> > >               self.file = []
> > >               self.xml_files = []
> > > -             self.copyright_year = None
> > > -             self.authors = []
> > > -             self.license = None
> > >
> > >       def error(self, message):
> > >               parser, filename = self.stack[-1]
> > > @@ -686,10 +683,6 @@ class Parser(object):
> > >                       self.parse_field(attrs["name"], attrs)
> > >               elif name == "database":
> > >                       self.do_validate(attrs["xsi:schemaLocation"])
> > > -             elif name == "copyright":
> > > -                     self.copyright_year = attrs["year"]
> > > -             elif name == "author":
> > > -                     self.authors.append(attrs["name"] + " <" + attrs["email"] + "> " + attrs["name"])
> > >
> > >       def end_element(self, name):
> > >               if name == "domain":
> > > @@ -706,8 +699,6 @@ class Parser(object):
> > >                       self.current_array = self.current_array.parent
> > >               elif name == "enum":
> > >                       self.current_enum = None
> > > -             elif name == "license":
> > > -                     self.license = self.cdata
> > >
> > >       def character_data(self, data):
> > >               self.cdata += data
> > > @@ -868,33 +859,7 @@ def dump_c(args, guard, func):
> > >
> > >       print("#ifndef %s\n#define %s\n" % (guard, guard))
> > >
> > > -     print("""/* Autogenerated file, DO NOT EDIT manually!
> > > -
> > > -This file was generated by the rules-ng-ng gen_header.py tool in this git repository:
> > > -http://gitlab.freedesktop.org/mesa/mesa/
> > > -git clone https://gitlab.freedesktop.org/mesa/mesa.git
> > > -
> > > -The rules-ng-ng source files this header was generated from are:
> > > -""")
> > > -     maxlen = 0
> > > -     for filepath in p.xml_files:
> > > -             new_filepath = re.sub("^.+drivers","drivers",filepath)
> > > -             maxlen = max(maxlen, len(new_filepath))
> > > -     for filepath in p.xml_files:
> > > -             pad = " " * (maxlen - len(new_filepath))
> > > -             filesize = str(os.path.getsize(filepath))
> > > -             filesize = " " * (7 - len(filesize)) + filesize
> > > -             filetime = time.ctime(os.path.getmtime(filepath))
> > > -             print("- " + new_filepath + pad + " (" + filesize + " bytes, from <stripped>)")
> > > -     if p.copyright_year:
> > > -             current_year = str(datetime.date.today().year)
> > > -             print()
> > > -             print("Copyright (C) %s-%s by the following authors:" % (p.copyright_year, current_year))
> > > -             for author in p.authors:
> > > -                     print("- " + author)
> > > -     if p.license:
> > > -             print(p.license)
> >
> > IANAL, but I as the generated files contain C/C++ functions, I think we
> > need to have a corresponding licence in the file.
> 
> I can't find anything that indicates a difference depending on the
> contents of the generated file (ie. whether it be
> functions/tables/prototypes/etc).  And AFAICT it is implicit that the
> license of the generated file is inherited from the input to the
> generator.
> 
> Some other points:
> - the various *.mod.c files generated for each kernel module do not
> contain a license
> - various files generated by asn1_compiler do not contain a license
> - other generated .c/.h files are a mixed bag, some contain a license
> header and some do not
> 
> (In all of the cases the generated files should not be distributed,
> IMHO.  Yocto should fix this.)

It's a bit funny. Normally you use something like linux-headers-foo,
which contains just include/*, arch/foo/include/ and some other files.
Yocto has adopted a way of building the modules against a full-kernel
source & binaries dirs. As such, those two directories are parts of the
cache aka 'shared state', which gets shared, etc.

> 
> BR,
> -R
> 
> >
> > > -     print("*/")
> > > +     print("/* Autogenerated file, DO NOT EDIT manually! */")
> > >
> > >       print()
> > >       print("#ifdef __KERNEL__")
> > > --
> > > 2.51.0
> > >
> >
> > --
> > With best wishes
> > Dmitry

-- 
With best wishes
Dmitry
Re: [PATCH 1/5] drm/msm/registers: Remove license/etc from generated headers
Posted by Rob Clark 3 months ago
On Wed, Sep 10, 2025 at 12:38 PM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Tue, Sep 09, 2025 at 10:25:52AM -0700, Rob Clark wrote:
> > On Tue, Sep 9, 2025 at 8:01 AM Dmitry Baryshkov
> > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > >
> > > On Mon, Sep 08, 2025 at 12:30:04PM -0700, Rob Clark wrote:
> > > > Since these generated files are no longer checked in, either in mesa or
> > > > in the linux kernel, simplify things by dropping the verbose generated
> > > > comment.
> > > >
> > > > These were semi-nerf'd on the kernel side, in the name of build
> > > > reproducibility, by commit ba64c6737f86 ("drivers: gpu: drm: msm:
> > > > registers: improve reproducibility"), but in a way that was semi-
> > > > kernel specific.  We can just reduce the divergence between kernel
> > > > and mesa by just dropping all of this.
> > > >
> > > > Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
> > > > ---
> > > >  drivers/gpu/drm/msm/registers/gen_header.py | 37 +--------------------
> > > >  1 file changed, 1 insertion(+), 36 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
> > > > index a409404627c7..56273a810c1d 100644
> > > > --- a/drivers/gpu/drm/msm/registers/gen_header.py
> > > > +++ b/drivers/gpu/drm/msm/registers/gen_header.py
> > > > @@ -444,9 +444,6 @@ class Parser(object):
> > > >               self.variants = set()
> > > >               self.file = []
> > > >               self.xml_files = []
> > > > -             self.copyright_year = None
> > > > -             self.authors = []
> > > > -             self.license = None
> > > >
> > > >       def error(self, message):
> > > >               parser, filename = self.stack[-1]
> > > > @@ -686,10 +683,6 @@ class Parser(object):
> > > >                       self.parse_field(attrs["name"], attrs)
> > > >               elif name == "database":
> > > >                       self.do_validate(attrs["xsi:schemaLocation"])
> > > > -             elif name == "copyright":
> > > > -                     self.copyright_year = attrs["year"]
> > > > -             elif name == "author":
> > > > -                     self.authors.append(attrs["name"] + " <" + attrs["email"] + "> " + attrs["name"])
> > > >
> > > >       def end_element(self, name):
> > > >               if name == "domain":
> > > > @@ -706,8 +699,6 @@ class Parser(object):
> > > >                       self.current_array = self.current_array.parent
> > > >               elif name == "enum":
> > > >                       self.current_enum = None
> > > > -             elif name == "license":
> > > > -                     self.license = self.cdata
> > > >
> > > >       def character_data(self, data):
> > > >               self.cdata += data
> > > > @@ -868,33 +859,7 @@ def dump_c(args, guard, func):
> > > >
> > > >       print("#ifndef %s\n#define %s\n" % (guard, guard))
> > > >
> > > > -     print("""/* Autogenerated file, DO NOT EDIT manually!
> > > > -
> > > > -This file was generated by the rules-ng-ng gen_header.py tool in this git repository:
> > > > -http://gitlab.freedesktop.org/mesa/mesa/
> > > > -git clone https://gitlab.freedesktop.org/mesa/mesa.git
> > > > -
> > > > -The rules-ng-ng source files this header was generated from are:
> > > > -""")
> > > > -     maxlen = 0
> > > > -     for filepath in p.xml_files:
> > > > -             new_filepath = re.sub("^.+drivers","drivers",filepath)
> > > > -             maxlen = max(maxlen, len(new_filepath))
> > > > -     for filepath in p.xml_files:
> > > > -             pad = " " * (maxlen - len(new_filepath))
> > > > -             filesize = str(os.path.getsize(filepath))
> > > > -             filesize = " " * (7 - len(filesize)) + filesize
> > > > -             filetime = time.ctime(os.path.getmtime(filepath))
> > > > -             print("- " + new_filepath + pad + " (" + filesize + " bytes, from <stripped>)")
> > > > -     if p.copyright_year:
> > > > -             current_year = str(datetime.date.today().year)
> > > > -             print()
> > > > -             print("Copyright (C) %s-%s by the following authors:" % (p.copyright_year, current_year))
> > > > -             for author in p.authors:
> > > > -                     print("- " + author)
> > > > -     if p.license:
> > > > -             print(p.license)
> > >
> > > IANAL, but I as the generated files contain C/C++ functions, I think we
> > > need to have a corresponding licence in the file.
> >
> > I can't find anything that indicates a difference depending on the
> > contents of the generated file (ie. whether it be
> > functions/tables/prototypes/etc).  And AFAICT it is implicit that the
> > license of the generated file is inherited from the input to the
> > generator.
> >
> > Some other points:
> > - the various *.mod.c files generated for each kernel module do not
> > contain a license
> > - various files generated by asn1_compiler do not contain a license
> > - other generated .c/.h files are a mixed bag, some contain a license
> > header and some do not
> >
> > (In all of the cases the generated files should not be distributed,
> > IMHO.  Yocto should fix this.)
>
> It's a bit funny. Normally you use something like linux-headers-foo,
> which contains just include/*, arch/foo/include/ and some other files.
> Yocto has adopted a way of building the modules against a full-kernel
> source & binaries dirs. As such, those two directories are parts of the
> cache aka 'shared state', which gets shared, etc.

So _all_ generated files get shared?  Is this about building
out-of-tree modules?  (Which even in that case, they shouldn't need
these generated files.)

BR,
-R

> >
> > BR,
> > -R
> >
> > >
> > > > -     print("*/")
> > > > +     print("/* Autogenerated file, DO NOT EDIT manually! */")
> > > >
> > > >       print()
> > > >       print("#ifdef __KERNEL__")
> > > > --
> > > > 2.51.0
> > > >
> > >
> > > --
> > > With best wishes
> > > Dmitry
>
> --
> With best wishes
> Dmitry
Re: [PATCH 1/5] drm/msm/registers: Remove license/etc from generated headers
Posted by Dmitry Baryshkov 3 months ago
On Wed, Sep 10, 2025 at 02:44:54PM -0700, Rob Clark wrote:
> On Wed, Sep 10, 2025 at 12:38 PM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >
> > On Tue, Sep 09, 2025 at 10:25:52AM -0700, Rob Clark wrote:
> > > On Tue, Sep 9, 2025 at 8:01 AM Dmitry Baryshkov
> > > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > > >
> > > > On Mon, Sep 08, 2025 at 12:30:04PM -0700, Rob Clark wrote:
> > > > > Since these generated files are no longer checked in, either in mesa or
> > > > > in the linux kernel, simplify things by dropping the verbose generated
> > > > > comment.
> > > > >
> > > > > These were semi-nerf'd on the kernel side, in the name of build
> > > > > reproducibility, by commit ba64c6737f86 ("drivers: gpu: drm: msm:
> > > > > registers: improve reproducibility"), but in a way that was semi-
> > > > > kernel specific.  We can just reduce the divergence between kernel
> > > > > and mesa by just dropping all of this.
> > > > >
> > > > > Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
> > > > > ---
> > > > >  drivers/gpu/drm/msm/registers/gen_header.py | 37 +--------------------
> > > > >  1 file changed, 1 insertion(+), 36 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
> > > > > index a409404627c7..56273a810c1d 100644
> > > > > --- a/drivers/gpu/drm/msm/registers/gen_header.py
> > > > > +++ b/drivers/gpu/drm/msm/registers/gen_header.py
> > > > > @@ -444,9 +444,6 @@ class Parser(object):
> > > > >               self.variants = set()
> > > > >               self.file = []
> > > > >               self.xml_files = []
> > > > > -             self.copyright_year = None
> > > > > -             self.authors = []
> > > > > -             self.license = None
> > > > >
> > > > >       def error(self, message):
> > > > >               parser, filename = self.stack[-1]
> > > > > @@ -686,10 +683,6 @@ class Parser(object):
> > > > >                       self.parse_field(attrs["name"], attrs)
> > > > >               elif name == "database":
> > > > >                       self.do_validate(attrs["xsi:schemaLocation"])
> > > > > -             elif name == "copyright":
> > > > > -                     self.copyright_year = attrs["year"]
> > > > > -             elif name == "author":
> > > > > -                     self.authors.append(attrs["name"] + " <" + attrs["email"] + "> " + attrs["name"])
> > > > >
> > > > >       def end_element(self, name):
> > > > >               if name == "domain":
> > > > > @@ -706,8 +699,6 @@ class Parser(object):
> > > > >                       self.current_array = self.current_array.parent
> > > > >               elif name == "enum":
> > > > >                       self.current_enum = None
> > > > > -             elif name == "license":
> > > > > -                     self.license = self.cdata
> > > > >
> > > > >       def character_data(self, data):
> > > > >               self.cdata += data
> > > > > @@ -868,33 +859,7 @@ def dump_c(args, guard, func):
> > > > >
> > > > >       print("#ifndef %s\n#define %s\n" % (guard, guard))
> > > > >
> > > > > -     print("""/* Autogenerated file, DO NOT EDIT manually!
> > > > > -
> > > > > -This file was generated by the rules-ng-ng gen_header.py tool in this git repository:
> > > > > -http://gitlab.freedesktop.org/mesa/mesa/
> > > > > -git clone https://gitlab.freedesktop.org/mesa/mesa.git
> > > > > -
> > > > > -The rules-ng-ng source files this header was generated from are:
> > > > > -""")
> > > > > -     maxlen = 0
> > > > > -     for filepath in p.xml_files:
> > > > > -             new_filepath = re.sub("^.+drivers","drivers",filepath)
> > > > > -             maxlen = max(maxlen, len(new_filepath))
> > > > > -     for filepath in p.xml_files:
> > > > > -             pad = " " * (maxlen - len(new_filepath))
> > > > > -             filesize = str(os.path.getsize(filepath))
> > > > > -             filesize = " " * (7 - len(filesize)) + filesize
> > > > > -             filetime = time.ctime(os.path.getmtime(filepath))
> > > > > -             print("- " + new_filepath + pad + " (" + filesize + " bytes, from <stripped>)")
> > > > > -     if p.copyright_year:
> > > > > -             current_year = str(datetime.date.today().year)
> > > > > -             print()
> > > > > -             print("Copyright (C) %s-%s by the following authors:" % (p.copyright_year, current_year))
> > > > > -             for author in p.authors:
> > > > > -                     print("- " + author)
> > > > > -     if p.license:
> > > > > -             print(p.license)
> > > >
> > > > IANAL, but I as the generated files contain C/C++ functions, I think we
> > > > need to have a corresponding licence in the file.
> > >
> > > I can't find anything that indicates a difference depending on the
> > > contents of the generated file (ie. whether it be
> > > functions/tables/prototypes/etc).  And AFAICT it is implicit that the
> > > license of the generated file is inherited from the input to the
> > > generator.
> > >
> > > Some other points:
> > > - the various *.mod.c files generated for each kernel module do not
> > > contain a license
> > > - various files generated by asn1_compiler do not contain a license
> > > - other generated .c/.h files are a mixed bag, some contain a license
> > > header and some do not
> > >
> > > (In all of the cases the generated files should not be distributed,
> > > IMHO.  Yocto should fix this.)
> >
> > It's a bit funny. Normally you use something like linux-headers-foo,
> > which contains just include/*, arch/foo/include/ and some other files.
> > Yocto has adopted a way of building the modules against a full-kernel
> > source & binaries dirs. As such, those two directories are parts of the
> > cache aka 'shared state', which gets shared, etc.
> 
> So _all_ generated files get shared?  Is this about building
> out-of-tree modules?  (Which even in that case, they shouldn't need
> these generated files.)

Yes. 

-- 
With best wishes
Dmitry