compositor: Move fan_debug to gl-renderer
With the debug binding infrastructure, we can do this all inside
gl-renderer.c.
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index 9e3bbcd..43fa39d 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -72,6 +72,7 @@
struct gl_renderer {
struct weston_renderer base;
int fragment_shader_debug;
+ int fan_debug;
EGLDisplay egl_display;
EGLContext egl_context;
@@ -648,6 +649,7 @@
pixman_region32_t *surf_region)
{
struct weston_compositor *ec = es->compositor;
+ struct gl_renderer *gr = get_renderer(ec);
GLfloat *v;
unsigned int *vtxcnt;
int i, first, nfans;
@@ -675,7 +677,7 @@
for (i = 0, first = 0; i < nfans; i++) {
glDrawArrays(GL_TRIANGLE_FAN, first, vtxcnt[i]);
- if (ec->fan_debug)
+ if (gr->fan_debug)
triangle_fan_debug(es, first, vtxcnt[i]);
first += vtxcnt[i];
}
@@ -762,7 +764,7 @@
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- if (ec->fan_debug) {
+ if (gr->fan_debug) {
use_shader(gr, &gr->solid_shader);
shader_uniforms(&gr->solid_shader, es, output);
}
@@ -1015,14 +1017,14 @@
/* if debugging, redraw everything outside the damage to clean up
* debug lines from the previous draw on this buffer:
*/
- if (compositor->fan_debug) {
+ if (gr->fan_debug) {
pixman_region32_t undamaged;
pixman_region32_init(&undamaged);
pixman_region32_subtract(&undamaged, &output->region,
output_damage);
- compositor->fan_debug = 0;
+ gr->fan_debug = 0;
repaint_surfaces(output, &undamaged);
- compositor->fan_debug = 1;
+ gr->fan_debug = 1;
pixman_region32_fini(&undamaged);
}
@@ -1887,6 +1889,17 @@
weston_output_damage(output);
}
+static void
+fan_debug_repaint_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
+ void *data)
+{
+ struct weston_compositor *compositor = data;
+ struct gl_renderer *gr = get_renderer(compositor);
+
+ gr->fan_debug = !gr->fan_debug;
+ weston_compositor_damage_all(compositor);
+}
+
static int
gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
{
@@ -1986,6 +1999,8 @@
weston_compositor_add_debug_binding(ec, KEY_S,
fragment_debug_binding, ec);
+ weston_compositor_add_debug_binding(ec, KEY_F,
+ fan_debug_repaint_binding, ec);
weston_log("GL ES 2 renderer features:\n");
weston_log_continue(STAMP_SPACE "read-back format: %s\n",