Re: [PATCH xserver] glx: Allow arbitrary context attributes for direct contexts

2017-07-28 Thread Eric Anholt
Adam Jackson  writes:

> On Fri, 2017-07-28 at 09:56 -0700, Eric Anholt wrote:
>> Adam Jackson  writes:
>> 
>> > For direct contexts, most context attributes don't require any
>> > particular awareness on the part of the server. Examples include
>> > GLX_ARB_create_context_no_error and GLX_ARB_context_flush_control, where
>> > all of the behavior change lives in the renderer; since that's on the
>> > client side for a direct context, there's no reason for the X server to
>> > validate the attribute.
>> > 
>> > The context attributes will still be validated on the client side, and
>> > we still validate attributes for indirect contexts since the server
>> > implementation might need to handle them. For example, the indirect
>> > code might internally use ARB_context_flush_control for all contexts, in
>> > which case it would need to manually emit glFlush when the client
>> > switches between two indirect contexts that didn't request the no-flush
>> > attribute.
>> > 
>> > Signed-off-by: Adam Jackson 
>> 
>> Does the client side even need to send the client-side attributes for
>> direct contexts?
>
> It would probably be legal for it to not? The ARB_create_context spec,
> discussing why direct/indirect is a parameter not an attribute, says
> "... different paths to the server may be taken for creating direct
> contexts, and parsing the attribute list in the client should not be
> required". One could read that to mean that creating the server-side of
> a direct context needn't be exactly like creating an indirect context,
> that you could send only those attributes the server needs to be aware
> of (although doing this would mean parsing the attribute list in the
> client, which the issue is otherwise trying to avoid...)
>
> However, none of the GLX extensions that define new context attributes
> seem to define whether that attrib is client or server state, and
> Mesa's glXCreateContextAttribsARB does not edit the attribute list
> before sending it to the server. It seems simpler to me for the server
> ignore unknown attribs for direct contexts than for Mesa to grow a list
> of attributes to censor, because e.g. ARB_create_context_no_error would
> then be exactly as easy to wire up for direct GLX as for EGL.

My thinking was: if we do it client side, then new Mesa works even with
old X.  That said, the fix here is trivial, so let's do it anyway.

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] glx: Allow arbitrary context attributes for direct contexts

2017-07-28 Thread Adam Jackson
On Fri, 2017-07-28 at 09:56 -0700, Eric Anholt wrote:
> Adam Jackson  writes:
> 
> > For direct contexts, most context attributes don't require any
> > particular awareness on the part of the server. Examples include
> > GLX_ARB_create_context_no_error and GLX_ARB_context_flush_control, where
> > all of the behavior change lives in the renderer; since that's on the
> > client side for a direct context, there's no reason for the X server to
> > validate the attribute.
> > 
> > The context attributes will still be validated on the client side, and
> > we still validate attributes for indirect contexts since the server
> > implementation might need to handle them. For example, the indirect
> > code might internally use ARB_context_flush_control for all contexts, in
> > which case it would need to manually emit glFlush when the client
> > switches between two indirect contexts that didn't request the no-flush
> > attribute.
> > 
> > Signed-off-by: Adam Jackson 
> 
> Does the client side even need to send the client-side attributes for
> direct contexts?

It would probably be legal for it to not? The ARB_create_context spec,
discussing why direct/indirect is a parameter not an attribute, says
"... different paths to the server may be taken for creating direct
contexts, and parsing the attribute list in the client should not be
required". One could read that to mean that creating the server-side of
a direct context needn't be exactly like creating an indirect context,
that you could send only those attributes the server needs to be aware
of (although doing this would mean parsing the attribute list in the
client, which the issue is otherwise trying to avoid...)

However, none of the GLX extensions that define new context attributes
seem to define whether that attrib is client or server state, and
Mesa's glXCreateContextAttribsARB does not edit the attribute list
before sending it to the server. It seems simpler to me for the server
ignore unknown attribs for direct contexts than for Mesa to grow a list
of attributes to censor, because e.g. ARB_create_context_no_error would
then be exactly as easy to wire up for direct GLX as for EGL.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] glx: Allow arbitrary context attributes for direct contexts

2017-07-28 Thread Eric Anholt
Adam Jackson  writes:

> For direct contexts, most context attributes don't require any
> particular awareness on the part of the server. Examples include
> GLX_ARB_create_context_no_error and GLX_ARB_context_flush_control, where
> all of the behavior change lives in the renderer; since that's on the
> client side for a direct context, there's no reason for the X server to
> validate the attribute.
>
> The context attributes will still be validated on the client side, and
> we still validate attributes for indirect contexts since the server
> implementation might need to handle them. For example, the indirect
> code might internally use ARB_context_flush_control for all contexts, in
> which case it would need to manually emit glFlush when the client
> switches between two indirect contexts that didn't request the no-flush
> attribute.
>
> Signed-off-by: Adam Jackson 

Does the client side even need to send the client-side attributes for
direct contexts?


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] glx: Allow arbitrary context attributes for direct contexts

2017-07-27 Thread Adam Jackson
For direct contexts, most context attributes don't require any
particular awareness on the part of the server. Examples include
GLX_ARB_create_context_no_error and GLX_ARB_context_flush_control, where
all of the behavior change lives in the renderer; since that's on the
client side for a direct context, there's no reason for the X server to
validate the attribute.

The context attributes will still be validated on the client side, and
we still validate attributes for indirect contexts since the server
implementation might need to handle them. For example, the indirect
code might internally use ARB_context_flush_control for all contexts, in
which case it would need to manually emit glFlush when the client
switches between two indirect contexts that didn't request the no-flush
attribute.

Signed-off-by: Adam Jackson 
---
 glx/createcontext.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/glx/createcontext.c b/glx/createcontext.c
index c8b36ebb0..068b35fa7 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -207,7 +207,9 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, 
GLbyte * pc)
 #endif
 
 default:
-return BadValue;
+if (!req->isDirect)
+return BadValue;
+break;
 }
 }
 
-- 
2.13.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel