virtio-gl: merge virtio-gl device.
authorSangjin Kim <sangjin3.kim@samsung.com>
Tue, 9 Jul 2013 13:43:20 +0000 (22:43 +0900)
committerSangjin Kim <sangjin3.kim@samsung.com>
Tue, 9 Jul 2013 13:43:20 +0000 (22:43 +0900)
Change-Id: I62f3713c03e12c4c7c5964aeb1b212fb3ae0cb98
Signed-off-by: Sangjin Kim <sangjin3.kim@samsung.com>
hw/virtio/virtio-pci.c
hw/virtio/virtio-pci.h
include/hw/pci/pci.h
tizen/src/hw/maru_device_ids.h
tizen/src/hw/virtio-gl.c
tizen/src/hw/virtio-gl.h [new file with mode: 0644]

index 1a5f95d..45adc64 100644 (file)
@@ -1501,8 +1501,6 @@ static const TypeInfo virtio_rng_pci_info = {
 };
 
 #ifdef CONFIG_MARU
-#if 0
-#ifdef CONFIG_GL_BACKEND
 /* virtio-gl-pci */
 
 static int virtio_gl_pci_init(VirtIOPCIProxy *vpci_dev)
@@ -1520,7 +1518,6 @@ static int virtio_gl_pci_init(VirtIOPCIProxy *vpci_dev)
 
 static void virtio_gl_pci_class_init(ObjectClass *klass, void *data)
 {
-//    DeviceClass *dc = DEVICE_CLASS(klass);
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
 
@@ -1542,11 +1539,9 @@ static TypeInfo virtio_gl_pci_info = {
     .name          = TYPE_VIRTIO_GL_PCI,
     .parent        = TYPE_VIRTIO_PCI,
     .instance_size = sizeof(VirtIOPCIProxy),
-    .instance_init = sizeof(VirtIOGL),
+    .instance_init = virtio_gl_pci_instance_init,
     .class_init    = virtio_gl_pci_class_init,
 };
-#endif
-#endif
 
 /* virtio-touchscreen-pci */
 
@@ -1815,16 +1810,12 @@ static void virtio_pci_register_types(void)
     type_register_static(&vhost_scsi_pci_info);
 #endif
 #ifdef CONFIG_MARU
-#if 0
-#ifdef CONFIG_GL_BACKEND
-    type_register_static(&virtio_gl_pci_info);
-#endif
-#endif
     type_register_static(&virtio_evdi_pci_info);
     type_register_static(&virtio_esm_pci_info);
     type_register_static(&virtio_hwkey_pci_info);
     type_register_static(&virtio_keyboard_pci_info);
     type_register_static(&virtio_touchscreen_pci_info);
+    type_register_static(&virtio_gl_pci_info);
 #endif
 }
 
index ec2e4d0..6ab9e17 100644 (file)
@@ -42,6 +42,7 @@
 #include "../tizen/src/hw/maru_virtio_hwkey.h"
 #include "../tizen/src/hw/maru_virtio_keyboard.h"
 #include "../tizen/src/hw/maru_virtio_touchscreen.h"
+#include "../tizen/src/hw/virtio-gl.h"
 #endif
 
 typedef struct VirtIOPCIProxy VirtIOPCIProxy;
@@ -54,9 +55,7 @@ typedef struct VHostSCSIPCI VHostSCSIPCI;
 typedef struct VirtIORngPCI VirtIORngPCI;
 
 #ifdef CONFIG_MARU
-#ifdef CONFIG_GL_BACKEND
-// typedef struct VirtIOGLPCI VirtIOGLPCI;
-#endif
+typedef struct VirtIOGLPCI VirtIOGLPCI;
 typedef struct VirtIOTouchscreenPCI VirtIOTouchscreenPCI;
 typedef struct VirtIOEVDIPCI VirtIOEVDIPCI;
 typedef struct VirtIOESMPCI VirtIOESMPCI;
@@ -225,9 +224,7 @@ struct VirtIORngPCI {
 };
 
 #ifdef CONFIG_MARU
-#ifdef CONFIG_GL_BACKEND
 
-#if 0
 /*
  * virtio-gl-pci: This extends VirtioPCIProxy.
  */
@@ -239,8 +236,6 @@ struct VirtIOGLPCI {
     VirtIOPCIProxy parent_obj;
     VirtIOGL vdev;
 };
-#endif
-#endif
 
 /*
  * virtio-touchscreen-pci: This extends VirtioPCIProxy.
index 238c15f..8d075ab 100644 (file)
@@ -80,9 +80,6 @@
 #define PCI_DEVICE_ID_VIRTIO_SCSI        0x1004
 #define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
 #define PCI_DEVICE_ID_VIRTIO_9P          0x1009
-#ifdef CONFIG_MARU
-#define PCI_DEVICE_ID_VIRTIO_GL          0x1006
-#endif
 
 #define PCI_VENDOR_ID_REDHAT             0x1b36
 #define PCI_DEVICE_ID_REDHAT_BRIDGE      0x0001
index 47a2fda..8b56fb8 100644 (file)
@@ -53,7 +53,8 @@
 #define PCI_DEVICE_ID_VIRTIO_KEYBOARD    0x1020
 #define PCI_DEVICE_ID_VIRTIO_ESM         0x1024
 #define PCI_DEVICE_ID_VIRTIO_HWKEY       0x1028
-#define PCI_DEVICE_ID_VIRTIO_EVDI        0x1028
+#define PCI_DEVICE_ID_VIRTIO_EVDI        0x1032
+#define PCI_DEVICE_ID_VIRTIO_GL          0x1036
 
 /* Virtio */
 /*
@@ -87,5 +88,6 @@
 #define VIRTIO_ID_ESM           13
 #define VIRTIO_ID_HWKEY         14
 #define VIRTIO_ID_EVDI          15
+#define VIRTIO_ID_GL                   16
 
 #endif /* MARU_DEVICE_IDS_H_ */
index 72c1df3..c2c6c76 100644 (file)
@@ -24,8 +24,9 @@
  * THE SOFTWARE.
  */
 
+#if 0
 #include "hw.h"
-#include "virtio.h"
+#include "maru_device_ids.h"
 
 typedef target_phys_addr_t arg_t;
 #include "opengl_process.h"
@@ -35,6 +36,8 @@ typedef target_phys_addr_t arg_t;
 #include "tizen/src/debug_ch.h"
 MULTI_DEBUG_CHANNEL(qemu, virtio-gl);
 
+#define TYPE_VIRTIO_GL "virtio-gl"
+
 int decode_call_int(ProcessStruct *p, char *in_args, int args_len, char *r_buffer);
 
 /* Uncomment to enable debugging - WARNING!!! changes ABI! */
@@ -64,6 +67,9 @@ struct d_hdr
 #define SIZE_IN_HEADER 4
 #endif
 
+#endif
+#include "virtio-gl.h"
+
 static void virtio_gl_handle(VirtIODevice *vdev, VirtQueue *vq)
 {
        VirtQueueElement elem;
@@ -214,14 +220,18 @@ VirtIODevice *virtio_gl_init(DeviceState *dev)
 {
        VirtIOGL *s;
 
-       s = (VirtIOGL *)virtio_common_init("virtio-gl", VIRTIO_ID_GL,
-                       0, sizeof(VirtIOGL));
-       if (!s)
+       s = g_malloc0(sizeof(VirtIOGL));
+       virtio_init(&s->vdev, TYPE_VIRTIO_GL, VIRTIO_ID_GL, 0);
+       if (&s->vdev == NULL) {
+               ERR("Failed to initialize virtio gl device.\n");
                return NULL;
+       }
+
+       VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(&s->vdev);
+       vdc->get_features = virtio_gl_get_features;
 
-       s->vdev.get_features = virtio_gl_get_features;
        s->vq = virtio_add_queue(&s->vdev, 128, virtio_gl_handle);
-       register_savevm(dev, "virtio-gl", -1, 1, virtio_gl_save, virtio_gl_load, s);
+       register_savevm(dev, TYPE_VIRTIO_GL, -1, 1, virtio_gl_save, virtio_gl_load, s);
 
        return &s->vdev;
 }
diff --git a/tizen/src/hw/virtio-gl.h b/tizen/src/hw/virtio-gl.h
new file mode 100644 (file)
index 0000000..ae00b10
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef VIRTIO_GL_H_
+#define VIRTIO_GL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hw/hw.h"
+#include "maru_device_ids.h"
+
+//typedef target_phys_addr_t arg_t;
+#include "opengl_process.h"
+#include "opengl_exec.h"
+#include <sys/time.h>
+
+#include "tizen/src/debug_ch.h"
+MULTI_DEBUG_CHANNEL(qemu, virtio-gl);
+
+#define TYPE_VIRTIO_GL "virtio-gl"
+
+int decode_call_int(ProcessStruct *p, char *in_args, int args_len, char *r_buffer);
+
+/* Uncomment to enable debugging - WARNING!!! changes ABI! */
+//#define DEBUG_GLIO
+
+typedef struct VirtIOGL
+{
+       VirtIODevice vdev;
+       VirtQueue *vq;
+} VirtIOGL;
+
+struct d_hdr
+{
+       int pid;
+       int rq_l;
+       int rrq_l;
+#ifdef DEBUG_GLIO
+       int sum;
+#endif
+};
+
+#define SIZE_OUT_HEADER sizeof(struct d_hdr)
+
+#ifdef DEBUG_GLIO
+#define SIZE_IN_HEADER (4*2)
+#else
+#define SIZE_IN_HEADER 4
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VIRTIO_GL_H_ */