Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Have unregistered hypercalls fail to guest
[palacios.git] / palacios / include / interfaces / vmm_graphics_console.h
1 /*
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2011, Peter Dinda <pdinda@northwestern.edu> 
11  * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Peter Dinda <pdinda@northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20
21 #ifndef __VMM_GRAPHICS_CONSOLE_H__
22 #define __VMM_GRAPHICS_CONSOLE_H__
23
24 #include <palacios/vmm.h>
25
26
27 /* A graphics console is opaque to the palacios */
28 typedef void * v3_graphics_console_t;
29
30
31 #ifdef __V3VEE__
32
33
34 struct v3_frame_buffer_spec ;
35
36
37 /* we give a desired spec and get back the actual spec */
38 v3_graphics_console_t v3_graphics_console_open(struct v3_vm_info * vm, 
39                                                struct v3_frame_buffer_spec *desired_spec,
40                                                struct v3_frame_buffer_spec *actual_spec);
41
42 /* Spec is an optional output argument the indicates the current FB specification */
43 /* The data will only be read or read/written between a get and release */
44 void *v3_graphics_console_get_frame_buffer_data_read(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec);
45 void  v3_graphics_console_release_frame_buffer_data_read(v3_graphics_console_t cons);
46 void *v3_graphics_console_get_frame_buffer_data_rw(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec);
47 void  v3_graphics_console_release_frame_buffer_data_rw(v3_graphics_console_t cons);
48 // returns >0 if a redraw in response to this update would be useful now
49 int   v3_graphics_console_inform_update(v3_graphics_console_t cons);
50 // when render_request is invoked, Palacios will redraw immediately
51 int   v3_graphics_console_register_render_request(
52                       v3_graphics_console_t cons,
53                       int (*render_request)(v3_graphics_console_t cons,
54                                             void *priv_data),
55                       void *priv_data);
56 // when update_inquire is invoked, palacios will indicate if there
57 // is anything new with a non-zero return value
58 int   v3_graphics_console_register_update_inquire(
59                       v3_graphics_console_t cons,
60                       int (*update_inquire)(v3_graphics_console_t cons,
61                                             void *priv_data),
62                       void *priv_data);
63
64 void v3_graphics_console_close(v3_graphics_console_t cons);
65
66 #endif
67
68
69
70 /*
71    A graphics console provides a frame buffer into which to render
72    which is specified as follows.
73
74
75    The data of the actual frame buffer is in row-major order.
76 */
77 struct v3_frame_buffer_spec {
78     uint32_t height;
79     uint32_t width;
80     uint8_t  bytes_per_pixel; 
81     uint8_t  bits_per_channel;
82     uint8_t  red_offset;   // byte offset in pixel to get to red channel
83     uint8_t  green_offset; // byte offset in pixel to get to green channel
84     uint8_t  blue_offset;  // byte offset in pixel to get to blue channel
85 };
86
87
88
89 struct v3_graphics_console_hooks {
90     // Note that the minimum spec argument may be null, indicating that it is not provided 
91     v3_graphics_console_t (*open)(void * priv_data, 
92                                   struct v3_frame_buffer_spec *desired_spec, 
93                                   struct v3_frame_buffer_spec *actual_spec);
94     void                  (*close)(v3_graphics_console_t cons);
95
96     void * (*get_data_read)(v3_graphics_console_t cons, struct v3_frame_buffer_spec *cur_spec);
97     void   (*release_data_read)(v3_graphics_console_t cons);
98     void * (*get_data_rw)(v3_graphics_console_t cons, struct v3_frame_buffer_spec *cur_spec);
99     void   (*release_data_rw)(v3_graphics_console_t cons);
100
101     // callback to indicate that the FB is stale and that an update can occur
102     // a positive return value indicates we should re-render now
103     // this callback is from Palacios to the implementation and is called
104     // when virtual GPU state changes to ask if the FB should be re-rendered now
105     int (*changed)(v3_graphics_console_t cons);
106
107    
108     // callback to allow Palacios to register a render request callback
109     // with the implementation.  Using this callback, the implementation
110     // can specifically request that Palacios render immediately
111     int (*register_render_request)(v3_graphics_console_t cons,
112                     int (*render_request)(v3_graphics_console_t cons,
113                                          void *priv_data),
114                     void *priv_data);
115
116     // callback to allow Palacios to register an update inquire callback 
117     // with the implementation.  Using this callback, the implementation
118     // can ask if Palacios has any new data
119     int (*register_update_inquire)(v3_graphics_console_t cons,
120                     int (*update_inquire)(v3_graphics_console_t cons,
121                                           void *priv_data),
122                     void *priv_data);
123        
124 };
125
126
127 extern void V3_Init_Graphics_Console(struct v3_graphics_console_hooks *hooks);
128
129 #endif