Re: glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-16 Thread Lukas F . Hartmann
Adam Jackson  writes:

> I'm somewhat surprised Mesa doesn't expose any of ANGLE/EXT/NV in GLES2
> contexts. If it did so - and if etnaviv actually implemented instanced
> rendering, which it definitely has code to sometimes do - then I
> suspect you wouldn't need this patch.

Also there is currently no codepath that creates a GLES context in
Xwayland, there is only EGL_OPENGL_API:
https://cgit.freedesktop.org/xorg/xserver/tree/hw/xwayland/xwayland-glamor-gbm.c#n789

On the other hand, "standalone" glamor has a corresponding codepath for it:
https://github.com/mirror/xserver/blob/9d628ee5facf6318368d5b8ca181e083adcffe8c/glamor/glamor_egl.c#L957

But this is only triggered if there is no Desktop GL available at all on
the platform. I tried earlier today to switch the init in
xwayland-glamor-gbm.c to use EGL_OPENGL_ES_API but then I had severe
rendering errors on etnaviv with most text and icons missing.

BTW in parallel this patch was posted to mesa today to downgrade GLSL to 120
as well:
https://lists.freedesktop.org/archives/mesa-dev/2018-May/195060.html

Thanks for merging!

Cheers
Lukas
___
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: glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-16 Thread Adam Jackson
On Tue, 2018-05-15 at 21:51 +0200, Lukas F. Hartmann wrote:
> Hi,
> 
> I upgraded Xwayland and the assorted libraries from git masters today,
> and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
> error was:
> 
> No provider of glVertexAttribDivisor found.  Requires one of:
> Desktop OpenGL 3.3
> OpenGL ES 3.0
> GL extension "GL_ANGLE_instanced_arrays"
> GL extension "GL_ARB_instanced_arrays"
> GL extension "GL_EXT_instanced_arrays"
> GL extension "GL_NV_instanced_arrays"

I'm somewhat surprised Mesa doesn't expose any of ANGLE/EXT/NV in GLES2
contexts. If it did so - and if etnaviv actually implemented instanced
rendering, which it definitely has code to sometimes do - then I
suspect you wouldn't need this patch.

> The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
> rendering assumes that glVertexAttribDivisor() is always available on
> GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
> work fine again on this platform.

Forcing GLSL 1.20 has the side effect of disabling a lot of other
acceleration paths, you'd really rather use 1.30 if you could.

Regardless, this is better than it was. Merged, thanks:

remote: I: patch #223110 updated using rev 
7437b6dbdee050f8ebb3a79b9077d051c91880c3.
remote: I: 1 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/xserver
   3ab32a5378..7437b6dbde  master -> master

- 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: glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-16 Thread Lukas F . Hartmann
Eric,

thanks for the insight. It's still possible that this is a bug in mesa/etnaviv
or a rare glitch in my setup. I'll report back when we know for sure.

Cheers
Lukas

Eric Anholt  writes:

> "Lukas F. Hartmann"  writes:
>
>> Hi,
>>
>> I upgraded Xwayland and the assorted libraries from git masters today,
>> and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
>> error was:
>>
>> No provider of glVertexAttribDivisor found.  Requires one of:
>> Desktop OpenGL 3.3
>> OpenGL ES 3.0
>> GL extension "GL_ANGLE_instanced_arrays"
>> GL extension "GL_ARB_instanced_arrays"
>> GL extension "GL_EXT_instanced_arrays"
>> GL extension "GL_NV_instanced_arrays"
>>
>> The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
>> rendering assumes that glVertexAttribDivisor() is always available on
>> GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
>> work fine again on this platform. After chatting with ajax in
>> #xorg-devel, the following solution was proposed.
>
> In Mesa we've decided in the past to not expose GLSL >= 1.30 on GL 2.x,
> because you can't use most of the new functionality of GLSL 1.30 without
> GL 3.x's APIs.
>
> However, it would be awfully nice for glamor if Mesa drivers *could*
> expose 1.30 on GL2 (if you've got integer textures, you could do
> glamor_font.c's accelerated core text rendering, for example), so I'm
> tempted to take the patch for now so we can start working toward that.
>
> Reviewed-by: Eric Anholt 
>
> but I'll give others a chance to offer input on this.
___
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: glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-16 Thread Eric Anholt
"Lukas F. Hartmann"  writes:

> Hi,
>
> I upgraded Xwayland and the assorted libraries from git masters today,
> and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
> error was:
>
> No provider of glVertexAttribDivisor found.  Requires one of:
> Desktop OpenGL 3.3
> OpenGL ES 3.0
> GL extension "GL_ANGLE_instanced_arrays"
> GL extension "GL_ARB_instanced_arrays"
> GL extension "GL_EXT_instanced_arrays"
> GL extension "GL_NV_instanced_arrays"
>
> The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
> rendering assumes that glVertexAttribDivisor() is always available on
> GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
> work fine again on this platform. After chatting with ajax in
> #xorg-devel, the following solution was proposed.

In Mesa we've decided in the past to not expose GLSL >= 1.30 on GL 2.x,
because you can't use most of the new functionality of GLSL 1.30 without
GL 3.x's APIs.

However, it would be awfully nice for glamor if Mesa drivers *could*
expose 1.30 on GL2 (if you've got integer textures, you could do
glamor_font.c's accelerated core text rendering, for example), so I'm
tempted to take the patch for now so we can start working toward that.

Reviewed-by: Eric Anholt 

but I'll give others a chance to offer input on this.


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: glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-16 Thread Lukas Hartmann
Good call, I don’t know if this is a bug or on purpose. I’ll try to find that 
out. But on a GL 3.0-3.2 platform this would still fail if there was no support 
for glVertexAttribDivisor, or am I wrong?

Cheers
Lukas

> On 16. May 2018, at 01:05, Dave Airlie  wrote:
> 
>> On 16 May 2018 at 05:51, Lukas F. Hartmann  wrote:
>> Hi,
>> 
>> I upgraded Xwayland and the assorted libraries from git masters today,
>> and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
>> error was:
>> 
>> No provider of glVertexAttribDivisor found.  Requires one of:
>>Desktop OpenGL 3.3
>>OpenGL ES 3.0
>>GL extension "GL_ANGLE_instanced_arrays"
>>GL extension "GL_ARB_instanced_arrays"
>>GL extension "GL_EXT_instanced_arrays"
>>GL extension "GL_NV_instanced_arrays"
>> 
>> The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
>> rendering assumes that glVertexAttribDivisor() is always available on
>> GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
>> work fine again on this platform. After chatting with ajax in
>> #xorg-devel, the following solution was proposed.
> 
> I'm not sure it's legal to expose GLSL 1.40 on GL 2.1.
> 
> Dave.

___
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: glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-15 Thread Dave Airlie
On 16 May 2018 at 05:51, Lukas F. Hartmann  wrote:
> Hi,
>
> I upgraded Xwayland and the assorted libraries from git masters today,
> and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
> error was:
>
> No provider of glVertexAttribDivisor found.  Requires one of:
> Desktop OpenGL 3.3
> OpenGL ES 3.0
> GL extension "GL_ANGLE_instanced_arrays"
> GL extension "GL_ARB_instanced_arrays"
> GL extension "GL_EXT_instanced_arrays"
> GL extension "GL_NV_instanced_arrays"
>
> The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
> rendering assumes that glVertexAttribDivisor() is always available on
> GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
> work fine again on this platform. After chatting with ajax in
> #xorg-devel, the following solution was proposed.

I'm not sure it's legal to expose GLSL 1.40 on GL 2.1.

Dave.
___
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

glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-15 Thread Lukas F. Hartmann
Hi,

I upgraded Xwayland and the assorted libraries from git masters today,
and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
error was:

No provider of glVertexAttribDivisor found.  Requires one of:
Desktop OpenGL 3.3
OpenGL ES 3.0
GL extension "GL_ANGLE_instanced_arrays"
GL extension "GL_ARB_instanced_arrays"
GL extension "GL_EXT_instanced_arrays"
GL extension "GL_NV_instanced_arrays"

The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
rendering assumes that glVertexAttribDivisor() is always available on
GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
work fine again on this platform. After chatting with ajax in
#xorg-devel, the following solution was proposed.

This is my first time of submitting a patch, so please excuse me and
advise if I'm doing it wrong ;)

Cheers
Lukas (mntmn)

---
 glamor/glamor.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 86935ed..d984d20 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -563,6 +563,14 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 
 if (!glamor_check_instruction_count(gl_version))
 goto fail;
+
+/* Glamor rendering assumes that platforms with GLSL 130+
+ * have instanced arrays, but this is not always the case.
+ * etnaviv offers GLSL 140 with OpenGL 2.1.
+ */
+if (glamor_priv->glsl_version >= 130 &&
+!epoxy_has_gl_extension("GL_ARB_instanced_arrays"))
+glamor_priv->glsl_version = 120;
 } else {
 if (gl_version < 20) {
 ErrorF("Require Open GLES2.0 or later.\n");
-- 
2.15.1


___
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