[Beignet] [PATCH 1/6] Android: change the saved file path.
Yang Rong
rong.r.yang at intel.com
Mon Nov 9 18:40:12 PST 2015
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 98b6d51..72ba0c5 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -751,7 +751,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 0aab208..3711d89 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -693,7 +693,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