static int blit_outputs(struct uterm_video *video) { struct uterm_display *iter; int j, ret; struct uterm_screen *screen; j = 0; iter = uterm_video_get_displays(video); for ( ; iter; iter = uterm_display_next(iter)) { log_notice("Activating display %d %p...", j, iter); ret = uterm_display_activate(iter, NULL); if (ret) log_err("Cannot activate display %d: %d", j, ret); else log_notice("Successfully activated display %d", j); ret = uterm_display_set_dpms(iter, UTERM_DPMS_ON); if (ret) log_err("Cannot set DPMS to ON: %d", ret); ++j; } iter = uterm_video_get_displays(video); for ( ; iter; iter = uterm_display_next(iter)) { if (uterm_display_get_state(iter) != UTERM_DISPLAY_ACTIVE) continue; ret = uterm_screen_new_single(&screen, iter); if (ret) { log_err("Cannot create temp-screen object: %d", ret); continue; } ret = uterm_screen_fill(screen, 0xff, 0xff, 0xff, 0, 0, uterm_screen_width(screen), uterm_screen_height(screen)); if (ret) { log_err("cannot fill framebuffer"); uterm_screen_unref(screen); continue; } ret = uterm_screen_swap(screen); if (ret) { log_err("Cannot swap screen: %d", ret); uterm_screen_unref(screen); continue; } log_notice("Successfully set screen on display %p", iter); uterm_screen_unref(screen); } log_notice("Waiting 5 seconds..."); ev_eloop_run(eloop, 5000); log_notice("Exiting..."); return 0; }
static int blit_outputs(struct uterm_video *video) { struct uterm_display *iter; int j, ret; struct uterm_mode *mode; j = 0; iter = uterm_video_get_displays(video); for ( ; iter; iter = uterm_display_next(iter)) { log_notice("Activating display %d %p...", j, iter); ret = uterm_display_activate(iter, NULL); if (ret) log_err("Cannot activate display %d: %d", j, ret); else log_notice("Successfully activated display %d", j); ret = uterm_display_set_dpms(iter, UTERM_DPMS_ON); if (ret) log_err("Cannot set DPMS to ON: %d", ret); ++j; } iter = uterm_video_get_displays(video); for ( ; iter; iter = uterm_display_next(iter)) { if (uterm_display_get_state(iter) != UTERM_DISPLAY_ACTIVE) continue; mode = uterm_display_get_current(iter); ret = uterm_display_fill(iter, 0xff, 0xff, 0xff, 0, 0, uterm_mode_get_width(mode), uterm_mode_get_height(mode)); if (ret) { log_err("cannot fill framebuffer"); continue; } ret = uterm_display_swap(iter, true); if (ret) { log_err("Cannot swap screen: %d", ret); continue; } log_notice("Successfully set screen on display %p", iter); } log_notice("Waiting 5 seconds..."); ev_eloop_run(eloop, 5000); log_notice("Exiting..."); return 0; }
static int list_outputs(struct uterm_video *video) { struct uterm_display *iter; struct uterm_mode *cur, *mode; int i; log_notice("List of Outputs:"); i = 0; iter = uterm_video_get_displays(video); for ( ; iter; iter = uterm_display_next(iter)) { cur = uterm_display_get_current(iter); log_notice("Output %d:", i++); log_notice(" active: %d", uterm_display_get_state(iter)); log_notice(" has current: %s", cur ? "yes" : "no"); mode = uterm_display_get_modes(iter); for ( ; mode; mode = uterm_mode_next(mode)) { log_notice(" Mode '%s':", uterm_mode_get_name(mode)); log_notice(" x: %u", uterm_mode_get_width(mode)); log_notice(" y: %u", uterm_mode_get_height(mode)); } } log_notice("End of Output list"); return 0; }
static int set_outputs(struct uterm_video *video) { struct uterm_display *iter; int j, ret; struct gl_shader *shader; struct uterm_screen *screen; ret = gl_shader_new(&shader); if (ret) { log_err("Cannot create shader: %d", ret); return ret; } j = 0; iter = uterm_video_get_displays(video); for ( ; iter; iter = uterm_display_next(iter)) { log_notice("Activating display %d %p...", j, iter); ret = uterm_display_activate(iter, NULL); if (ret) log_err("Cannot activate display %d: %d", j, ret); else log_notice("Successfully activated display %d", j); ret = uterm_display_set_dpms(iter, UTERM_DPMS_ON); if (ret) log_err("Cannot set DPMS to ON: %d", ret); ++j; } iter = uterm_video_get_displays(video); for ( ; iter; iter = uterm_display_next(iter)) { if (uterm_display_get_state(iter) != UTERM_DISPLAY_ACTIVE) continue; ret = uterm_screen_new_single(&screen, iter); if (ret) { log_err("Cannot create temp-screen object: %d", ret); continue; } ret = uterm_screen_use(screen); if (ret) { log_err("Cannot use screen: %d", ret); uterm_screen_unref(screen); continue; } glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glViewport(0, 0, uterm_screen_width(screen), uterm_screen_height(screen)); gl_shader_draw_def(shader, d_vert, d_col, 6); if (gl_has_error()) log_err("GL error occurred"); ret = uterm_screen_swap(screen); if (ret) { log_err("Cannot swap screen: %d", ret); uterm_screen_unref(screen); continue; } log_notice("Successfully set screen on display %p", iter); uterm_screen_unref(screen); } log_notice("Waiting 5 seconds..."); ev_eloop_run(eloop, 5000); log_notice("Exiting..."); gl_shader_unref(shader); return 0; }