[Mesa-dev] [PATCH 2/5] android: radeonsi: fix building error in si_shader.c

Mauro Rossi issor.oruam at gmail.com
Wed Feb 3 03:18:01 UTC 2016


Hi Michel,

Patch was updated according to the instructions and log/commit messages
changed.

Thanks for the advice

Mauro


>From 7a9090bffa434b78d8654c4c6d4c8dc0ec00c524 Mon Sep 17 00:00:00 2001
From: Mauro Rossi <issor.oruam at gmail.com>
Date: Wed, 3 Feb 2016 03:54:08 +0100
Subject: [PATCH] android: radeonsi: add strchrnul() to fix building error

Android Bionic has no strchrnul, which is used in
si_shader_dump_disassembly(), so we need an implementation.

A new android compatibility header was added to support
the definition of the needed function.
---
 include/android_compat.h                 | 45
++++++++++++++++++++++++++++++++
 src/gallium/drivers/radeonsi/si_shader.c |  4 +++
 2 files changed, 49 insertions(+)
 create mode 100644 include/android_compat.h

diff --git a/include/android_compat.h b/include/android_compat.h
new file mode 100644
index 0000000..224521d
--- /dev/null
+++ b/include/android_compat.h
@@ -0,0 +1,45 @@
+/**************************************************************************
+ *
+ * Copyright (C) 2014 Emil Velikov <emil.l.velikov at gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
"Software"),
+ * to deal in the Software without restriction, including without
limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+
**************************************************************************/
+
+#ifndef _ANDROID_COMPAT_H_
+#define _ANDROID_COMPAT_H_
+
+/*
+ * Android Bionic has no strchrnul, which is used in
si_shader_dump_disassembly(),
+ * so we must fill in an implementation.
+ */
+
+char *
+strchrnul(const char *s, int c)
+{
+ char * result = strchr(s, c);
+
+ if (result == NULL) {
+ result = s + strlen(s);
+ }
+
+ return result;
+}
+
+#endif /* _ANDROID_COMPAT_H_ */
diff --git a/src/gallium/drivers/radeonsi/si_shader.c
b/src/gallium/drivers/radeonsi/si_shader.c
index 2192b21..86a00fb 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -49,6 +49,10 @@

 #include <errno.h>

+#if defined(__ANDROID__)
+#include "android_compat.h"
+#endif /* __ANDROID__ */
+
 static const char *scratch_rsrc_dword0_symbol =
  "SCRATCH_RSRC_DWORD0";

-- 
2.5.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20160203/01cca4be/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-android-radeonsi-add-strchrnul-to-fix-building-error.patch
Type: text/x-patch
Size: 2959 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20160203/01cca4be/attachment-0001.bin>


More information about the mesa-dev mailing list