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

2016-04-01 Thread Emil Velikov
On 21 February 2016 at 19:57, Mauro Rossi  wrote:
> Hi Micheal,
>
> no problem, I'm learning so much and you and Emil have both shown amounts of
> patience with me.
>
> I've tested the following patch and it works
>
Mauro, please send patches that can be applied without rewriting them.
As the Gmail web interface alters the contents of the email, I'd
suggest using git send-email. Iirc you used it a while back ?

If you have some comments that shouldn't appear in the patch (like in
this case), just add them after the --- like illustrated below.

I believe you don't have any other outstanding patches send to the
mailing list, correct ? Can you please send out all the delta vs
android-x86. Some of the patches might need a bit of rework, but
pretty much all of them look reasonable.

Thanks
Emil

From a00b1182fd74ec6af37e09e53dd3febec36af27d Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sun, 21 Feb 2016 20:31:21 +0100
Subject: [PATCH] radeonsi: use util_strchrnul() to fix android building
error

Android Bionic does not support strchrnul() string function,
gallium auxiliary util/u_string.h provides util_strchrnul()

This change avoids the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error:
undefined reference to 'strchrnul'
collect2: error: ld returned 1 exit status
---

Newly added comment that won't appear in git history, aimed for reviewers.

 src/gallium/drivers/radeonsi/si_shader.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-21 Thread Mauro Rossi
Hi Micheal,

no problem, I'm learning so much and you and Emil have both shown amounts
of patience with me.

I've tested the following patch and it works

Mauro


>From a00b1182fd74ec6af37e09e53dd3febec36af27d Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sun, 21 Feb 2016 20:31:21 +0100
Subject: [PATCH] radeonsi: use util_strchrnul() to fix android building
error

Android Bionic does not support strchrnul() string function,
gallium auxiliary util/u_string.h provides util_strchrnul()

This change avoids the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error:
undefined reference to 'strchrnul'
collect2: error: ld returned 1 exit status
---
 src/gallium/drivers/radeonsi/si_shader.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c
b/src/gallium/drivers/radeonsi/si_shader.c
index d1482de..192a736 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -39,6 +39,7 @@
 #include "radeon/radeon_llvm_emit.h"
 #include "util/u_memory.h"
 #include "util/u_pstipple.h"
+#include "util/u_string.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_util.h"
 #include "tgsi/tgsi_dump.h"
@@ -4019,7 +4020,7 @@ static void si_shader_dump_disassembly(const struct
radeon_shader_binary *binary

 line = binary->disasm_string;
 while (*line) {
-p = strchrnul(line, '\n');
+p = util_strchrnul(line, '\n');
 count = p - line;

 if (count) {
-- 
2.5.0
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-16 Thread Michel Dänzer
On 16.02.2016 20:03, Emil Velikov wrote:
> On 16 February 2016 at 07:02, Michel Dänzer  wrote:
>> On 14.02.2016 23:41, Mauro Rossi wrote:
>>>
>>> From: Mauro Rossi >
>>> Date: Sun, 14 Feb 2016 15:34:16 +0100
>>> Subject: [PATCH 1/2] android: add support for strchrnul
>>>
>>> Android Bionic has no strchrnul in string functions,
>>> radeonsi uses strchrnul, so we need an implementation.
>>>
>>> strchrnul.h is added in top mesa include path.
>>
>> Gallium code (at least outside of src/gallium/state_trackers) is not
>> supposed to include headers from the toplevel include directory. This
>> header should be in src/util/ instead.
>>
> If we consider this a compatibility wrapper then include/ is fine
> (alongside a name like gnu_string.h). Although I'm thinking about a
> shorter fix -> s/strchrnul/util_strchrnul/. Gallium already has (and
> uses) an util function.

Oh. Sorry Mauro I missed util_strchrnul, please just make radeonsi use that.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-16 Thread Emil Velikov
On 16 February 2016 at 07:02, Michel Dänzer  wrote:
> On 14.02.2016 23:41, Mauro Rossi wrote:
>>
>> From: Mauro Rossi >
>> Date: Sun, 14 Feb 2016 15:34:16 +0100
>> Subject: [PATCH 1/2] android: add support for strchrnul
>>
>> Android Bionic has no strchrnul in string functions,
>> radeonsi uses strchrnul, so we need an implementation.
>>
>> strchrnul.h is added in top mesa include path.
>
> Gallium code (at least outside of src/gallium/state_trackers) is not
> supposed to include headers from the toplevel include directory. This
> header should be in src/util/ instead.
>
If we consider this a compatibility wrapper then include/ is fine
(alongside a name like gnu_string.h). Although I'm thinking about a
shorter fix -> s/strchrnul/util_strchrnul/. Gallium already has (and
uses) an util function.

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-15 Thread Michel Dänzer
On 14.02.2016 23:41, Mauro Rossi wrote:
> 
> From: Mauro Rossi >
> Date: Sun, 14 Feb 2016 15:34:16 +0100
> Subject: [PATCH 1/2] android: add support for strchrnul
> 
> Android Bionic has no strchrnul in string functions,
> radeonsi uses strchrnul, so we need an implementation.
> 
> strchrnul.h is added in top mesa include path.

Gallium code (at least outside of src/gallium/state_trackers) is not
supposed to include headers from the toplevel include directory. This
header should be in src/util/ instead.


> +/**
> + *
> + * Copyright (C) 2014 Emil Velikov  >

Why Emil's copyright?


> +char *
> +strchrnul(const char *s, int c)
> +{
> +char * result = strchr(s, c);

No space after the asterisk:

char *result = strchr(s, c);


> From: Mauro Rossi >
> Date: Sun, 14 Feb 2016 15:10:16 +0100
> Subject: [PATCH 2/2] android: radeonsi: fix building error in si_shader.c

With the shortlog changed to something along the lines of

 radeonsi: Fix strchrnul being undefined on Android

this patch is

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-14 Thread Mauro Rossi
Hi,

thanks, now they should be ok

The macro name was changed to __STRCHRNUL_H

Tested by building marshmallow-x86
M.



>From c1fd979ee7b3e74c4d097b7b1941ebbe65f8d003 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sun, 14 Feb 2016 15:34:16 +0100
Subject: [PATCH 1/2] android: add support for strchrnul

Android Bionic has no strchrnul in string functions,
radeonsi uses strchrnul, so we need an implementation.

strchrnul.h is added in top mesa include path.
---
 include/strchrnul.h | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 include/strchrnul.h

diff --git a/include/strchrnul.h b/include/strchrnul.h
new file mode 100644
index 000..b22028d
--- /dev/null
+++ b/include/strchrnul.h
@@ -0,0 +1,46 @@
+/**
+ *
+ * Copyright (C) 2014 Emil Velikov 
+ *
+ * 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 __STRCHRNUL_H
+#define __STRCHRNUL_H
+
+#include 
+
+#if defined(__ANDROID__)
+
+char *
+strchrnul(const char *s, int c)
+{
+char * result = strchr(s, c);
+
+if (result == NULL) {
+result = s + strlen(s);
+}
+
+return result;
+}
+
+#endif /* __ANDROID__ */
+
+#endif /* __STRCHRNUL_H */
-- 
2.5.0





>From e6252743efcd487a7b0d9f37712d4d41149ef0dd Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sun, 14 Feb 2016 15:10:16 +0100
Subject: [PATCH 2/2] android: radeonsi: fix building error in si_shader.c

Android Bionic does not support strchrnul() function,
causing the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error:
undefined reference to 'strchrnul'
collect2: error: ld returned 1 exit status
---
 src/gallium/drivers/radeonsi/si_shader.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c
b/src/gallium/drivers/radeonsi/si_shader.c
index 19c427a..ec26d71 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -48,6 +48,7 @@
 #include "sid.h"

 #include 
+#include 

 static const char *scratch_rsrc_dword0_symbol =
 "SCRATCH_RSRC_DWORD0";
-- 
2.5.0
From c1fd979ee7b3e74c4d097b7b1941ebbe65f8d003 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sun, 14 Feb 2016 15:34:16 +0100
Subject: [PATCH 1/2] android: add support for strchrnul

Android Bionic has no strchrnul in string functions,
radeonsi uses strchrnul, so we need an implementation.

strchrnul.h is added in top mesa include path.
---
 include/strchrnul.h | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 include/strchrnul.h

diff --git a/include/strchrnul.h b/include/strchrnul.h
new file mode 100644
index 000..b22028d
--- /dev/null
+++ b/include/strchrnul.h
@@ -0,0 +1,46 @@
+/**
+ *
+ * Copyright (C) 2014 Emil Velikov 
+ *
+ * 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 

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

2016-02-07 Thread Michel Dänzer
On 07.02.2016 08:56, Mauro Rossi wrote:
> From e33d112be85e86c2537c26622969dea7dfd16186 Mon Sep 17 00:00:00 2001
> From: Mauro Rossi >
> Date: Sat, 6 Feb 2016 23:54:24 +0100
> Subject: [PATCH 2/2] android: radeonsi: fix building error in si_shader.c
> 
> Android Bionic does not support strchrnul() function,
> causing the following building error:
> 
> external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error:
> undefined reference to 'strchrnul'
> collect2: error: ld returned 1 exit status
> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c
> b/src/gallium/drivers/radeonsi/si_shader.c
> index d9ed6b2..1b5e984 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -49,6 +49,10 @@
>  
>  #include 
>  
> +#if defined(__ANDROID__)

This guard needs to be in the header, as I suggested.


> +#include "strchrnul.h"

This should be

#include 

The "..." syntax is for files which are located in the same directory as
the file which has the #include statement.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-07 Thread Michel Dänzer
On 07.02.2016 08:55, Mauro Rossi wrote:
> From 8030a6cd9d7bb3320fca94038f1969db56223598 Mon Sep 17 00:00:00 2001
> From: Mauro Rossi >
> Date: Sat, 6 Feb 2016 23:52:36 +0100
> Subject: [PATCH 1/2] android: add support for strchrnul
> 
> Android Bionic has no strchrnul in string functions,
> radeonsi uses strchrnul, so we need an implementation.
> 
> strchrnul.h is added in top mesa include path.
> ---
>  include/strchrnul.h | 40 
>  1 file changed, 40 insertions(+)
>  create mode 100644 include/strchrnul.h
> 
> diff --git a/include/strchrnul.h b/include/strchrnul.h
> new file mode 100644
> index 000..83477e2
> --- /dev/null
> +++ b/include/strchrnul.h
> @@ -0,0 +1,40 @@
> +/**
> + *
> + * Copyright (C) 2014 Emil Velikov  >
> + *
> + * 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 _STRCHRNUL_H_
> +#define _STRCHRNUL_H_
> +
> +char *
> +strchrnul(const char *s, int c)
> +{
> +char * result = strchr(s, c);
> +
> +if (result == NULL) {
> +result = s + strlen(s);
> +}
> +
> +return result;
> +}
> +
> +#endif /* _STRCHRNUL_H_ */

Apart from my review of patch 2, this header should

#include 

so that it also works on platforms which do provide strchrnul.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-06 Thread Mauro Rossi
>From e33d112be85e86c2537c26622969dea7dfd16186 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sat, 6 Feb 2016 23:54:24 +0100
Subject: [PATCH 2/2] android: radeonsi: fix building error in si_shader.c

Android Bionic does not support strchrnul() function,
causing the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error:
undefined reference to 'strchrnul'
collect2: error: ld returned 1 exit status
---
 src/gallium/drivers/radeonsi/si_shader.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c
b/src/gallium/drivers/radeonsi/si_shader.c
index d9ed6b2..1b5e984 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -49,6 +49,10 @@

 #include 

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

-- 
2.5.0
From e33d112be85e86c2537c26622969dea7dfd16186 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sat, 6 Feb 2016 23:54:24 +0100
Subject: [PATCH 2/2] android: radeonsi: fix building error in si_shader.c

Android Bionic does not support strchrnul() function,
causing the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error: undefined reference to 'strchrnul'
collect2: error: ld returned 1 exit status
---
 src/gallium/drivers/radeonsi/si_shader.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index d9ed6b2..1b5e984 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -49,6 +49,10 @@
 
 #include 
 
+#if defined(__ANDROID__)
+#include "strchrnul.h"
+#endif /* __ANDROID__ */
+
 static const char *scratch_rsrc_dword0_symbol =
 	"SCRATCH_RSRC_DWORD0";
 
-- 
2.5.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-06 Thread Mauro Rossi
>From 8030a6cd9d7bb3320fca94038f1969db56223598 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sat, 6 Feb 2016 23:52:36 +0100
Subject: [PATCH 1/2] android: add support for strchrnul

Android Bionic has no strchrnul in string functions,
radeonsi uses strchrnul, so we need an implementation.

strchrnul.h is added in top mesa include path.
---
 include/strchrnul.h | 40 
 1 file changed, 40 insertions(+)
 create mode 100644 include/strchrnul.h

diff --git a/include/strchrnul.h b/include/strchrnul.h
new file mode 100644
index 000..83477e2
--- /dev/null
+++ b/include/strchrnul.h
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright (C) 2014 Emil Velikov 
+ *
+ * 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 _STRCHRNUL_H_
+#define _STRCHRNUL_H_
+
+char *
+strchrnul(const char *s, int c)
+{
+char * result = strchr(s, c);
+
+if (result == NULL) {
+result = s + strlen(s);
+}
+
+return result;
+}
+
+#endif /* _STRCHRNUL_H_ */
-- 
2.5.0
From 8030a6cd9d7bb3320fca94038f1969db56223598 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Sat, 6 Feb 2016 23:52:36 +0100
Subject: [PATCH 1/2] android: add support for strchrnul

Android Bionic has no strchrnul in string functions,
radeonsi uses strchrnul, so we need an implementation.

strchrnul.h is added in top mesa include path.
---
 include/strchrnul.h | 40 
 1 file changed, 40 insertions(+)
 create mode 100644 include/strchrnul.h

diff --git a/include/strchrnul.h b/include/strchrnul.h
new file mode 100644
index 000..83477e2
--- /dev/null
+++ b/include/strchrnul.h
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright (C) 2014 Emil Velikov 
+ *
+ * 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 _STRCHRNUL_H_
+#define _STRCHRNUL_H_
+
+char *
+strchrnul(const char *s, int c)
+{
+	char * result = strchr(s, c);
+
+	if (result == NULL) {
+		result = s + strlen(s);
+	}
+
+	return result;
+}
+
+#endif /* _STRCHRNUL_H_ */
-- 
2.5.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-03 Thread Michel Dänzer
On 03.02.2016 12:18, Mauro Rossi wrote:
> Hi Michel,
> 
> Patch was updated according to the instructions and log/commit messages
> changed.

Thanks, but I'm afraid it doesn't match existing compatibility headers
very well.


> +#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.
> + */

Don't mention si_shader_dump_disassembly here.


> +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_ */

Looking at e.g. include/c99_*.h or src/util/str*.h, there isn't one
header per platform but per standard header / feature. Since strchrnul
is defined in string.h, the compatibility header could be called e.g.
string_compat.h or just strchrnul.h, containing something like:

#include 


#if defined(__ANDROID__)

char *
strchrnul(const char *s, int c)
{
char * result = strchr(s, c);

if (result == NULL) {
result = s + strlen(s);
}

return result;
}

#endif /* __ANDROID__ */


> 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 
>  
> +#if defined(__ANDROID__)
> +#include "android_compat.h"
> +#endif /* __ANDROID__ */

Also, adding the compatibility header and making use of it should be two
separate changes. Presumably si_shader.c picks up string.h from
src/gallium/include/pipe/p_compiler.h, so the second change could just
change the latter to

#include 

or add

#include 

to si_shader.c.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-02-02 Thread Mauro Rossi
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 
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 000..224521d
--- /dev/null
+++ b/include/android_compat.h
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright (C) 2014 Emil Velikov 
+ *
+ * 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 

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

-- 
2.5.0
From 7a9090bffa434b78d8654c4c6d4c8dc0ec00c524 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
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 000..224521d
--- /dev/null
+++ b/include/android_compat.h
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright (C) 2014 Emil Velikov 
+ *
+ * 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, 

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

2016-02-01 Thread Michel Dänzer
On 02.02.2016 07:37, Mauro Rossi wrote:
> Bionic does not support strchrnul() function,
> causing the following building error:
> 
> external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error: undefined 
> reference to 'strchrnul'
> collect2: error: ld returned 1 exit status
> 
> This patch embeds the code of strchrnul() in si_shader.c,
> in the same way described here:
> 
> http://lists.freedesktop.org/archives/piglit/2013-February/004798.html
> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 18 ++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
> b/src/gallium/drivers/radeonsi/si_shader.c
> index 2192b21..3717cfa 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -49,6 +49,24 @@
>  
>  #include 
>  
> +#if defined(__ANDROID__)
> +/*
> + * 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__ */
> +
>  static const char *scratch_rsrc_dword0_symbol =
>   "SCRATCH_RSRC_DWORD0";
>  
> 

It would be better to put this in a compatibility header in include/, so
it can be used elsewhere in the tree as well.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev