Merge lp:~cameronnemo/pantheon-greeter/optional-gl into lp:~elementary-pantheon/pantheon-greeter/trunk

Proposed by Cameron Norman on 2014-08-07
Status: Rejected
Rejected by: Zisu Andrei on 2016-10-26
Proposed branch: lp:~cameronnemo/pantheon-greeter/optional-gl
Merge into: lp:~elementary-pantheon/pantheon-greeter/trunk
Diff against target: 168 lines (+66/-34)
4 files modified
CMakeLists.txt (+41/-17)
src/Wallpaper.vala (+8/-0)
vapi-gl/gl.vapi (+17/-0)
vapi/gl.vapi (+0/-17)
To merge this branch: bzr merge lp:~cameronnemo/pantheon-greeter/optional-gl
Reviewer Review Type Date Requested Status
Zisu Andrei Disapprove on 2016-10-26
kay van der Zander 2014-08-07 Needs Fixing on 2015-09-16
Corentin Noël 2014-10-06 Pending
Review via email: mp+229897@code.launchpad.net

Description of the change

This leaves out GL specific code if GL is not available.

This is Raphael Isemann's branch, just rebased on current trunk (I had to fix a merge conflict). There is a bounty on the bug, but I think that if Raphael is assigned to the bug he will get the bounty so it is probably no problem.

The original merge request was rejected because it did not compile when GL was found (I do not think it was reviewed for without GL), but I tested this branch and it does compile locally.

To post a comment you must log in.
kay van der Zander (kay20) wrote :

 crop the packages and options in a cmake variable like sources. this makes the if smaller and removes duplicate of vala_precompile.

review: Needs Fixing
kay van der Zander (kay20) wrote :

also the bug report stated that it should work it egl also known as opengl es.
to fix the bug you also need to make it working with opengl es function: https://www.khronos.org/registry/gles/specs/1.1/es_cm_spec_1.1.12.pdf

otherwise we would lose functionality/apperance on arm build.

Zisu Andrei (matzipan) wrote :

I'm afraid this MR doesn't try to solve the bug.

review: Disapprove

Unmerged revisions

277. By Cameron Norman on 2014-08-07

Raphael Isemann: make GL usage optional

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-07-25 18:49:46 +0000
3+++ CMakeLists.txt 2014-08-07 05:25:11 +0000
4@@ -39,23 +39,47 @@
5 file(GLOB_RECURSE sources src/*.vala)
6
7 include (ValaPrecompile)
8-vala_precompile (VALA_C
9- ${sources}
10- ${CMAKE_BINARY_DIR}/src/config.vala
11-PACKAGES
12- granite
13- liblightdm-gobject-1
14- posix
15- gdk-pixbuf-2.0
16- gdk-x11-3.0
17- x11
18- clutter-gtk-1.0
19- indicator-0.4
20- gl
21- posix-fixes
22-OPTIONS
23- --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi
24-)
25+
26+pkg_check_modules (GL QUIET gl)
27+if (GL_FOUND)
28+ pkg_check_modules(GL REQUIRED gl)
29+ vala_precompile (VALA_C
30+ ${sources}
31+ ${CMAKE_BINARY_DIR}/src/config.vala
32+ PACKAGES
33+ granite
34+ liblightdm-gobject-1
35+ posix
36+ gdk-pixbuf-2.0
37+ gdk-x11-3.0
38+ x11
39+ clutter-gtk-1.0
40+ indicator-0.4
41+ gl
42+ posix-fixes
43+ OPTIONS
44+ --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi
45+ --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi-gl
46+ --define=USE_GL
47+ )
48+else (GL_FOUND)
49+ vala_precompile (VALA_C
50+ ${sources}
51+ ${CMAKE_BINARY_DIR}/src/config.vala
52+ PACKAGES
53+ granite
54+ liblightdm-gobject-1
55+ posix
56+ gdk-pixbuf-2.0
57+ gdk-x11-3.0
58+ x11
59+ clutter-gtk-1.0
60+ indicator-0.4
61+ posix-fixes
62+ OPTIONS
63+ --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi
64+ )
65+endif (GL_FOUND)
66
67 add_subdirectory (po)
68
69
70=== modified file 'src/Wallpaper.vala'
71--- src/Wallpaper.vala 2014-03-13 17:16:53 +0000
72+++ src/Wallpaper.vala 2014-08-07 05:25:11 +0000
73@@ -36,7 +36,9 @@
74 */
75 Queue<GtkClutter.Texture> unused_wallpapers = new Queue<GtkClutter.Texture> ();
76
77+#if USE_GL
78 int gpu_limit;
79+#endif
80
81 string[] cache_path = {};
82 Gdk.Pixbuf[] cache_pixbuf = {};
83@@ -48,9 +50,11 @@
84 public int screen_height { get; set; }
85
86 public Wallpaper () {
87+#if USE_GL
88 GL.GLint result = 1;
89 GL.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, out result);
90 gpu_limit = result;
91+#endif
92 }
93
94 string get_default () {
95@@ -86,10 +90,12 @@
96 var cancelable = new Cancellable ();
97 loading_wallpapers.append (cancelable);
98 InputStream stream = yield file.read_async (GLib.Priority.DEFAULT);
99+#if USE_GL
100 buf = yield Gdk.Pixbuf.new_from_stream_async (stream, cancelable);
101 loading_wallpapers.remove (cancelable);
102 // we downscale the pixbuf as far as we can on the CPU
103 buf = validate_pixbuf (buf);
104+#endif
105 //add loaded wallpapers and paths to cache
106 cache_path += path;
107 cache_pixbuf += buf;
108@@ -161,6 +167,7 @@
109 return null;
110 }
111
112+#if USE_GL
113 /**
114 * makes the pixbuf fit inside the GPU limit and scales it to
115 * screen size to save memory.
116@@ -170,6 +177,7 @@
117 result = scale_to_rect (pixbuf, screen_width, screen_height);
118 return result;
119 }
120+#endif
121
122 /**
123 * Scales the pixbuf down to fit in the given dimensions.
124
125=== added directory 'vapi-gl'
126=== added file 'vapi-gl/gl.vapi'
127--- vapi-gl/gl.vapi 1970-01-01 00:00:00 +0000
128+++ vapi-gl/gl.vapi 2014-08-07 05:25:11 +0000
129@@ -0,0 +1,17 @@
130+/* gl.vapi generated by vapigen, do not modify. */
131+
132+[CCode (cprefix = "GL", gir_namespace = "GL", gir_version = "1.0", lower_case_cprefix = "gl_")]
133+namespace GL {
134+ [CCode (cheader_filename = "GL/gl.h", cname = "GLint")]
135+ [SimpleType]
136+ public struct GLint : int {
137+ }
138+ [CCode (cheader_filename = "GL/gl.h", cname = "GLenum")]
139+ [SimpleType]
140+ public struct GLenum : uint {
141+ }
142+ [CCode (cheader_filename = "GL/gl.h", cname = "GL_MAX_TEXTURE_SIZE")]
143+ public const int GL_MAX_TEXTURE_SIZE;
144+ [CCode (cheader_filename = "GL/gl.h", cname = "glGetIntegerv")]
145+ public static void glGetIntegerv (GL.GLenum pname, out unowned GL.GLint @params);
146+}
147
148=== removed file 'vapi/gl.vapi'
149--- vapi/gl.vapi 2013-02-17 13:12:35 +0000
150+++ vapi/gl.vapi 1970-01-01 00:00:00 +0000
151@@ -1,17 +0,0 @@
152-/* gl.vapi generated by vapigen, do not modify. */
153-
154-[CCode (cprefix = "GL", gir_namespace = "GL", gir_version = "1.0", lower_case_cprefix = "gl_")]
155-namespace GL {
156- [CCode (cheader_filename = "GL/gl.h", cname = "GLint")]
157- [SimpleType]
158- public struct GLint : int {
159- }
160- [CCode (cheader_filename = "GL/gl.h", cname = "GLenum")]
161- [SimpleType]
162- public struct GLenum : uint {
163- }
164- [CCode (cheader_filename = "GL/gl.h", cname = "GL_MAX_TEXTURE_SIZE")]
165- public const int GL_MAX_TEXTURE_SIZE;
166- [CCode (cheader_filename = "GL/gl.h", cname = "glGetIntegerv")]
167- public static void glGetIntegerv (GL.GLenum pname, out unowned GL.GLint @params);
168-}

Subscribers

People subscribed via source and target branches