qemu: Fix gl failure from 64b target on 32b host

Data from 64b target is truncated by 32b host. This patch makes type of data
buf in host same as target.

[YOCTO #2221] got fixed.

(From OE-Core rev: d9f12cee3847cbf1cf9fc20cb614f8cd67d2a2ee)

Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>

[Bumped PR - sgw]

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Zhai Edwin 2012-04-06 14:39:39 +08:00 committed by Richard Purdie
parent c54831fa89
commit fe0b3333a5
2 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,66 @@
This patch fix GL application failure from 64b target on 32b host
64b target produce 64b args buffer, but qemu parse it as 32b and get wrong
data. To avoid this, the type of args buffer in qemu should be same as target,
that is, target_phys_addr_t. The only potential issue is that we need copy
the data in buffer one by one, or else data corruption when 32b/64b for
target/host combination.
Upstream-Status: Inappropriate [other] - depends on qemu gl patch
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Index: qemu-0.15.1/target-i386/opengl_func.h
===================================================================
--- qemu-0.15.1.orig/target-i386/opengl_func.h 2012-04-06 10:00:08.000000000 +0800
+++ qemu-0.15.1/target-i386/opengl_func.h 2012-04-06 10:47:38.000000000 +0800
@@ -25,10 +25,10 @@
#include "mesa_gl.h"
#include "mesa_glext.h"
-/* Argument list are internally of a type that can hold a target pointer
- * or a host pointer. If 32b target runs on 64b host, it should be big enough
- * to hold host pointer */
-typedef long unsigned int arg_t;
+/* Argument list are internally of a type that point to a buffer passed from
+ * target. It should have same type as target, so that we can support 32b
+ * target on 64b host, and vice versa */
+typedef target_phys_addr_t arg_t;
enum {
TYPE_NONE,
Index: qemu-0.15.1/Makefile.target
===================================================================
--- qemu-0.15.1.orig/Makefile.target 2012-04-06 10:00:08.000000000 +0800
+++ qemu-0.15.1/Makefile.target 2012-04-06 10:00:08.000000000 +0800
@@ -128,7 +128,7 @@
gl_beginend.h: ../target-i386/beginend_funcs.sh
$< > $@
opengl_exec.o : opengl_exec.c server_stub.c gl_func.h opengl_func.h gl_beginend.h
- $(CC) $(GL_CFLAGS) $(DEFINES) -c -o $@ $< -I. -I../target-i386
+ $(CC) $(GL_CFLAGS) $(DEFINES) -c -o $@ $< -I.. -I. -I../fpu -I../target-i386 -DNEED_CPU_H
#########################################################
# Linux user emulator target
Index: qemu-0.15.1/target-i386/opengl_exec.c
===================================================================
--- qemu-0.15.1.orig/target-i386/opengl_exec.c 2012-04-06 10:00:08.000000000 +0800
+++ qemu-0.15.1/target-i386/opengl_exec.c 2012-04-06 10:39:22.000000000 +0800
@@ -37,16 +37,12 @@
#include <mesa_gl.h>
#include <mesa_glx.h>
-// TODO
-typedef long unsigned int target_phys_addr_t;
-
+#include "exec.h"
#include "opengl_func.h"
#include "mesa_glu.h"
#include "mesa_mipmap.c"
-#include "../qemu-common.h"
-
//#define SYSTEMATIC_ERROR_CHECK
#define BUFFER_BEGINEND
#define glGetError() 0

View File

@ -3,7 +3,7 @@ require qemu.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
PR = "r4"
PR = "r5"
FILESPATH = "${FILE_DIRNAME}/qemu-${PV}"
FILESDIR = "${WORKDIR}"
@ -29,6 +29,7 @@ QEMUGLPATCHES = "\
file://enable-i386-linux-user.patch \
file://qemugl-fix.patch \
file://opengl-sdl-fix.patch \
file://opengl-args-copy-fix.patch \
"
SRC_URI_append_virtclass-native = "\