From cc7e70649aa9d7b972674dc7ee9185d8db23d8a2 Mon Sep 17 00:00:00 2001 From: Sooyoung Ha Date: Thu, 16 Jun 2016 14:49:54 +0900 Subject: yagl: introduce yagl protocol version 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 --- hw/yagl/yagl_device.c | 9 +++++++++ hw/yagl/yagl_server.c | 1 + hw/yagl/yagl_transport.c | 4 ++-- hw/yagl/yagl_transport.h | 13 +++++++++++++ hw/yagl/yagl_version.h | 6 ++++-- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/hw/yagl/yagl_device.c b/hw/yagl/yagl_device.c index 131c9a3e19..3cee269cdd 100644 --- a/hw/yagl/yagl_device.c +++ b/hw/yagl/yagl_device.c @@ -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(), }; diff --git a/hw/yagl/yagl_server.c b/hw/yagl/yagl_server.c index b2bdcf65a4..3e65ac12ff 100644 --- a/hw/yagl/yagl_server.c +++ b/hw/yagl/yagl_server.c @@ -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); diff --git a/hw/yagl/yagl_transport.c b/hw/yagl/yagl_transport.c index 2e84264efa..708508437d 100644 --- a/hw/yagl/yagl_transport.c +++ b/hw/yagl/yagl_transport.c @@ -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; diff --git a/hw/yagl/yagl_transport.h b/hw/yagl/yagl_transport.h index f59a1c2ad4..a91453f37b 100644 --- a/hw/yagl/yagl_transport.h +++ b/hw/yagl/yagl_transport.h @@ -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; diff --git a/hw/yagl/yagl_version.h b/hw/yagl/yagl_version.h index f05d6171a5..f510abb2e1 100644 --- a/hw/yagl/yagl_version.h +++ b/hw/yagl/yagl_version.h @@ -33,8 +33,10 @@ #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 -- cgit v1.2.3