[Mesa-dev] mesa: fix GLES1 version initialization for gallium

Submitted by Marek Olšák on June 1, 2015, 7:44 p.m.

Details

Message ID 1433187888-22421-1-git-send-email-maraeo@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák June 1, 2015, 7:44 p.m.
From: Marek Olšák <marek.olsak@amd.com>

eglCreateContext was failing.

Broken by 03fd6704db9f1d0f203bf8da18bd587c7e35ce60
---
 src/mesa/main/version.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 409e5ae..572f2da 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -137,7 +137,7 @@  bool
 _mesa_override_gl_version_contextless(struct gl_constants *consts,
                                       gl_api *apiOut, GLuint *versionOut)
 {
-   int version;
+   int version = 0;
    bool fwd_context, compat_context;
 
    get_gl_override(*apiOut, &version, &fwd_context, &compat_context);

Comments

On Mon, Jun 1, 2015 at 12:44 PM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> eglCreateContext was failing.
>
> Broken by 03fd6704db9f1d0f203bf8da18bd587c7e35ce60
> ---
>  src/mesa/main/version.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 409e5ae..572f2da 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -137,7 +137,7 @@ bool
>  _mesa_override_gl_version_contextless(struct gl_constants *consts,
>                                        gl_api *apiOut, GLuint *versionOut)
>  {
> -   int version;
> +   int version = 0;
>     bool fwd_context, compat_context;
>
>     get_gl_override(*apiOut, &version, &fwd_context, &compat_context);

The problem is that get_gl_override() doesn't initialize version,
fwd_context, or compat_context for GLES1 because it contains an
early-out:

   if (api == API_OPENGLES)
      return;

(and the compiler warns about it, and you can't *not* see it because
version.c gets recompiled nearly every time)

I guess your change is okay, since the rest of the function is inside
an if (version > 0), but I'm really not sure how Ian thought this was
supposed to work...
On 01/06/15 22:59, Matt Turner wrote:
> On Mon, Jun 1, 2015 at 12:44 PM, Marek Olšák <maraeo@gmail.com> wrote:
>> From: Marek Olšák <marek.olsak@amd.com>
>>
>> eglCreateContext was failing.
>>
>> Broken by 03fd6704db9f1d0f203bf8da18bd587c7e35ce60
>> ---
>>   src/mesa/main/version.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
>> index 409e5ae..572f2da 100644
>> --- a/src/mesa/main/version.c
>> +++ b/src/mesa/main/version.c
>> @@ -137,7 +137,7 @@ bool
>>   _mesa_override_gl_version_contextless(struct gl_constants *consts,
>>                                         gl_api *apiOut, GLuint *versionOut)
>>   {
>> -   int version;
>> +   int version = 0;
>>      bool fwd_context, compat_context;
>>
>>      get_gl_override(*apiOut, &version, &fwd_context, &compat_context);
> The problem is that get_gl_override() doesn't initialize version,
> fwd_context, or compat_context for GLES1 because it contains an
> early-out:
>
>     if (api == API_OPENGLES)
>        return;
>
> (and the compiler warns about it, and you can't *not* see it because
> version.c gets recompiled nearly every time)
>
> I guess your change is okay, since the rest of the function is inside
> an if (version > 0), but I'm really not sure how Ian thought this was
> supposed to work...

I pushed a fix for this:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=184e4de3a126fa21945fe59f68b8a29977919fc4