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.


Added graphics console host interface
Peter Dinda [Tue, 5 Apr 2011 00:00:28 +0000 (19:00 -0500)]
Kconfig
palacios/include/palacios/vmm_graphics_console.h [new file with mode: 0644]
palacios/src/palacios/Makefile
palacios/src/palacios/vmm_graphics_console.c [new file with mode: 0644]

diff --git a/Kconfig b/Kconfig
index 7c72ace..28c4b09 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -133,10 +133,19 @@ config FILE
 
 
 config CONSOLE
-       bool "Host Support for VM console"
+       bool "Host Support for VM text-mode console"
        default n
        help 
          Select this if you want to forward a guest console interface to some host OS service
+          This is for a TEXT MODE console.   Select the framebuffer console for graphics and text
+
+config GRAPHICS_CONSOLE
+       bool "Host Support for VM graphics and text-mode console based on a frame buffer"
+       default n
+       help 
+         Select this if you want to forward a guest graphics-mode (and text-mode) console 
+          interface to some host OS service.  This is for a GRAPHICS console based on a shared frame buffer.
+          Text mode output is RENDERED onto the framebuffer
 
 config SOCKET
         bool "Host support for Network Sockets"
diff --git a/palacios/include/palacios/vmm_graphics_console.h b/palacios/include/palacios/vmm_graphics_console.h
new file mode 100644 (file)
index 0000000..7cdd427
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Peter Dinda <pdinda@northwestern.edu> 
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Peter Dinda <pdinda@northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#ifndef __VMM_GRAPHICS_CONSOLE_H__
+#define __VMM_GRAPHICS_CONSOLE_H__
+
+#include <palacios/vmm.h>
+
+
+/* A graphics console is opaque to the palacios */
+typedef void * v3_graphics_console_t;
+
+
+#ifdef __V3VEE__
+
+
+struct v3_frame_buffer_spec ;
+
+
+/* we give a desired spec and get back the actual spec */
+v3_graphics_console_t v3_graphics_console_open(struct v3_vm_info * vm, 
+                                              struct v3_frame_buffer_spec *desired_spec,
+                                              struct v3_frame_buffer_spec *actual_spec);
+
+/* Spec is an optional output argument the indicates the current FB specification */
+/* The data will only be read or read/written between a get and release */
+void *v3_graphics_console_get_frame_buffer_data_read(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec);
+void  v3_graphics_console_release_frame_buffer_data_read(v3_graphics_console_t cons);
+void *v3_graphics_console_get_frame_buffer_data_rw(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec);
+void  v3_graphics_console_release_frame_buffer_data_rw(v3_graphics_console_t cons);
+// returns >0 if a redraw in response to this update would be useful now
+int   v3_graphics_console_inform_update(v3_graphics_console_t cons);
+
+void v3_graphics_console_close(v3_graphics_console_t cons);
+
+#endif
+
+
+
+/*
+   A graphics console provides a frame buffer into which to render
+   which is specified as follows.
+
+
+   The data of the actual frame buffer is in row-major order.
+*/
+struct v3_frame_buffer_spec {
+    uint32_t height;
+    uint32_t width;
+    uint8_t  bytes_per_pixel; 
+    uint8_t  bits_per_channel;
+    uint8_t  red_offset;   // byte offset in pixel to get to red channel
+    uint8_t  green_offset; // byte offset in pixel to get to green channel
+    uint8_t  blue_offset;  // byte offset in pixel to get to blue channel
+};
+
+
+
+struct v3_graphics_console_hooks {
+    // Note that the minimum spec argument may be null, indicating that it is not provided 
+    v3_graphics_console_t (*open)(void * priv_data, 
+                                 struct v3_frame_buffer_spec *desired_spec, 
+                                 struct v3_frame_buffer_spec *actual_spec);
+    void                  (*close)(v3_graphics_console_t cons);
+
+    void * (*get_data_read)(v3_graphics_console_t cons, struct v3_frame_buffer_spec *cur_spec);
+    void   (*release_data_read)(v3_graphics_console_t cons);
+    void * (*get_data_rw)(v3_graphics_console_t cons, struct v3_frame_buffer_spec *cur_spec);
+    void   (*release_data_rw)(v3_graphics_console_t cons);
+
+    // callback to indicate that the FB is stale and that an update can occur
+    // a positive return value indicates we should re-render now
+    int (*changed)(v3_graphics_console_t cons);
+};
+
+
+extern void V3_Init_Graphics_Console(struct v3_graphics_console_hooks *hooks);
+
+#endif
index 756b020..c02f934 100644 (file)
@@ -70,6 +70,7 @@ obj-$(CONFIG_PACKET) +=  vmm_packet.o
 obj-$(CONFIG_VNET) += vmm_vnet_core.o
 obj-$(CONFIG_FILE) += vmm_file.o
 obj-$(CONFIG_CONSOLE) += vmm_console.o vmm_stream.o
+obj-$(CONFIG_GRAPHICS_CONSOLE) += vmm_graphics_console.o
 
 
 obj-$(CONFIG_SYMBIOTIC) += vmm_symbiotic.o vmm_symspy.o
diff --git a/palacios/src/palacios/vmm_graphics_console.c b/palacios/src/palacios/vmm_graphics_console.c
new file mode 100644 (file)
index 0000000..eb40a03
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Peter Dinda <pdinda@northwestern.edu>
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Peter Dinda <pdinda@northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#include <palacios/vmm_graphics_console.h>
+#include <palacios/vmm.h>
+#include <palacios/vmm_debug.h>
+#include <palacios/vmm_types.h>
+#include <palacios/vm_guest.h>
+
+struct v3_graphics_console_hooks * graphics_console_hooks = 0;
+
+v3_graphics_console_t v3_graphics_console_open(struct v3_vm_info * vm, 
+                                              struct v3_frame_buffer_spec *desired_spec,
+                                              struct v3_frame_buffer_spec *actual_spec)
+{                                             
+    V3_ASSERT(graphics_console_hooks != NULL);
+    V3_ASSERT(graphics_console_hooks->open != NULL);
+
+    return graphics_console_hooks->open(vm->host_priv_data, desired_spec, actual_spec);
+}
+
+void v3_graphics_console_close(v3_graphics_console_t cons) 
+{
+    V3_ASSERT(graphics_console_hooks);
+    V3_ASSERT(graphics_console_hooks->close);
+
+    graphics_console_hooks->close(cons);
+}
+
+void * v3_graphics_console_get_frame_buffer_data_read(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec) 
+{
+    V3_ASSERT(graphics_console_hooks != NULL);
+    V3_ASSERT(graphics_console_hooks->get_data_read != NULL);
+    
+    return graphics_console_hooks->get_data_read(cons, spec);
+}
+
+
+void  v3_graphics_console_release_frame_buffer_data_read(v3_graphics_console_t cons)
+{
+    V3_ASSERT(graphics_console_hooks != NULL);
+    V3_ASSERT(graphics_console_hooks->release_data_read != NULL);
+    
+    return graphics_console_hooks->release_data_read(cons);
+}
+
+void * v3_graphics_console_get_frame_buffer_data_rw(v3_graphics_console_t cons, struct v3_frame_buffer_spec *spec) 
+{
+    V3_ASSERT(graphics_console_hooks != NULL);
+    V3_ASSERT(graphics_console_hooks->get_data_rw != NULL);
+    
+    return graphics_console_hooks->get_data_rw(cons, spec);
+}
+
+void v3_graphics_console_release_frame_buffer_data_rw(v3_graphics_console_t cons)
+{
+    V3_ASSERT(graphics_console_hooks != NULL);
+    V3_ASSERT(graphics_console_hooks->release_data_rw != NULL);
+    
+    return graphics_console_hooks->release_data_rw(cons);
+}
+
+
+
+int v3_graphics_console_inform_update(v3_graphics_console_t cons) {
+    V3_ASSERT(graphics_console_hooks != NULL);
+    V3_ASSERT(graphics_console_hooks->changed != NULL);
+    
+    return graphics_console_hooks->changed(cons);
+}
+
+void V3_Init_Graphics_Console(struct v3_graphics_console_hooks * hooks) {
+    graphics_console_hooks = hooks;
+    PrintDebug("V3 graphics console inited\n");
+
+    return;
+}