diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2013-05-07 10:50:09 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-05-07 10:50:09 -0400 |
commit | 8799d41b1ed1d00d8979c2fa324df07308cde428 (patch) | |
tree | 2c22381952ebcc6e3474fabcc9ee9c44309f4090 /src | |
parent | e314875d00739b9c55a065b96f8040f627edb8e3 (diff) |
compositor: Move fan_debug to gl-renderer
With the debug binding infrastructure, we can do this all inside
gl-renderer.c.
Diffstat (limited to 'src')
-rw-r--r-- | src/compositor.h | 1 | ||||
-rw-r--r-- | src/gl-renderer.c | 25 | ||||
-rw-r--r-- | src/shell.c | 12 |
3 files changed, 20 insertions, 18 deletions
diff --git a/src/compositor.h b/src/compositor.h index e761138..49764c0 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -572,7 +572,6 @@ struct weston_compositor { struct wl_array indices; /* only used in compositor-wayland */ struct wl_array vtxcnt; struct weston_plane primary_plane; - int fan_debug; uint32_t focus; 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_surface_state { struct gl_renderer { struct weston_renderer base; int fragment_shader_debug; + int fan_debug; EGLDisplay egl_display; EGLContext egl_context; @@ -648,6 +649,7 @@ repaint_region(struct weston_surface *es, pixman_region32_t *region, 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 @@ repaint_region(struct weston_surface *es, pixman_region32_t *region, 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 @@ draw_surface(struct weston_surface *es, struct weston_output *output, 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 @@ gl_renderer_repaint_output(struct weston_output *output, /* 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 @@ fragment_debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, 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 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface) 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", diff --git a/src/shell.c b/src/shell.c index 3a92728..f129288 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3901,16 +3901,6 @@ backlight_binding(struct weston_seat *seat, uint32_t time, uint32_t key, output->set_backlight(output, output->backlight_current); } -static void -fan_debug_repaint_binding(struct weston_seat *seat, uint32_t time, uint32_t key, - void *data) -{ - struct desktop_shell *shell = data; - struct weston_compositor *compositor = shell->compositor; - compositor->fan_debug = !compositor->fan_debug; - weston_compositor_damage_all(compositor); -} - struct debug_binding_grab { struct weston_keyboard_grab grab; struct weston_seat *seat; @@ -4226,8 +4216,6 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) /* Debug bindings */ weston_compositor_add_key_binding(ec, KEY_SPACE, mod | MODIFIER_SHIFT, debug_binding, shell); - weston_compositor_add_debug_binding(ec, KEY_F, - fan_debug_repaint_binding, shell); } WL_EXPORT int |