[waffle] [PATCH 2/2] wflinfo: Properly handle minor versions > 9

Chad Versace chad.versace at linux.intel.com
Wed Apr 30 19:15:32 PDT 2014


On Wed, Apr 30, 2014 at 10:27:04AM -0700, Jordan Justen wrote:
> On Tue, Apr 29, 2014 at 1:12 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> > On Tuesday, April 29, 2014 08:39:19 Jordan Justen wrote:
> >> Previously -V 1.40 would be treated the same as -V 5.0.
> >>
> >> Instead, whenever a minor version is requested greater
> >> than 9, bump the major version, and use 0 for the minor
> >> version.
> >>
> >> This leads to -V 1.40 being interpreted as -V 2.0.
> >>
> >> Alternatively, we might treat minor versions greater
> >> than 9 as an error.
> >>
> >> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> >> ---
> >> src/utils/wflinfo.c | 6 ++++++
> >> 1 file changed, 6 insertions(+)
> >>
> >> diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
> >> index 386bdd0..982311d 100644
> >> --- a/src/utils/wflinfo.c
> >> +++ b/src/utils/wflinfo.c
> >> @@ -336,6 +336,12 @@ parse_args(int argc, char *argv[], struct options
> >> *opts)
> >> usage_error_printf("'%s' is not a valid OpenGL version",
> >> optarg);
> >> }
> >> + if (minor > 9) {
> >> + // If a minor version greater than 9 was requested, then
> >> + // bump the major version and use 0 for the minor.
> >> + major++;
> >> + minor = 0;
> >> + }
> >> opts->context_version = 10 * major + minor;
> >> break;
> >> }
> >>
> >
> > As a consumer of wflinfo I would prefer to see a bad version treated as an
> > error.
> 
> I could see wflinfo deciding that minor > 9 is always an error.
> 
> But, I don't want to check the version again a known set of good
> versions because:
> * New spec/driver versions could be used with older wflinfo builds
> * Different versions per API
> * I'd rather leave it to libwaffle/driver to reject the version
> 
> Maybe a better fix is to not store major/minor from the user as major
> * 10 + minor.

I agree with Dylan. Bad versions should fail. If wflinfo "helpfully"
cleans up bad versions, then the user may get an unwanted surprise.

I agree with Jordan. Let's avoid hardcoding a list of known GL versions
if at all possible. And wflinfo shouldn't be the arbiter of what's
a good and bad GL version. libwaffle already has plenty of code for
that. These types of checks can get surprisingly complicated (otherwise,
libwaffle wouldn't need to exist), and we should avoid duplicating that
code.

Jordan, I think splitting the major and minor versions into separate
variables context_major_version/context_minor_version is a good idea.


More information about the waffle mailing list