2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2011, Peter Dinda <pdinda@northwestern.edu>
11 * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Peter Dinda <pdinda@northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #include <interfaces/vmm_graphics_console.h>
22 #include <palacios/vmm.h>
23 #include <palacios/vmm_debug.h>
24 #include <palacios/vmm_types.h>
25 #include <palacios/vm_guest.h>
27 struct v3_graphics_console_hooks * graphics_console_hooks = 0;
29 v3_graphics_console_t v3_graphics_console_open(struct v3_vm_info * vm,
30 struct v3_frame_buffer_spec *desired_spec,
31 struct v3_frame_buffer_spec *actual_spec)
33 V3_ASSERT(vm, VCORE_NONE, graphics_console_hooks != NULL);
34 V3_ASSERT(vm, VCORE_NONE, graphics_console_hooks->open != NULL);
36 return graphics_console_hooks->open(vm->host_priv_data, desired_spec, actual_spec);
39 void v3_graphics_console_close(v3_graphics_console_t cons)
41 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks);
42 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->close);
44 graphics_console_hooks->close(cons);
47 void * v3_graphics_console_get_frame_buffer_data_read(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec)
49 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks != NULL);
50 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->get_data_read != NULL);
52 return graphics_console_hooks->get_data_read(cons, spec);
56 void v3_graphics_console_release_frame_buffer_data_read(v3_graphics_console_t cons)
58 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks != NULL);
59 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->release_data_read != NULL);
61 return graphics_console_hooks->release_data_read(cons);
64 void * v3_graphics_console_get_frame_buffer_data_rw(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec)
66 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks != NULL);
67 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->get_data_rw != NULL);
69 return graphics_console_hooks->get_data_rw(cons, spec);
72 void v3_graphics_console_release_frame_buffer_data_rw(v3_graphics_console_t cons)
74 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks != NULL);
75 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->release_data_rw != NULL);
77 return graphics_console_hooks->release_data_rw(cons);
82 int v3_graphics_console_inform_update(v3_graphics_console_t cons) {
83 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks != NULL);
84 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->changed != NULL);
86 return graphics_console_hooks->changed(cons);
89 int v3_graphics_console_register_render_request(
90 v3_graphics_console_t cons,
91 int (*render_request)(v3_graphics_console_t cons,
95 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks!=NULL);
96 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->register_render_request!=NULL);
98 return graphics_console_hooks->register_render_request(cons,render_request,priv_data);
101 int v3_graphics_console_register_update_inquire(
102 v3_graphics_console_t cons,
103 int (*update_inquire)(v3_graphics_console_t cons,
107 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks!=NULL);
108 V3_ASSERT(VM_NONE, VCORE_NONE, graphics_console_hooks->register_update_inquire!=NULL);
110 return graphics_console_hooks->register_update_inquire(cons,update_inquire,priv_data);
114 void V3_Init_Graphics_Console(struct v3_graphics_console_hooks * hooks) {
115 graphics_console_hooks = hooks;
116 PrintDebug(VM_NONE, VCORE_NONE, "V3 graphics console inited\n");