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.


7cdd427d3941f2905621b4a0553a9ca9692971d0
[palacios.git] / palacios / include / palacios / 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
51 void v3_graphics_console_close(v3_graphics_console_t cons);
52
53 #endif
54
55
56
57 /*
58    A graphics console provides a frame buffer into which to render
59    which is specified as follows.
60
61
62    The data of the actual frame buffer is in row-major order.
63 */
64 struct v3_frame_buffer_spec {
65     uint32_t height;
66     uint32_t width;
67     uint8_t  bytes_per_pixel; 
68     uint8_t  bits_per_channel;
69     uint8_t  red_offset;   // byte offset in pixel to get to red channel
70     uint8_t  green_offset; // byte offset in pixel to get to green channel
71     uint8_t  blue_offset;  // byte offset in pixel to get to blue channel
72 };
73
74
75
76 struct v3_graphics_console_hooks {
77     // Note that the minimum spec argument may be null, indicating that it is not provided 
78     v3_graphics_console_t (*open)(void * priv_data, 
79                                   struct v3_frame_buffer_spec *desired_spec, 
80                                   struct v3_frame_buffer_spec *actual_spec);
81     void                  (*close)(v3_graphics_console_t cons);
82
83     void * (*get_data_read)(v3_graphics_console_t cons, struct v3_frame_buffer_spec *cur_spec);
84     void   (*release_data_read)(v3_graphics_console_t cons);
85     void * (*get_data_rw)(v3_graphics_console_t cons, struct v3_frame_buffer_spec *cur_spec);
86     void   (*release_data_rw)(v3_graphics_console_t cons);
87
88     // callback to indicate that the FB is stale and that an update can occur
89     // a positive return value indicates we should re-render now
90     int (*changed)(v3_graphics_console_t cons);
91 };
92
93
94 extern void V3_Init_Graphics_Console(struct v3_graphics_console_hooks *hooks);
95
96 #endif