Re: [Mesa-dev] [PATCH 3/4] st/mesa: add support for KHR_no_error flag

2017-07-12 Thread Eric Engestrom
On Wednesday, 2017-07-12 17:58:56 +0200, Grigori Goronzy wrote:
> On 2017-07-12 15:08, Emil Velikov wrote:
> > On 11 July 2017 at 23:26, Grigori Goronzy  wrote:
> > > Add a new context flag and plumb it through the various layers of the
> > > context creation code to set up dispatch tables for the no-error mode.
> > > ---
> > >  src/gallium/include/state_tracker/st_api.h   |  1 +
> > >  src/gallium/state_trackers/dri/dri_context.c |  3 +++
> > >  src/mesa/state_tracker/st_context.c  | 10 +++---
> > >  src/mesa/state_tracker/st_context.h  |  3 ++-
> > >  src/mesa/state_tracker/st_manager.c  |  6 +-
> > >  5 files changed, 18 insertions(+), 5 deletions(-)
> > > 
> > I think this should come before the enablement patch... although
> > looking at Issue #6 we may be fine as-is.
> > 
> 
> What's issue #6?

Issue #6 in the spec [1]:

> (6) Should creating a context fail if the context created context does not
> support a no error mode?
> 
> RESOLVED: No.  Expect context creation to succeed even if the implementation
> can't honor the request for a no error context. This reduces the number of
> reasons creating a context can fail and seems to be a more forward looking
> resolution considering context flags allow GL apps to query what context
> flags are set.

In other words, it is legal to advertise the extension before you
actually support it, however counter-intuitive this may be.

[1] 
https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_create_context_no_error.txt
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] st/mesa: add support for KHR_no_error flag

2017-07-12 Thread Grigori Goronzy

On 2017-07-12 15:08, Emil Velikov wrote:

On 11 July 2017 at 23:26, Grigori Goronzy  wrote:

Add a new context flag and plumb it through the various layers of the
context creation code to set up dispatch tables for the no-error mode.
---
 src/gallium/include/state_tracker/st_api.h   |  1 +
 src/gallium/state_trackers/dri/dri_context.c |  3 +++
 src/mesa/state_tracker/st_context.c  | 10 +++---
 src/mesa/state_tracker/st_context.h  |  3 ++-
 src/mesa/state_tracker/st_manager.c  |  6 +-
 5 files changed, 18 insertions(+), 5 deletions(-)


I think this should come before the enablement patch... although
looking at Issue #6 we may be fine as-is.



What's issue #6?

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


Re: [Mesa-dev] [PATCH 3/4] st/mesa: add support for KHR_no_error flag

2017-07-12 Thread Emil Velikov
On 11 July 2017 at 23:26, Grigori Goronzy  wrote:
> Add a new context flag and plumb it through the various layers of the
> context creation code to set up dispatch tables for the no-error mode.
> ---
>  src/gallium/include/state_tracker/st_api.h   |  1 +
>  src/gallium/state_trackers/dri/dri_context.c |  3 +++
>  src/mesa/state_tracker/st_context.c  | 10 +++---
>  src/mesa/state_tracker/st_context.h  |  3 ++-
>  src/mesa/state_tracker/st_manager.c  |  6 +-
>  5 files changed, 18 insertions(+), 5 deletions(-)
>
I think this should come before the enablement patch... although
looking at Issue #6 we may be fine as-is.

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


[Mesa-dev] [PATCH 3/4] st/mesa: add support for KHR_no_error flag

2017-07-11 Thread Grigori Goronzy
Add a new context flag and plumb it through the various layers of the
context creation code to set up dispatch tables for the no-error mode.
---
 src/gallium/include/state_tracker/st_api.h   |  1 +
 src/gallium/state_trackers/dri/dri_context.c |  3 +++
 src/mesa/state_tracker/st_context.c  | 10 +++---
 src/mesa/state_tracker/st_context.h  |  3 ++-
 src/mesa/state_tracker/st_manager.c  |  6 +-
 5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 222e565..29e05e9 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -90,6 +90,7 @@ enum st_api_feature
 #define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE  (1 << 1)
 #define ST_CONTEXT_FLAG_ROBUST_ACCESS   (1 << 2)
 #define ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED (1 << 3)
+#define ST_CONTEXT_FLAG_NO_ERROR(1 << 4)
 
 /**
  * Reasons that context creation might fail.
diff --git a/src/gallium/state_trackers/dri/dri_context.c 
b/src/gallium/state_trackers/dri/dri_context.c
index e25f186..275c0d4 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -107,6 +107,9 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
if (notify_reset)
   attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED;
 
+   if (flags & __DRI_CTX_FLAG_NO_ERROR)
+  attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
+
if (sharedContextPrivate) {
   st_share = ((struct dri_context *)sharedContextPrivate)->st;
}
diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index f535139..b8677f4 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -288,7 +288,7 @@ static void st_init_driver_flags(struct st_context *st);
 
 static struct st_context *
 st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
-   const struct st_config_options *options)
+   const struct st_config_options *options, bool no_error)
 {
struct pipe_screen *screen = pipe->screen;
uint i;
@@ -369,6 +369,9 @@ st_create_context_priv( struct gl_context *ctx, struct 
pipe_context *pipe,
 
ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
 
+   if (no_error)
+  ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
+
st->has_stencil_export =
   screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT);
st->has_shader_model3 = screen->get_param(screen, PIPE_CAP_SM3);
@@ -535,7 +538,8 @@ static void st_init_driver_flags(struct st_context *st)
 struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
  const struct gl_config *visual,
  struct st_context *share,
- const struct st_config_options *options)
+ const struct st_config_options *options,
+ bool no_error)
 {
struct gl_context *ctx;
struct gl_context *shareCtx = share ? share->ctx : NULL;
@@ -566,7 +570,7 @@ struct st_context *st_create_context(gl_api api, struct 
pipe_context *pipe,
if (debug_get_option_mesa_mvp_dp4())
   ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = 
GL_TRUE;
 
-   st = st_create_context_priv(ctx, pipe, options);
+   st = st_create_context_priv(ctx, pipe, options, no_error);
if (!st) {
   _mesa_destroy_context(ctx);
}
diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index af9149e..b2ea6b5 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -390,7 +390,8 @@ extern struct st_context *
 st_create_context(gl_api api, struct pipe_context *pipe,
   const struct gl_config *visual,
   struct st_context *share,
-  const struct st_config_options *options);
+  const struct st_config_options *options,
+  bool no_error);
 
 extern void
 st_destroy_context(struct st_context *st);
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 7a3205c..242262b 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -654,6 +654,7 @@ st_api_create_context(struct st_api *stapi, struct 
st_manager *smapi,
struct pipe_context *pipe;
struct gl_config mode;
gl_api api;
+   bool no_error = false;
unsigned ctx_flags = PIPE_CONTEXT_PREFER_THREADED;
 
if (!(stapi->profile_mask & (1 << attribs->profile)))
@@ -680,6 +681,9 @@ st_api_create_context(struct st_api *stapi, struct 
st_manager *smapi,
if (attribs->flags & ST_CONTEXT_FLAG_ROBUST_ACCESS)
   ctx_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
 
+   if (attribs->flags & ST_CONTEXT_FLAG_NO_ERROR)
+