From 4dc1fa8e8d1f14868ab8bba93a8cbb87f847c4e3 Mon Sep 17 00:00:00 2001 From: Martyn Capewell Date: Fri, 4 Dec 2009 16:44:58 +0000 Subject: Adds support for UBFX to JIT and Disassembler This introduces UBFX instruction generation abilities to the Pixelflinger JIT, and also modifies the component extraction function to generate the instruction. The extract function contains defines to prevent generation of UBFX on pre-v7 cores. The JIT itself retains the ability to produce the instruction even on v5/6. This patch only generates UBFX when MOV, AND or BIC can't be used. Based on the TRM, this appears to be faster on A9 than using UBFX in all cases. On startup, Pixelflinger JITs three chunks of code. UBFX improves these as follows: 00000077:03515104_00000000_00000000 (Blends a single colour into an RGB565 buffer.) Before: 27 inst/pixel, After: 24 inst/pixel, Improvement: 12.5% 00000077:03545404_00000A01_00000000 (Blends RGBA8888 texture into an RGB565 buffer using alpha.) Before: 30 inst/pixel, After: 27 inst/pixel, Improvement: 11.1% 00000077:03545404_00000A04_00000000 (Blends RGB565 texture into an RGB565 buffer using alpha.) Before: 29 inst/pixel, After: 27 inst/pixel, Improvement: 7.4% --- libpixelflinger/codeflinger/ARMAssembler.cpp | 10 ++++++++++ libpixelflinger/codeflinger/ARMAssembler.h | 1 + libpixelflinger/codeflinger/ARMAssemblerInterface.h | 3 +++ libpixelflinger/codeflinger/ARMAssemblerProxy.cpp | 4 ++++ libpixelflinger/codeflinger/ARMAssemblerProxy.h | 1 + libpixelflinger/codeflinger/disassem.c | 11 +++++++++++ libpixelflinger/codeflinger/load_store.cpp | 18 +++++++++++++++++- 7 files changed, 47 insertions(+), 1 deletion(-) diff --git a/libpixelflinger/codeflinger/ARMAssembler.cpp b/libpixelflinger/codeflinger/ARMAssembler.cpp index d3720c3..fa9f1ad 100644 --- a/libpixelflinger/codeflinger/ARMAssembler.cpp +++ b/libpixelflinger/codeflinger/ARMAssembler.cpp @@ -433,6 +433,16 @@ void ARMAssembler::UXTB16(int cc, int Rd, int Rm, int rotate) { *mPC++ = (cc<<28) | 0x6CF0070 | (Rd<<12) | ((rotate >> 3) << 10) | Rm; } +#if 0 +#pragma mark - +#pragma mark Bit manipulation (ARMv7+ only)... +#endif + +// Bit manipulation (ARMv7+ only)... +void ARMAssembler::UBFX(int cc, int Rd, int Rn, int lsb, int width) +{ + *mPC++ = (cc<<28) | 0x7E00000 | ((width-1)<<16) | (Rd<<12) | (lsb<<7) | 0x50 | Rn; +} }; // namespace android diff --git a/libpixelflinger/codeflinger/ARMAssembler.h b/libpixelflinger/codeflinger/ARMAssembler.h index a667cb5..e7f038a 100644 --- a/libpixelflinger/codeflinger/ARMAssembler.h +++ b/libpixelflinger/codeflinger/ARMAssembler.h @@ -124,6 +124,7 @@ public: virtual void SMLAW(int cc, int y, int Rd, int Rm, int Rs, int Rn); virtual void UXTB16(int cc, int Rd, int Rm, int rotate); + virtual void UBFX(int cc, int Rd, int Rn, int lsb, int width); private: ARMAssembler(const ARMAssembler& rhs); diff --git a/libpixelflinger/codeflinger/ARMAssemblerInterface.h b/libpixelflinger/codeflinger/ARMAssemblerInterface.h index ff6af2a..796342a 100644 --- a/libpixelflinger/codeflinger/ARMAssemblerInterface.h +++ b/libpixelflinger/codeflinger/ARMAssemblerInterface.h @@ -206,6 +206,9 @@ public: // byte/half word extract... virtual void UXTB16(int cc, int Rd, int Rm, int rotate) = 0; + // bit manipulation... + virtual void UBFX(int cc, int Rd, int Rn, int lsb, int width) = 0; + // ----------------------------------------------------------------------- // convenience... // ----------------------------------------------------------------------- diff --git a/libpixelflinger/codeflinger/ARMAssemblerProxy.cpp b/libpixelflinger/codeflinger/ARMAssemblerProxy.cpp index 7c422db..c57d7da 100644 --- a/libpixelflinger/codeflinger/ARMAssemblerProxy.cpp +++ b/libpixelflinger/codeflinger/ARMAssemblerProxy.cpp @@ -199,5 +199,9 @@ void ARMAssemblerProxy::UXTB16(int cc, int Rd, int Rm, int rotate) { mTarget->UXTB16(cc, Rd, Rm, rotate); } +void ARMAssemblerProxy::UBFX(int cc, int Rd, int Rn, int lsb, int width) { + mTarget->UBFX(cc, Rd, Rn, lsb, width); +} + }; // namespace android diff --git a/libpixelflinger/codeflinger/ARMAssemblerProxy.h b/libpixelflinger/codeflinger/ARMAssemblerProxy.h index 9134cce..8c7f270 100644 --- a/libpixelflinger/codeflinger/ARMAssemblerProxy.h +++ b/libpixelflinger/codeflinger/ARMAssemblerProxy.h @@ -115,6 +115,7 @@ public: int Rd, int Rm, int Rs, int Rn); virtual void UXTB16(int cc, int Rd, int Rm, int rotate); + virtual void UBFX(int cc, int Rd, int Rn, int lsb, int width); private: ARMAssemblerInterface* mTarget; diff --git a/libpixelflinger/codeflinger/disassem.c b/libpixelflinger/codeflinger/disassem.c index c17f3ec..aeb8034 100644 --- a/libpixelflinger/codeflinger/disassem.c +++ b/libpixelflinger/codeflinger/disassem.c @@ -81,6 +81,8 @@ * g - 2nd fp operand (register) (bits 16-18) * h - 3rd fp operand (register/immediate) (bits 0-4) * j - xtb rotate literal (bits 10-11) + * i - bfx lsb literal (bits 7-11) + * w - bfx width literal (bits 16-20) * b - branch address * t - thumb branch address (bits 24, 0-23) * k - breakpoint comment (bits 0-3, 8-19) @@ -124,6 +126,7 @@ static const struct arm32_insn arm32_i[] = { { 0x0fe000f0, 0x00a00090, "umlal", "Sdnms" }, { 0x0fe000f0, 0x00e00090, "smlal", "Sdnms" }, { 0x0fff03f0, 0x06cf0070, "uxtb16", "dmj" }, + { 0x0fe00070, 0x07e00050, "ubfx", "dmiw" }, { 0x0d700000, 0x04200000, "strt", "daW" }, { 0x0d700000, 0x04300000, "ldrt", "daW" }, { 0x0d700000, 0x04600000, "strbt", "daW" }, @@ -412,6 +415,14 @@ disasm(const disasm_interface_t *di, u_int loc, int altfmt) case 'j': di->di_printf("ror #%d", ((insn >> 10) & 3) << 3); break; + /* i - bfx lsb literal (bits 7-11) */ + case 'i': + di->di_printf("#%d", (insn >> 7) & 31); + break; + /* w - bfx width literal (bits 16-20) */ + case 'w': + di->di_printf("#%d", 1 + ((insn >> 16) & 31)); + break; /* b - branch address */ case 'b': branch = ((insn << 2) & 0x03ffffff); diff --git a/libpixelflinger/codeflinger/load_store.cpp b/libpixelflinger/codeflinger/load_store.cpp index 93c5825..023381c 100644 --- a/libpixelflinger/codeflinger/load_store.cpp +++ b/libpixelflinger/codeflinger/load_store.cpp @@ -18,9 +18,10 @@ #include #include #include - #include "codeflinger/GGLAssembler.h" +#include + namespace android { // ---------------------------------------------------------------------------- @@ -110,6 +111,20 @@ void GGLAssembler::extract(integer_t& d, int s, int h, int l, int bits) assert(maskLen<=8); assert(h); +#if __ARM_ARCH__ >= 7 + const int mask = (1<> l; + } else if (!l && isValidImmediate(mask)) { + AND(AL, 0, d.reg, s, imm(mask)); // component = packed & mask; + } else if (!l && isValidImmediate(~mask)) { + BIC(AL, 0, d.reg, s, imm(~mask)); // component = packed & mask; + } else { + UBFX(AL, d.reg, s, l, maskLen); // component = (packed & mask) >> l; + } +#else if (h != bits) { const int mask = ((1< Date: Wed, 9 Jun 2010 16:11:09 -0400 Subject: - creates proper ifc.h and dhcp.h headers for libnetutils - adds ifc_set_hwaddr - adds hwaddr command to netcfg - code reuse: dhcp_configure calls ifc_configure; inet_ntoa is used for printing - consistency: use net.XXX.dnsX properties in favor of dhcp.XXX.dnsX properties (see related change to WifiStateTracker) - updated system/core/nexus to use new headers, although not sure if anybody still uses nexus Change-Id: Idd70c0ac6e89b38e86816578c33eff805d30cac4 --- include/netutils/dhcp.h | 40 ++++++++++++++++++++++++++++++++ include/netutils/ifc.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ libnetutils/dhcp_utils.c | 14 ++++++++++++ libnetutils/dhcpclient.c | 46 +++++++++---------------------------- libnetutils/ifc_utils.c | 21 +++++++++++++---- libnetutils/ifc_utils.h | 35 ---------------------------- netcfg/netcfg.c | 36 +++++++++++++++-------------- nexus/DhcpClient.cpp | 26 +++------------------ 8 files changed, 163 insertions(+), 114 deletions(-) create mode 100644 include/netutils/dhcp.h create mode 100644 include/netutils/ifc.h delete mode 100644 libnetutils/ifc_utils.h diff --git a/include/netutils/dhcp.h b/include/netutils/dhcp.h new file mode 100644 index 0000000..96798c5 --- /dev/null +++ b/include/netutils/dhcp.h @@ -0,0 +1,40 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _NETUTILS_DHCP_H_ +#define _NETUTILS_DHCP_H_ + +#include +#include + +__BEGIN_DECLS + +extern int do_dhcp(char *iname); +extern int dhcp_do_request(const char *ifname, + in_addr_t *ipaddr, + in_addr_t *gateway, + in_addr_t *mask, + in_addr_t *dns1, + in_addr_t *dns2, + in_addr_t *server, + uint32_t *lease); +extern int dhcp_stop(const char *ifname); +extern int dhcp_release_lease(const char *ifname); +extern char *dhcp_get_errmsg(); + +__END_DECLS + +#endif /* _NETUTILS_DHCP_H_ */ diff --git a/include/netutils/ifc.h b/include/netutils/ifc.h new file mode 100644 index 0000000..2e502ab --- /dev/null +++ b/include/netutils/ifc.h @@ -0,0 +1,59 @@ +/* + * Copyright 2008, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _NETUTILS_IFC_H_ +#define _NETUTILS_IFC_H_ + +#include +#include + +__BEGIN_DECLS + +extern int ifc_init(void); +extern void ifc_close(void); + +extern int ifc_get_ifindex(const char *name, int *if_indexp); +extern int ifc_get_hwaddr(const char *name, void *ptr); + +extern int ifc_up(const char *name); +extern int ifc_down(const char *name); + +extern int ifc_enable(const char *ifname); +extern int ifc_disable(const char *ifname); + +extern int ifc_reset_connections(const char *ifname); + +extern int ifc_set_addr(const char *name, in_addr_t addr); +extern int ifc_set_mask(const char *name, in_addr_t mask); +extern int ifc_set_hwaddr(const char *name, const void *ptr); + +extern int ifc_add_host_route(const char *name, in_addr_t addr); +extern int ifc_remove_host_routes(const char *name); +extern int ifc_get_default_route(const char *ifname); +extern int ifc_set_default_route(const char *ifname, in_addr_t gateway); +extern int ifc_create_default_route(const char *name, in_addr_t addr); +extern int ifc_remove_default_route(const char *ifname); + +extern int ifc_get_info(const char *name, in_addr_t *addr, in_addr_t *mask, + in_addr_t *flags); + +extern int ifc_configure(const char *ifname, in_addr_t address, + in_addr_t netmask, in_addr_t gateway, + in_addr_t dns1, in_addr_t dns2); + +__END_DECLS + +#endif /* _NETUTILS_IFC_H_ */ diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c index bad2e2f..43f5ec7 100644 --- a/libnetutils/dhcp_utils.c +++ b/libnetutils/dhcp_utils.c @@ -114,6 +114,14 @@ static void fill_ip_info(const char *interface, } } +static const char *ipaddr_to_string(in_addr_t addr) +{ + struct in_addr in_addr; + + in_addr.s_addr = addr; + return inet_ntoa(in_addr); +} + /* * Start the dhcp client daemon, and wait for it to finish * configuring the interface. @@ -157,7 +165,13 @@ int dhcp_do_request(const char *interface, return -1; } if (strcmp(prop_value, "ok") == 0) { + char dns_prop_name[PROPERTY_KEY_MAX]; fill_ip_info(interface, ipaddr, gateway, mask, dns1, dns2, server, lease); + /* copy the dhcp.XXX.dns properties to net.XXX.dns */ + snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", interface); + property_set(dns_prop_name, *dns1 ? ipaddr_to_string(*dns1) : ""); + snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", interface); + property_set(dns_prop_name, *dns2 ? ipaddr_to_string(*dns2) : ""); return 0; } else { snprintf(errmsg, sizeof(errmsg), "DHCP result was %s", prop_value); diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c index 45e392a..b247016 100644 --- a/libnetutils/dhcpclient.c +++ b/libnetutils/dhcpclient.c @@ -36,8 +36,8 @@ #include +#include #include "dhcpmsg.h" -#include "ifc_utils.h" #include "packet.h" #define VERBOSE 2 @@ -85,16 +85,12 @@ int fatal(const char *reason) // exit(1); } -const char *ipaddr(uint32_t addr) +const char *ipaddr(in_addr_t addr) { - static char buf[32]; - - sprintf(buf,"%d.%d.%d.%d", - addr & 255, - ((addr >> 8) & 255), - ((addr >> 16) & 255), - (addr >> 24)); - return buf; + struct in_addr in_addr; + + in_addr.s_addr = addr; + return inet_ntoa(in_addr); } typedef struct dhcp_info dhcp_info; @@ -128,31 +124,11 @@ void get_dhcp_info(uint32_t *ipaddr, uint32_t *gateway, uint32_t *mask, *lease = last_good_info.lease; } -static int ifc_configure(const char *ifname, dhcp_info *info) +static int dhcp_configure(const char *ifname, dhcp_info *info) { - char dns_prop_name[PROPERTY_KEY_MAX]; - - if (ifc_set_addr(ifname, info->ipaddr)) { - printerr("failed to set ipaddr %s: %s\n", ipaddr(info->ipaddr), strerror(errno)); - return -1; - } - if (ifc_set_mask(ifname, info->netmask)) { - printerr("failed to set netmask %s: %s\n", ipaddr(info->netmask), strerror(errno)); - return -1; - } - if (ifc_create_default_route(ifname, info->gateway)) { - printerr("failed to set default route %s: %s\n", ipaddr(info->gateway), strerror(errno)); - return -1; - } - - snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", ifname); - property_set(dns_prop_name, info->dns1 ? ipaddr(info->dns1) : ""); - snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", ifname); - property_set(dns_prop_name, info->dns2 ? ipaddr(info->dns2) : ""); - last_good_info = *info; - - return 0; + return ifc_configure(ifname, info->ipaddr, info->netmask, info->gateway, + info->dns1, info->dns2); } static const char *dhcp_type_to_name(uint32_t type) @@ -449,7 +425,7 @@ int dhcp_init_ifc(const char *ifname) printerr("timed out\n"); if ( info.type == DHCPOFFER ) { printerr("no acknowledgement from DHCP server\nconfiguring %s with offered parameters\n", ifname); - return ifc_configure(ifname, &info); + return dhcp_configure(ifname, &info); } errno = ETIME; close(s); @@ -530,7 +506,7 @@ int dhcp_init_ifc(const char *ifname) if (info.type == DHCPACK) { printerr("configuring %s\n", ifname); close(s); - return ifc_configure(ifname, &info); + return dhcp_configure(ifname, &info); } else if (info.type == DHCPNAK) { printerr("configuration request denied\n"); close(s); diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c index bde336f..296d617 100644 --- a/libnetutils/ifc_utils.c +++ b/libnetutils/ifc_utils.c @@ -27,6 +27,8 @@ #include #include +#include +#include #include #include #include @@ -45,7 +47,7 @@ static int ifc_ctl_sock = -1; void printerr(char *fmt, ...); -static const char *ipaddr_to_string(uint32_t addr) +static const char *ipaddr_to_string(in_addr_t addr) { struct in_addr in_addr; @@ -88,7 +90,7 @@ int ifc_get_hwaddr(const char *name, void *ptr) r = ioctl(ifc_ctl_sock, SIOCGIFHWADDR, &ifr); if(r < 0) return -1; - memcpy(ptr, &ifr.ifr_hwaddr.sa_data, 6); + memcpy(ptr, &ifr.ifr_hwaddr.sa_data, ETH_ALEN); return 0; } @@ -143,6 +145,17 @@ int ifc_set_addr(const char *name, in_addr_t addr) return ioctl(ifc_ctl_sock, SIOCSIFADDR, &ifr); } +int ifc_set_hwaddr(const char *name, const void *ptr) +{ + int r; + struct ifreq ifr; + ifc_init_ifr(name, &ifr); + + ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; + memcpy(&ifr.ifr_hwaddr.sa_data, ptr, ETH_ALEN); + return ioctl(ifc_ctl_sock, SIOCSIFHWADDR, &ifr); +} + int ifc_set_mask(const char *name, in_addr_t mask) { struct ifreq ifr; @@ -429,9 +442,9 @@ ifc_configure(const char *ifname, ifc_close(); - snprintf(dns_prop_name, sizeof(dns_prop_name), "dhcp.%s.dns1", ifname); + snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns1", ifname); property_set(dns_prop_name, dns1 ? ipaddr_to_string(dns1) : ""); - snprintf(dns_prop_name, sizeof(dns_prop_name), "dhcp.%s.dns2", ifname); + snprintf(dns_prop_name, sizeof(dns_prop_name), "net.%s.dns2", ifname); property_set(dns_prop_name, dns2 ? ipaddr_to_string(dns2) : ""); return 0; diff --git a/libnetutils/ifc_utils.h b/libnetutils/ifc_utils.h deleted file mode 100644 index 49b8747..0000000 --- a/libnetutils/ifc_utils.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _IFC_UTILS_H_ -#define _IFC_UTILS_H_ - -int ifc_init(void); - -int ifc_get_ifindex(const char *name, int *if_indexp); -int ifc_get_hwaddr(const char *name, void *ptr); - -int ifc_up(const char *name); -int ifc_down(const char *name); - -int ifc_set_addr(const char *name, unsigned addr); -int ifc_set_mask(const char *name, unsigned mask); - -int ifc_create_default_route(const char *name, unsigned addr); - -int ifc_get_info(const char *name, unsigned *addr, unsigned *mask, unsigned *flags); - -#endif diff --git a/netcfg/netcfg.c b/netcfg/netcfg.c index fc9cf48..9cd883a 100644 --- a/netcfg/netcfg.c +++ b/netcfg/netcfg.c @@ -19,17 +19,13 @@ #include #include #include +#include + +#include +#include static int verbose = 0; -int ifc_init(); -void ifc_close(); -int ifc_up(char *iname); -int ifc_down(char *iname); -int ifc_remove_host_routes(char *iname); -int ifc_remove_default_route(char *iname); -int ifc_get_info(const char *name, unsigned *addr, unsigned *mask, unsigned *flags); -int do_dhcp(char *iname); void die(const char *reason) { @@ -37,16 +33,12 @@ void die(const char *reason) exit(1); } -const char *ipaddr(unsigned addr) +const char *ipaddr(in_addr_t addr) { - static char buf[32]; - - sprintf(buf,"%d.%d.%d.%d", - addr & 255, - ((addr >> 8) & 255), - ((addr >> 16) & 255), - (addr >> 24)); - return buf; + struct in_addr in_addr; + + in_addr.s_addr = addr; + return inet_ntoa(in_addr); } void usage(void) @@ -86,6 +78,15 @@ int dump_interfaces(void) return 0; } +int set_hwaddr(const char *name, const char *asc) { + struct ether_addr *addr = ether_aton(asc); + if (!addr) { + printf("Failed to parse '%s'\n", asc); + return -1; + } + return ifc_set_hwaddr(name, addr->ether_addr_octet); +} + struct { const char *name; @@ -97,6 +98,7 @@ struct { "down", 1, ifc_down }, { "flhosts", 1, ifc_remove_host_routes }, { "deldefault", 1, ifc_remove_default_route }, + { "hwaddr", 2, set_hwaddr }, { 0, 0, 0 }, }; diff --git a/nexus/DhcpClient.cpp b/nexus/DhcpClient.cpp index a5654d2..713059d 100644 --- a/nexus/DhcpClient.cpp +++ b/nexus/DhcpClient.cpp @@ -27,35 +27,15 @@ #include +#include +#include + #include "DhcpClient.h" #include "DhcpState.h" #include "DhcpListener.h" #include "IDhcpEventHandlers.h" #include "Controller.h" -extern "C" { -int ifc_disable(const char *ifname); -int ifc_add_host_route(const char *ifname, uint32_t addr); -int ifc_remove_host_routes(const char *ifname); -int ifc_set_default_route(const char *ifname, uint32_t gateway); -int ifc_get_default_route(const char *ifname); -int ifc_remove_default_route(const char *ifname); -int ifc_reset_connections(const char *ifname); -int ifc_configure(const char *ifname, in_addr_t ipaddr, in_addr_t netmask, in_addr_t gateway, in_addr_t dns1, in_addr_t dns2); - -int dhcp_do_request(const char *ifname, - in_addr_t *ipaddr, - in_addr_t *gateway, - in_addr_t *mask, - in_addr_t *dns1, - in_addr_t *dns2, - in_addr_t *server, - uint32_t *lease); -int dhcp_stop(const char *ifname); -int dhcp_release_lease(const char *ifname); -char *dhcp_get_errmsg(); -} - DhcpClient::DhcpClient(IDhcpEventHandlers *handlers) : mState(DhcpState::INIT), mHandlers(handlers) { mServiceManager = new ServiceManager(); -- cgit v1.1 From c419e2a210ad7e37a1f749f2ab4de7c7f95b90d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Thu, 10 Jun 2010 20:48:19 -0300 Subject: adb: clean up 0 --> NULL for pointers Change-Id: I9216fdf534d807a55dfbc6800b5c3ef5f8c83368 --- adb/sockets.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adb/sockets.c b/adb/sockets.c index 9f1b598..58dcfbb 100644 --- a/adb/sockets.c +++ b/adb/sockets.c @@ -366,7 +366,7 @@ static void local_socket_event_func(int fd, unsigned ev, void *_s) asocket *create_local_socket(int fd) { asocket *s = calloc(1, sizeof(asocket)); - if(s == 0) fatal("cannot allocate socket"); + if (s == NULL) fatal("cannot allocate socket"); install_local_socket(s); s->fd = fd; s->enqueue = local_socket_enqueue; @@ -482,7 +482,7 @@ asocket *create_remote_socket(unsigned id, atransport *t) asocket *s = calloc(1, sizeof(aremotesocket)); adisconnect* dis = &((aremotesocket*)s)->disconnect; - if(s == 0) fatal("cannot allocate socket"); + if (s == NULL) fatal("cannot allocate socket"); s->id = id; s->enqueue = remote_socket_enqueue; s->ready = remote_socket_ready; @@ -761,7 +761,7 @@ asocket *create_smart_socket(void (*action_cb)(asocket *s, const char *act)) { D("Creating smart socket \n"); asocket *s = calloc(1, sizeof(asocket)); - if(s == 0) fatal("cannot allocate socket"); + if (s == NULL) fatal("cannot allocate socket"); s->id = 0; s->enqueue = smart_socket_enqueue; s->ready = smart_socket_ready; -- cgit v1.1 From 8e78dc64d2fedccc77966b0636f7530f452dc7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Thu, 10 Jun 2010 22:36:08 -0300 Subject: adb: remove unneeded assignment of id to zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... as memory was already obtained zero'ed by calloc(). Change-Id: Ic73bad09b54cb778fd40bdf86bb40888ea504c5f Signed-off-by: André Goddard Rosa --- adb/sockets.c | 1 - 1 file changed, 1 deletion(-) diff --git a/adb/sockets.c b/adb/sockets.c index 58dcfbb..6d1c89b 100644 --- a/adb/sockets.c +++ b/adb/sockets.c @@ -762,7 +762,6 @@ asocket *create_smart_socket(void (*action_cb)(asocket *s, const char *act)) D("Creating smart socket \n"); asocket *s = calloc(1, sizeof(asocket)); if (s == NULL) fatal("cannot allocate socket"); - s->id = 0; s->enqueue = smart_socket_enqueue; s->ready = smart_socket_ready; s->close = smart_socket_close; -- cgit v1.1 From 8182829ccb46fc5b043ea258672602dc2928dee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Sat, 12 Jun 2010 11:40:20 -0300 Subject: adb: optimize socket-list-walking code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8bbb8b671c1ce7a2ce736b60b0cdb7b21ccdc372 Signed-off-by: André Goddard Rosa --- adb/sockets.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/adb/sockets.c b/adb/sockets.c index 6d1c89b..43925e4 100644 --- a/adb/sockets.c +++ b/adb/sockets.c @@ -65,8 +65,11 @@ asocket *find_local_socket(unsigned id) asocket *result = NULL; adb_mutex_lock(&socket_list_lock); - for(s = local_socket_list.next; s != &local_socket_list && !result; s = s->next) { - if(s->id == id) result = s; + for (s = local_socket_list.next; s != &local_socket_list; s = s->next) { + if (s->id == id) { + result = s; + break; + } } adb_mutex_unlock(&socket_list_lock); -- cgit v1.1 From eb558b9240743e24c87796191f54c99890641b14 Mon Sep 17 00:00:00 2001 From: Michael Richardson Date: Wed, 2 Jun 2010 19:21:39 -0400 Subject: eliminate a compiler warning: signed/unsigned length Change-Id: I6139a1b3f9caa8fe3492e4850dcc58d8d5ff0cfb --- adb/usb_vendors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c index 6d85fb1..e9e14da 100644 --- a/adb/usb_vendors.c +++ b/adb/usb_vendors.c @@ -151,7 +151,7 @@ void usb_vendors_init(void) /* builds the path to the adb vendor id file. returns 0 if success */ int build_path(char* buff, size_t len, const char* format, const char* home) { - if (snprintf(buff, len, format, home, ANDROID_PATH, ANDROID_ADB_INI) >= len) { + if (snprintf(buff, len, format, home, ANDROID_PATH, ANDROID_ADB_INI) >= (signed)len) { return 1; } -- cgit v1.1 From 62f4d86b7c9143860bc5e9679382fcf159b788b4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Queru Date: Tue, 15 Jun 2010 08:19:56 -0700 Subject: Fix build - cpu-features is ARM-specific Change-Id: I66521f279545a249e3dcb645914f7b66f23cef21 --- libpixelflinger/codeflinger/load_store.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpixelflinger/codeflinger/load_store.cpp b/libpixelflinger/codeflinger/load_store.cpp index 023381c..ed20a00 100644 --- a/libpixelflinger/codeflinger/load_store.cpp +++ b/libpixelflinger/codeflinger/load_store.cpp @@ -20,7 +20,9 @@ #include #include "codeflinger/GGLAssembler.h" +#ifdef __ARM_ARCH__ #include +#endif namespace android { -- cgit v1.1 From 83cb93b4016cbd6029a2d215a7b63fa716b103e4 Mon Sep 17 00:00:00 2001 From: Michael Richardson Date: Wed, 2 Jun 2010 19:09:39 -0400 Subject: added vendor ID for http://www.onthegovideo.com/ Change-Id: I38e3a6f252728d93177745778147e6f6ed45d5c5 --- adb/usb_vendors.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c index e9e14da..db8b018 100644 --- a/adb/usb_vendors.c +++ b/adb/usb_vendors.c @@ -69,6 +69,8 @@ #define VENDOR_ID_PANTECH 0x10A9 // Qualcomm's USB Vendor ID #define VENDOR_ID_QUALCOMM 0x05c6 +// On-The-Go-Video's USB Vendor ID +#define VENDOR_ID_OTGV 0x2257 /** built-in vendor list */ @@ -90,6 +92,7 @@ int builtInVendorIds[] = { VENDOR_ID_KYOCERA, VENDOR_ID_PANTECH, VENDOR_ID_QUALCOMM, + VENDOR_ID_OTGV, }; #define BUILT_IN_VENDOR_COUNT (sizeof(builtInVendorIds)/sizeof(builtInVendorIds[0])) -- cgit v1.1