[Mesa-dev] [PATCH] r600g/sb: Fix Android build

Vadim Girlin vadimgirlin at gmail.com
Wed Jul 3 02:26:06 PDT 2013


On 06/28/2013 01:31 AM, Tom Stellard wrote:
> From: Chih-Wei Huang <cwhuang at android-x86.org>
>
> Add the sb CXX files to the Android Makefile and also stop using some
> c++11 features.
> ---
>   src/gallium/drivers/r600/Android.mk         | 5 +++--
>   src/gallium/drivers/r600/sb/sb_bc.h         | 4 ++--
>   src/gallium/drivers/r600/sb/sb_ra_init.cpp  | 2 +-
>   src/gallium/drivers/r600/sb/sb_valtable.cpp | 4 ++--
>   4 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/Android.mk b/src/gallium/drivers/r600/Android.mk
> index e5188bb..4d2f69f 100644
> --- a/src/gallium/drivers/r600/Android.mk
> +++ b/src/gallium/drivers/r600/Android.mk
> @@ -28,11 +28,12 @@ include $(LOCAL_PATH)/Makefile.sources
>
>   include $(CLEAR_VARS)
>
> -LOCAL_SRC_FILES := $(C_SOURCES)
> +LOCAL_SRC_FILES := $(C_SOURCES) $(CXX_SOURCES)
>
> -LOCAL_C_INCLUDES :=
> +LOCAL_C_INCLUDES := $(DRM_TOP)
>
>   LOCAL_MODULE := libmesa_pipe_r600
>
> +include external/stlport/libstlport.mk
>   include $(GALLIUM_COMMON_MK)
>   include $(BUILD_STATIC_LIBRARY)
> diff --git a/src/gallium/drivers/r600/sb/sb_bc.h b/src/gallium/drivers/r600/sb/sb_bc.h
> index 25255a7..73c250d 100644
> --- a/src/gallium/drivers/r600/sb/sb_bc.h
> +++ b/src/gallium/drivers/r600/sb/sb_bc.h
> @@ -846,7 +846,7 @@ public:
>   	unsigned ndw() { return bc.size(); }
>
>   	void write_data(uint32_t* dst) {
> -		memcpy(dst, bc.data(), 4 * bc.size());
> +		std::copy(bc.begin(), bc.end(), dst);
>   	}
>
>   	void align(unsigned a) {
> @@ -870,7 +870,7 @@ public:
>   	}
>
>   	unsigned get_pos() { return pos; }
> -	uint32_t *data() { return bc.data(); }
> +	uint32_t *data() { return bc.begin(); }

This results in type conversion error for me with gcc 4.8.1 (fedora 19). 
Probably we can simply use &bc[0] here.

PS Sorry for the late reply, I'm sick now so I haven't checked email 
recently. Also I'm not sure when I'll be able to look into it and run 
any tests myself, so if this issue is fixed and there are no other 
regressions, I'm OK with this patch.

>
>   	bytecode & operator <<(uint32_t v) {
>   		if (pos == ndw()) {
> diff --git a/src/gallium/drivers/r600/sb/sb_ra_init.cpp b/src/gallium/drivers/r600/sb/sb_ra_init.cpp
> index bfe5ab9..24b24a0 100644
> --- a/src/gallium/drivers/r600/sb/sb_ra_init.cpp
> +++ b/src/gallium/drivers/r600/sb/sb_ra_init.cpp
> @@ -680,7 +680,7 @@ void ra_split::split_vec(vvec &vv, vvec &v1, vvec &v2, bool allow_swz) {
>
>   			value *t;
>   			vvec::iterator F =
> -					allow_swz ? find(v2.begin(), v2.end(), o) : v2.end();
> +					allow_swz ? std::find(v2.begin(), v2.end(), o) : v2.end();
>
>   			if (F != v2.end()) {
>   				t = *(v1.begin() + (F - v2.begin()));
> diff --git a/src/gallium/drivers/r600/sb/sb_valtable.cpp b/src/gallium/drivers/r600/sb/sb_valtable.cpp
> index 5e6aca0..00aee66 100644
> --- a/src/gallium/drivers/r600/sb/sb_valtable.cpp
> +++ b/src/gallium/drivers/r600/sb/sb_valtable.cpp
> @@ -207,7 +207,7 @@ void value_table::get_values(vvec& v) {
>
>   	for(vt_table::iterator I = hashtable.begin(), E = hashtable.end();
>   			I != E; ++I) {
> -		T = copy(I->begin(), I->end(), T);
> +		T = std::copy(I->begin(), I->end(), T);
>   	}
>   }
>
> @@ -368,7 +368,7 @@ inline bool sb_bitset::set_chk(unsigned id, bool bit) {
>   }
>
>   void sb_bitset::clear() {
> -	memset(data.data(), 0, sizeof(basetype) * data.size());
> +	std::fill(data.begin(), data.end(), 0);
>   }
>
>   void sb_bitset::resize(unsigned size) {
>



More information about the mesa-dev mailing list