GLX vs EGL context: bad font and edge rendering with EGL

232 views
Skip to first unread message

rubenvb

unread,
Apr 28, 2017, 12:11:34 PM4/28/17
to skia-discuss
Hello list,

I'm experimenting with Skia on Linux, and previously had written a rudimentary GLX+Skia+XCB window creation thing and was able to draw on screen.
Since I thought EGL would be more flexible, I attempted to replace the GLX stuff with EGL.
I succeeded in drawing on screen, but the quality of the EGL result is, well, abysmal.

With GLX, it seemed there was some form of anti-aliasing enabled, as a line drawn on the pixel boundary was blended into two pixels:

With EGL, this effect is absent, and above all, text rendering is just bad:


In both cases, the Skia side is identical: I use the _glx or _egl versions of the GrGlCreateNativeInterface function, respectively.

I first thought this would be due to the EGL config that eglChooseConfig picked, but now I have tried every config returned by eglGetConfigs, of which 4 give the same result and the other four fail to produce a context and/or window at all.
I am out of ideas for how to fix the EGL implementation. It seems like something Skia does differently, or that the rendering to screen does differently.
Unfortunately, these are my first steps into low-level GUI programming, and it seems I'm stuck.
I have a preference for a single EGL implementation if possible, so I don't need to write/maintain overlapping functionality for both APIs.

Does anyone have any ideas where the difference might come from?

rubenvb

unread,
Apr 28, 2017, 12:54:58 PM4/28/17
to skia-discuss
Because it seems I forgot to link the actual code, you can check ik out at github.com/skui-org/skui, most of the relevant (GLX) bits are in gui/window_xcb.c++.

I haven't committed the equivalent EGL because, well, it results in ugly rendering for now.

Jim Van Verth

unread,
Apr 28, 2017, 1:06:06 PM4/28/17
to skia-discuss
Does the SkPaint you're using have anti-aliasing explicitly enabled?  Perhaps GLX is implicitly setting that for you somehow.

On Fri, Apr 28, 2017 at 12:55 PM rubenvb <vanboxe...@gmail.com> wrote:
Because it seems I forgot to link the actual code, you can check ik out at github.com/skui-org/skui, most of the relevant (GLX) bits are in gui/window_xcb.c++.

I haven't committed the equivalent EGL because, well, it results in ugly rendering for now.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Brian Salomon

unread,
Apr 28, 2017, 1:07:57 PM4/28/17
to skia-discuss
Hi,

That is unusual. Skia shouldn't really care about EGL vs GLX. You're drawing with antialiasing enabled on SkPaint, right? Is it possible that the EGL back buffer is not the same size as the window dimensions and it is being nearest neighbor sampled on to the screen? It seems unlikely, but I don't have any better ideas at the moment. :)

Brian


On Fri, Apr 28, 2017 at 12:55 PM rubenvb <vanboxe...@gmail.com> wrote:
Because it seems I forgot to link the actual code, you can check ik out at github.com/skui-org/skui, most of the relevant (GLX) bits are in gui/window_xcb.c++.

I haven't committed the equivalent EGL because, well, it results in ugly rendering for now.

--

rubenvb

unread,
Apr 28, 2017, 1:49:25 PM4/28/17
to skia-discuss
Hmm seems the problem, like so often, lies between keyboard and chair.
I made antialising of my canvas (and thus the SkPaint) optional but something must have gone wrong.
As I was splitting off the EGL switch changes so I could provide you guys with a branch to look at, I came to a point where it worked just fine with EGL.

Thanks a bunch for the rubber duck debugging session. Can't believe I spent a whole week of evenings on this stupid mistake.


Op vrijdag 28 april 2017 19:07:57 UTC+2 schreef Brian Salomon:
Reply all
Reply to author
Forward
0 new messages