Re: [Mesa-dev] [PATCH] dri_util: fallback to core with drivers not supporting compat for 3.1

2018-03-07 Thread Ian Romanick
On 03/02/2018 02:55 PM, Andres Gomez wrote:
> 2599b92eb97 changed Mesa's behavior to allow Compatiblity profile with
> 3.1, and fail when the driver doesn't implement it, if the Core
> profile is not requested by applications.
> 
> Formerly, when requesting a 3.1 Compatibility profile Mesa would
> always fall back into a Core profile. We go back to that behavior now
> so, if the specific driver is not supporting 3.1 with Compatibility
> profile, we will keep falling back into 3.1 Core.
> 
> Fixes: a0c8b49284e ("mesa: enable OpenGL 3.1 with ARB_compatibility")
> 
> Cc: Marek Olšák 
> Cc: Ian Romanick 
> Cc: Kenneth Graunke 
> Cc: Eric Engestrom 
> Cc: Emil Velikov 
> Signed-off-by: Andres Gomez 
> ---
>  docs/features.txt  |  4 ++--
>  src/mesa/drivers/dri/common/dri_util.c | 10 ++
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/features.txt b/docs/features.txt
> index 5eae34bf0df..d53dd805b1d 100644
> --- a/docs/features.txt
> +++ b/docs/features.txt
> @@ -25,8 +25,8 @@ not started
>  # OpenGL Core and Compatibility context support
>  
>  Some drivers do not support the Compatibility profile or ARB_compatibility.
> -Such drivers are limited to OpenGL 3.0 if the Core profile is not requested
> -by applications. Some of the later GL features are exposed in the 3.0 context
> +Such drivers are limited to use OpenGL 3.1 and later in Core
> +profile. Some of the later GL features are exposed in the 3.0 context

As I said in review of another patch, we need to stop saying OpenGL 3.1
{core,compatibility} profile.  There is no such thing as a profile
before OpenGL 3.2.  Our use of that mechanism is merely an artifact of
how we have implemented things to support multiple drivers in multiple APIs.

I would suggest wording this as:

Some drivers do not support the Compatibility profile or the
ARB_compatibility extensions.  If an application does not request a
specific version without the forward-compatiblity flag, such drivers
will be limited to OpenGL 3.0.  If an application requests OpenGL 3.1,
it will get a context that may or may not have the ARB_compatibility
extension enabled.  Some of the later GL features are exposed in the 3.0
context as extensions.

>  as extensions.
>  
>  
> diff --git a/src/mesa/drivers/dri/common/dri_util.c 
> b/src/mesa/drivers/dri/common/dri_util.c
> index a34f38d6114..53461dfb4e0 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -381,6 +381,16 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
>   }
>  }
>  
> +/* The specific Mesa driver may not support the GL_ARB_compatibilty
> + * extension or the compatibility profile.  In that case, we treat an
> + * API_OPENGL_COMPAT 3.1 as API_OPENGL_CORE. We reject API_OPENGL_COMPAT
> + * 3.2+ in any case.
> + */
> +if (mesa_api == API_OPENGL_COMPAT &&
> +ctx_config.major_version == 3 && ctx_config.minor_version == 1 &&
> +screen->max_gl_compat_version < 31)
> +   mesa_api = API_OPENGL_CORE;
> +
>  if (mesa_api == API_OPENGL_COMPAT
>  && ((ctx_config.major_version > 3)
>  || (ctx_config.major_version == 3 &&
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri_util: fallback to core with drivers not supporting compat for 3.1

2018-03-05 Thread Emil Velikov
Hi Andres,

On 2 March 2018 at 22:55, Andres Gomez  wrote:
> 2599b92eb97 changed Mesa's behavior to allow Compatiblity profile with
> 3.1, and fail when the driver doesn't implement it, if the Core
> profile is not requested by applications.
>
> Formerly, when requesting a 3.1 Compatibility profile Mesa would
> always fall back into a Core profile. We go back to that behavior now
> so, if the specific driver is not supporting 3.1 with Compatibility
> profile, we will keep falling back into 3.1 Core.
>
The above message seems pretty hard to parse. May I suggest reusing
the inline comment as commit message, or borrowing something like
below:

---
Currently, the i965 driver does not support the ARB_compatibility
extension, thus creating an GL3.1 context (which is implicitly a
compat one) will fail.
Props to the validate_context_version() check and i965's
"max_gl_compat_version = 30"

Restore the original check which changes mesa_api to API_OPENGL_CODE, only when:
 - GL3.1 + API_OPENGL_COMPAT is requested, and
 - driver does not support ARB_compatibility - as deduced by
max_gl_compat_version
---

\The 2599b92eb97 hunk seems misplaced bth, so I'd drop it all together.

With that the patch is
Reviewed-by: Emil Velikov 

Orthogonal to that, it might be a good idea to:
 - split the ARB_compatibility hunk out of _mesa_compute_version -
only st/mesa should do it + it seems misplaced all together
 - add GL3.1 compat support for i965

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev