On Thu, 2011-11-17 at 13:59 +0530, Kui Zheng wrote:
> Here are patches to add ARM NEON acceleration in generic software fallbacks. 
> (See NEON: http://www.arm.com/products/processors/technologies/neon.php)

+#ifdef USE_NEON
+static bool has_neon( void )
+{
+     Elf32_auxv_t aux;
+     uint32_t hwcap = 0;
+     int fd = -1;
+     fd = open ("/proc/self/auxv", O_RDONLY);
+     if (fd >= 0) {
+          while (read (fd, &aux, sizeof(Elf32_auxv_t)) == 
sizeof(Elf32_auxv_t)) {
+               if (aux.a_type == AT_HWCAP) {
+                    hwcap = aux.a_un.a_val;
+                    /* hardcode these values to avoid depending on specific
+                     * versions of the hwcap header, e.g. HWCAP_NEON
+                     */
+                    /* this flag is only present on kernel 2.6.29 */

This is leaking the file descriptor here.

+                    return (hwcap & 4096) != 0;
+               }
+          }
+          close (fd);
+     }
+     return false;
+}
+#endif


_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to