compositor: Move fan_debug to gl-renderer

With the debug binding infrastructure, we can do this all inside
gl-renderer.c.
Kristian Høgsberg 12 years ago
parent e314875d00
commit 8799d41b1e
  1. 1
      src/compositor.h
  2. 25
      src/gl-renderer.c
  3. 12
      src/shell.c

@ -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;

@ -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",

@ -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

Loading…
Cancel
Save