Re: trouble with GL and GLES surfaces

Theo Veenker <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On 01/10/2018 01:08 AM, Bryce Harrington wrote:
> On Fri, Dec 29, 2017 at 05:26:32PM +0100, Theo Veenker wrote:
>> Hi all,
>>
>> I decided to spend some time on playing with cairo's GL backend. First I
>> looked at 1.15.11 (this is all under Linux Mint 18 64-bit, kernel 4.4.0-98,
>> X.Org 1.18.4).
> 
> Thanks for testing the gles code.
> 
>> Cairo 1.15.11 configured with --enable-gl worked for me. I could use
>> cairo_gl_surface_create_for_window(), cairo_gl_surface_create() and
>> cairo_surface_create_similar() as advertised.
>>
>> However when configured with --enable-glesv2 I ran into some problems:
>> - Cairo_gl_surface_create_for_egl() is fine, but both
>> cairo_gl_surface_create() and cairo_surface_create_similar() consistently
>> fail with CAIRO_STATUS_DEVICE_ERROR.
> 
> Unfortunately CAIRO_STATUS_DEVICE_ERROR is used as kind of a generic
> "something's wrong" error message.  Could be anything from a driver
> issue on up.  I wouldn't rule out some flaw in my patch, either,
> although if you're seeing problems creating gl surfaces on 1.14 too,
> then might be a deeper issue.
> 
> I verified glesv2 worked and generated graphics for me identically
> between 1.14 and 1.15 before landing, although it's possible you're
> setting up the surfaces in a different way that I didn't test.  If you
> can give me the snippet of code you're using to set things up, or a
> minimal test case or somesuch, I can examine it compared with my own and
> see if I can see the same issue as you and maybe isolate why.

I have cooked up a few test programs. Tested on two platforms (one with Radeon HD 5670 and 
one with an Intel something). I get same results on both platforms. I'll send the test 
code with a readme to you, so you can check it yourself.


>> Then I tried the same thing using cairo 1.14.2. Here I don't see any of the
>> problems mentioned above. However I did notice a different problem with the
>> regular GL (non-GLES) backend:
>> - It appears I can't use a GL surface (as created by
>> cairo_gl_surface_create() or cairo_surface_create_similar()) as a source for
>> cairo_set_source_surface(). No error is reported by
>> cairo_set_source_surface() or cairo_paint(). This does however work
>> correctly when configured with --enable-glesv2.
> 
> As far as I know that *should* work.  Is there a possibility that
> there's an error in your setup code?  That could explain a lot of the
> problems you've described.  Again, if you can send me a sample
> reproducer I can take a deeper look.  If it does turn out to be a
> regression in the new code, your example could help me isolate it and
> improve my own tests to cover that case.

I don't know what I could be doing wrong. I'm only swapping one function call for a 
similar one. For 1.15 this works, for 1.14 it does not (tested on both platforms). The 
only thing I can think of is waiting until the window is fully mapped before creating GL 
surfaces on it. Not tried. Don't know if it makes sense.

> 
>> I did not test the GLESv3 backend as I have no idea where to get the glesv3
>> package referred to by cairo.pc.
> 
> The glesv3 support may be installed with glesv2.  You can look in
> /usr/include and /usr/lib to see if the gles 3 stuff is there, or just
> try --enable-glesv3.  I doubt it'll make a difference for your problem
> though, but might be broken in a more interesting way.

Aha. So the GLESv3 code if any is included in libGLESv2.so? I do appear to have the GLES3 
headers. Maybe the glesv3 reference in cairo.pc should be dropped then? Otherwise 
"pkg-config --cflags/libs cairo" commands will unnecessarily fail if no glesv3 package can 
be found. Does it even exist ATM?

Theo

-- 
Theo Veenker  |  Beexy - Behavioral Experiment Software
+31(0)524-541531  |  +31(0)6-42525777 mobile
[email protected]  |  www.beexy.nl
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.