yagl: introduce yagl protocol version
authorSooyoung Ha <yoosah.ha@samsung.com>
Thu, 16 Jun 2016 05:49:54 +0000 (14:49 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 16 Jun 2016 07:24:16 +0000 (16:24 +0900)
Now yagl device receives the protocol version from emulator run option
and put it into emulator kernel to notice to user.

Change-Id: Id3baacf035a2e723a0ebad4e1cfe22b26af72d03
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
hw/yagl/yagl_device.c
hw/yagl/yagl_server.c
hw/yagl/yagl_transport.c
hw/yagl/yagl_transport.h
hw/yagl/yagl_version.h

index 131c9a3e19ebf4477923453d7f794440991898be..3cee269cdd92c8a603d2f9daa4617dd49584a869 100644 (file)
@@ -46,6 +46,7 @@
 #include "hw/vigs/display.h"
 #include "hw/vigs/winsys.h"
 #include "yagl_gles_driver.h"
+#include "yagl_version.h"
 
 #define PCI_VENDOR_ID_YAGL 0x19B1
 #define PCI_DEVICE_ID_YAGL 0x1010
@@ -58,6 +59,8 @@
 
 #define YAGL_MAX_USERS (YAGL_MEM_SIZE / YAGL_REGS_SIZE)
 
+uint32_t yagl_protocol_version = 0;
+
 struct yagl_user
 {
     bool activated;
@@ -73,6 +76,7 @@ typedef struct YaGLState
     char *render_queue;
     char *wsi;
     char *gl_version;
+    uint32_t protocol;
     MemoryRegion iomem;
     struct yagl_server_state *ss;
     struct yagl_user users[YAGL_MAX_USERS];
@@ -227,6 +231,10 @@ static int yagl_device_init(PCIDevice *dev)
     struct yagl_egl_backend *egl_backend = NULL;
     struct yagl_gles_driver *gles_driver = NULL;
 
+    if (s->protocol > 0) {
+        yagl_protocol_version = s->protocol;
+    }
+
     if (s->display) {
         dobj = displayobject_find(s->display);
 
@@ -400,6 +408,7 @@ static Property yagl_properties[] = {
     DEFINE_PROP_STRING("render_queue", YaGLState, render_queue),
     DEFINE_PROP_STRING("wsi", YaGLState, wsi),
     DEFINE_PROP_STRING("gl_version", YaGLState, gl_version),
+    DEFINE_PROP_UINT32("protocol", YaGLState, protocol, 24),
     DEFINE_PROP_END_OF_LIST(),
 };
 
index b2bdcf65a4e0fa16d560332381cd4333b7f657ac..3e65ac12ffa13d418f9d6a9d02505082b04712cd 100644 (file)
@@ -276,6 +276,7 @@ out:
     yagl_marshal_put_uint32_t(&buff, 1);
     yagl_marshal_put_uint32_t(&buff, ss->render_type);
     yagl_marshal_put_uint32_t(&buff, ss->gl_version);
+    yagl_marshal_put_uint32_t(&buff, yagl_protocol_version);
 
     YAGL_LOG_FUNC_EXIT(NULL);
 
index 2e84264efada41292f0fcd617ce83c7d75bf7996..708508437d9c9a2c3d16e6919a085a64cfd0e9cf 100644 (file)
@@ -269,7 +269,7 @@ void yagl_transport_get_out_array(struct yagl_transport *t,
                                   const void **data,
                                   int32_t *count)
 {
-    target_ulong va = (target_ulong)yagl_transport_get_out_uintptr_t(t);
+    target_ulong va = (target_ulong)yagl_transport_get_out_uint64_t(t);
     uint32_t size;
 
     *count = yagl_transport_get_out_uint32_t(t);
@@ -296,7 +296,7 @@ void yagl_transport_get_in_array(struct yagl_transport *t,
                                  int32_t *maxcount,
                                  int32_t **count)
 {
-    target_ulong va = (target_ulong)yagl_transport_get_out_uintptr_t(t);
+    target_ulong va = (target_ulong)yagl_transport_get_out_uint64_t(t);
     uint32_t size;
     struct yagl_transport_in_array *in_array;
     uint32_t offset;
index f59a1c2ad4c3fa455696fc9d843cb321cb39d201..a91453f37b3a93dbd89cb97a29a4511e11b54bb9 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "yagl_types.h"
 #include "yagl_vector.h"
+#include "yagl_version.h"
 #include "qemu/queue.h"
 
 #define YAGL_TRANSPORT_MAX_IN 8
@@ -153,6 +154,18 @@ static __inline uint32_t yagl_transport_get_out_uint32_t(struct yagl_transport *
     return tmp;
 }
 
+static __inline uint64_t yagl_transport_get_out_uint64_t(struct yagl_transport *t)
+{
+    uint64_t tmp;
+    if (yagl_protocol_version < 24) {
+        tmp = *(uint32_t*)t->ptr;
+    } else {
+        tmp = *(uint64_t*)t->ptr;
+    }
+    t->ptr += 8;
+    return tmp;
+}
+
 static __inline uintptr_t yagl_transport_get_out_uintptr_t(struct yagl_transport *t)
 {
     uintptr_t tmp = *(uintptr_t*)t->ptr;
index f05d6171a599522e031b6b794f626bee41902f3a..f510abb2e17805a9bf94cdaa653c959326c7bbc6 100644 (file)
 #include "qemu-common.h"
 
 /*
- * Whenever protocol changes be sure to bump this.
+ * Whenever qemu-kernel interface changes be sure to bump this.
  */
-#define YAGL_VERSION 24
+#define YAGL_VERSION 1
+
+extern uint32_t yagl_protocol_version;
 
 #endif