[Beignet] [PATCH 01/10] Android: change the saved file path.
Yang Rong
rong.r.yang at intel.com
Thu May 19 08:37:07 UTC 2016
Save tmp file to /data/local/tmp and the ustest image to /sdcard/ocl
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
src/cl_program.c | 5 +++++
utests/utest_helper.cpp | 10 +++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/cl_program.c b/src/cl_program.c
index e079a77..b569479 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -781,7 +781,12 @@ cl_program_compile(cl_program p,
p->build_opts = NULL;
}
+#if defined(__ANDROID__)
+ char temp_header_template[]= "/data/local/tmp/beignet.XXXXXX";
+#else
char temp_header_template[]= "/tmp/beignet.XXXXXX";
+#endif
+
char* temp_header_path = mkdtemp(temp_header_template);
if (p->source_type == FROM_SOURCE) {
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 4d2d4df..2a204f3 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -685,7 +685,15 @@ void cl_write_bmp(const int *data, int width, int height, const char *filename)
{
int x, y;
- FILE *fp = fopen(filename, "wb");
+ FILE *fp = NULL;
+#if defined(__ANDROID__)
+ char dst_img[256];
+ snprintf(dst_img, sizeof(dst_img), "/sdcard/ocl/%s", filename);
+ fp = fopen(dst_img, "wb");
+ if(fp == NULL) return;
+#else
+ fp = fopen(filename, "wb");
+#endif
assert(fp);
char *raw = (char *) malloc(width * height * sizeof(int)); // at most
--
2.1.4
More information about the Beignet
mailing list