Bug 54319 - [EGL] compile error in cairo-egl-context.c at line 189
Summary: [EGL] compile error in cairo-egl-context.c at line 189
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: gl backend (show other bugs)
Version: 1.12.2
Hardware: IA64 (Itanium) Windows (All)
: medium blocker
Assignee: cairo-bugs mailing list
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-31 12:12 UTC by Manfred Kogler
Modified: 2018-08-25 13:38 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Manfred Kogler 2012-08-31 12:12:54 UTC
Hi cairo-team!

My target is to get a cairo library that supports OpenVG and EGL (currently on Windows, later on on Linux). I noticed, that enabling EGL also enforces enabling OpenGL or OpenGLES. So I ended up activating the following settings on top of plain 1.12.2 release:

	CAIRO_HAS_GL_SURFACE=1
	CAIRO_HAS_VG_SURFACE=1
	CAIRO_HAS_EGL_FUNCTIONS=1

Using Visual Studio 11 compiler (VC11) this configuration produces these warnings and compile errors:
	...
	cairo-gl-msaa-compositor.c
	cairo-gl-spans-compositor.c
	cairo-gl-traps-compositor.c
	cairo-gl-traps-compositor.c(329) : warning C4133: '=' : incompatible types - fro
	m 'cairo_surface_t *' to 'cairo_gl_surface_t *'
	cairo-gl-source.c
	cairo-gl-surface.c
	cairo-vg-surface.c
	cairo-egl-context.c
	cairo-egl-context.c(189) : error C2440: 'function' : cannot convert from '__eglM
	ustCastToProperFunctionPointerType (__stdcall *)(const char *)' to 'cairo_gl_get
	_proc_addr_func_t'
	cairo-egl-context.c(189) : warning C4024: '_cairo_gl_dispatch_init' : different
	types for formal and actual parameter 2
	make[1]: *** [debug/cairo-egl-context.obj] Error 2
	make[1]: Leaving directory `/c/Users/kog/xxx/CairoBuild/cairo/src'
	make: *** [cairo] Error 2

I also tested the very same configuration on latest 1.12 git branch and latest master git branch. Everywhere the very same warnings and errors (apart from slightly differing line numbers of course). Enabling CAIRO_HAS_EGL_FUNCTIONS=1 breaks the build.

Many thanks for your support!

Kind regards,
Fred
Comment 1 Manfred Kogler 2012-08-31 17:34:25 UTC
(In reply to comment #0)
> Hi cairo-team!
> 
> My target is to get a cairo library that supports OpenVG and EGL (currently on
> Windows, later on on Linux). I noticed, that enabling EGL also enforces
> enabling OpenGL or OpenGLES. So I ended up activating the following settings on
> top of plain 1.12.2 release:
> 
>     CAIRO_HAS_GL_SURFACE=1
>     CAIRO_HAS_VG_SURFACE=1
>     CAIRO_HAS_EGL_FUNCTIONS=1
> 
> Using Visual Studio 11 compiler (VC11) this configuration produces these
> warnings and compile errors:
>     ...
>     cairo-gl-msaa-compositor.c
>     cairo-gl-spans-compositor.c
>     cairo-gl-traps-compositor.c
>     cairo-gl-traps-compositor.c(329) : warning C4133: '=' : incompatible types
> - fro
>     m 'cairo_surface_t *' to 'cairo_gl_surface_t *'
>     cairo-gl-source.c
>     cairo-gl-surface.c
>     cairo-vg-surface.c
>     cairo-egl-context.c
>     cairo-egl-context.c(189) : error C2440: 'function' : cannot convert from
> '__eglM
>     ustCastToProperFunctionPointerType (__stdcall *)(const char *)' to
> 'cairo_gl_get
>     _proc_addr_func_t'
>     cairo-egl-context.c(189) : warning C4024: '_cairo_gl_dispatch_init' :
> different
>     types for formal and actual parameter 2
>     make[1]: *** [debug/cairo-egl-context.obj] Error 2
>     make[1]: Leaving directory `/c/Users/kog/xxx/CairoBuild/cairo/src'
>     make: *** [cairo] Error 2
> 
> I also tested the very same configuration on latest 1.12 git branch and latest
> master git branch. Everywhere the very same warnings and errors (apart from
> slightly differing line numbers of course). Enabling CAIRO_HAS_EGL_FUNCTIONS=1
> breaks the build.
> 
> Many thanks for your support!
> 
> Kind regards,
> Fred

after having had a closer look, I could figure out the fix for the compile error and also got rid of the warning with an additional cast:

***************************************************************
 src/cairo-gl-private.h          | 2 +-
 src/cairo-gl-traps-compositor.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 3afdd70..b494207 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -204,7 +204,7 @@ typedef enum cairo_gl_var_type {
 #define CAIRO_GL_VAR_TYPE_MAX ((CAIRO_GL_VAR_TEXCOORDS << 3) | (CAIRO_GL_VAR_TEXCOORDS << 2) | (CAIRO_GL_VAR_TEXCOORDS << 1) | CAIRO_GL_VAR_TEXCOORDS)
 
 typedef void (*cairo_gl_generic_func_t)(void);
-typedef cairo_gl_generic_func_t (*cairo_gl_get_proc_addr_func_t)(const char *procname);
+typedef cairo_gl_generic_func_t (EGLAPIENTRY *cairo_gl_get_proc_addr_func_t)(const char *procname);
 
 typedef struct _cairo_gl_dispatch {
     /* Buffers */
diff --git a/src/cairo-gl-traps-compositor.c b/src/cairo-gl-traps-compositor.c
index 776b74c..e7a002c 100644
--- a/src/cairo-gl-traps-compositor.c
+++ b/src/cairo-gl-traps-compositor.c
@@ -326,7 +326,7 @@ traps_to_operand (void *_dst,
     if (unlikely (status))
 	goto error;
 
-    operand->texture.owns_surface = mask;
+    operand->texture.owns_surface = (cairo_gl_surface_t *)mask;
     return CAIRO_STATUS_SUCCESS;
 
 error:
***************************************************************

I think those are proper fixes and propose to add 'em to the master branch.

Kind regards,
Fred
Comment 2 GitLab Migration User 2018-08-25 13:38:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/113.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.