Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
On 7 June 2017 at 16:22, Jonathan Graywrote: > On Wed, Jun 07, 2017 at 11:18:53PM +0800, Chih-Wei Huang wrote: >> 2017-06-07 22:47 GMT+08:00 Jonathan Gray : >> > On Wed, Jun 07, 2017 at 10:30:49PM +0800, Chih-Wei Huang wrote: >> >> 2017-06-07 21:54 GMT+08:00 Jonathan Gray : >> >> > On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote: >> >> >> On 6 June 2017 at 07:30, Chih-Wei Huang >> >> >> wrote: >> >> >> >>> These are are due to program_invocation_short_name/getprogname. How >> >> >> >>> about updating the file alike xmlconfig.c? >> >> >> >> >> >> >> >> Oh... I didn't notice that. >> >> >> >> Let me check. >> >> >> > >> >> >> > Well, I saw several BSD OSes define >> >> >> > the same context: >> >> >> > >> >> >> > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && >> >> >> > (__NetBSD_Version__ >= 106000100) >> >> >> > #include >> >> >> > #define GET_PROGRAM_NAME() getprogname() >> >> >> > #elif defined(__DragonFly__) >> >> >> > #include >> >> >> > #define GET_PROGRAM_NAME() getprogname() >> >> >> > #elif defined(__APPLE__) >> >> >> > #include >> >> >> > #define GET_PROGRAM_NAME() getprogname() >> >> >> > #elif ... >> >> >> > >> >> >> > Not sure why has no OpenBSD? >> >> >> Your guess is as good as mine. Jonathan, any ideas if/who this is >> >> >> supposed to work for you guys? >> >> > >> >> > I have no idea where that block comes from as the latest >> >> > src/gallium/auxiliary/os/os_process.c >> >> >> >> Sorry. A little off-topic. >> >> Yes, the original patch is about os_process.c. >> >> But now we are talking about xmlconfig.c >> >> (in src/mesa/drivers/dri/common/ ) >> > >> > You miss the other relevant part of that file >> > >> > #if !defined(GET_PROGRAM_NAME) >> > #if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__) || >> > defined(ANDROID) >> > /* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. >> > * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's >> > * used as a last resort, if there is no documented facility available. */ >> > static const char *__getProgramName () { >> > extern const char *__progname; >> > char * arg = strrchr(__progname, '/'); >> > if (arg) >> > return arg+1; >> > else >> > return __progname; >> > } >> > #define GET_PROGRAM_NAME() __getProgramName() >> > #else >> > #define GET_PROGRAM_NAME() "" >> > #warning "Per application configuration won't work with your OS >> > version." >> > #endif >> > #endif >> > >> > __progname exists since BSD 4.4, OpenBSD has had getprogname() since >> > 5.4 in 2013. This should all be simplified to look like or use the >> > gallium code. >> >> No. I didn't miss the part. > > __progname was never mentioned in any mail I read. > >> That's exact what I asked. >> OpenBSD has getprogname(). >> Why should it fall back to the hack? > > Clearly the code is older than 2013. Right - so we were a bit to sparse :-\ Chih-Wei, Jonathan any interest in cleaning up the xmlconfig.c ifdef spaghetti and adding a proper Android fix for gallium? -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
On Wed, Jun 07, 2017 at 11:18:53PM +0800, Chih-Wei Huang wrote: > 2017-06-07 22:47 GMT+08:00 Jonathan Gray: > > On Wed, Jun 07, 2017 at 10:30:49PM +0800, Chih-Wei Huang wrote: > >> 2017-06-07 21:54 GMT+08:00 Jonathan Gray : > >> > On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote: > >> >> On 6 June 2017 at 07:30, Chih-Wei Huang wrote: > >> >> >>> These are are due to program_invocation_short_name/getprogname. How > >> >> >>> about updating the file alike xmlconfig.c? > >> >> >> > >> >> >> Oh... I didn't notice that. > >> >> >> Let me check. > >> >> > > >> >> > Well, I saw several BSD OSes define > >> >> > the same context: > >> >> > > >> >> > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && > >> >> > (__NetBSD_Version__ >= 106000100) > >> >> > #include > >> >> > #define GET_PROGRAM_NAME() getprogname() > >> >> > #elif defined(__DragonFly__) > >> >> > #include > >> >> > #define GET_PROGRAM_NAME() getprogname() > >> >> > #elif defined(__APPLE__) > >> >> > #include > >> >> > #define GET_PROGRAM_NAME() getprogname() > >> >> > #elif ... > >> >> > > >> >> > Not sure why has no OpenBSD? > >> >> Your guess is as good as mine. Jonathan, any ideas if/who this is > >> >> supposed to work for you guys? > >> > > >> > I have no idea where that block comes from as the latest > >> > src/gallium/auxiliary/os/os_process.c > >> > >> Sorry. A little off-topic. > >> Yes, the original patch is about os_process.c. > >> But now we are talking about xmlconfig.c > >> (in src/mesa/drivers/dri/common/ ) > > > > You miss the other relevant part of that file > > > > #if !defined(GET_PROGRAM_NAME) > > #if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__) || > > defined(ANDROID) > > /* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. > > * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's > > * used as a last resort, if there is no documented facility available. */ > > static const char *__getProgramName () { > > extern const char *__progname; > > char * arg = strrchr(__progname, '/'); > > if (arg) > > return arg+1; > > else > > return __progname; > > } > > #define GET_PROGRAM_NAME() __getProgramName() > > #else > > #define GET_PROGRAM_NAME() "" > > #warning "Per application configuration won't work with your OS > > version." > > #endif > > #endif > > > > __progname exists since BSD 4.4, OpenBSD has had getprogname() since > > 5.4 in 2013. This should all be simplified to look like or use the > > gallium code. > > No. I didn't miss the part. __progname was never mentioned in any mail I read. > That's exact what I asked. > OpenBSD has getprogname(). > Why should it fall back to the hack? Clearly the code is older than 2013. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
2017-06-07 22:47 GMT+08:00 Jonathan Gray: > On Wed, Jun 07, 2017 at 10:30:49PM +0800, Chih-Wei Huang wrote: >> 2017-06-07 21:54 GMT+08:00 Jonathan Gray : >> > On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote: >> >> On 6 June 2017 at 07:30, Chih-Wei Huang wrote: >> >> >>> These are are due to program_invocation_short_name/getprogname. How >> >> >>> about updating the file alike xmlconfig.c? >> >> >> >> >> >> Oh... I didn't notice that. >> >> >> Let me check. >> >> > >> >> > Well, I saw several BSD OSes define >> >> > the same context: >> >> > >> >> > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && >> >> > (__NetBSD_Version__ >= 106000100) >> >> > #include >> >> > #define GET_PROGRAM_NAME() getprogname() >> >> > #elif defined(__DragonFly__) >> >> > #include >> >> > #define GET_PROGRAM_NAME() getprogname() >> >> > #elif defined(__APPLE__) >> >> > #include >> >> > #define GET_PROGRAM_NAME() getprogname() >> >> > #elif ... >> >> > >> >> > Not sure why has no OpenBSD? >> >> Your guess is as good as mine. Jonathan, any ideas if/who this is >> >> supposed to work for you guys? >> > >> > I have no idea where that block comes from as the latest >> > src/gallium/auxiliary/os/os_process.c >> >> Sorry. A little off-topic. >> Yes, the original patch is about os_process.c. >> But now we are talking about xmlconfig.c >> (in src/mesa/drivers/dri/common/ ) > > You miss the other relevant part of that file > > #if !defined(GET_PROGRAM_NAME) > #if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__) || > defined(ANDROID) > /* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. > * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's > * used as a last resort, if there is no documented facility available. */ > static const char *__getProgramName () { > extern const char *__progname; > char * arg = strrchr(__progname, '/'); > if (arg) > return arg+1; > else > return __progname; > } > #define GET_PROGRAM_NAME() __getProgramName() > #else > #define GET_PROGRAM_NAME() "" > #warning "Per application configuration won't work with your OS > version." > #endif > #endif > > __progname exists since BSD 4.4, OpenBSD has had getprogname() since > 5.4 in 2013. This should all be simplified to look like or use the > gallium code. No. I didn't miss the part. That's exact what I asked. OpenBSD has getprogname(). Why should it fall back to the hack? -- Chih-Wei Android-x86 project http://www.android-x86.org ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
On Wed, Jun 07, 2017 at 10:30:49PM +0800, Chih-Wei Huang wrote: > 2017-06-07 21:54 GMT+08:00 Jonathan Gray: > > On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote: > >> On 6 June 2017 at 07:30, Chih-Wei Huang wrote: > >> >>> These are are due to program_invocation_short_name/getprogname. How > >> >>> about updating the file alike xmlconfig.c? > >> >> > >> >> Oh... I didn't notice that. > >> >> Let me check. > >> > > >> > Well, I saw several BSD OSes define > >> > the same context: > >> > > >> > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && > >> > (__NetBSD_Version__ >= 106000100) > >> > #include > >> > #define GET_PROGRAM_NAME() getprogname() > >> > #elif defined(__DragonFly__) > >> > #include > >> > #define GET_PROGRAM_NAME() getprogname() > >> > #elif defined(__APPLE__) > >> > #include > >> > #define GET_PROGRAM_NAME() getprogname() > >> > #elif ... > >> > > >> > Not sure why has no OpenBSD? > >> Your guess is as good as mine. Jonathan, any ideas if/who this is > >> supposed to work for you guys? > > > > I have no idea where that block comes from as the latest > > src/gallium/auxiliary/os/os_process.c > > Sorry. A little off-topic. > Yes, the original patch is about os_process.c. > But now we are talking about xmlconfig.c > (in src/mesa/drivers/dri/common/ ) You miss the other relevant part of that file #if !defined(GET_PROGRAM_NAME) #if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__) || defined(ANDROID) /* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's * used as a last resort, if there is no documented facility available. */ static const char *__getProgramName () { extern const char *__progname; char * arg = strrchr(__progname, '/'); if (arg) return arg+1; else return __progname; } #define GET_PROGRAM_NAME() __getProgramName() #else #define GET_PROGRAM_NAME() "" #warning "Per application configuration won't work with your OS version." #endif #endif __progname exists since BSD 4.4, OpenBSD has had getprogname() since 5.4 in 2013. This should all be simplified to look like or use the gallium code. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
2017-06-07 21:54 GMT+08:00 Jonathan Gray: > On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote: >> On 6 June 2017 at 07:30, Chih-Wei Huang wrote: >> >>> These are are due to program_invocation_short_name/getprogname. How >> >>> about updating the file alike xmlconfig.c? >> >> >> >> Oh... I didn't notice that. >> >> Let me check. >> > >> > Well, I saw several BSD OSes define >> > the same context: >> > >> > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && >> > (__NetBSD_Version__ >= 106000100) >> > #include >> > #define GET_PROGRAM_NAME() getprogname() >> > #elif defined(__DragonFly__) >> > #include >> > #define GET_PROGRAM_NAME() getprogname() >> > #elif defined(__APPLE__) >> > #include >> > #define GET_PROGRAM_NAME() getprogname() >> > #elif ... >> > >> > Not sure why has no OpenBSD? >> Your guess is as good as mine. Jonathan, any ideas if/who this is >> supposed to work for you guys? > > I have no idea where that block comes from as the latest > src/gallium/auxiliary/os/os_process.c Sorry. A little off-topic. Yes, the original patch is about os_process.c. But now we are talking about xmlconfig.c (in src/mesa/drivers/dri/common/ ) > is still > #elif defined(__GLIBC__) || defined(__CYGWIN__) > name = program_invocation_short_name; > #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) > /* *BSD and OS X */ > name = getprogname(); > #elif defined(PIPE_OS_HAIKU) > image_info info; > get_image_info(B_CURRENT_TEAM, ); > name = info.name; > #else > #warning unexpected platform in os_process.c > return FALSE; > #endif -- Chih-Wei Android-x86 project http://www.android-x86.org ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote: > On 6 June 2017 at 07:30, Chih-Wei Huangwrote: > > 2017-06-06 13:06 GMT+08:00 Chih-Wei Huang : > >> 2017-06-05 21:04 GMT+08:00 Emil Velikov : > >>> On 4 June 2017 at 04:31, Chih-Wei Huang wrote: > Android bionic is derived from OpenBSD. So the logics of BSD > almost apply to Android as well. > > >>> Having platform FOO define both PIPE_OS_BSD and PIPE_OS_LINUX does not > >>> seem so obvious bth. > >> > >> Yeah.. but that's true. > >> Android is a BSD-style userspace > >> running on a Linux kernel. > >> > It fixes the warnings > > external/mesa/src/gallium/auxiliary/os/os_process.c:43:2: warning: > unexpected platform in os_process.c [-W#warnings] > ^ > external/mesa/src/gallium/auxiliary/os/os_process.c:97:2: warning: > unexpected platform in os_process.c [-W#warnings] > >>> > >>> These are are due to program_invocation_short_name/getprogname. How > >>> about updating the file alike xmlconfig.c? > >> > >> Oh... I didn't notice that. > >> Let me check. > > > > Well, I saw several BSD OSes define > > the same context: > > > > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && > > (__NetBSD_Version__ >= 106000100) > > #include > > #define GET_PROGRAM_NAME() getprogname() > > #elif defined(__DragonFly__) > > #include > > #define GET_PROGRAM_NAME() getprogname() > > #elif defined(__APPLE__) > > #include > > #define GET_PROGRAM_NAME() getprogname() > > #elif ... > > > > Not sure why has no OpenBSD? > Your guess is as good as mine. Jonathan, any ideas if/who this is > supposed to work for you guys? I have no idea where that block comes from as the latest src/gallium/auxiliary/os/os_process.c is still #elif defined(__GLIBC__) || defined(__CYGWIN__) name = program_invocation_short_name; #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) /* *BSD and OS X */ name = getprogname(); #elif defined(PIPE_OS_HAIKU) image_info info; get_image_info(B_CURRENT_TEAM, ); name = info.name; #else #warning unexpected platform in os_process.c return FALSE; #endif > > > Android definitely has getprogname(). > > (at least since Lollipop as I know) > > > > Should I add: > > > > #elif defined(__OpenBSD__) || defined(ANDROID) > > #include > > #define GET_PROGRAM_NAME() getprogname() > > #elif... > > > > I either don't understand why not all the BSD OSes > > which has getprogname() share the same if case. > > > It should be doable but need a bit of cleanup: > - doubt we're can use GLIBC earlier than v2 // not BSD related > - the FreeBSD/NetBSD version checks could(?) be dropped > For each case, please check (CC) some people using the respective platform. > Mesa git log and the respective upstream repos should have contact points. > > Thanks > Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
On 6 June 2017 at 07:30, Chih-Wei Huangwrote: > 2017-06-06 13:06 GMT+08:00 Chih-Wei Huang : >> 2017-06-05 21:04 GMT+08:00 Emil Velikov : >>> On 4 June 2017 at 04:31, Chih-Wei Huang wrote: Android bionic is derived from OpenBSD. So the logics of BSD almost apply to Android as well. >>> Having platform FOO define both PIPE_OS_BSD and PIPE_OS_LINUX does not >>> seem so obvious bth. >> >> Yeah.. but that's true. >> Android is a BSD-style userspace >> running on a Linux kernel. >> It fixes the warnings external/mesa/src/gallium/auxiliary/os/os_process.c:43:2: warning: unexpected platform in os_process.c [-W#warnings] ^ external/mesa/src/gallium/auxiliary/os/os_process.c:97:2: warning: unexpected platform in os_process.c [-W#warnings] >>> >>> These are are due to program_invocation_short_name/getprogname. How >>> about updating the file alike xmlconfig.c? >> >> Oh... I didn't notice that. >> Let me check. > > Well, I saw several BSD OSes define > the same context: > > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && > (__NetBSD_Version__ >= 106000100) > #include > #define GET_PROGRAM_NAME() getprogname() > #elif defined(__DragonFly__) > #include > #define GET_PROGRAM_NAME() getprogname() > #elif defined(__APPLE__) > #include > #define GET_PROGRAM_NAME() getprogname() > #elif ... > > Not sure why has no OpenBSD? Your guess is as good as mine. Jonathan, any ideas if/who this is supposed to work for you guys? > Android definitely has getprogname(). > (at least since Lollipop as I know) > > Should I add: > > #elif defined(__OpenBSD__) || defined(ANDROID) > #include > #define GET_PROGRAM_NAME() getprogname() > #elif... > > I either don't understand why not all the BSD OSes > which has getprogname() share the same if case. > It should be doable but need a bit of cleanup: - doubt we're can use GLIBC earlier than v2 // not BSD related - the FreeBSD/NetBSD version checks could(?) be dropped For each case, please check (CC) some people using the respective platform. Mesa git log and the respective upstream repos should have contact points. Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
2017-06-06 13:06 GMT+08:00 Chih-Wei Huang: > 2017-06-05 21:04 GMT+08:00 Emil Velikov : >> On 4 June 2017 at 04:31, Chih-Wei Huang wrote: >>> Android bionic is derived from OpenBSD. So the logics of BSD >>> almost apply to Android as well. >>> >> Having platform FOO define both PIPE_OS_BSD and PIPE_OS_LINUX does not >> seem so obvious bth. > > Yeah.. but that's true. > Android is a BSD-style userspace > running on a Linux kernel. > >>> It fixes the warnings >>> >>> external/mesa/src/gallium/auxiliary/os/os_process.c:43:2: warning: >>> unexpected platform in os_process.c [-W#warnings] >>> ^ >>> external/mesa/src/gallium/auxiliary/os/os_process.c:97:2: warning: >>> unexpected platform in os_process.c [-W#warnings] >> >> These are are due to program_invocation_short_name/getprogname. How >> about updating the file alike xmlconfig.c? > > Oh... I didn't notice that. > Let me check. Well, I saw several BSD OSes define the same context: #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106000100) #include #define GET_PROGRAM_NAME() getprogname() #elif defined(__DragonFly__) #include #define GET_PROGRAM_NAME() getprogname() #elif defined(__APPLE__) #include #define GET_PROGRAM_NAME() getprogname() #elif ... Not sure why has no OpenBSD? Android definitely has getprogname(). (at least since Lollipop as I know) Should I add: #elif defined(__OpenBSD__) || defined(ANDROID) #include #define GET_PROGRAM_NAME() getprogname() #elif... I either don't understand why not all the BSD OSes which has getprogname() share the same if case. -- Chih-Wei Android-x86 project http://www.android-x86.org ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Android: define PIPE_OS_BSD
On 4 June 2017 at 04:31, Chih-Wei Huangwrote: > Android bionic is derived from OpenBSD. So the logics of BSD > almost apply to Android as well. > Having platform FOO define both PIPE_OS_BSD and PIPE_OS_LINUX does not seem so obvious bth. > It fixes the warnings > > external/mesa/src/gallium/auxiliary/os/os_process.c:43:2: warning: unexpected > platform in os_process.c [-W#warnings] > ^ > external/mesa/src/gallium/auxiliary/os/os_process.c:97:2: warning: unexpected > platform in os_process.c [-W#warnings] These are are due to program_invocation_short_name/getprogname. How about updating the file alike xmlconfig.c? -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev