int main(void) { l4_kernel_info_t *kip = l4re_kip(); struct l4_vhw_descriptor *vhw; int i; if (!kip) { printf("KIP not available!\n"); return 1; } if (!l4util_kip_kernel_is_ux(kip)) { printf("This example is for Fiasco-UX only.\n"); return 1; } vhw = l4_vhw_get(kip); printf("kip at %p, vhw at %p\n", kip, vhw); printf("magic: %08x, version: %08x, count: %02d\n", vhw->magic, vhw->version, vhw->count); for (i = 0; i < vhw->count; i++) print_entry(l4_vhw_get_entry(vhw, i)); return 0; }
int ux_probe(con_accel_t *accel) { struct l4_vhw_descriptor *vhw; struct l4_vhw_entry *vhwe; if (!l4util_kip_kernel_is_ux(l4re_kip())) return -L4_ENODEV; if (l4io_lookup_device("L4UXfb", NULL, 0, 0)) { printf("WARNING: Running under Fiasco-UX and no 'L4UXfb' device found, can only use polling mode!\n"); return -L4_ENODEV; } printf("Found Fiasco-UX Framebuffer\n"); if (!(vhw = l4_vhw_get(l4re_kip()))) return -L4_ENODEV; if (!(vhwe = l4_vhw_get_entry_type(vhw, L4_TYPE_VHW_FRAMEBUFFER))) return -L4_ENODEV; ux_con_pid = vhwe->provider_pid; accel->drty = uxScreenUpdate; accel->caps = ACCEL_POST_DIRTY; printf("Found VHW descriptor, provider is %d\n", ux_con_pid); l4_thread_control_start(); l4_thread_control_ux_host_syscall(1); l4_thread_control_commit(l4re_env()->main_thread); /* The update thread needs to run with the same priority than as the vc * threads (otherwise the screen won't be updated) */ { pthread_t update_tid; pthread_attr_t a; struct sched_param sp; pthread_attr_init(&a); sp.sched_priority = 0x70; pthread_attr_setschedpolicy(&a, SCHED_L4); pthread_attr_setschedparam(&a, &sp); pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); if (pthread_create(&update_tid, &a, updater_thread, NULL)) return -L4_ENOMEM; updater_id = pthread_getl4cap(update_tid); #if 0 update_tid = l4thread_create_long(L4THREAD_INVALID_ID, updater_thread, ".scr-upd", L4THREAD_INVALID_SP, L4THREAD_DEFAULT_SIZE, 0xff, NULL, L4THREAD_CREATE_ASYNC); if (update_tid < 0) { printf("Could not create updater thread.\n"); return -L4_ENOTHREAD; } updater_id = l4thread_l4_id(update_tid); #endif } #if 0 if (hw_vid_mem_addr != vhwe->mem_start || hw_vid_mem_size != vhwe->mem_size) printf("!!! Memory area mismatch "l4_addr_fmt"(%lx) vs. "l4_addr_fmt "(%lx) ... continuing\n", hw_vid_mem_addr, hw_vid_mem_size, vhwe->mem_start, vhwe->mem_size); #endif //map_io_mem(hw_vid_mem_addr, hw_vid_mem_size, 0, "UX video", // (l4_addr_t *)&hw_map_vid_mem_addr); // already mapped by vesa-ds + rm-attach hw_map_vid_mem_addr = hw_vid_mem_addr; return 0; }