Re: [Mesa-dev] [PATCH] android: mesa: revert "Enable asm unconditionally"

2019-07-18 Thread Chih-Wei Huang
Mauro Rossi  於 2019年7月14日 週日 下午5:17寫道:
>
> This patch partially reverts 20294dc ("mesa: Enable asm unconditionally, ...")
>
> Android makefile build logic needs to disable assembler optimization
> in 32bit builds to avoid text relocations for libglapi.so shared
>
> Fixes the following build error with Android x86 32bit target:
>
> [  0% 4/477] target SharedLib: libglapi 
> (out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/LINKED/libglapi.so)
> FAILED: 
> out/target/product/x86/obj/SHARED_LIBRARIES/libglapi_intermediates/LINKED/libglapi.so
> ...
> prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/bin/ld:
>  warning: shared library text segment is not shareable
> prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/bin/ld:
>  error: treating warnings as errors
> clang-6.0: error: linker command failed with exit code 1 (use -v to see 
> invocation)
>
> Fixes: 20294dc ("mesa: Enable asm unconditionally, now that gen_matypes is 
> gone.")
> Signed-off-by: Mauro Rossi 
> ---
>  Android.common.mk   | 3 +++
>  Android.mk  | 7 +++
>  src/mesa/Android.libmesa_dricore.mk | 2 ++
>  src/mesa/Android.libmesa_st_mesa.mk | 2 ++
>  4 files changed, 14 insertions(+)
>
> diff --git a/Android.common.mk b/Android.common.mk
> index 8a1c734353..209654bb75 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -106,9 +106,12 @@ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26 && 
> echo true),true)
>  LOCAL_CFLAGS += -DHAVE_SYS_SHM_H
>  endif
>
> +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
>  ifeq ($(TARGET_ARCH),x86)
>  LOCAL_CFLAGS += \
> -DUSE_X86_ASM
> +
> +endif
>  endif
>  ifeq ($(ARCH_ARM_HAVE_NEON),true)
>  LOCAL_CFLAGS_arm += -DUSE_ARM_ASM
> diff --git a/Android.mk b/Android.mk
> index 57613eccfc..4a2a003ea3 100644
> --- a/Android.mk
> +++ b/Android.mk
> @@ -83,6 +83,13 @@ endif
>
>  $(foreach d, $(MESA_BUILD_CLASSIC) $(MESA_BUILD_GALLIUM), $(eval $(d) := 
> true))
>
> +# host and target must be the same arch to generate matypes.h
> +ifeq ($(TARGET_ARCH),$(HOST_ARCH))
> +MESA_ENABLE_ASM := true
> +else
> +MESA_ENABLE_ASM := false
> +endif
> +
>  ifneq ($(filter true, $(HAVE_GALLIUM_RADEONSI)),)
>  MESA_ENABLE_LLVM := true
>  endif
> diff --git a/src/mesa/Android.libmesa_dricore.mk 
> b/src/mesa/Android.libmesa_dricore.mk
> index 8eb6aabe83..792117767b 100644
> --- a/src/mesa/Android.libmesa_dricore.mk
> +++ b/src/mesa/Android.libmesa_dricore.mk
> @@ -39,9 +39,11 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>  LOCAL_SRC_FILES := \
> $(MESA_FILES)
>
> +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
>  ifeq ($(TARGET_ARCH),x86)
> LOCAL_SRC_FILES += $(X86_FILES)
>  endif # x86
> +endif # MESA_ENABLE_ASM
>
>  ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
>  LOCAL_WHOLE_STATIC_LIBRARIES := \
> diff --git a/src/mesa/Android.libmesa_st_mesa.mk 
> b/src/mesa/Android.libmesa_st_mesa.mk
> index 16153a3c5b..ddfd03059c 100644
> --- a/src/mesa/Android.libmesa_st_mesa.mk
> +++ b/src/mesa/Android.libmesa_st_mesa.mk
> @@ -42,9 +42,11 @@ LOCAL_GENERATED_SOURCES := \
> $(MESA_GEN_GLSL_H) \
>     $(MESA_GEN_NIR_H)
>
> +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
>  ifeq ($(TARGET_ARCH),x86)
> LOCAL_SRC_FILES += $(X86_FILES)
>  endif # x86
> +endif # MESA_ENABLE_ASM
>
>  ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
>  LOCAL_WHOLE_STATIC_LIBRARIES := \
> --

Looks good to me.

Review-by: Chih-Wei Huang 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/3] android: radeonsi/gfx10: generate gfx10_format_table.h (v2)

2019-07-07 Thread Chih-Wei Huang
Mauro Rossi  於 2019年7月7日 週日 上午4:17寫道:
>
> Fix Android building rules for gfx10_format_table.h generated header
>
> (v2) Add LOCAL_C_INCLUDES += $(intermediates)/radeonsi to fix error:
>
> external/mesa/src/gallium/drivers/radeonsi/si_state.c:46:10:
> fatal error: 'gfx10_format_table.h' file not found
>  ^~
> 1 error generated.
>
> Fixes: 0ffa229 ("radeonsi/gfx10: generate gfx10_format_table.h")
> Signed-off-by: Mauro Rossi 
> ---
>  src/gallium/drivers/radeonsi/Android.mk | 16 
>  1 file changed, 16 insertions(+)
>
> diff --git a/src/gallium/drivers/radeonsi/Android.mk 
> b/src/gallium/drivers/radeonsi/Android.mk
> index 76309a4ebc..e402da639e 100644
> --- a/src/gallium/drivers/radeonsi/Android.mk
> +++ b/src/gallium/drivers/radeonsi/Android.mk
> @@ -61,6 +61,22 @@ $(intermediates)/radeonsi/si_driinfo.h: $(MERGE_DRIINFO) 
> $(GEN_DRIINFO_INPUTS)
> @echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
> $(hide) $(MESA_PYTHON2) $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS) > $@ 
> || ($(RM) $@; false)
>
> +GEN10_FORMAT_TABLE_INPUTS := \
> +   $(MESA_TOP)/src/gallium/auxiliary/util/u_format.csv \
> +   $(MESA_TOP)/src/amd/registers/gfx10-rsrc.json
> +
> +GEN10_FORMAT_TABLE_DEP := \
> +   $(MESA_TOP)/src/amd/registers/regdb.py
> +
> +GEN10_FORMAT_TABLE := $(LOCAL_PATH)/gfx10_format_table.py
> +
> +$(intermediates)/radeonsi/gfx10_format_table.h: $(GEN10_FORMAT_TABLE) 
> $(GEN10_FORMAT_TABLE_INPUTS) $(GEN10_FORMAT_TABLE_DEP)
> +   @mkdir -p $(dir $@)
> +   @echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
> +   $(hide) $(MESA_PYTHON2) $(GEN10_FORMAT_TABLE) 
> $(GEN10_FORMAT_TABLE_INPUTS) > $@ || ($(RM) $@; false)
> +
> +LOCAL_C_INCLUDES += $(intermediates)/radeonsi

I'm curious why we need this.
Then I noticed the two generated headers
si_driinfo_h and gfx10_format_table.h are used inconsistently.
si_driinfo_h is included with a prefix radeonsi/, (e.g., in pipe_radeonsi.c)
#include "radeonsi/si_driinfo.h"

while gfx10_format_table.h isn't: (e.g. radv_private.h)

#include "gfx10_format_table.h"

Shouldn't them be unified?

>  LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
>
>  $(call mesa-build-with-llvm)



-- 
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

[Mesa-dev] [PATCH] android: vulkan/util: fix generating vk_enum_to_str.*

2019-07-05 Thread Chih-Wei Huang
The gen_enum_to_str.py generates vk_enum_to_str.c and its header at once.
However, the makefiles incorrectly list both files parallel with the same
recipes. That means both two files may be generated simultaneously by two
processes. The generating files may be truncated by another process, as
shown below:

$ cd $OUT/obj/STATIC_LIBRARIES/libmesa_vulkan_util_intermediates/util
$ ls -l

-rw-rw-r-- 1 lh lh 193713 Jul  5 13:31 vk_enum_to_str.c
-rw-rw-r-- 1 lh lh   4609 Jul  5 13:31 vk_enum_to_str.d
-rw-rw-r-- 1 lh lh  0 Jul  5 16:21 vk_enum_to_str.h

Let one file depends on the other with empty recipe to avoid the issue.

Signed-off-by: Chih-Wei Huang 
---
 src/vulkan/Android.mk | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/vulkan/Android.mk b/src/vulkan/Android.mk
index c3230d8..71aa5e5 100644
--- a/src/vulkan/Android.mk
+++ b/src/vulkan/Android.mk
@@ -54,14 +54,16 @@ LOCAL_SRC_FILES := $(VULKAN_UTIL_FILES) $(VULKAN_WSI_FILES)
 
 vulkan_api_xml = $(MESA_TOP)/src/vulkan/registry/vk.xml
 
-$(LOCAL_GENERATED_SOURCES): $(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py \
+$(firstword $(LOCAL_GENERATED_SOURCES)): 
$(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py \
$(vulkan_api_xml)
@echo "target Generated: $(PRIVATE_MODULE) <= $(notdir $(@))"
@mkdir -p $(dir $@)
-   $(hide) $(MESA_PYTHON2) $(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py \
+   $(hide) $(MESA_PYTHON2) $< \
--xml $(vulkan_api_xml) \
--outdir $(dir $@)
 
+$(lastword $(LOCAL_GENERATED_SOURCES)): $(firstword $(LOCAL_GENERATED_SOURCES))
+
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)/util
 
 ifeq ($(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5 6 7),)
-- 
2.7.4

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

[Mesa-dev] [PATCH 4/8] android: radv: fix improper use of LOCAL_WHOLE_STATIC_LIBRARIES

2019-06-25 Thread Chih-Wei Huang
The libmesa_git_sha1 is a dummy library. There is no reason to put
it into LOCAL_WHOLE_STATIC_LIBRARIES.

Move libmesa_vulkan_util to the vulkan.radv which really needs it.

Signed-off-by: Chih-Wei Huang 
---
 src/amd/vulkan/Android.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/Android.mk b/src/amd/vulkan/Android.mk
index a7c31d4..4290cc0 100644
--- a/src/amd/vulkan/Android.mk
+++ b/src/amd/vulkan/Android.mk
@@ -74,7 +74,7 @@ LOCAL_C_INCLUDES := \
$(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_vulkan_util,,)/util \
$(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_util,,)
 
-LOCAL_WHOLE_STATIC_LIBRARIES := \
+LOCAL_STATIC_LIBRARIES := \
libmesa_vulkan_util \
libmesa_git_sha1
 
@@ -158,7 +158,8 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_compiler \
libmesa_amdgpu_addrlib \
libmesa_amd_common \
-   libmesa_radv_common
+   libmesa_radv_common \
+   libmesa_vulkan_util
 
 LOCAL_SHARED_LIBRARIES += $(RADV_SHARED_LIBRARIES) libz libsync liblog
 
-- 
2.7.4

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

[Mesa-dev] [PATCH 8/8] android: radv: import include paths from used libraries

2019-06-25 Thread Chih-Wei Huang
It's unnecessary to manually add these include paths since they could
be imported automatically.

Signed-off-by: Chih-Wei Huang 
---
 src/amd/vulkan/Android.mk | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/amd/vulkan/Android.mk b/src/amd/vulkan/Android.mk
index 52993cc..322620f 100644
--- a/src/amd/vulkan/Android.mk
+++ b/src/amd/vulkan/Android.mk
@@ -33,8 +33,6 @@ RADV_COMMON_INCLUDES := \
$(MESA_TOP)/src/vulkan/wsi \
$(MESA_TOP)/src/vulkan/util \
$(MESA_TOP)/src/amd \
-   $(MESA_TOP)/src/amd/common \
-   $(MESA_TOP)/src/compiler \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/mesa/drivers/dri/common \
@@ -66,14 +64,12 @@ LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR
 
 $(call mesa-build-with-llvm)
 
-LOCAL_C_INCLUDES := \
-   $(RADV_COMMON_INCLUDES) \
-   $(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_amd_common,,)/common \
-   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir \
-   $(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_radv_common,,) \
-   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_util,,)
+LOCAL_C_INCLUDES := $(RADV_COMMON_INCLUDES)
 
 LOCAL_STATIC_LIBRARIES := \
+   libmesa_amd_common \
+   libmesa_nir \
+   libmesa_util \
libmesa_vulkan_util \
libmesa_git_sha1
 
@@ -146,9 +142,7 @@ LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR
 
 $(call mesa-build-with-llvm)
 
-LOCAL_C_INCLUDES := \
-   $(RADV_COMMON_INCLUDES) \
-   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_radv_common,,)
+LOCAL_C_INCLUDES := $(RADV_COMMON_INCLUDES)
 
 LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_util \
-- 
2.7.4

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

[Mesa-dev] [PATCH 5/8] android: vulkan/util: fix export path

2019-06-25 Thread Chih-Wei Huang
Export the correct include path so that the libraries use it can
get it automatically.

Signed-off-by: Chih-Wei Huang 
---
 src/amd/vulkan/Android.mk   | 1 -
 src/intel/Android.vulkan.mk | 1 -
 src/vulkan/Android.mk   | 3 +--
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/amd/vulkan/Android.mk b/src/amd/vulkan/Android.mk
index 4290cc0..52993cc 100644
--- a/src/amd/vulkan/Android.mk
+++ b/src/amd/vulkan/Android.mk
@@ -71,7 +71,6 @@ LOCAL_C_INCLUDES := \
$(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_amd_common,,)/common \
$(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir \
$(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_radv_common,,) \
-   $(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_vulkan_util,,)/util \
$(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_util,,)
 
 LOCAL_STATIC_LIBRARIES := \
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 4fff842..5083fec 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -107,7 +107,6 @@ ANV_INCLUDES := \
$(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_anv_entrypoints,,)/vulkan \
$(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir \
$(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_vulkan_common,,)/vulkan \
-   $(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_vulkan_util,,)/util
 
 ANV_SHARED_LIBRARIES := libdrm
 
diff --git a/src/vulkan/Android.mk b/src/vulkan/Android.mk
index 99dd3f5..c3230d8 100644
--- a/src/vulkan/Android.mk
+++ b/src/vulkan/Android.mk
@@ -62,8 +62,7 @@ $(LOCAL_GENERATED_SOURCES): 
$(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py \
--xml $(vulkan_api_xml) \
--outdir $(dir $@)
 
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-$(intermediates)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)/util
 
 ifeq ($(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5 6 7),)
 LOCAL_SHARED_LIBRARIES += libnativewindow
-- 
2.7.4

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

[Mesa-dev] [PATCH 1/8] android: anv: remove unused LOCAL_EXPORT_C_INCLUDE_DIRS

2019-06-25 Thread Chih-Wei Huang
The vulkan module is the final HAL. No need to export its headers
since none will import it.

Signed-off-by: Chih-Wei Huang 
---
 src/intel/Android.vulkan.mk | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 3c257e5..8d978c3 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -316,8 +316,6 @@ LOCAL_C_INCLUDES := \
$(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_anv_entrypoints,,)/vulkan \
$(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_vulkan_common,,)/vulkan
 
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(MESA_TOP)/src/intel/vulkan
-
 LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_nir \
libmesa_isl \
-- 
2.7.4

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

[Mesa-dev] [PATCH 6/8] android: anv: eliminate libmesa_anv_entrypoints

2019-06-25 Thread Chih-Wei Huang
The dummy library libmesa_anv_entrypoints is totally unnecessary.
The four VULKAN_GENERATED_FILES could be generated and built in
libmesa_vulkan_common directly. The libraries using the generated
headers should get it via the exported include path.

Signed-off-by: Chih-Wei Huang 
---
 src/intel/Android.vulkan.mk | 82 +++--
 1 file changed, 20 insertions(+), 62 deletions(-)

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 5083fec..450cf2e 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -53,60 +53,9 @@ VULKAN_COMMON_HEADER_LIBRARIES := \
libhardware_headers
 endif
 
-# libmesa_anv_entrypoints with header and dummy.c
-#
-# This static library is built to pull entrypoints header
-# for multiple gen specific build targets below. The c file
-# is generated separately for libmesa_vulkan_common to avoid
-# duplicate symbols when linking the anv libraries.
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libmesa_anv_entrypoints
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir)
-
-LOCAL_C_INCLUDES := \
-   $(VULKAN_COMMON_INCLUDES)
-
-LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_entrypoints.h
-LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/dummy.c
-LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.h
-
-$(intermediates)/vulkan/dummy.c:
-   @mkdir -p $(dir $@)
-   @echo "Gen Dummy: $(PRIVATE_MODULE) <= $(notdir $(@))"
-   $(hide) touch $@
-
-$(intermediates)/vulkan/anv_entrypoints.h: $(intermediates)/vulkan/dummy.c \
-  $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
-  $(ANV_EXTENSIONS_SCRIPT) \
-  $(VULKAN_API_XML)
-   $(MESA_PYTHON2) $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
-   --outdir $(dir $@) \
-   --xml $(VULKAN_API_XML)
-
-$(intermediates)/vulkan/anv_extensions.h: $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
- $(ANV_EXTENSIONS_SCRIPT) \
- $(VULKAN_API_XML)
-   @mkdir -p $(dir $@)
-   $(MESA_PYTHON2) $(ANV_EXTENSIONS_GEN_SCRIPT) \
-   --xml $(VULKAN_API_XML) \
-   --out-h $@
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-$(intermediates)
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-include $(MESA_COMMON_MK)
-include $(BUILD_STATIC_LIBRARY)
-
 ANV_INCLUDES := \
$(VULKAN_COMMON_INCLUDES) \
-   $(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_anv_entrypoints,,)/vulkan \
$(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir \
-   $(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_vulkan_common,,)/vulkan \
 
 ANV_SHARED_LIBRARIES := libdrm
 
@@ -127,7 +76,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=70
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -148,7 +97,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=75
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -169,7 +118,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=80
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -190,7 +139,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=90
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -211,7 +160,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=100
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -232,7 +181,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=110
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -252,12 +201,14 @@ intermediates := $(call local-generated-sources-dir)
 
 LOCAL_SRC_FILES := $

[Mesa-dev] [PATCH 0/8] Android makefiles clean up

2019-06-25 Thread Chih-Wei Huang
There are several issues in the current Android makefiles. Though they
may not affect the functionalities, it's ugly and unprofessional.

* Add unnecessary LOCAL_EXPORT_C_INCLUDE_DIRS
* Not export necessary include paths
* Add dummy libraries to LOCAL_WHOLE_STATIC_LIBRARIES
* Use unnecessary dummy library to generate headers
* Add include paths which could be imported automatically

This is a series of patches to clean up these issues.


Chih-Wei Huang (8):
  android: anv: remove unused LOCAL_EXPORT_C_INCLUDE_DIRS
  android: radv: remove unused LOCAL_EXPORT_C_INCLUDE_DIRS
  android: anv: fix improper use of LOCAL_WHOLE_STATIC_LIBRARIES
  android: radv: fix improper use of LOCAL_WHOLE_STATIC_LIBRARIES
  android: vulkan/util: fix export path
  android: anv: eliminate libmesa_anv_entrypoints
  android: anv: import include path of libmesa_nir
  android: radv: import include paths from used libraries

 src/amd/vulkan/Android.mk   |  26 +++---
 src/intel/Android.vulkan.mk | 115 ++--
 src/vulkan/Android.mk   |   3 +-
 3 files changed, 44 insertions(+), 100 deletions(-)

-- 
2.7.4

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

[Mesa-dev] [PATCH 7/8] android: anv: import include path of libmesa_nir

2019-06-25 Thread Chih-Wei Huang
Add libmesa_nir to a common LOCAL_STATIC_LIBRARIES defined by
ANV_STATIC_LIBRARIES so that its include path can be imported
automatically. Then ANV_INCLUDES is unnecessary and could be
eliminated.

Signed-off-by: Chih-Wei Huang 
---
 src/intel/Android.vulkan.mk | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 450cf2e..5d2ec4f 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -38,7 +38,6 @@ VULKAN_COMMON_INCLUDES := \
$(MESA_TOP)/src/vulkan/util \
$(MESA_TOP)/src/intel \
$(MESA_TOP)/src/intel/vulkan \
-   $(MESA_TOP)/src/compiler \
frameworks/native/vulkan/include
 
 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27; echo $$?), 0)
@@ -53,9 +52,10 @@ VULKAN_COMMON_HEADER_LIBRARIES := \
libhardware_headers
 endif
 
-ANV_INCLUDES := \
-   $(VULKAN_COMMON_INCLUDES) \
-   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir \
+ANV_STATIC_LIBRARIES := \
+   libmesa_vulkan_common \
+   libmesa_genxml \
+   libmesa_nir
 
 ANV_SHARED_LIBRARIES := libdrm
 
@@ -74,9 +74,9 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_SRC_FILES := $(VULKAN_GEN7_FILES)
 LOCAL_CFLAGS := -DGEN_VERSIONx10=70
 
-LOCAL_C_INCLUDES := $(ANV_INCLUDES)
+LOCAL_C_INCLUDES := $(VULKAN_COMMON_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
+LOCAL_STATIC_LIBRARIES := $(ANV_STATIC_LIBRARIES)
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -95,9 +95,9 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_SRC_FILES := $(VULKAN_GEN75_FILES)
 LOCAL_CFLAGS := -DGEN_VERSIONx10=75
 
-LOCAL_C_INCLUDES := $(ANV_INCLUDES)
+LOCAL_C_INCLUDES := $(VULKAN_COMMON_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
+LOCAL_STATIC_LIBRARIES := $(ANV_STATIC_LIBRARIES)
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -116,9 +116,9 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_SRC_FILES := $(VULKAN_GEN8_FILES)
 LOCAL_CFLAGS := -DGEN_VERSIONx10=80
 
-LOCAL_C_INCLUDES := $(ANV_INCLUDES)
+LOCAL_C_INCLUDES := $(VULKAN_COMMON_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
+LOCAL_STATIC_LIBRARIES := $(ANV_STATIC_LIBRARIES)
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -137,9 +137,9 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_SRC_FILES := $(VULKAN_GEN9_FILES)
 LOCAL_CFLAGS := -DGEN_VERSIONx10=90
 
-LOCAL_C_INCLUDES := $(ANV_INCLUDES)
+LOCAL_C_INCLUDES := $(VULKAN_COMMON_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
+LOCAL_STATIC_LIBRARIES := $(ANV_STATIC_LIBRARIES)
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -158,9 +158,9 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_SRC_FILES := $(VULKAN_GEN10_FILES)
 LOCAL_CFLAGS := -DGEN_VERSIONx10=100
 
-LOCAL_C_INCLUDES := $(ANV_INCLUDES)
+LOCAL_C_INCLUDES := $(VULKAN_COMMON_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
+LOCAL_STATIC_LIBRARIES := $(ANV_STATIC_LIBRARIES)
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -179,9 +179,9 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_SRC_FILES := $(VULKAN_GEN11_FILES)
 LOCAL_CFLAGS := -DGEN_VERSIONx10=110
 
-LOCAL_C_INCLUDES := $(ANV_INCLUDES)
+LOCAL_C_INCLUDES := $(VULKAN_COMMON_INCLUDES)
 
-LOCAL_STATIC_LIBRARIES := libmesa_vulkan_common libmesa_genxml
+LOCAL_STATIC_LIBRARIES := $(ANV_STATIC_LIBRARIES)
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -205,10 +205,10 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)/vulkan
 
 LOCAL_C_INCLUDES := \
$(LOCAL_EXPORT_C_INCLUDE_DIRS) \
-   $(ANV_INCLUDES) \
-   $(MESA_TOP)/src/compiler
+   $(VULKAN_COMMON_INCLUDES)
 
 LOCAL_STATIC_LIBRARIES := \
+   libmesa_nir \
libmesa_genxml \
libmesa_git_sha1 \
libmesa_vulkan_util
-- 
2.7.4

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

[Mesa-dev] [PATCH 2/8] android: radv: remove unused LOCAL_EXPORT_C_INCLUDE_DIRS

2019-06-25 Thread Chih-Wei Huang
The vulkan module is the final HAL. No need to export its headers
since none will import it.

Signed-off-by: Chih-Wei Huang 
---
 src/amd/vulkan/Android.mk | 4 
 1 file changed, 4 deletions(-)

diff --git a/src/amd/vulkan/Android.mk b/src/amd/vulkan/Android.mk
index 0725fea..a7c31d4 100644
--- a/src/amd/vulkan/Android.mk
+++ b/src/amd/vulkan/Android.mk
@@ -151,10 +151,6 @@ LOCAL_C_INCLUDES := \
$(RADV_COMMON_INCLUDES) \
$(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_radv_common,,)
 
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-   $(MESA_TOP)/src/amd/vulkan \
-   $(intermediates)
-
 LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_util \
libmesa_nir \
-- 
2.7.4

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

[Mesa-dev] [PATCH 3/8] android: anv: fix improper use of LOCAL_WHOLE_STATIC_LIBRARIES

2019-06-25 Thread Chih-Wei Huang
The libmesa_anv_entrypoints and libmesa_genxml are dummy libraries.
There is no reason to put them into LOCAL_WHOLE_STATIC_LIBRARIES.

Move libmesa_vulkan_util to the vulkan HAL which really needs it.

Signed-off-by: Chih-Wei Huang 
---
 src/intel/Android.vulkan.mk | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 8d978c3..4fff842 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -128,7 +128,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=70
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -149,7 +149,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=75
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -170,7 +170,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=80
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -191,7 +191,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=90
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -212,7 +212,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=100
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -233,7 +233,7 @@ LOCAL_CFLAGS := -DGEN_VERSIONx10=110
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
-LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+LOCAL_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
@@ -257,7 +257,7 @@ LOCAL_C_INCLUDES := \
$(ANV_INCLUDES) \
$(MESA_TOP)/src/compiler
 
-LOCAL_WHOLE_STATIC_LIBRARIES := \
+LOCAL_STATIC_LIBRARIES := \
libmesa_anv_entrypoints \
libmesa_genxml \
libmesa_git_sha1 \
@@ -326,14 +326,14 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_intel_common \
libmesa_intel_dev \
libmesa_vulkan_common \
+   libmesa_vulkan_util \
libmesa_anv_gen7 \
libmesa_anv_gen75 \
libmesa_anv_gen8 \
libmesa_anv_gen9 \
libmesa_anv_gen10 \
libmesa_anv_gen11 \
-   libmesa_intel_compiler \
-   libmesa_anv_entrypoints
+   libmesa_intel_compiler
 
 LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES) libz libsync liblog
 LOCAL_HEADER_LIBRARIES += $(VULKAN_COMMON_HEADER_LIBRARIES)
-- 
2.7.4

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

Re: [Mesa-dev] [PATCH] android: virgl: fix libmesa_virgil_common build and dependencies

2019-06-25 Thread Chih-Wei Huang
Mauro Rossi  於 2019年6月25日 週二 下午5:52寫道:
>
> Hi,
>
> On Mon, Jun 24, 2019 at 8:55 AM Chih-Wei Huang  
> wrote:
>>
>> Mauro Rossi  於 2019年6月15日 週六 下午1:39寫道:
>> >
>> > Fixes the following building errors and resolves Bug 110922
>> > Fixes gallium_dri target missing symbols at linking.
>> >
>> > external/mesa/src/gallium/winsys/virgl/drm/Android.mk:
>> > error: libmesa_winsys_virgl (STATIC_LIBRARIES android-x86_64) missing 
>> > libmesa_winsys_virgl_common (STATIC_LIBRARIES android-x86_64)
>> > ...
>> > external/mesa/src/gallium/winsys/virgl/vtest/Android.mk:
>> > error: libmesa_winsys_virgl_vtest (STATIC_LIBRARIES android-x86_64) 
>> > missing libmesa_winsys_virgl_common (STATIC_LIBRARIES android-x86_64)
>> > ...
>> > build/core/main.mk:728: error: exiting from previous errors.
>> >
>> > In file included from 
>> > external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c:34:
>> > external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h:35:10:
>> > fatal error: 'virgl_resource_cache.h' file not found
>> >  ^~~~
>> > 1 error generated.
>> >
>> > In file included from 
>> > external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c:32:
>> > external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h:35:10:
>> > fatal error: 'virgl_resource_cache.h' file not found
>> > #include "virgl_resource_cache.h"
>> >  ^~~~
>> > 1 error generated.
>> >
>> > Fixes: b18f09a ("virgl: Introduce virgl_resource_cache")
>> > Signed-off-by: Mauro Rossi 
>> > ---
>> >  src/gallium/Android.mk| 2 +-
>> >  src/gallium/drivers/virgl/Android.mk  | 2 +-
>> >  src/gallium/winsys/virgl/drm/Android.mk   | 2 ++
>> >  src/gallium/winsys/virgl/vtest/Android.mk | 2 ++
>> >  4 files changed, 6 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
>> > index 3a3f042c7a..37e923c225 100644
>> > --- a/src/gallium/Android.mk
>> > +++ b/src/gallium/Android.mk
>> > @@ -43,7 +43,7 @@ SUBDIRS += winsys/radeon/drm drivers/r300
>> >  SUBDIRS += winsys/radeon/drm drivers/r600
>> >  SUBDIRS += winsys/radeon/drm winsys/amdgpu/drm drivers/radeonsi
>> >  SUBDIRS += winsys/vc4/drm drivers/vc4
>> > -SUBDIRS += winsys/virgl/drm winsys/virgl/vtest drivers/virgl
>> > +SUBDIRS += winsys/virgl/common winsys/virgl/drm winsys/virgl/vtest 
>> > drivers/virgl
>> >  SUBDIRS += winsys/svga/drm drivers/svga
>> >  SUBDIRS += winsys/etnaviv/drm drivers/etnaviv drivers/renderonly
>> >  SUBDIRS += state_trackers/dri
>> > diff --git a/src/gallium/drivers/virgl/Android.mk 
>> > b/src/gallium/drivers/virgl/Android.mk
>> > index 0067dfa702..a6fe53fbe9 100644
>> > --- a/src/gallium/drivers/virgl/Android.mk
>> > +++ b/src/gallium/drivers/virgl/Android.mk
>> > @@ -35,5 +35,5 @@ include $(BUILD_STATIC_LIBRARY)
>> >
>> >  ifneq ($(HAVE_GALLIUM_VIRGL),)
>> >  GALLIUM_TARGET_DRIVERS += virtio_gpu
>> > -$(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_virgl 
>> > libmesa_winsys_virgl_vtest)
>> > +$(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_virgl_common 
>> > libmesa_winsys_virgl libmesa_winsys_virgl_vtest)
>> >  endif
>> > diff --git a/src/gallium/winsys/virgl/drm/Android.mk 
>> > b/src/gallium/winsys/virgl/drm/Android.mk
>> > index 5e2500774e..398a7645bc 100644
>> > --- a/src/gallium/winsys/virgl/drm/Android.mk
>> > +++ b/src/gallium/winsys/virgl/drm/Android.mk
>> > @@ -27,6 +27,8 @@ include $(CLEAR_VARS)
>> >
>> >  LOCAL_SRC_FILES := $(C_SOURCES)
>> >
>> > +LOCAL_C_INCLUDES := $(GALLIUM_TOP)/winsys/virgl/common
>>
>> This should be unnecessary.
>> The include path should be imported automatically.
>> However, there is a typo in Android.mk of libmesa_winsys_virgl_common
>> that prevents it from working. We should fix the typo instead of adding this.
>> Will send a patch later.
>
>
> I was also thinking the LOCAL_C_INCLUDES un-necessary,
> but for some reason fatal error: '*.h' file not found was happening without 
> this
>
> I double checked prior to submit the patch with the LOCAL_C_INCLUDES
>
>>
>>
>> > +
>> >  LOCAL_MODULE := libmesa_winsys_virgl
>> >
>> >  LOCAL_STATIC_LIBRARIES := libmesa

Re: [Mesa-dev] [PATCH] android: virgl: fix libmesa_virgil_common build and dependencies

2019-06-24 Thread Chih-Wei Huang
Mauro Rossi  於 2019年6月15日 週六 下午1:39寫道:
>
> Fixes the following building errors and resolves Bug 110922
> Fixes gallium_dri target missing symbols at linking.
>
> external/mesa/src/gallium/winsys/virgl/drm/Android.mk:
> error: libmesa_winsys_virgl (STATIC_LIBRARIES android-x86_64) missing 
> libmesa_winsys_virgl_common (STATIC_LIBRARIES android-x86_64)
> ...
> external/mesa/src/gallium/winsys/virgl/vtest/Android.mk:
> error: libmesa_winsys_virgl_vtest (STATIC_LIBRARIES android-x86_64) missing 
> libmesa_winsys_virgl_common (STATIC_LIBRARIES android-x86_64)
> ...
> build/core/main.mk:728: error: exiting from previous errors.
>
> In file included from 
> external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c:34:
> external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h:35:10:
> fatal error: 'virgl_resource_cache.h' file not found
>  ^~~~
> 1 error generated.
>
> In file included from 
> external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c:32:
> external/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h:35:10:
> fatal error: 'virgl_resource_cache.h' file not found
> #include "virgl_resource_cache.h"
>  ^~~~
> 1 error generated.
>
> Fixes: b18f09a ("virgl: Introduce virgl_resource_cache")
> Signed-off-by: Mauro Rossi 
> ---
>  src/gallium/Android.mk| 2 +-
>  src/gallium/drivers/virgl/Android.mk  | 2 +-
>  src/gallium/winsys/virgl/drm/Android.mk   | 2 ++
>  src/gallium/winsys/virgl/vtest/Android.mk | 2 ++
>  4 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
> index 3a3f042c7a..37e923c225 100644
> --- a/src/gallium/Android.mk
> +++ b/src/gallium/Android.mk
> @@ -43,7 +43,7 @@ SUBDIRS += winsys/radeon/drm drivers/r300
>  SUBDIRS += winsys/radeon/drm drivers/r600
>  SUBDIRS += winsys/radeon/drm winsys/amdgpu/drm drivers/radeonsi
>  SUBDIRS += winsys/vc4/drm drivers/vc4
> -SUBDIRS += winsys/virgl/drm winsys/virgl/vtest drivers/virgl
> +SUBDIRS += winsys/virgl/common winsys/virgl/drm winsys/virgl/vtest 
> drivers/virgl
>  SUBDIRS += winsys/svga/drm drivers/svga
>  SUBDIRS += winsys/etnaviv/drm drivers/etnaviv drivers/renderonly
>  SUBDIRS += state_trackers/dri
> diff --git a/src/gallium/drivers/virgl/Android.mk 
> b/src/gallium/drivers/virgl/Android.mk
> index 0067dfa702..a6fe53fbe9 100644
> --- a/src/gallium/drivers/virgl/Android.mk
> +++ b/src/gallium/drivers/virgl/Android.mk
> @@ -35,5 +35,5 @@ include $(BUILD_STATIC_LIBRARY)
>
>  ifneq ($(HAVE_GALLIUM_VIRGL),)
>  GALLIUM_TARGET_DRIVERS += virtio_gpu
> -$(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_virgl 
> libmesa_winsys_virgl_vtest)
> +$(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_virgl_common 
> libmesa_winsys_virgl libmesa_winsys_virgl_vtest)
>  endif
> diff --git a/src/gallium/winsys/virgl/drm/Android.mk 
> b/src/gallium/winsys/virgl/drm/Android.mk
> index 5e2500774e..398a7645bc 100644
> --- a/src/gallium/winsys/virgl/drm/Android.mk
> +++ b/src/gallium/winsys/virgl/drm/Android.mk
> @@ -27,6 +27,8 @@ include $(CLEAR_VARS)
>
>  LOCAL_SRC_FILES := $(C_SOURCES)
>
> +LOCAL_C_INCLUDES := $(GALLIUM_TOP)/winsys/virgl/common

This should be unnecessary.
The include path should be imported automatically.
However, there is a typo in Android.mk of libmesa_winsys_virgl_common
that prevents it from working. We should fix the typo instead of adding this.
Will send a patch later.

> +
>  LOCAL_MODULE := libmesa_winsys_virgl
>
>  LOCAL_STATIC_LIBRARIES := libmesa_winsys_virgl_common
> diff --git a/src/gallium/winsys/virgl/vtest/Android.mk 
> b/src/gallium/winsys/virgl/vtest/Android.mk
> index 5b33f67711..6d35223c8e 100644
> --- a/src/gallium/winsys/virgl/vtest/Android.mk
> +++ b/src/gallium/winsys/virgl/vtest/Android.mk
> @@ -27,6 +27,8 @@ include $(CLEAR_VARS)
>
>  LOCAL_SRC_FILES := $(C_SOURCES)
>
> +LOCAL_C_INCLUDES := $(GALLIUM_TOP)/winsys/virgl/common

Ditto

> +
>  LOCAL_MODULE := libmesa_winsys_virgl_vtest
>
>  LOCAL_STATIC_LIBRARIES := libmesa_winsys_virgl_common
> --



-- 
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

[Mesa-dev] [PATCH] android: fix typo LOCAL_EXPORT_C_INCLUDES

2019-06-24 Thread Chih-Wei Huang
Should be LOCAL_EXPORT_C_INCLUDE_DIRS.

Signed-off-by: Chih-Wei Huang 
---
 src/gallium/winsys/virgl/common/Android.mk | 2 +-
 src/mapi/Android.mk| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/winsys/virgl/common/Android.mk 
b/src/gallium/winsys/virgl/common/Android.mk
index 0b8eda1..c2b25cb 100644
--- a/src/gallium/winsys/virgl/common/Android.mk
+++ b/src/gallium/winsys/virgl/common/Android.mk
@@ -29,7 +29,7 @@ LOCAL_SRC_FILES := $(C_SOURCES)
 
 LOCAL_MODULE := libmesa_winsys_virgl_common
 
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
 
 include $(GALLIUM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
diff --git a/src/mapi/Android.mk b/src/mapi/Android.mk
index 06a7647..9405d2a 100644
--- a/src/mapi/Android.mk
+++ b/src/mapi/Android.mk
@@ -50,7 +50,7 @@ LOCAL_CFLAGS := \
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi
 
-LOCAL_EXPORT_C_INCLUDES := \
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(MESA_TOP)/src/mapi
 
 LOCAL_MODULE := libglapi
-- 
2.7.4

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

Re: [Mesa-dev] [PATCH] android: virgl: fix generated virgl_driinfo.h building rules

2019-06-23 Thread Chih-Wei Huang
Mauro Rossi  於 2019年6月22日 週六 上午2:06寫道:
>
> Changelog in Android makefile:
> - Add LOCAL_MODULE_CLASS, intermediates and LOCAL_GENERATED_SOURCES
> - Use LOCAL_EXPORT_C_INCLUDE_DIRS to export $(intermediates) path
> - Move generated header rules before 'include $(BUILD_STATIC_LIBRARY)'
>
> Fixes the following building error:
>
> In file included from external/mesa/src/gallium/targets/dri/target.c:1:
> external/mesa/src/gallium/auxiliary/target-helpers/drm_helper.h:257:16:
> fatal error: 'virgl/virgl_driinfo.h' file not found
>   #include "virgl/virgl_driinfo.h"
>^~~
> 1 error generated.
>
> Fixes: cf800998a ("virgl: Add driinfo file and tie it into the build")
> Signed-off-by: Mauro Rossi 
> ---
>  src/gallium/drivers/virgl/Android.mk | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/virgl/Android.mk 
> b/src/gallium/drivers/virgl/Android.mk
> index f77bcf196e..585ed7b2ce 100644
> --- a/src/gallium/drivers/virgl/Android.mk
> +++ b/src/gallium/drivers/virgl/Android.mk
> @@ -30,8 +30,9 @@ LOCAL_SRC_FILES := \
>
>  LOCAL_MODULE := libmesa_pipe_virgl
>
> -include $(GALLIUM_COMMON_MK)
> -include $(BUILD_STATIC_LIBRARY)
> +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
> +intermediates := $(call local-generated-sources-dir)
> +LOCAL_GENERATED_SOURCES += $(intermediates)/virgl/virgl_driinfo.h
>
>  GEN_DRIINFO_INPUTS := \
> $(MESA_TOP)/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h \
> @@ -44,6 +45,11 @@ $(intermediates)/virgl/virgl_driinfo.h: $(MERGE_DRIINFO) 
> $(GEN_DRIINFO_INPUTS)
> @echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
> $(hide) $(MESA_PYTHON2) $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS) > $@ 
> || ($(RM) $@; false)
>
> +LOCAL_EXPORT_C_INCLUDE_DIRS += $(intermediates)
> +
> +include $(GALLIUM_COMMON_MK)
> +include $(BUILD_STATIC_LIBRARY)
> +
>  ifneq ($(HAVE_GALLIUM_VIRGL),)
>  GALLIUM_TARGET_DRIVERS += virtio_gpu
>  $(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_virgl_common 
> libmesa_winsys_virgl libmesa_winsys_virgl_vtest)
> --

I suggest to use := instead of += in
LOCAL_GENERATED_SOURCES and LOCAL_EXPORT_C_INCLUDE_DIRS
since they don't catenate others.
Except that, the patch looks good to me.

Review-by: Chih-Wei Huang 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/2] android: anv: fix generated files depedencies

2019-03-05 Thread Chih-Wei Huang
Tapani Pälli  於 2019年3月5日 週二 下午4:48寫道:
>
> On 3/5/19 9:26 AM, Chih-Wei Huang wrote:
> > Mauro Rossi  於 2019年3月4日 週一 上午3:58寫道:
> >>
> >> Fix anv_extrypoints.{c,h} and anv_extensions.{c,h} missing dependencies
> >> Rename the variable labels according to targets and python scripts
> >> Align the building rules as per Automake for simplification
> >>
> >> Fixes building errors during rebuils due to missing dependencies
> >>
> >> Fixes: 9a508b7 ("android: anv/extensions: fix generated sources build")
> >> Fixes: dd088d4bec7 ("anv/extensions: Generate a header file with extension 
> >> tables")
> >> Signed-off-by: Mauro Rossi 
> >> Cc: "19.0" 
> >> ---
> >>   src/intel/Android.vulkan.mk | 38 +++--
> >>   1 file changed, 24 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
> >> index 04c9d5b3e4..2e99ac6294 100644
> >> --- a/src/intel/Android.vulkan.mk
> >> +++ b/src/intel/Android.vulkan.mk
> >> @@ -23,9 +23,10 @@ LOCAL_PATH := $(call my-dir)
> >>   include $(CLEAR_VARS)
> >>   include $(LOCAL_PATH)/Makefile.sources
> >>
> >> -VK_ENTRYPOINTS_SCRIPT := $(MESA_PYTHON2) 
> >> $(LOCAL_PATH)/vulkan/anv_entrypoints_gen.py
> >> -
> >> -VK_EXTENSIONS_SCRIPT := $(MESA_PYTHON2) 
> >> $(LOCAL_PATH)/vulkan/anv_extensions_gen.py
> >> +ANV_ENTRYPOINTS_GEN_SCRIPT := $(LOCAL_PATH)/vulkan/anv_entrypoints_gen.py
> >> +ANV_EXTENSIONS_GEN_SCRIPT := $(LOCAL_PATH)/vulkan/anv_extensions_gen.py
> >> +ANV_EXTENSIONS_SCRIPT := $(LOCAL_PATH)/vulkan/anv_extensions.py
> >> +VULKAN_API_XML := $(MESA_TOP)/src/vulkan/registry/vk.xml
> >>
> >>   VULKAN_COMMON_INCLUDES := \
> >>  $(MESA_TOP)/include \
> >> @@ -64,10 +65,13 @@ $(intermediates)/vulkan/dummy.c:
> >>  @echo "Gen Dummy: $(PRIVATE_MODULE) <= $(notdir $(@))"
> >>  $(hide) touch $@
> >>
> >> -$(intermediates)/vulkan/anv_entrypoints.h: $(intermediates)/vulkan/dummy.c
> >> -   $(VK_ENTRYPOINTS_SCRIPT) \
> >> +$(intermediates)/vulkan/anv_entrypoints.h: 
> >> $(intermediates)/vulkan/dummy.c \
> >
> > I know it was not introduced in this patch.
> > However, it makes no sense to let the header depend on a generated empty 
> > file.
> > This should be removed.
>
> dummy.c is there to meet the Android build system's rules .. comment in
> this file says:

I understand that.
I meant the header anv_entrypoints.h doesn't need to
depend on the generated dummy.c. That's clear.

> # libmesa_anv_entrypoints with header and dummy.c
> #
> # This static library is built to pull entrypoints header
> # for multiple gen specific build targets below. The c file
> # is generated separately for libmesa_vulkan_common to avoid
> # duplicate symbols when linking the anv libraries.
>
> we have same hack applied also in following files within Mesa tree:
>
> src/mesa/Android.libmesa_git_sha1.mk
> src/intel/Android.genxml.mk
> src/broadcom/Android.genxml.mk
>
>
> >> +  $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> >> +  $(ANV_EXTENSIONS_SCRIPT) \
> >> +  $(VULKAN_API_XML)
> >> +   $(MESA_PYTHON2) $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> >>  --outdir $(dir $@) \
> >> -   --xml $(MESA_TOP)/src/vulkan/registry/vk.xml
> >> +   --xml $(VULKAN_API_XML)
> >>
> >>   LOCAL_EXPORT_C_INCLUDE_DIRS := \
> >>   $(intermediates)
> >> @@ -241,22 +245,28 @@ LOCAL_GENERATED_SOURCES += 
> >> $(intermediates)/vulkan/anv_entrypoints.c
> >>   LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.c
> >>   LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.h
> >>
> >> -$(intermediates)/vulkan/anv_entrypoints.c:
> >> +$(intermediates)/vulkan/anv_entrypoints.c: $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> >> +  $(ANV_EXTENSIONS_SCRIPT) \
> >> +  $(VULKAN_API_XML)
> >>  @mkdir -p $(dir $@)
> >> -   $(VK_ENTRYPOINTS_SCRIPT) \
> >> +   $(MESA_PYTHON2) $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> >>  --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
> >>  --outdir $(dir $@)
> &g

Re: [Mesa-dev] [PATCH 1/2] android: anv: fix generated files depedencies

2019-03-04 Thread Chih-Wei Huang
Mauro Rossi  於 2019年3月4日 週一 上午3:58寫道:
>
> Fix anv_extrypoints.{c,h} and anv_extensions.{c,h} missing dependencies
> Rename the variable labels according to targets and python scripts
> Align the building rules as per Automake for simplification
>
> Fixes building errors during rebuils due to missing dependencies
>
> Fixes: 9a508b7 ("android: anv/extensions: fix generated sources build")
> Fixes: dd088d4bec7 ("anv/extensions: Generate a header file with extension 
> tables")
> Signed-off-by: Mauro Rossi 
> Cc: "19.0" 
> ---
>  src/intel/Android.vulkan.mk | 38 +++--
>  1 file changed, 24 insertions(+), 14 deletions(-)
>
> diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
> index 04c9d5b3e4..2e99ac6294 100644
> --- a/src/intel/Android.vulkan.mk
> +++ b/src/intel/Android.vulkan.mk
> @@ -23,9 +23,10 @@ LOCAL_PATH := $(call my-dir)
>  include $(CLEAR_VARS)
>  include $(LOCAL_PATH)/Makefile.sources
>
> -VK_ENTRYPOINTS_SCRIPT := $(MESA_PYTHON2) 
> $(LOCAL_PATH)/vulkan/anv_entrypoints_gen.py
> -
> -VK_EXTENSIONS_SCRIPT := $(MESA_PYTHON2) 
> $(LOCAL_PATH)/vulkan/anv_extensions_gen.py
> +ANV_ENTRYPOINTS_GEN_SCRIPT := $(LOCAL_PATH)/vulkan/anv_entrypoints_gen.py
> +ANV_EXTENSIONS_GEN_SCRIPT := $(LOCAL_PATH)/vulkan/anv_extensions_gen.py
> +ANV_EXTENSIONS_SCRIPT := $(LOCAL_PATH)/vulkan/anv_extensions.py
> +VULKAN_API_XML := $(MESA_TOP)/src/vulkan/registry/vk.xml
>
>  VULKAN_COMMON_INCLUDES := \
> $(MESA_TOP)/include \
> @@ -64,10 +65,13 @@ $(intermediates)/vulkan/dummy.c:
> @echo "Gen Dummy: $(PRIVATE_MODULE) <= $(notdir $(@))"
> $(hide) touch $@
>
> -$(intermediates)/vulkan/anv_entrypoints.h: $(intermediates)/vulkan/dummy.c
> -   $(VK_ENTRYPOINTS_SCRIPT) \
> +$(intermediates)/vulkan/anv_entrypoints.h: $(intermediates)/vulkan/dummy.c \

I know it was not introduced in this patch.
However, it makes no sense to let the header depend on a generated empty file.
This should be removed.

> +  $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> +  $(ANV_EXTENSIONS_SCRIPT) \
> +  $(VULKAN_API_XML)
> +   $(MESA_PYTHON2) $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> --outdir $(dir $@) \
> -   --xml $(MESA_TOP)/src/vulkan/registry/vk.xml
> +   --xml $(VULKAN_API_XML)
>
>  LOCAL_EXPORT_C_INCLUDE_DIRS := \
>  $(intermediates)
> @@ -241,22 +245,28 @@ LOCAL_GENERATED_SOURCES += 
> $(intermediates)/vulkan/anv_entrypoints.c
>  LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.c
>  LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.h
>
> -$(intermediates)/vulkan/anv_entrypoints.c:
> +$(intermediates)/vulkan/anv_entrypoints.c: $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> +  $(ANV_EXTENSIONS_SCRIPT) \
> +  $(VULKAN_API_XML)
> @mkdir -p $(dir $@)
> -   $(VK_ENTRYPOINTS_SCRIPT) \
> +   $(MESA_PYTHON2) $(ANV_ENTRYPOINTS_GEN_SCRIPT) \
> --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
> --outdir $(dir $@)
>
> -$(intermediates)/vulkan/anv_extensions.c:
> +$(intermediates)/vulkan/anv_extensions.c: $(ANV_EXTENSIONS_GEN_SCRIPT) \
> + $(ANV_EXTENSIONS_SCRIPT) \
> + $(VULKAN_API_XML)
> @mkdir -p $(dir $@)
> -   $(VK_EXTENSIONS_SCRIPT) \
> -   --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
> +   $(MESA_PYTHON2) $(ANV_EXTENSIONS_GEN_SCRIPT) \
> +   --xml $(VULKAN_API_XML) \
> --out-c $@
>
> -$(intermediates)/vulkan/anv_extensions.h:
> +$(intermediates)/vulkan/anv_extensions.h: $(ANV_EXTENSIONS_GEN_SCRIPT) \
> +  $(ANV_EXTENSIONS_SCRIPT) \
> +  $(VULKAN_API_XML)
> @mkdir -p $(dir $@)
> -   $(VK_EXTENSIONS_SCRIPT) \
> -   --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
> +   $(MESA_PYTHON2) $(ANV_EXTENSIONS_GEN_SCRIPT) \
> +   --xml $(VULKAN_API_XML) \
> --out-h $@
>
>  LOCAL_SHARED_LIBRARIES := $(ANV_SHARED_LIBRARIES)
> --


-- 
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

[Mesa-dev] [PATCH] Android: fix a missing nir_intrinsics.h error

2018-05-24 Thread Chih-Wei Huang
The commit 76dfed8ae2d5 changed nir_intrinsics.h to be a generated
header, but the corresponding dependency was not updated for Android.
It causes the error:

[  0% 19/4336] target  C: libmesa_pipe_radeonsi <= 
external/mesa/src/gallium/drivers/radeonsi/si_debug.c
...
In file included from external/mesa/src/gallium/drivers/radeonsi/si_debug.c:25:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:28:
In file included from 
external/mesa/src/gallium/drivers/radeonsi/si_shader.h:140:
In file included from external/mesa/src/amd/common/ac_llvm_build.h:30:
external/mesa/src/compiler/nir/nir.h:966:10: fatal error: 'nir_intrinsics.h' 
file not found
 ^~
1 error generated.

Fixes: 76dfed8ae2d5 ("nir: mako all the intrinsics")
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/compiler/Android.nir.gen.mk | 1 +
 src/gallium/drivers/radeonsi/Android.mk | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/compiler/Android.nir.gen.mk b/src/compiler/Android.nir.gen.mk
index fa0707e..894fb12 100644
--- a/src/compiler/Android.nir.gen.mk
+++ b/src/compiler/Android.nir.gen.mk
@@ -46,6 +46,7 @@ LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
 # Modules using libmesa_nir must set LOCAL_GENERATED_SOURCES to this
 MESA_GEN_NIR_H := $(addprefix $(call local-generated-sources-dir)/, \
nir/nir_opcodes.h \
+   nir/nir_intrinsics.h \
nir/nir_builder_opcodes.h)
 
 nir_builder_opcodes_gen := $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
diff --git a/src/gallium/drivers/radeonsi/Android.mk 
b/src/gallium/drivers/radeonsi/Android.mk
index e72b80c..76309a4 100644
--- a/src/gallium/drivers/radeonsi/Android.mk
+++ b/src/gallium/drivers/radeonsi/Android.mk
@@ -46,6 +46,8 @@ LOCAL_MODULE := libmesa_pipe_radeonsi
 
 intermediates := $(call local-generated-sources-dir)
 
+# We need to get NIR's generated headers.
+LOCAL_GENERATED_SOURCES := $(MESA_GEN_NIR_H)
 LOCAL_GENERATED_SOURCES += $(addprefix 
$(intermediates)/radeonsi/,$(GENERATED_SOURCES))
 
 GEN_DRIINFO_INPUTS := \
-- 
2.9.5

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


Re: [Mesa-dev] [PATCH] egl/android: remove flink name support

2018-04-27 Thread Chih-Wei Huang
2018-04-27 1:34 GMT+08:00 Rob Herring <r...@kernel.org>:
> On Thu, Apr 26, 2018 at 11:56 AM, Emil Velikov <emil.l.veli...@gmail.com> 
> wrote:
>> On 26 April 2018 at 03:30, Chih-Wei Huang <cwhu...@linux.org.tw> wrote:
>>> 2018-04-25 19:55 GMT+08:00 Robert Foss <robert.f...@collabora.com>:
>>>> Hey Emil & Chih-Wei,
>>>>
>>>> On 04/24/2018 01:59 PM, Emil Velikov wrote:
>>>>>
>>>>> On 24 April 2018 at 12:28, Emil Velikov <emil.l.veli...@gmail.com> wrote:
>>>>>
>>>>>> On the topic of keeping the old code behind a #define or just removing
>>>>>> it, it'll be great if interested parties can reach a consensus.
>>>>>>
>>>>> Actually one can simply drop this code and drm_gralloc users can add a
>>>>> drm_ioctl_permit() hack.
>>>>> Namely: loosen the restrictions to consider render nodes identical to
>>>>> primary/card ones.
>>>>>
>>>>> Yes, it's a nasty hack, yet no worse than the existing one that
>>>>> removes the auth :-\
>>>>
>>>> I'm fine with adding a #define.
>>>> Chih-Wei: Do you have any objections?
>>>
>>> "keeping the old code behind a #define"?
>>> Sounds good to me. Thank you!
>>
>> Having a look at the Android-x86 kernel:
>> The current hack in the permission check (see drm_ioctl_permit in [1])
>> effectively threats render nodes and primary nodes as the same thing.
>>
>> Thus, on top of the current patch the !dri2_dpy->is_render_node check
>> should be removed, for Android-x86.
>> There's no need to keep the flink code around ;-)
>
> Except I don't think drm_gralloc fills in a dma-buf fd in it's
> handle... There was an AOSP version that did IIRC.
>
> Or maybe I'm missing something.

IIRC, AOSP's modified drm_gralloc requires drm_hwcomposer.
Then we loop back to the old problem:
drm_hwcomposer doesn't work for most x86 GPUs.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl/android: remove flink name support

2018-04-27 Thread Chih-Wei Huang
2018-04-27 2:19 GMT+08:00 Robert Foss :
>
> I've spent some time today preparing a #ifdef version of what robher
> submitted.
>
> It's fine, but there is no way automatically enable the HAVE_DRM_GRALLOC
> #define through the build tools. So a small simple patch adding the shared
> library dependency, and adding the -DHAVE_DRM_GRALLOC cflag is needed.

I can add BOARD_USES_DRM_GRALLOC=true
(like BOARD_USES_DRM_HWCOMPOSER=true)
in our BoardConfig.mk.
Then you can add these in Android.mk of mesa:

ifeq ($(BOARD_USES_DRM_GRALLOC),true)
LOCAL_CFLAGS += -DHAVE_DRM_GRALLOC
endif


> I'll send it out tomorrow, a bit late in the day for sending out patches now
> ;)

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


Re: [Mesa-dev] [PATCH] egl/android: remove flink name support

2018-04-26 Thread Chih-Wei Huang
2018-04-25 19:55 GMT+08:00 Robert Foss :
> Hey Emil & Chih-Wei,
>
> On 04/24/2018 01:59 PM, Emil Velikov wrote:
>>
>> On 24 April 2018 at 12:28, Emil Velikov  wrote:
>>
>>> On the topic of keeping the old code behind a #define or just removing
>>> it, it'll be great if interested parties can reach a consensus.
>>>
>> Actually one can simply drop this code and drm_gralloc users can add a
>> drm_ioctl_permit() hack.
>> Namely: loosen the restrictions to consider render nodes identical to
>> primary/card ones.
>>
>> Yes, it's a nasty hack, yet no worse than the existing one that
>> removes the auth :-\
>
> I'm fine with adding a #define.
> Chih-Wei: Do you have any objections?

"keeping the old code behind a #define"?
Sounds good to me. Thank you!
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl/android: remove flink name support

2018-04-22 Thread Chih-Wei Huang
What's the impact to drm_gralloc?


2018-04-20 5:09 GMT+08:00 Rob Herring :
> Maintaining both flink names and prime fd support which are provided by
> 2 different gralloc implementations is problematic because we have a
> dependency on a specific gralloc implementation header.
>
> This mostly removes the dependency on the gralloc implementation and
> headers. The dependency on GRALLOC_MODULE_PERFORM_GET_DRM_FD remains for
> now, but the definition is added locally to remove the header
> dependency.
>
> Signed-off-by: Rob Herring 
> ---
> With this plus Robert's probing patch, we remove any gralloc
> implementation dependency (other than it has to be a pre 1.0
> implementation...).
>
>  src/egl/drivers/dri2/egl_dri2.h |   1 -
>  src/egl/drivers/dri2/platform_android.c | 172 
> 
>  2 files changed, 17 insertions(+), 156 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
> index cc76c73eab2f..d9e1f466fbeb 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -61,7 +61,6 @@ struct zwp_linux_dmabuf_v1;
>
>  #include 
>  #include 
> -#include 
>
>  #endif /* HAVE_ANDROID_PLATFORM */
>
> diff --git a/src/egl/drivers/dri2/platform_android.c 
> b/src/egl/drivers/dri2/platform_android.c
> index 4f25cb746915..68c85d7f99fa 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -37,7 +37,6 @@
>  #include "loader.h"
>  #include "egl_dri2.h"
>  #include "egl_dri2_fallbacks.h"
> -#include "gralloc_drm.h"
>
>  #define ALIGN(val, align)  (((val) + (align) - 1) & ~((align) - 1))
>
> @@ -164,12 +163,6 @@ get_native_buffer_fd(struct ANativeWindowBuffer *buf)
> return (handle && handle->numFds) ? handle->data[0] : -1;
>  }
>
> -static int
> -get_native_buffer_name(struct ANativeWindowBuffer *buf)
> -{
> -   return gralloc_drm_get_gem_handle(buf->handle);
> -}
> -
>  static EGLBoolean
>  droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf)
>  {
> @@ -822,50 +815,6 @@ droid_create_image_from_prime_fd(_EGLDisplay *disp, 
> _EGLContext *ctx,
> return dri2_create_image_dma_buf(disp, ctx, NULL, attr_list);
>  }
>
> -static _EGLImage *
> -droid_create_image_from_name(_EGLDisplay *disp, _EGLContext *ctx,
> - struct ANativeWindowBuffer *buf)
> -{
> -   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> -   struct dri2_egl_image *dri2_img;
> -   int name;
> -   int format;
> -
> -   name = get_native_buffer_name(buf);
> -   if (!name) {
> -  _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
> -  return NULL;
> -   }
> -
> -   format = get_format(buf->format);
> -   if (format == -1)
> -   return NULL;
> -
> -   dri2_img = calloc(1, sizeof(*dri2_img));
> -   if (!dri2_img) {
> -  _eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm");
> -  return NULL;
> -   }
> -
> -   _eglInitImage(_img->base, disp);
> -
> -   dri2_img->dri_image =
> -  dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
> -  buf->width,
> -  buf->height,
> -  format,
> -  name,
> -  buf->stride,
> -  dri2_img);
> -   if (!dri2_img->dri_image) {
> -  free(dri2_img);
> -  _eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm");
> -  return NULL;
> -   }
> -
> -   return _img->base;
> -}
> -
>  static EGLBoolean
>  droid_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
>  EGLint attribute, EGLint *value)
> @@ -921,7 +870,7 @@ dri2_create_image_android_native_buffer(_EGLDisplay *disp,
> if (fd >= 0)
>return droid_create_image_from_prime_fd(disp, ctx, buf, fd);
>
> -   return droid_create_image_from_name(disp, ctx, buf);
> +   return NULL;
>  }
>
>  static _EGLImage *
> @@ -943,82 +892,6 @@ droid_flush_front_buffer(__DRIdrawable * driDrawable, 
> void *loaderPrivate)
>  {
>  }
>
> -static int
> -droid_get_buffers_parse_attachments(struct dri2_egl_surface *dri2_surf,
> -unsigned int *attachments, int count)
> -{
> -   int num_buffers = 0;
> -
> -   /* fill dri2_surf->buffers */
> -   for (int i = 0; i < count * 2; i += 2) {
> -  __DRIbuffer *buf, *local;
> -
> -  assert(num_buffers < ARRAY_SIZE(dri2_surf->buffers));
> -  buf = _surf->buffers[num_buffers];
> -
> -  switch (attachments[i]) {
> -  case __DRI_BUFFER_BACK_LEFT:
> - if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
> -buf->attachment = attachments[i];
> -buf->name = get_native_buffer_name(dri2_surf->buffer);
> -buf->cpp = get_format_bpp(dri2_surf->buffer->format);
> -buf->pitch = dri2_surf->buffer->stride * 

Re: [Mesa-dev] [PATCH v1 0/7] Implement commont gralloc_handle_t in libdrm

2018-03-26 Thread Chih-Wei Huang
2018-03-22 16:23 GMT+08:00 Tomasz Figa <tf...@chromium.org>:
> Hi Chih-Wei,
>
> On Thu, Feb 22, 2018 at 2:53 PM, Chih-Wei Huang <cwhu...@linux.org.tw> wrote:
>> 2018-02-21 3:03 GMT+08:00 Rob Herring <r...@kernel.org>:
>>>
>>> Perhaps worth revisiting. Given we've failed to progress at all since
>>> then may change opinions some. We already have to handle multiple
>>> opens share the same pipe_screen, so I don't think reusing the fd buys
>>> us anything.
>>>
>>> Maybe we're close to the point of removing the flink name support too.
>>> The android-x86 folks have been working to get dma-bufs working.
>>> Chih-Wei, any comments on this?
>>
>> Ah! Sorry. I didn't catch or understand the details.
>> Did you mean the attempts to use drm_hwcomposer
>> in android-x86?
>> My understanding so far is most x86 GPUs won't work
>> except some very limited models.
>> It's due to kernel driver issues which may never be solved.
>> So we can't drop the flink name support.
>> Please correct me if I am wrong.
>
> Could you elaborate a bit more on those GPUs that won't work and
> corresponding driver issues? We're running cros_gralloc on Intel and
> AMD GPUs, with DMA-buf and render-node only setup and we haven't seen
> any problems.

Hi Tomasz,
I remember (in our previous discussion) you said
CrOS uses your own hwcomposer (proprietary?) so
the story may be different.

What we have tried is gbm_gralloc + drm_hwcomposer
and I reported the issues here:
https://lists.freedesktop.org/archives/dri-devel/2017-September/153580.html

Sorry I didn't make more tests recently.
I CC Mauro to comment. He should have made more tests
with newer kernel and mesa.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v1 0/7] Implement commont gralloc_handle_t in libdrm

2018-02-22 Thread Chih-Wei Huang
2018-02-21 3:03 GMT+08:00 Rob Herring :
>
> Perhaps worth revisiting. Given we've failed to progress at all since
> then may change opinions some. We already have to handle multiple
> opens share the same pipe_screen, so I don't think reusing the fd buys
> us anything.
>
> Maybe we're close to the point of removing the flink name support too.
> The android-x86 folks have been working to get dma-bufs working.
> Chih-Wei, any comments on this?

Ah! Sorry. I didn't catch or understand the details.
Did you mean the attempts to use drm_hwcomposer
in android-x86?
My understanding so far is most x86 GPUs won't work
except some very limited models.
It's due to kernel driver issues which may never be solved.
So we can't drop the flink name support.
Please correct me if I am wrong.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] Android: update CleanSpec.mk

2017-11-06 Thread Chih-Wei Huang
2017-11-03 19:02 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:
> On 11/03/2017 12:30 PM, Chih-Wei Huang wrote:
>> 2017-11-03 15:47 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:
>>> Hi Chih-Wei;
>>> This looks good to me. Only thing that causes a bit of headache is ...
>>> what
>>> is the difference between PRODUCT_OUT, OUT_DIR and TARGET_OUT?
>>
>> OUT_DIR is also set to "out" if it's not already set.
>>
>> PRODUCT_OUT is where all target files go.
>> (i.e., out/target/product/$device/)
>>
>> TARGET_OUT is $PRODUCT_OUT/system
>>
>> Please see the definitions in build/core/envsetup.mk.
>
> OK, thanks. I'm not sure if TARGET_OUT is correct then, at least on
> Android-IA these vendor files are under:
>
> out/target/product/$device/vendor/lib
>
> so, not under 'system'.

Yes. This patch is used to remove old files under 'system'.
Otherwise the image may contain duplicate libraries
that causes unexpected problems.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] Android: update CleanSpec.mk

2017-11-03 Thread Chih-Wei Huang
2017-11-03 15:47 GMT+08:00 Tapani Pälli :
> Hi Chih-Wei;
>
> This looks good to me. Only thing that causes a bit of headache is ... what
> is the difference between PRODUCT_OUT, OUT_DIR and TARGET_OUT?

OUT_DIR is also set to "out" if it's not already set.

PRODUCT_OUT is where all target files go.
(i.e., out/target/product/$device/)

TARGET_OUT is $PRODUCT_OUT/system

Please see the definitions in build/core/envsetup.mk.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] Android: update CleanSpec.mk

2017-11-03 Thread Chih-Wei Huang
The libraries are moved to /vendor since commit c3f75d48.
Clean all old files for incremental builds.

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 CleanSpec.mk | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/CleanSpec.mk b/CleanSpec.mk
index d08b0def7d..eca3845354 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -14,3 +14,10 @@ $(call add-clean-step, rm -rf 
$(HOST_OUT_release)/*/EXECUTABLES/mesa_*_intermedi
 $(call add-clean-step, rm -rf 
$(HOST_OUT_release)/*/EXECUTABLES/glsl_compiler_intermediates)
 $(call add-clean-step, rm -rf 
$(HOST_OUT_release)/*/STATIC_LIBRARIES/libmesa_*_intermediates)
 $(call add-clean-step, rm -rf 
$(PRODUCT_OUT)/*/SHARED_LIBRARIES/*_dri_intermediates)
+
+# Move libraries to /vendor
+$(call add-clean-step, rm -f $(TARGET_OUT)/lib*/dri/*)
+$(call add-clean-step, rm -f $(TARGET_OUT)/lib*/libgbm.so)
+$(call add-clean-step, rm -f $(TARGET_OUT)/lib*/libglapi.so)
+$(call add-clean-step, rm -f $(TARGET_OUT)/lib*/libvulkan_intel.so)
+$(call add-clean-step, rm -f $(TARGET_OUT)/lib*/egl/libGLES_mesa.so)
-- 
2.13.6

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


[Mesa-dev] [PATCH] Android: fix undeclared identifier 'gfx9d_reg_table'

2017-09-09 Thread Chih-Wei Huang
Since commit 552aaa11 the compiler complains:

external/mesa/src/amd/common/ac_debug.c:124:51: error: use of undeclared 
identifier 'gfx9d_reg_table'; did you mean 'sid_reg_table'?
reg = find_register(gfx9d_reg_table, 
ARRAY_SIZE(gfx9d_reg_table), offset);
^~~
sid_reg_table

It's because the commit ef97cc0c ("radeonsi/gfx9: add IB parser support")
add gfx9d.h as a recipe of sid_tables.h. But the corresponding Android.mk
was not updated. However, it's not spotted since gfx9d_reg_table is not
really used until commit 552aaa11 was landed.

Fixes: 552aaa11 (ac/debug: take ASIC generation into account when printing 
registers)

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/amd/Android.common.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/Android.common.mk b/src/amd/Android.common.mk
index 4e2d0f9..4ef7f17 100644
--- a/src/amd/Android.common.mk
+++ b/src/amd/Android.common.mk
@@ -44,7 +44,7 @@ LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, 
$(AMD_GENERATED_FILES)
 $(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
 $(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ > $@
 
-$(intermediates)/common/sid_tables.h: $(LOCAL_PATH)/common/sid_tables.py 
$(MESA_TOP)/src/amd/common/sid.h
+$(intermediates)/common/sid_tables.h: $(LOCAL_PATH)/common/sid_tables.py 
$(LOCAL_PATH)/common/sid.h $(LOCAL_PATH)/common/gfx9d.h
$(transform-generated-source)
 
 LOCAL_C_INCLUDES := \
-- 
1.9.1

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


[Mesa-dev] [PATCH] Android: fix radeonsi building errors on Android O

2017-09-05 Thread Chih-Wei Huang
The radeonsi driver fails in the error:

[  5% 200/3583] target  C++: libmesa_amd_common_32 <= 
external/mesa/src/amd/common/ac_llvm_helper.cpp
In file included from external/mesa/src/amd/common/ac_llvm_helper.cpp:35:
In file included from 
external/llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:22:
In file included from external/llvm/include/llvm/IR/Module.h:21:
In file included from external/llvm/include/llvm/IR/Function.h:22:
In file included from external/llvm/include/llvm/IR/Argument.h:19:
external/llvm/include/llvm/IR/Attributes.h:71:14: fatal error: 
'llvm/IR/Attributes.inc' file not found
#include "llvm/IR/Attributes.inc"
 ^~~~
1 error generated.

The reason is llvm-headers is still necessary to build radeonsi driver.
However, it's accidentally(?) removed in commit 4734bfc0.

Fixes: 4734bfc0 ("Android: Fix LLVM duplicated symbols linking for N and M")

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 Android.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Android.mk b/Android.mk
index e03eb71..4ab6725 100644
--- a/Android.mk
+++ b/Android.mk
@@ -96,6 +96,7 @@ define mesa-build-with-llvm
   $(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
 $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0)) \
   $(if $(filter 8,$(MESA_ANDROID_MAJOR_VERSION)), \
+$(eval LOCAL_HEADER_LIBRARIES += llvm-headers) \
 $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
   $(eval LOCAL_SHARED_LIBRARIES += libLLVM)
 endef
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] ac/debug: use util_strchrnul() to fix android build error

2017-08-25 Thread Chih-Wei Huang
2017-08-25 5:52 GMT+08:00 Mauro Rossi :
> Similar to e09d04cd56 "radeonsi: use util_strchrnul() to fix android build 
> error"
>
> Android Bionic does not support strchrnul() string function,

This is not entirely true.
Bionic has strchrnul() since Android 7.0.
But I think it's OK to merge this one.
We can address Android 7.0 in another patch.

> gallium auxiliary util/u_string.h provides util_strchrnul()
>
> This change avoids the following warning and error:
>
> external/mesa/src/amd/common/ac_debug.c:501:15: warning: implicit declaration 
> of function 'strchrnul' is invalid in C99
> char *end = strchrnul(out, '\n');
> ^
> external/mesa/src/amd/common/ac_debug.c:501:9: error: incompatible integer to 
> pointer conversion initializing 'char *' with an expression of type 'int'
> char *end = strchrnul(out, '\n');
>   ^ 
> 1 warning and 1 error generated.
>
> Fixes: c2c3912410 "ac/debug: annotate IB dumps with the raw values"
> ---
>  src/amd/common/ac_debug.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c
> index 2af83a146c..3daa556f5d 100644
> --- a/src/amd/common/ac_debug.c
> +++ b/src/amd/common/ac_debug.c
> @@ -39,6 +39,7 @@
>  #include "sid_tables.h"
>  #include "util/u_math.h"
>  #include "util/u_memory.h"
> +#include "util/u_string.h"
>
>  /* Parsed IBs are difficult to read without colors. Use "less -R file" to
>   * read them, or use "aha -b -f file" to convert them to html.
> @@ -498,7 +499,7 @@ static void format_ib_output(FILE *f, char *out)
> if (indent)
> print_spaces(f, indent);
>
> -   char *end = strchrnul(out, '\n');
> +   char *end = util_strchrnul(out, '\n');
> fwrite(out, end - out, 1, f);
> fputc('\n', f); /* always end with a new line */
> if (!*end)
> --


-- 
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 mesa] egl/android: add missing include

2017-08-25 Thread Chih-Wei Huang
2017-08-24 22:22 GMT+08:00 Eric Engestrom :
> Cc: Rob Herring 
> Signed-off-by: Eric Engestrom 
> ---
> This needs to land before [1], otherwise the latter will break android.
>
> [1] https://lists.freedesktop.org/archives/mesa-dev/2017-August/167428.html
>
>  src/egl/drivers/dri2/platform_android.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/egl/drivers/dri2/platform_android.c 
> b/src/egl/drivers/dri2/platform_android.c
> index a864a2af3d..36fc5833b4 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -27,6 +27,7 @@
>   * DEALINGS IN THE SOFTWARE.
>   */
>
> +#include 
>  #include 
>  #include 
>  #include 
> --

NACK.
This breaks Android O sinlce
the include path was changed.

external/mesa/src/egl/drivers/dri2/platform_android.c:30:10: fatal
error: 'android/native_window.h' file not found
#include 
 ^
1 error generated.


Actually Android O builds with [1] perfectly
without this one.

Not tested in pre-O.
We (android-x86) have no plan to use
the master branch with pre-O.


-- 
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 2/2] Android: EGL: fix missing nativewindow.h include on O

2017-08-24 Thread Chih-Wei Huang
2017-08-24 22:02 GMT+08:00 Rob Herring <r...@kernel.org>:
> On Thu, Aug 24, 2017 at 4:08 AM, Chih-Wei Huang <cwhu...@android-x86.org> 
> wrote:
>> 2017-08-24 1:25 GMT+08:00 Rob Herring <r...@kernel.org>:
>>
>> I'm also trying to fix it.
>> Seems it only requires the headers instead
>> of the shared library. Adding libnativewindow to
>> LOCAL_SHARED_LIBRARIES would add the
>> unnecessary dependency to libGLES_mesa.so.
>
> Then the correct way to do this is LOCAL_HEADER_LIBRARIES instead.

Right. Unfortunately these two libs don't define
cc_library_headers in their Android.bp
so we can't use it.

>> Locally I fixed it in this way:
>>
>> diff --git a/src/egl/Android.mk b/src/egl/Android.mk
>> index 4ccbb9b..9e96aca 100644
>> --- a/src/egl/Android.mk
>> +++ b/src/egl/Android.mk
>> @@ -43,6 +43,8 @@ LOCAL_CFLAGS := \
>> -D_EGL_BUILT_IN_DRIVER_DRI2
>>
>>  LOCAL_C_INCLUDES := \
>> +   frameworks/native/libs/arect/include \
>> +   frameworks/native/libs/nativewindow/include \
>
> Doing external includes this way is exactly what we don't want to do.
> There's a defined way to do cross project headers.

Agree.
But better than add extra unnecessary dependency IMO.

Fortunately we have a much better solution
as suggested by Emil.
I just tested it and it works as expected.
Since it only needs the name ANativeWindow,
forward declaration fits the purpose perfectly.


-- 
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 2/2] Android: EGL: fix missing nativewindow.h include on O

2017-08-24 Thread Chih-Wei Huang
2017-08-24 1:25 GMT+08:00 Rob Herring :
> The build against AOSP master and O is broken:
>
> external/mesa3d/include/EGL/eglplatform.h:100:10: fatal error: 
> 'android/native_window.h' file not found
>
> native_window.h has moved and is now part of libnativewindow library, so
> add this dependency.
>
> Signed-off-by: Rob Herring 
> ---
>  src/egl/Android.mk | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/egl/Android.mk b/src/egl/Android.mk
> index 00553226773e..3852deb4364c 100644
> --- a/src/egl/Android.mk
> +++ b/src/egl/Android.mk
> @@ -58,6 +58,10 @@ LOCAL_SHARED_LIBRARIES := \
> libgralloc_drm \
> libsync
>
> +ifeq ($(filter $(MESA_ANDROID_MAJOR_VERSION),5 6 7),)
> +LOCAL_SHARED_LIBRARIES += libnativewindow
> +endif

I'm also trying to fix it.
Seems it only requires the headers instead
of the shared library. Adding libnativewindow to
LOCAL_SHARED_LIBRARIES would add the
unnecessary dependency to libGLES_mesa.so.

Locally I fixed it in this way:

diff --git a/src/egl/Android.mk b/src/egl/Android.mk
index 4ccbb9b..9e96aca 100644
--- a/src/egl/Android.mk
+++ b/src/egl/Android.mk
@@ -43,6 +43,8 @@ LOCAL_CFLAGS := \
-D_EGL_BUILT_IN_DRIVER_DRI2

 LOCAL_C_INCLUDES := \
+   frameworks/native/libs/arect/include \
+   frameworks/native/libs/nativewindow/include \
$(MESA_TOP)/src/egl/main \
$(MESA_TOP)/src/egl/drivers/dri2 \
$(MESA_TOP)/src/gallium/include


>  # This controls enabling building of driver libraries
>  ifneq ($(HAVE_I915_DRI),)
>  LOCAL_REQUIRED_MODULES += i915_dri
> --



-- 
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 1/2] Android: fix Android O version check for LLVM

2017-08-24 Thread Chih-Wei Huang
2017-08-24 1:25 GMT+08:00 Rob Herring <r...@kernel.org>:
> With the release of O, the MESA_ANDROID_MAJOR_VERSION has changed to 8.
> Change the LLVM check to match. There's no point to continue to support 'O'
> as no one is going to use an old AOSP master.
>
> Presumably, we'll be back here again to fix things again for P (or 9).
>
> Signed-off-by: Rob Herring <r...@kernel.org>
> ---
>  Android.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Android.mk b/Android.mk
> index 1fcde5f4d7fb..1fb584dd5eb0 100644
> --- a/Android.mk
> +++ b/Android.mk
> @@ -96,7 +96,7 @@ define mesa-build-with-llvm
>  $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_PATCH=0)) \
>$(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
>  $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0)) \
> -  $(if $(filter O,$(MESA_ANDROID_MAJOR_VERSION)), \
> +  $(if $(filter 8,$(MESA_ANDROID_MAJOR_VERSION)), \
>  $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
>$(eval LOCAL_SHARED_LIBRARIES += libLLVM)
>  endef
> --

Looks good to me.

Reviewed-by: Chih-Wei Huang <cwhu...@linux.org.tw>

-- 
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: Fix LLVM duplicated symbols linking for N and M

2017-08-18 Thread Chih-Wei Huang
2017-08-19 8:27 GMT+08:00 Emil Velikov :
> On 18 August 2017 at 20:46, Rob Herring  wrote:
>> Both statically linking libLLVMCore and dynamically linking libLLVM causes
>> duplicated symbols in gallium_dri.so and it fails to dlopen. We don't
>> really need to link libLLVMCore, but just need generated headers to be
>> built first. Dynamically linking to libLLVM instead is enough to do
>> that. Thanks to Qiang Yu for finding the root cause.
>>
> Nice find indeed, thanks.
>
> This reminds me - a small task for a rainy day.
> - Wire the version script files into the Android build - see the
> autoconf snippet below.
> It will hide the hundreds of symbols when static linking LLVM (aka
> sidestep the current issue) and make the binary noticeably smaller.
>
> gallium_dri_la_LDFLAGS += \
>-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri/dri.sym
>
>> With this change, we can align all versions and just have libLLVM as a
>> shared lib dependency.
>>
>> This also requires changes in the M and N versions of LLVM to export the
>> include paths for libLLVM. AOSP master is okay.
>>
> Perfect :-)
>
>> Fixes: 26aee6f4d5a ("Android: rework LLVM build support")
>> Reported-by: Mauro Rossi 
>> Cc: Emil Velikov 
>> Cc: 17.2 
>> Signed-off-by: Qiang Yu 
>> Signed-off-by: Rob Herring 
>
> Reviewed-by: Emil Velikov 
>
>> ---
>>  Android.mk  | 12 
>>  src/amd/Android.common.mk   |  4 +---
>>  src/gallium/drivers/radeon/Android.mk   |  2 +-
>>  src/gallium/drivers/radeonsi/Android.mk |  2 +-
>>  4 files changed, 7 insertions(+), 13 deletions(-)
>>
>> diff --git a/Android.mk b/Android.mk
>> index 6571161c8783..dc4041364551 100644
>> --- a/Android.mk
>> +++ b/Android.mk
>> @@ -92,16 +92,12 @@ define mesa-build-with-llvm
>>$(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5), \
>>  $(warning Unsupported LLVM version in Android 
>> $(MESA_ANDROID_MAJOR_VERSION)),) \
>>$(if $(filter 6,$(MESA_ANDROID_MAJOR_VERSION)), \
>> -$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_PATCH=0) \
>> -$(eval LOCAL_STATIC_LIBRARIES += libLLVMCore) \
>> -$(eval LOCAL_C_INCLUDES += external/llvm/include 
>> external/llvm/device/include),) \
>> +$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 
>> -DMESA_LLVM_VERSION_PATCH=0),) \

Hmm, why do we need an extra comma?
Does it correspond to the else case of $(if ...)?
If so it could be omitted.

>>$(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
>> -$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0) \
>> -$(eval LOCAL_STATIC_LIBRARIES += libLLVMCore) \
>> -$(eval LOCAL_C_INCLUDES += external/llvm/include 
>> external/llvm/device/include),) \
>> +$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 
>> -DMESA_LLVM_VERSION_PATCH=0),) \
>>$(if $(filter O,$(MESA_ANDROID_MAJOR_VERSION)), \
>> -$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0) \
>> -$(eval LOCAL_HEADER_LIBRARIES += llvm-headers),)
>> +$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 
>> -DMESA_LLVM_VERSION_PATCH=0),) \
>> +  $(eval LOCAL_SHARED_LIBRARIES += libLLVM)
> Am I the only person getting tad confused by amount of brackets?
> As mentioned by Chih-Wei - a shell switch is not possible, but how
> about a test vague like the following?
>
> test "x$(MESA_ANDROID_MAJOR_VERSION)" = "xO" &&
>$(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)

Only possible if you put it into $(shell ...)
That gives me an idea. Maybe we ca do like

$(shell case "$(MESA_ANDROID_MAJOR_VERSION)" in \
6) echo ... ;; \
7) echo ... ;; \
*)  echo ... ;; \
esac)

I haven't really try it yet.

-- 
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: export intermediates from libmesa_util

2017-08-01 Thread Chih-Wei Huang
2017-08-01 19:23 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:
> Fixes following build issues:
>
>In file included from 
> vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/common/dri_util.c:45:
>vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal 
> error: 'xmlpool/options.h' file not found
>...
>In file included from 
> vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/i965/intel_screen.c:44:
>vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal 
> error: 'xmlpool/options.h' file not found
>
> Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
> ---
>  src/mesa/drivers/dri/common/Android.mk | 2 ++
>  src/util/Android.mk| 3 +++
>  2 files changed, 5 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/common/Android.mk 
> b/src/mesa/drivers/dri/common/Android.mk
> index 573189d..f15a3b9 100644
> --- a/src/mesa/drivers/dri/common/Android.mk
> +++ b/src/mesa/drivers/dri/common/Android.mk
> @@ -46,6 +46,8 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
>  LOCAL_SRC_FILES := \
> $(DRI_COMMON_FILES)
>
> +LOCAL_STATIC_LIBRARIES := libmesa_util
> +
>  include $(MESA_COMMON_MK)
>  include $(BUILD_STATIC_LIBRARY)
>
> diff --git a/src/util/Android.mk b/src/util/Android.mk
> index ecf3eb7..7e54ae7 100644
> --- a/src/util/Android.mk
> +++ b/src/util/Android.mk
> @@ -51,6 +51,9 @@ LOCAL_MODULE := libmesa_util
>  LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>
>  intermediates := $(call local-generated-sources-dir)
> +
> +LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
> +
>  UTIL_GENERATED_SOURCES := $(addprefix 
> $(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
>  LOCAL_GENERATED_SOURCES := $(UTIL_GENERATED_SOURCES)
>
> --

Looks good to me.

I suggest to add this to commit message

Fixes: 601093f9 (xmlconfig: move into src/util)
(yes, I believe it causes the issue)

Review-by: Chih-Wei Huang <cwhu...@linux.org.tw>


-- 
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: add libmesa_util include path to MESA_DRI_C_INCLUDES

2017-08-01 Thread Chih-Wei Huang
2017-08-01 15:51 GMT+08:00 Tapani Pälli :
> It is required by libmesa_dri_common and i965_dri modules which both
> already use MESA_DRI_C_INCLUDES. Fixes following build errors:
>
> In file included from 
> vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/common/dri_util.c:45:
> vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
> 'xmlpool/options.h' file not found
> ---
> In file included from 
> vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/i965/intel_screen.c:44:
> vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
> 'xmlpool/options.h' file not found

What commit caused the errors?

> Signed-off-by: Tapani Pälli 
> ---
>  src/mesa/drivers/dri/Android.mk | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
> index 53ff4b4..9314479 100644
> --- a/src/mesa/drivers/dri/Android.mk
> +++ b/src/mesa/drivers/dri/Android.mk
> @@ -33,6 +33,7 @@ MESA_DRI_CFLAGS := \
>
>  MESA_DRI_C_INCLUDES := \
> $(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
> +   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_util,,) \

It would be better to export the include path
from libmesa_util.

> $(MESA_TOP)/src/gallium/include \
> $(MESA_TOP)/src/gallium/auxiliary \
> external/expat/lib
> --

-- 
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 v2] st/dri: add 32-bit RGBX/RGBA formats

2017-07-31 Thread Chih-Wei Huang
2017-08-01 0:18 GMT+08:00 Rob Herring <r...@kernel.org>:
> On Fri, Jul 28, 2017 at 6:06 AM, Chih-Wei Huang <cwhu...@android-x86.org> 
> wrote:
>> Hi Rob,
>> I'm testing this patch on an AMD radeon chip (PALM) now.
>> I use our legacy drm_gralloc since the radeon driver
>> doesn't support atomic api required by drm_hwcomposer.
>>
>> On SurfaceFlinger started, the screen just messed up.
>
> In what way? Swapped red and blue?

No. Just garbage pictures.
(I should take a picture but I'm unable to do it now)

>> If reverting this patch, it becomes normal as before.



-- 
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 v2] st/dri: add 32-bit RGBX/RGBA formats

2017-07-30 Thread Chih-Wei Huang
Hi Rob,
Sorry to bother you again.
This patch also breaks the srwast/llvmpipe on Android
since the red and blue are just swapped.
I guess nouveau has the same issue but
I'm waiting Mauro's confirmation.

Any comment?

-- 
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 v2] st/dri: add 32-bit RGBX/RGBA formats

2017-07-30 Thread Chih-Wei Huang
2017-07-28 22:59 GMT+08:00 Marek Olšák :
> Hi,
>
> I've sent a request to revert this commit in 17.2. I'll keep it in
> master, but I'll add a fix not to expose the new formats for GLX.

I thought it doesn't break GLX according to
the commit message (investigation by Chad Versace).
Isn't it correct?

The issues I reported are all for Android.
Sorry if I didn't make it clear enough.

We still hope to use this patch to support
RGBA_ on Android since it gives
better app compatibility.
I guess some drivers (radeon/amdgpu/nouveau/swrast?)
need to be fixed to support RGBA_ better.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] st/dri: add 32-bit RGBX/RGBA formats

2017-07-28 Thread Chih-Wei Huang
Hi Rob,
I'm testing this patch on an AMD radeon chip (PALM) now.
I use our legacy drm_gralloc since the radeon driver
doesn't support atomic api required by drm_hwcomposer.

On SurfaceFlinger started, the screen just messed up.
If reverting this patch, it becomes normal as before.

Does the radeon driver need more patches to
support RGBA_ / RGBX_?
Any idea?


-- 
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 v2] st/dri: add 32-bit RGBX/RGBA formats

2017-07-28 Thread Chih-Wei Huang
2017-07-26 23:34 GMT+08:00 Rob Herring <r...@kernel.org>:
> On Tue, Jul 25, 2017 at 10:16 PM, Chih-Wei Huang
> <cwhu...@android-x86.org> wrote:
>> 2017-07-26 1:24 GMT+08:00 Rob Herring <r...@kernel.org>:
>>>
>>> I double checked and I get 8-8-8-8. I'm have HWC2 enabled and
>>> SurfaceFlinger is unpatched master branch.
>>
>> Hmm, strange.
>> Which hwcomposer branch did you use and
>> what GPU did you test?
>
> The hwc2 branch with virgl. There's also some kernel changes with
> fence support for virgl needed[1].

Oh, I didn't notice the hwc2 branch. I still follow your wiki
https://github.com/robherring/generic_device/wiki/Building
which points to the android-m branch. (which is HWC1)

What kernel changes? (did you forget to list the link?)

>> As I explained to you (in another private email),
>> I'm testing QEMU x86 virgl with your branches:
>>
>> http://github.com/robherring/gbm_gralloc  (master branch)
>> http://github.com/robherring/drm_hwcomposer (android-m branch)
>>
>> If I understand your code correctly, it supports
>> only HWC1, no HWC2 yet.
>> I accidentally set HWC2=true in the first time testing
>> but it didn't work. Setting HWC2=false works.
>> (on the other hand, the chromium upstream[1] does
>> switch to HWC2 now, but I can't make it work yet)
>
> Upstream does not yet support HWC2. The patches for support are under
> review on Gerrit.

I saw they have switched to HWC2, say
https://chromium.googlesource.com/chromiumos/drm_hwcomposer/+/ac8741504befec1d8aa2067a6eb5c2088bc84160
https://chromium.googlesource.com/chromiumos/drm_hwcomposer/+/ed2ec4b0b3dc739fc0fd3427b2b740cc0de3

Maybe it's not complete so not work for me?
(or I missed kernel patches?)

> But I don't think this is a HWC1 vs. HWC2 issue. The EGL config code
> is the same.
>
>> About the client (SurfaceFlinger), I believe it requests
>> HAL_PIXEL_FORMAT_RGBA_ but finally
>> HAL_PIXEL_FORMAT_RGBX_ is used.
>
> Actually, by default it does not request a specific format.
>
>> The logic I saw is:
>> 1. In SurfaceFlinger::init(), it calls RenderEngine::create() with
>> hwcFormat=HAL_PIXEL_FORMAT_RGBA_
>>(if HWC2 is used or if HWC1 api ver >= 1.1)
>> 2. RenderEngine::create() calls RenderEngine::chooseEglConfig()
>>with format=HAL_PIXEL_FORMAT_RGBA_
>> 3. chooseEglConfig() tries to find a config and prints
>>the info as we see in the logcat. With this patch,
>>the selected config is 8-8-8-0.
>
> This first ignores the format and requests a config with all component
> sizes equal to 8. If that fails, it falls back to the requested
> format. If it falls back, you should see some messages about that.

OK. Yes.

>> 4. RenderEngine::create() saves the config to mEGLConfig
>>by engine->setEGLHandles()
>> 5. Later, new DisplayDevice::DisplayDevice() is called with
>>with the selected config (mRenderEngine->getEGLConfig()).
>>Then it calls eglCreateWindowSurface() with the config.
>> 6. eglCreateWindowSurface() checks[2] the alpha attrib
>>of this config to decide which format to be used.
>>With this patch, alpha=0 so HAL_PIXEL_FORMAT_RGBX_
>>is used. (if alpha > 0, HAL_PIXEL_FORMAT_RGBA_ is used)
>>
>> The differences between you and me maybe:
>> * AOSP: master vs 7.1.2
>> * Mesa: master(?) vs 17.1.5
>> * GPU: ?? vs virgl
>>
>> I think AOSP doesn't matter. I don't see explicit change
>> of the above logic in the master branch.
>
> I looked and don't see a change either.

I finally found the AOSP version does matter
since this commit is in master but not in 7.1.2:

https://android.googlesource.com/platform/frameworks/native/+/e7f39727a484107b2d2a78ecad3d7f44c24d%5E%21/#F0

By picking it to 7.1.2, now I got 8-8-8-8 in virgl.
Thanks!

>> Does Mesa version matter? May I need more patches in 17.1.5?
>
> I don't think so. I've carried the patch for some time. The main
> change was just the config ordering.
>
>> About GPU, did you test virgl and still see 8-8-8-8?
>>
>> About the problem of the change, it's not explicitly.
>> But some apps require RGBA_ still can't work.
>> An example is the screen capture apps like Screenshot touch[3].
>
> Let me try that one.

With the RenderEngine's patch the app works now.
Great!


>> It complains the producer output format is RGBX_
>> but RGBA_ is expected:


-- 
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 v2] st/dri: add 32-bit RGBX/RGBA formats

2017-07-25 Thread Chih-Wei Huang
2017-07-26 1:24 GMT+08:00 Rob Herring <r...@kernel.org>:
> On Tue, Jul 25, 2017 at 10:15 AM, Emil Velikov <emil.l.veli...@gmail.com> 
> wrote:
>> On 25 July 2017 at 03:46, Chih-Wei Huang <cwhu...@android-x86.org> wrote:
>>> On Tue 11 Jul 2017, Rob Herring wrote:
>>>>> From: Marek Olšák <marek.ol...@amd.com>
>>>>>
>>>>> Add support for 32-bit RGBX/RGBA formats which are required for Android.
>>>>>
>>>>> The original patch (commit ccdcf91104a5) was reverted (commit
>>>>> c0c6ca40a25e) in mesa as it broke GLX resulting in swapped colors. Based
>>>>> on further investigation by Chad Versace, moving the RGBX/RGBA configs
>>>>> to the end is enough to prevent breaking GLX.
>>>>>
>>>>> The handling of RGBA/RGBX in dri_fill_st_visual is a fix from Marek
>>>>> Olšák.
>>>>>
>>>>> Cc: Eric Anholt <e...@anholt.net>
>>>>> Cc: Chad Versace <chadvers...@chromium.org>
>>>>> Cc: Mauro Rossi <issor.or...@gmail.com>
>>>>> Reviewed-by: Marek Olšák <marek.ol...@amd.com>
>>>>> Signed-off-by: Rob Herring <r...@kernel.org>
>>>>> ---
>>>
>>> Hi Rob,
>>> I'm testing this patch with your gbm_gralloc and mesa 17.1.5.
>>> Before applying this patch, the SurfaceFlinger sees
>>> the alpha=8 in RenderEngine::chooseEglConfig()
>>>
>> May want to check for patches in the Android EGL (meta) library.
>> I think, in does/did have a handful of workarounds.
>>
>> Is the Android-x86 one in sync with the one RobH uses?
>
> I double checked and I get 8-8-8-8. I'm have HWC2 enabled and
> SurfaceFlinger is unpatched master branch.

Hmm, strange.
Which hwcomposer branch did you use and
what GPU did you test?

As I explained to you (in another private email),
I'm testing QEMU x86 virgl with your branches:

http://github.com/robherring/gbm_gralloc  (master branch)
http://github.com/robherring/drm_hwcomposer (android-m branch)

If I understand your code correctly, it supports
only HWC1, no HWC2 yet.
I accidentally set HWC2=true in the first time testing
but it didn't work. Setting HWC2=false works.
(on the other hand, the chromium upstream[1] does
switch to HWC2 now, but I can't make it work yet)

About the client (SurfaceFlinger), I believe it requests
HAL_PIXEL_FORMAT_RGBA_ but finally
HAL_PIXEL_FORMAT_RGBX_ is used.

The logic I saw is:
1. In SurfaceFlinger::init(), it calls RenderEngine::create() with
hwcFormat=HAL_PIXEL_FORMAT_RGBA_
   (if HWC2 is used or if HWC1 api ver >= 1.1)
2. RenderEngine::create() calls RenderEngine::chooseEglConfig()
   with format=HAL_PIXEL_FORMAT_RGBA_
3. chooseEglConfig() tries to find a config and prints
   the info as we see in the logcat. With this patch,
   the selected config is 8-8-8-0.
4. RenderEngine::create() saves the config to mEGLConfig
   by engine->setEGLHandles()
5. Later, new DisplayDevice::DisplayDevice() is called with
   with the selected config (mRenderEngine->getEGLConfig()).
   Then it calls eglCreateWindowSurface() with the config.
6. eglCreateWindowSurface() checks[2] the alpha attrib
   of this config to decide which format to be used.
   With this patch, alpha=0 so HAL_PIXEL_FORMAT_RGBX_
   is used. (if alpha > 0, HAL_PIXEL_FORMAT_RGBA_ is used)

The differences between you and me maybe:
* AOSP: master vs 7.1.2
* Mesa: master(?) vs 17.1.5
* GPU: ?? vs virgl

I think AOSP doesn't matter. I don't see explicit change
of the above logic in the master branch.
Does Mesa version matter? May I need more patches in 17.1.5?
About GPU, did you test virgl and still see 8-8-8-8?

About the problem of the change, it's not explicitly.
But some apps require RGBA_ still can't work.
An example is the screen capture apps like Screenshot touch[3].
It complains the producer output format is RGBX_
but RGBA_ is expected:

07-26 10:18:28.236  2602  2669 E ImageReader_JNI: Producer output
buffer format: 0x2, ImageReader configured format: 0x1

I expect the patch fix it but it's not.

[1]: https://chromium.googlesource.com/chromiumos/drm_hwcomposer
[2]: 
https://android.googlesource.com/platform/frameworks/native/+/master/opengl/libs/EGL/eglApi.cpp#484
[3]: https://play.google.com/store/apps/details?id=com.mdiwebma.screenshot


-- 
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 v2] st/dri: add 32-bit RGBX/RGBA formats

2017-07-24 Thread Chih-Wei Huang
On Tue 11 Jul 2017, Rob Herring wrote:
>> From: Marek Olšák 
>>
>> Add support for 32-bit RGBX/RGBA formats which are required for Android.
>>
>> The original patch (commit ccdcf91104a5) was reverted (commit
>> c0c6ca40a25e) in mesa as it broke GLX resulting in swapped colors. Based
>> on further investigation by Chad Versace, moving the RGBX/RGBA configs
>> to the end is enough to prevent breaking GLX.
>>
>> The handling of RGBA/RGBX in dri_fill_st_visual is a fix from Marek
>> Olšák.
>>
>> Cc: Eric Anholt 
>> Cc: Chad Versace 
>> Cc: Mauro Rossi 
>> Reviewed-by: Marek Olšák 
>> Signed-off-by: Rob Herring 
>> ---
>> v2:
>> - Incorporated dri_fill_st_visual RGBA/X handling from Marek
>> - Handle RGBA/X in dri2_drawable_get_buffers for completeness

Hi Rob,
I'm testing this patch with your gbm_gralloc and mesa 17.1.5.
Before applying this patch, the SurfaceFlinger sees
the alpha=8 in RenderEngine::chooseEglConfig()

07-25 02:19:13.188  1125  1125 I SurfaceFlinger: EGL information: format=0x1
07-25 02:19:13.188  1125  1125 I SurfaceFlinger: vendor: Android
07-25 02:19:13.188  1125  1125 I SurfaceFlinger: version   : 1.4
Android META-EGL
07-25 02:19:13.188  1125  1125 I SurfaceFlinger: extensions:
EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time
EGL_KHR_swap_buffers_with_damage EGL_ANDROID_create_native_cli
ent_buffer EGL_ANDROID_front_buffer_auto_refresh EGL_KHR_image_base
EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image
EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_ima
ge EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_create_context
EGL_KHR_config_attribs EGL_KHR_surfaceless_context
EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync EGL_ANDROID_reco
rdable EGL_EXT_buffer_age
07-25 02:19:13.188  1125  1125 I SurfaceFlinger: Client API: OpenGL_ES
07-25 02:19:13.188  1125  1125 I SurfaceFlinger: EGLSurface: 8-8-8-8,
config=0xa5485880

 (r-b-g-a)
07-25 02:19:13.211  1125  1125 I SurfaceFlinger: OpenGL ES
informations: format=0x1
07-25 02:19:13.211  1125  1125 I SurfaceFlinger: vendor: Red Hat
07-25 02:19:13.211  1125  1125 I SurfaceFlinger: renderer  : Gallium
0.4 on virgl
07-25 02:19:13.211  1125  1125 I SurfaceFlinger: version   : OpenGL ES
3.0 Mesa 17.1.5 (git-317b5bd)

After applying the patch, however, alpha becomes 0

07-25 02:34:46.522  1125  1125 I SurfaceFlinger: EGL information: format=0x1
07-25 02:34:46.522  1125  1125 I SurfaceFlinger: vendor: Android
07-25 02:34:46.522  1125  1125 I SurfaceFlinger: version   : 1.4
Android META-EGL
07-25 02:34:46.522  1125  1125 I SurfaceFlinger: extensions:
EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time
EGL_KHR_swap_buffers_with_damage
EGL_ANDROID_create_native_client_buffer
EGL_ANDROID_front_buffer_auto_refresh EGL_KHR_image_base
EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image
EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image
EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_create_context
EGL_KHR_config_attribs EGL_KHR_surfaceless_context
EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync
EGL_ANDROID_recordable EGL_EXT_buffer_age
07-25 02:34:46.522  1125  1125 I SurfaceFlinger: Client API: OpenGL_ES
07-25 02:34:46.522  1125  1125 I SurfaceFlinger: EGLSurface: 8-8-8-0,
config=0xabc24d80


07-25 02:34:46.574  1125  1125 I SurfaceFlinger: OpenGL ES
informations: format=0x1
07-25 02:34:46.574  1125  1125 I SurfaceFlinger: vendor: Red Hat
07-25 02:34:46.574  1125  1125 I SurfaceFlinger: renderer  : Gallium
0.4 on virgl
07-25 02:34:46.574  1125  1125 I SurfaceFlinger: version   : OpenGL ES
3.0 Mesa 17.1.5 (git-317b5bd)


Therefore, eglCreateWindowSurface() finally chose
HAL_PIXEL_FORMAT_RGBX_ instead of
HAL_PIXEL_FORMAT_RGBA_.
Is that expected?
I thought it should be HAL_PIXEL_FORMAT_RGBA_.


-- 
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 2/2] android: fix spirv_info generation

2017-07-20 Thread Chih-Wei Huang
2017-07-20 18:02 GMT+08:00 Chih-Wei Huang <cwhu...@android-x86.org>:
>
> OK. I see the real problem.
> The rules to build spirv_info.c are incorrectly
> to use $(LOCAL_PATH).
> Basically speaking, $(LOCAL_PATH) can't be used
> in the recipes[1] since it is always changing.
> When the recipe rules are executed its value
> is not you expected.
> (using it in targets and prerequisites is OK)
>
> The typical way to handle it is to use private variable:
>
> $(intermediates)/spirv/spirv_info.c: PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
>
> Then use PRIVATE_LOCAL_PATH in the recpies.
>
> But in this case, seems it can just be simplified to $^
> (which means all the prerequisites)
>
> $(intermediates)/spirv/spirv_info.c:
> $(COMPILER_PATH)/spirv/spirv_info_c.py
> $(COMPILER_PATH)/spirv/spirv.core.grammar.json

Sorry. I meant $(LOCAL_PATH) instead of $(COMPILER_PATH).
(copied wrong lines)

I've submitted a real patch for it.

>  @mkdir -p $(dir $@)
>  $(hide) $(MESA_PYTHON2) $^ $@ || ($(RM) $@; false)



-- 
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


[Mesa-dev] [PATCH] Android: fix spirv_info.c generation

2017-07-20 Thread Chih-Wei Huang
It's incorrect to use $(LOCAL_PATH) in makefile recipes since it's
changing. The typical way to handle it is to use private variable.
Fortunately in this case we can just simplify them to $^.

See further:
https://patchwork.freedesktop.org/patch/167718/

Also simplify LOCAL_GENERATED_SOURCES.

Fixes: 2dd4e2ec (spirv: Generate spirv_info.c)

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/compiler/Android.nir.gen.mk | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/compiler/Android.nir.gen.mk b/src/compiler/Android.nir.gen.mk
index 4507ac4..e2187d0 100644
--- a/src/compiler/Android.nir.gen.mk
+++ b/src/compiler/Android.nir.gen.mk
@@ -41,7 +41,7 @@ LOCAL_EXPORT_C_INCLUDE_DIRS += \
$(MESA_TOP)/src/compiler/nir
 
 LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
-   $(NIR_GENERATED_FILES))
+   $(NIR_GENERATED_FILES) $(SPIRV_GENERATED_FILES))
 
 # Modules using libmesa_nir must set LOCAL_GENERATED_SOURCES to this
 MESA_GEN_NIR_H := $(addprefix $(call local-generated-sources-dir)/, \
@@ -95,9 +95,6 @@ $(intermediates)/nir/nir_opt_algebraic.c: 
$(nir_opt_algebraic_deps)
@mkdir -p $(dir $@)
$(hide) $(MESA_PYTHON2) $(nir_opt_algebraic_gen) $< > $@
 
-LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
-   $(SPIRV_GENERATED_FILES))
-
 $(intermediates)/spirv/spirv_info.c: $(LOCAL_PATH)/spirv/spirv_info_c.py 
$(LOCAL_PATH)/spirv/spirv.core.grammar.json
@mkdir -p $(dir $@)
-   $(hide) $(MESA_PYTHON2) $(LOCAL_PATH)/spirv/spirv_info_c.py 
$(LOCAL_PATH)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false)
+   $(hide) $(MESA_PYTHON2) $^ $@ || ($(RM) $@; false)
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 2/2] android: fix spirv_info generation

2017-07-20 Thread Chih-Wei Huang
2017-07-19 15:12 GMT+08:00 Tapani Pälli :
> Depending on build order, LOCAL_PATH maybe set or not (and can't
> be trusted to have assumed path), change modifies all occurences
> of LOCAL_PATH as locally defined COMPILER_PATH instead.
>
> Signed-off-by: Tapani Pälli 
> ---
>  src/compiler/Android.nir.gen.mk | 38 --
>  1 file changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/src/compiler/Android.nir.gen.mk b/src/compiler/Android.nir.gen.mk
> index 4507ac4..81511de 100644
> --- a/src/compiler/Android.nir.gen.mk
> +++ b/src/compiler/Android.nir.gen.mk
> @@ -27,6 +27,8 @@ ifeq ($(LOCAL_MODULE_CLASS),)
>  LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>  endif
>
> +COMPILER_PATH := $(MESA_TOP)/src/compiler
> +
>  intermediates := $(call local-generated-sources-dir)
>
>  LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
> @@ -48,48 +50,48 @@ MESA_GEN_NIR_H := $(addprefix $(call 
> local-generated-sources-dir)/, \
> nir/nir_opcodes.h \
> nir/nir_builder_opcodes.h)
>
> -nir_builder_opcodes_gen := $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
> +nir_builder_opcodes_gen := $(COMPILER_PATH)/nir/nir_builder_opcodes_h.py
>  nir_builder_opcodes_deps := \
> -   $(LOCAL_PATH)/nir/nir_opcodes.py \
> -   $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
> +   $(COMPILER_PATH)/nir/nir_opcodes.py \
> +   $(COMPILER_PATH)/nir/nir_builder_opcodes_h.py
>
>  $(intermediates)/nir/nir_builder_opcodes.h: $(nir_builder_opcodes_deps)
> @mkdir -p $(dir $@)
> $(hide) $(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@
>
> -nir_constant_expressions_gen := $(LOCAL_PATH)/nir/nir_constant_expressions.py
> +nir_constant_expressions_gen := 
> $(COMPILER_PATH)/nir/nir_constant_expressions.py
>  nir_constant_expressions_deps := \
> -   $(LOCAL_PATH)/nir/nir_opcodes.py \
> -   $(LOCAL_PATH)/nir/nir_constant_expressions.py
> +   $(COMPILER_PATH)/nir/nir_opcodes.py \
> +   $(COMPILER_PATH)/nir/nir_constant_expressions.py
>
>  $(intermediates)/nir/nir_constant_expressions.c: 
> $(nir_constant_expressions_deps)
> @mkdir -p $(dir $@)
> $(hide) $(MESA_PYTHON2) $(nir_constant_expressions_gen) $< > $@
>
> -nir_opcodes_h_gen := $(LOCAL_PATH)/nir/nir_opcodes_h.py
> +nir_opcodes_h_gen := $(COMPILER_PATH)/nir/nir_opcodes_h.py
>  nir_opcodes_h_deps := \
> -   $(LOCAL_PATH)/nir/nir_opcodes.py \
> -   $(LOCAL_PATH)/nir/nir_opcodes_h.py
> +   $(COMPILER_PATH)/nir/nir_opcodes.py \
> +   $(COMPILER_PATH)/nir/nir_opcodes_h.py
>
>  $(intermediates)/nir/nir_opcodes.h: $(nir_opcodes_h_deps)
> @mkdir -p $(dir $@)
> $(hide) $(MESA_PYTHON2) $(nir_opcodes_h_gen) $< > $@
>
> -$(LOCAL_PATH)/nir/nir.h: $(intermediates)/nir/nir_opcodes.h
> +$(COMPILER_PATH)/nir/nir.h: $(intermediates)/nir/nir_opcodes.h
>
> -nir_opcodes_c_gen := $(LOCAL_PATH)/nir/nir_opcodes_c.py
> +nir_opcodes_c_gen := $(COMPILER_PATH)/nir/nir_opcodes_c.py
>  nir_opcodes_c_deps := \
> -   $(LOCAL_PATH)/nir/nir_opcodes.py \
> -   $(LOCAL_PATH)/nir/nir_opcodes_c.py
> +   $(COMPILER_PATH)/nir/nir_opcodes.py \
> +   $(COMPILER_PATH)/nir/nir_opcodes_c.py
>
>  $(intermediates)/nir/nir_opcodes.c: $(nir_opcodes_c_deps)
> @mkdir -p $(dir $@)
> $(hide) $(MESA_PYTHON2) $(nir_opcodes_c_gen) $< > $@
>
> -nir_opt_algebraic_gen := $(LOCAL_PATH)/nir/nir_opt_algebraic.py
> +nir_opt_algebraic_gen := $(COMPILER_PATH)/nir/nir_opt_algebraic.py
>  nir_opt_algebraic_deps := \
> -   $(LOCAL_PATH)/nir/nir_opt_algebraic.py \
> -   $(LOCAL_PATH)/nir/nir_algebraic.py
> +   $(COMPILER_PATH)/nir/nir_opt_algebraic.py \
> +   $(COMPILER_PATH)/nir/nir_algebraic.py
>
>  $(intermediates)/nir/nir_opt_algebraic.c: $(nir_opt_algebraic_deps)
> @mkdir -p $(dir $@)
> @@ -98,6 +100,6 @@ $(intermediates)/nir/nir_opt_algebraic.c: 
> $(nir_opt_algebraic_deps)
>  LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
> $(SPIRV_GENERATED_FILES))
>
> -$(intermediates)/spirv/spirv_info.c: $(LOCAL_PATH)/spirv/spirv_info_c.py 
> $(LOCAL_PATH)/spirv/spirv.core.grammar.json
> +$(intermediates)/spirv/spirv_info.c: $(COMPILER_PATH)/spirv/spirv_info_c.py 
> $(COMPILER_PATH)/spirv/spirv.core.grammar.json
> @mkdir -p $(dir $@)
> -   $(hide) $(MESA_PYTHON2) $(LOCAL_PATH)/spirv/spirv_info_c.py 
> $(LOCAL_PATH)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false)
> +   $(hide) $(MESA_PYTHON2) $(COMPILER_PATH)/spirv/spirv_info_c.py 
> $(COMPILER_PATH)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false)

OK. I see the real problem.
The rules to build spirv_info.c are incorrectly
to use $(LOCAL_PATH).
Basically speaking, $(LOCAL_PATH) can't be used
in the recipes[1] since it is always changing.
When the recipe rules are executed its value
is not you expected.
(using it in targets and prerequisites is OK)

The typical way to handle it is to use private variable:

$(intermediates)/spirv/spirv_info.c: 

Re: [Mesa-dev] [PATCH v1 3/7] gallium: os_process fixes for Android

2017-06-15 Thread Chih-Wei Huang
2017-06-16 4:47 GMT+08:00 Robert Foss :
> From: Rob Herring 
>
> Signed-off-by: Rob Herring 
> ---
>  src/gallium/auxiliary/os/os_process.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/auxiliary/os/os_process.c 
> b/src/gallium/auxiliary/os/os_process.c
> index 6622b9b2bc..af5d22bf84 100644
> --- a/src/gallium/auxiliary/os/os_process.c
> +++ b/src/gallium/auxiliary/os/os_process.c
> @@ -34,7 +34,7 @@
>  #  include 
>  #elif defined(__GLIBC__) || defined(__CYGWIN__)
>  #  include 
> -#elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE)
> +#elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) || 
> defined(PIPE_OS_ANDROID)
>  #  include 
>  #elif defined(PIPE_OS_HAIKU)
>  #  include 
> @@ -59,6 +59,7 @@ os_get_process_name(char *procname, size_t size)
>  {
> const char *name;
>
> +
> /* First, check if the GALLIUM_PROCESS_NAME env var is set to
>  * override the normal process name query.
>  */
> @@ -86,7 +87,7 @@ os_get_process_name(char *procname, size_t size)
>
>  #elif defined(__GLIBC__) || defined(__CYGWIN__)
>name = program_invocation_short_name;
> -#elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE)
> +#elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) || 
> defined(PIPE_OS_ANDROID)
>/* *BSD and OS X */
>name = getprogname();
>  #elif defined(PIPE_OS_HAIKU)
> --

I have submitted another patch to fix
the same issue about 2 weeks ago.
My suggestion is just define PIPE_OS_BSD
for Android. This allows Android to share features
inherited from (Open)BSD and avoid further changes
like this one.

Please see:
https://lists.freedesktop.org/archives/mesa-dev/2017-June/157754.html

-- 
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

2017-06-07 Thread Chih-Wei Huang
2017-06-07 22:47 GMT+08:00 Jonathan Gray <j...@jsg.id.au>:
> On Wed, Jun 07, 2017 at 10:30:49PM +0800, Chih-Wei Huang wrote:
>> 2017-06-07 21:54 GMT+08:00 Jonathan Gray <j...@jsg.id.au>:
>> > On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote:
>> >> On 6 June 2017 at 07:30, Chih-Wei Huang <cwhu...@android-x86.org> 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

2017-06-07 Thread Chih-Wei Huang
2017-06-07 21:54 GMT+08:00 Jonathan Gray <j...@jsg.id.au>:
> On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote:
>> On 6 June 2017 at 07:30, Chih-Wei Huang <cwhu...@android-x86.org> 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

2017-06-06 Thread Chih-Wei Huang
2017-06-06 13:06 GMT+08:00 Chih-Wei Huang <cwhu...@android-x86.org>:
> 2017-06-05 21:04 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
>> On 4 June 2017 at 04:31, Chih-Wei Huang <cwhu...@android-x86.org> 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 0/3] Fix missing initializer errors in generated tables

2017-06-05 Thread Chih-Wei Huang
2017-06-05 3:57 GMT+08:00 Marek Olšák :
> NAK.
>
> In C/C++, the initializer is used to clear the memory to 0s, thus,
> adding 0s to the initializer is redundant and unnecessary. Empty
> initializer {} is also commonly used instead of memset.

Commonly used doesn't mean it's the right thing.
Otherwise the compiler should not generate such warnings.

The compiler tries to tell you "hey, you may miss setting something?"
If that's what you want (init to 0), please express it explicitly.

It's about readability of the code.
When people like me read the code,
I have exact the same question as the compiler:
"does the developer forget to set something?"

> You need to suppress this warning if you don't want to see it.

Not a good suggestion.

Making the code warning-free is the responsibility
of the one who wrote the code instead of
the one who builds the code.

So fix the code, please.

2017-06-05 6:20 GMT+08:00 Emil Velikov :
> On 4 June 2017 at 21:27, Benedikt Schemmer  wrote:
>> Hi all,
>>
>> my reasoning wasn't based on how c handles partial initializations,
>> but on how the generated files look like: like something is missing.
>>
>> Also I don't want to suppress these warnings, because I don't have
>> the experience you have with the codebase and would kind of like to
>> see if my changes have an negative impact or I forgot something.
>>
> Using [C99] designated initalizers should "make things right". Do
> check that the generated files are not included in C++ context, since
> C99 initalizers are not allowed there :-\
>
> Keep in might that explicit [zero] initialization may "force" the
> compiler to generate the actual code, increasing the binary size.

Why should the compiler generate actual code
in this case? I don't believe the compiler is so silly.


> On Sun, Jun 4, 2017 at 9:45 AM, Benedikt Schemmer  wrote:
>>
>> I send these patches as a series because they share the same problem:
>> all have missing fields in the default initialization path for field/register
>> definitions.
>>
>> This causes several hundreds (thousands?) of "missing initializer" warnings
>> from the compiler making it hard to spot less frequent errors.
>>
>> This also fixes a small copy and paste error in vk_format_table.py where
>> it isnt clear how it is autogenerated from where.
>>
>> Please kindly review and push if you find this useful.
>>
>> Thanks,
>> Benedikt
>>
>> Benedikt Schemmer (3):
>>   Fix missing initializer warning in sid_tables.h by adding appropriate
>> default fields in sid_tables.py
>>   Fix missing initializer warning in egd_tables.h by adding appropriate
>> default fields in egd_tables.py
>>   Fix missing initializer warning in vk_format_table.h by adding
>> appropriate default fields in vk_format_table.py
>>
>>  src/amd/common/sid_tables.py   | 4 ++--
>>  src/amd/vulkan/vk_format_table.py  | 4 ++--
>>  src/gallium/drivers/r600/egd_tables.py | 4 ++--




-- 
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: use bionic pthread_barrier_* if possible

2017-06-05 Thread Chih-Wei Huang
2017-06-05 21:15 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
> On 5 June 2017 at 09:27, Tapani Pälli <tapani.pa...@intel.com> wrote:
>> that seems the case
>>
>> Acked-by: Tapani Pälli <tapani.pa...@intel.com>
>>
>> On 06/04/2017 07:53 AM, Chih-Wei Huang wrote:
>>>
>>> The pthread_barrier_* functions were introduced to bionic
>>> since Nougat.
>>>
> ... and pushed. Thanks gents.
>
> Out of curiosity: Chih-Wei, did you notice any perf difference when
> using llvmpipe?

Hmm... No.
Should I expect that?
I just expect code size reduced
though it's very small.


-- 
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


[Mesa-dev] [PATCH] Android: use bionic pthread_barrier_* if possible

2017-06-03 Thread Chih-Wei Huang
The pthread_barrier_* functions were introduced to bionic
since Nougat.

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 Android.common.mk| 1 +
 src/gallium/auxiliary/os/os_thread.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Android.common.mk b/Android.common.mk
index 57c31fc..44ad97b 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -44,6 +44,7 @@ LOCAL_CFLAGS += \
 # It's likely due to a bug elsewhere, but let's temporarily add them
 # here to fix the radeonsi build.
 LOCAL_CFLAGS += \
+   -DANDROID_API_LEVEL=$(PLATFORM_SDK_VERSION) \
-DENABLE_SHADER_CACHE \
-D__STDC_CONSTANT_MACROS \
-D__STDC_LIMIT_MACROS \
diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index b6e0698..0a238e5 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -75,7 +75,7 @@ __pipe_mutex_assert_locked(mtx_t *mutex)
  * pipe_barrier
  */
 
-#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || 
defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD)) && !defined(PIPE_OS_ANDROID)
+#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || 
defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD)) && 
(!defined(PIPE_OS_ANDROID) || ANDROID_API_LEVEL >= 24)
 
 typedef pthread_barrier_t pipe_barrier;
 
-- 
1.9.1

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


[Mesa-dev] [PATCH] Android: define PIPE_OS_BSD

2017-06-03 Thread Chih-Wei Huang
Android bionic is derived from OpenBSD. So the logics of BSD
almost apply to Android as well.

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]
 ^
2 warnings generated.

Actually it's the only affected file by the change.

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/gallium/include/pipe/p_config.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/include/pipe/p_config.h 
b/src/gallium/include/pipe/p_config.h
index 3fa43ed..0d8e9f7 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -158,6 +158,7 @@
  */
 #if defined(ANDROID)
 #define PIPE_OS_ANDROID
+#define PIPE_OS_BSD
 #endif
 
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] i965: Add RGBX8888 and RGBA8888 to EGL configure and reorder the list

2017-05-17 Thread Chih-Wei Huang
2017-05-18 12:01 GMT+08:00 Xu, Randy :
>
>> -Original Message-
>> From: Palli, Tapani
>> >
>> > It's just applied. Isn't it?
>> > Yesterday without this patch
>> > the color format is mismatch apparently.
>>
>> Yeah we do need this. TBH I don't quite understand why but will try to figure
>> it out. I remember we used to have a patch in Surfaceflinger at one point
>> because visual was hardcoded there and this might be related.
>>
>> // Tapani
>
> Sorry, that's for different issue, I mix it with RGB565 blending one.
> This patch is required because some Android GLES test apps, like gl2_basic, 
> need to create RGBA surface.

Indeed it is.

As Emil pointed out, the patch was merged before
but reverted later since it broke desktop.

So what's the current upstreaming plan?


-- 
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] i965: Add RGBX8888 and RGBA8888 to EGL configure and reorder the list

2017-05-17 Thread Chih-Wei Huang
2017-05-18 11:26 GMT+08:00 Xu, Randy <randy...@intel.com>:
>
>> -Original Message-
>> From: Chih-Wei Huang [mailto:cwhu...@android-x86.org]
>> Sent: Thursday, May 18, 2017 11:04 AM
>> To: Xu, Randy <randy...@intel.com>
>> Cc: Emil Velikov <emil.l.veli...@gmail.com>; ML mesa-dev > d...@lists.freedesktop.org>
>> Subject: Re: [Mesa-dev] [PATCH] i965: Add RGBX and RGBA to EGL
>> configure and reorder the list
>>
>> 2017-05-12 12:04 GMT+08:00 Xu, Randy <randy...@intel.com>:
>> > Thanks, Emil
>> >
>> > dEQP has patch to exclude 565 blend cases (commit named "Exclude
>> RGB565 blending cases from the must-pass"), so we don’t need any patches
>> now.
>>
>> Hi Randy, Tapani,
>> I think we still need a patch. Right?
>> I see the similar patch is still applied to Android-IA codebase.
>
> Which patch do you means? As Google has excluded the RGB565 for blending 
> test, we don’t need patch Mesa

This one:
https://github.com/android-ia/external-mesa/commit/72d5e389c6adfbca8ec18885c93191dc62c78c82

It's just applied. Isn't it?
Yesterday without this patch
the color format is mismatch apparently.


-- 
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] i965: Add RGBX8888 and RGBA8888 to EGL configure and reorder the list

2017-05-17 Thread Chih-Wei Huang
2017-05-12 12:04 GMT+08:00 Xu, Randy :
> Thanks, Emil
>
> dEQP has patch to exclude 565 blend cases (commit named "Exclude RGB565 
> blending cases from the must-pass"), so we don’t need any patches now.

Hi Randy, Tapani,
I think we still need a patch. Right?
I see the similar patch is still applied
to Android-IA codebase.


-- 
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: correct libz dependency

2017-05-17 Thread Chih-Wei Huang
2017-05-17 21:11 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
> On 17 May 2017 at 13:45, Rob Herring <r...@kernel.org> wrote:
>> On Wed, May 17, 2017 at 12:10 AM, Chih-Wei Huang
>> <cwhu...@android-x86.org> wrote:
>>> Commit 6facb0c0 ("android: fix libz dynamic library dependencies")
>>> unconditionally adds libz as a dependency to all shared libraries.
>>> That is unnecessary.
>>>
>>> Commit 85a9b1b5 introduced libz as a dependency to libmesa_util.
>>> So only the shared libraries that use libmesa_util need libz.
>>>
>>> Fix Android Lollipop build by adding the include path of zlib to
>>> libmesa_util explicitly instead of getting the path implicitly
>>> from zlib since it doesn't export the include path in Lollipop.
>>>
>>> Fixes: 6facb0c0 "android: fix libz dynamic library dependencies"
>>>
>>> Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
>>> ---
>>>  Android.common.mk  | 4 
>>>  src/gallium/targets/dri/Android.mk | 3 ++-
>>>  src/intel/Android.vulkan.mk| 2 +-
>>>  src/mesa/drivers/dri/Android.mk| 3 ++-
>>>  src/util/Android.mk| 1 +
>>>  5 files changed, 6 insertions(+), 7 deletions(-)
>>
>> Reviewed-by: Rob Herring <r...@kernel.org>
> Thanks Rob. Pushed to master.

Thank you.

BTW, since libmesa_util is used by several places,
is it better to change it to a shared library?


-- 
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


[Mesa-dev] [PATCH] Android: correct libz dependency

2017-05-16 Thread Chih-Wei Huang
Commit 6facb0c0 ("android: fix libz dynamic library dependencies")
unconditionally adds libz as a dependency to all shared libraries.
That is unnecessary.

Commit 85a9b1b5 introduced libz as a dependency to libmesa_util.
So only the shared libraries that use libmesa_util need libz.

Fix Android Lollipop build by adding the include path of zlib to
libmesa_util explicitly instead of getting the path implicitly
from zlib since it doesn't export the include path in Lollipop.

Fixes: 6facb0c0 "android: fix libz dynamic library dependencies"

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 Android.common.mk  | 4 
 src/gallium/targets/dri/Android.mk | 3 ++-
 src/intel/Android.vulkan.mk| 2 +-
 src/mesa/drivers/dri/Android.mk| 3 ++-
 src/util/Android.mk| 1 +
 5 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 5e7fd94..a79c331 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -103,7 +103,3 @@ endif
 
 # Quiet down the build system and remove any .h files from the sources
 LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
-
-ifneq ($(LOCAL_IS_HOST_MODULE),true)
-LOCAL_SHARED_LIBRARIES += libz
-endif
diff --git a/src/gallium/targets/dri/Android.mk 
b/src/gallium/targets/dri/Android.mk
index f72551c..8c8fb5d 100644
--- a/src/gallium/targets/dri/Android.mk
+++ b/src/gallium/targets/dri/Android.mk
@@ -35,7 +35,8 @@ LOCAL_CFLAGS :=
 LOCAL_SHARED_LIBRARIES := \
libdl \
libglapi \
-   libexpat
+   libexpat \
+   libz
 
 $(foreach d, $(MESA_BUILD_GALLIUM), $(eval LOCAL_CFLAGS += $(patsubst 
HAVE_%,-D%,$(d
 
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 831b658..2bf56a4 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -231,7 +231,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_intel_compiler \
libmesa_anv_entrypoints
 
-LOCAL_SHARED_LIBRARIES := libdrm
+LOCAL_SHARED_LIBRARIES := libdrm libz
 
 include $(MESA_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index d4fb670..53ff4b4 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -51,7 +51,8 @@ MESA_DRI_SHARED_LIBRARIES := \
libdl \
libexpat \
libglapi \
-   liblog
+   liblog \
+   libz
 
 #---
 # Build drivers and libmesa_dri_common
diff --git a/src/util/Android.mk b/src/util/Android.mk
index 64aafbe..facdcf8 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -34,6 +34,7 @@ LOCAL_SRC_FILES := \
$(MESA_UTIL_FILES)
 
 LOCAL_C_INCLUDES := \
+   external/zlib \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/gallium/include \
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] android: fix libz dynamic library dependencies

2017-05-16 Thread Chih-Wei Huang
2017-03-05 5:11 GMT+08:00 Mauro Rossi :
> Fixes a series of libz related building errors:
>
> target SharedLib: gallium_dri_32
> (out/target/prod...SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so)
> external/elfutils/libelf/elf_compress.c:117: error: undefined reference to 
> 'deflateInit_'
> ...
> external/elfutils/libelf/elf_compress.c:244: error: undefined reference to 
> 'inflateEnd'
> clang++: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> Fixes: 85a9b1b "util/disk_cache: compress individual cache entries"
> ---
>  Android.common.mk   | 2 ++
>  src/util/Android.mk | 4 
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/Android.common.mk b/Android.common.mk
> index c27a77e..4b90fb9 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -128,3 +128,5 @@ endif
>
>  # Quiet down the build system and remove any .h files from the sources
>  LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
> +
> +LOCAL_SHARED_LIBRARIES += libz

I just noticed this is old patch which has been merged.
Sorry I didn't read earlier enough.
I have to say it is incorrect.
It unconditionally adds libz as a dependency
to all Mesa shared libraries.
That is unnecessary.

I'll send a patch to fix it later.


> diff --git a/src/util/Android.mk b/src/util/Android.mk
> index a139e68..a39185a 100644
> --- a/src/util/Android.mk
> +++ b/src/util/Android.mk
> @@ -53,8 +53,6 @@ $(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = 
> $(PRIVATE_PYTHON) $^ > $@
>  $(LOCAL_GENERATED_SOURCES): $(intermediates)/%.c: $(LOCAL_PATH)/%.py
> $(transform-generated-source)
>
> -LOCAL_SHARED_LIBRARIES := libz
> -
>  include $(MESA_COMMON_MK)
>  include $(BUILD_STATIC_LIBRARY)
>
> @@ -90,7 +88,5 @@ $(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = 
> $(PRIVATE_PYTHON) $^ > $@
>  $(LOCAL_GENERATED_SOURCES): $(intermediates)/%.c: $(LOCAL_PATH)/%.py
> $(transform-generated-source)
>
> -LOCAL_SHARED_LIBRARIES := libz
> -
>  include $(MESA_COMMON_MK)
>  include $(BUILD_HOST_STATIC_LIBRARY)
> --


-- 
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] egl: fix android logger compilation

2017-05-12 Thread Chih-Wei Huang
2017-05-12 14:15 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:
>
>
> On 05/12/2017 09:13 AM, Chih-Wei Huang wrote:
>>
>> 2017-05-12 13:37 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:
>>>
>>> this patch is a partial revert of 1ce5853 that break compilation
>>> since LOG_ERROR etc are not defined and also macro expansion won't
>>> work as planned (expands to 'ANDROID_egl2alog[level]')
>>>
>>> Fixes: 1ce5853 ("egl: simplify the Android logger")
>>> Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
>>> ---
>>>   src/egl/main/egllog.c | 21 ++---
>>>   1 file changed, 14 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
>>> index 6de2a50..51ab76f 100644
>>> --- a/src/egl/main/egllog.c
>>> +++ b/src/egl/main/egllog.c
>>> @@ -81,13 +81,20 @@ static void
>>>   _eglDefaultLogger(EGLint level, const char *msg)
>>>   {
>>>   #ifdef HAVE_ANDROID_PLATFORM
>>> -   static const int egl2alog[] = {
>>> -  [_EGL_FATAL] = LOG_ERROR,
>>> -  [_EGL_WARNING]  = LOG_WARN,
>>> -  [_EGL_INFO] = LOG_INFO,
>>> -  [_EGL_DEBUG] = LOG_DEBUG,
>>
>>
>> How about just change LOG_* to ANDROID_LOG_* ?
>> You also need to include "android/log.h".

Correction: this has already included (from cutils/log.h)

>> LOG_* are not real macros defined in Android headers.
>> They are concatenated to ANDROID_LOG_*
>> defined in android/log.h. (in system/core/include/)
>
>
> problem is that ALOG stringifies (is that a word?) the first argument and
> concats that with 'ANDROID_', so currently you get 'ANDROID_egl2alog[level]'
> which does not exist. With ANDROID applied, you would get 'ANDROID_ANDROID
> ..'

Ah, I see. Then change ALOG to LOG_PRI
(or android_printLog).

>
>
>>> -   };
>>> -   ALOG(egl2alog[level], LOG_TAG, "%s", msg);
>>> +   switch (level) {
>>> +   case _EGL_FATAL:
>>> +  ALOGE("%s", msg);
>>> +  break;
>>> +   case _EGL_WARNING:
>>> +  ALOGW("%s", msg);
>>> +  break;
>>> +   case _EGL_INFO:
>>> +  ALOGI("%s", msg);
>>> +  break;
>>> +   case _EGL_DEBUG:
>>> +  ALOGD("%s", msg);
>>> +  break;
>>> +   }
>>>   #else
>>>  fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
>>>   #endif /* HAVE_ANDROID_PLATFORM */


-- 
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] egl: fix android logger compilation

2017-05-12 Thread Chih-Wei Huang
2017-05-12 13:37 GMT+08:00 Tapani Pälli :
> this patch is a partial revert of 1ce5853 that break compilation
> since LOG_ERROR etc are not defined and also macro expansion won't
> work as planned (expands to 'ANDROID_egl2alog[level]')
>
> Fixes: 1ce5853 ("egl: simplify the Android logger")
> Signed-off-by: Tapani Pälli 
> ---
>  src/egl/main/egllog.c | 21 ++---
>  1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
> index 6de2a50..51ab76f 100644
> --- a/src/egl/main/egllog.c
> +++ b/src/egl/main/egllog.c
> @@ -81,13 +81,20 @@ static void
>  _eglDefaultLogger(EGLint level, const char *msg)
>  {
>  #ifdef HAVE_ANDROID_PLATFORM
> -   static const int egl2alog[] = {
> -  [_EGL_FATAL] = LOG_ERROR,
> -  [_EGL_WARNING]  = LOG_WARN,
> -  [_EGL_INFO] = LOG_INFO,
> -  [_EGL_DEBUG] = LOG_DEBUG,

How about just change LOG_* to ANDROID_LOG_* ?
You also need to include "android/log.h".

LOG_* are not real macros defined in Android headers.
They are concatenated to ANDROID_LOG_*
defined in android/log.h. (in system/core/include/)

> -   };
> -   ALOG(egl2alog[level], LOG_TAG, "%s", msg);
> +   switch (level) {
> +   case _EGL_FATAL:
> +  ALOGE("%s", msg);
> +  break;
> +   case _EGL_WARNING:
> +  ALOGW("%s", msg);
> +  break;
> +   case _EGL_INFO:
> +  ALOGI("%s", msg);
> +  break;
> +   case _EGL_DEBUG:
> +  ALOGD("%s", msg);
> +  break;
> +   }
>  #else
> fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
>  #endif /* HAVE_ANDROID_PLATFORM */
> --



-- 
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 00/12] Android build cleanup/fixes

2017-04-27 Thread Chih-Wei Huang
2017-04-28 3:43 GMT+08:00 Rob Herring <r...@kernel.org>:
> This is a series of clean-ups and fixes to the Android build files.
> Overall, it removes a lot of the if conditions that aren't necessary for
> normal builds and also enables "mmma external/mesa3d" to build
> everything for easier build testing.
>
> This fixes LLVM enabled builds on master though that requires changes
> to LLVM as well. In the process, LLVM builds with Lollipop are dropped
> as L doesn't have the minimum LLVM version for several drivers. Also,
> android-x86 L support is using mesa 11.0.
>
> I've only tested against AOSP master so far.
>
> Rob
>
> Mauro Rossi (2):
>   android: drop static linking of R600 LLVM libraries
>   android: define required __STDC* macros as cflags
>
> Rob Herring (10):
>   Android: amd: use exported include dirs instead of explicit includes
>   Android: amd/common: fix dependency on libmesa_nir
>   Android: drop LLVM support on Lollipop
>   Android: rework libelf dependencies
>   Android: remove needless conditional including of child makefiles
>   Android: Fix swrast only build
>   Android: push driver build details to driver makefiles
>   Android: default to building all drivers
>   Android: Add LLVM support for Android O
>   Android: Drop linking libgcc
>
>  Android.common.mk| 15 ++
>  Android.mk   | 57 ++-
>  src/amd/Android.addrlib.mk   |  6 +++
>  src/amd/Android.common.mk| 16 +--
>  src/compiler/Android.nir.gen.mk  |  1 +
>  src/egl/Android.mk   | 14 ++
>  src/gallium/Android.common.mk|  3 +-
>  src/gallium/Android.mk   | 58 +++-
>  src/gallium/auxiliary/Android.mk | 12 +++--
>  src/gallium/auxiliary/pipe-loader/Android.mk |  7 ++-
>  src/gallium/drivers/freedreno/Android.mk |  5 ++
>  src/gallium/drivers/i915/Android.mk  |  4 ++
>  src/gallium/drivers/nouveau/Android.mk   |  5 ++
>  src/gallium/drivers/r300/Android.mk  |  4 ++
>  src/gallium/drivers/r600/Android.mk  | 10 ++--
>  src/gallium/drivers/radeon/Android.mk|  7 ++-
>  src/gallium/drivers/radeonsi/Android.mk  | 12 -
>  src/gallium/drivers/softpipe/Android.mk  |  4 ++
>  src/gallium/drivers/svga/Android.mk  |  4 ++
>  src/gallium/drivers/vc4/Android.mk   |  4 ++
>  src/gallium/drivers/virgl/Android.mk |  4 ++
>  src/gallium/state_trackers/dri/Android.mk| 10 ++--
>  src/gallium/targets/dri/Android.mk   | 68 
> ++--
>  src/gallium/winsys/amdgpu/drm/Android.mk | 12 ++---
>  src/gallium/winsys/i915/drm/Android.mk   |  4 ++
>  src/mesa/Android.libmesa_dricore.mk  |  4 --
>  src/mesa/Android.libmesa_st_mesa.mk  |  4 --
>  src/mesa/drivers/dri/Android.mk          | 11 +
>  28 files changed, 149 insertions(+), 216 deletions(-)
>
> --

First of all, thank you for these patches.

Patches 1, 2, 3, 4, 5, 6, 7, 8, and 12 are

Reviewed-by: Chih-Wei Huang <cwhu...@linux.org.tw>

For others I hope to make a test
(at least on N) before commenting.

Minor suggestion: unify the uppercase or lowercase
in the subject of the series.


-- 
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 10/12] Android: default to building all drivers

2017-04-27 Thread Chih-Wei Huang
A typo in the subject?
(s/building/build/)

2017-04-28 3:43 GMT+08:00 Rob Herring :
> If BOARD_GPU_DRIVERS is empty, build all the drivers. This doesn't
> enable building mesa as that is controlled by including libGLES_mesa in
> the product.
>
> Signed-off-by: Rob Herring 
> ---
>  Android.mk | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/Android.mk b/Android.mk
> index 9f481ee7e109..76858c1616bc 100644
> --- a/Android.mk
> +++ b/Android.mk
> @@ -1,3 +1,4 @@
> +
>  # Mesa 3-D graphics library
>  #
>  # Copyright (C) 2010-2011 Chia-I Wu 
> @@ -53,8 +54,15 @@ gallium_drivers := \
> vc4.HAVE_GALLIUM_VC4 \
> virgl.HAVE_GALLIUM_VIRGL
>
> +$(warning $(BOARD_GPU_DRIVERS))
> +
> +ifeq ($(BOARD_GPU_DRIVERS),all)
> +MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
> +MESA_BUILD_GALLIUM := $(filter HAVE_%, $(subst ., , $(gallium_drivers)))
> +else
>  MESA_BUILD_CLASSIC := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst 
> $(d).%,%, $(filter $(d).%, $(classic_drivers)
>  MESA_BUILD_GALLIUM := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst 
> $(d).%,%, $(filter $(d).%, $(gallium_drivers)
> +endif
>  $(foreach d, $(MESA_BUILD_CLASSIC) $(MESA_BUILD_GALLIUM), $(eval $(d) := 
> true))
>
>  # host and target must be the same arch to generate matypes.h
> --

Aren't some drivers for arm or x86 only?
Is it really possible to build all drivers?


-- 
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 07/12] Android: remove needless conditional including of child makefiles

2017-04-27 Thread Chih-Wei Huang
2017-04-28 3:43 GMT+08:00 Rob Herring :
> It is not necessary to filter driver and winsys directories based on the
> list of enabled drivers. Selecting the included driver libraries or not is
> sufficient to control what is built.

Hmm.. The benefit is faster parsing time.
Though it would be very small.

Anyway, to make the rules cleaner,
I'm not against it.

> Signed-off-by: Rob Herring 
> ---
>  Android.mk  |  8 --
>  src/gallium/Android.mk  | 52 
> +++--
>  src/mesa/Android.libmesa_dricore.mk |  4 ---
>  src/mesa/Android.libmesa_st_mesa.mk |  4 ---
>  src/mesa/drivers/dri/Android.mk | 11 +---
>  5 files changed, 4 insertions(+), 75 deletions(-)
>
> diff --git a/Android.mk b/Android.mk
> index fdbf22fe643a..08daf770f26b 100644
> --- a/Android.mk
> +++ b/Android.mk
> @@ -76,8 +76,6 @@ endif
>  MESA_ENABLE_LLVM := $(if $(filter radeonsi,$(MESA_GPU_DRIVERS)),true,false)
>
>  # add subdirectories
> -ifneq ($(strip $(MESA_GPU_DRIVERS)),)
> -
>  SUBDIRS := \
> src/gbm \
> src/loader \
> @@ -92,11 +90,5 @@ SUBDIRS := \
> src/vulkan
>
>  INC_DIRS := $(call all-named-subdir-makefiles,$(SUBDIRS))
> -
> -ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
>  INC_DIRS += $(call all-named-subdir-makefiles,src/gallium)
> -endif
> -
>  include $(INC_DIRS)
> -
> -endif
> diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
> index e67cfab5b316..7c6bda68d59f 100644
> --- a/src/gallium/Android.mk
> +++ b/src/gallium/Android.mk
> @@ -33,62 +33,16 @@ SUBDIRS += auxiliary/pipe-loader
>  # Gallium drivers and their respective winsys
>  #
>
> -# swrast
> -ifneq ($(filter swrast,$(MESA_GPU_DRIVERS)),)
>  SUBDIRS += winsys/sw/dri drivers/softpipe
> -endif
> -
> -# freedreno
> -ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
>  SUBDIRS += winsys/freedreno/drm drivers/freedreno
> -endif
> -
> -# i915g
> -ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
>  SUBDIRS += winsys/i915/drm drivers/i915
> -endif
> -
> -# nouveau
> -ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),)
> -SUBDIRS += \
> -   winsys/nouveau/drm \
> -   drivers/nouveau
> -endif
> -
> -# r300g/r600g/radeonsi
> -ifneq ($(filter r300g r600g radeonsi, $(MESA_GPU_DRIVERS)),)
> -SUBDIRS += winsys/radeon/drm
> -ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
> -SUBDIRS += drivers/r300
> -endif
> -ifneq ($(filter r600g radeonsi, $(MESA_GPU_DRIVERS)),)
> -SUBDIRS += drivers/radeon
> -ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
> -SUBDIRS += drivers/r600
> -endif
> -ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),)
> -SUBDIRS += drivers/radeonsi
> -SUBDIRS += winsys/amdgpu/drm
> -endif
> -endif
> -endif
> -
> -# vc4
> -ifneq ($(filter vc4, $(MESA_GPU_DRIVERS)),)
> +SUBDIRS += winsys/nouveau/drm drivers/nouveau
> +SUBDIRS += drivers/r300 drivers/r600 drivers/radeon drivers/radeonsi
> +SUBDIRS += winsys/amdgpu/drm winsys/radeon/drm
>  SUBDIRS += winsys/vc4/drm drivers/vc4
> -endif
> -
> -# virgl
> -ifneq ($(filter virgl, $(MESA_GPU_DRIVERS)),)
>  SUBDIRS += winsys/virgl/drm winsys/virgl/vtest drivers/virgl
> -endif
> -
> -# vmwgfx
> -ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
>  SUBDIRS += winsys/svga/drm drivers/svga
> -endif
>
> -# Gallium state trackers and target for dri
>  SUBDIRS += state_trackers/dri targets/dri
>
>  include $(call all-named-subdir-makefiles,$(SUBDIRS))
> diff --git a/src/mesa/Android.libmesa_dricore.mk 
> b/src/mesa/Android.libmesa_dricore.mk
> index 86196ceb36ab..599b9ccd71ed 100644
> --- a/src/mesa/Android.libmesa_dricore.mk
> +++ b/src/mesa/Android.libmesa_dricore.mk
> @@ -24,8 +24,6 @@
>  # libmesa_dricore.a
>  # --
>
> -ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
> -
>  LOCAL_PATH := $(call my-dir)
>
>  # Import the following variables:
> @@ -72,5 +70,3 @@ LOCAL_WHOLE_STATIC_LIBRARIES += \
>  include $(LOCAL_PATH)/Android.gen.mk
>  include $(MESA_COMMON_MK)
>  include $(BUILD_STATIC_LIBRARY)
> -
> -endif # MESA_BUILD_CLASSIC
> diff --git a/src/mesa/Android.libmesa_st_mesa.mk 
> b/src/mesa/Android.libmesa_st_mesa.mk
> index 92df4ad2845b..de2a60a70ed9 100644
> --- a/src/mesa/Android.libmesa_st_mesa.mk
> +++ b/src/mesa/Android.libmesa_st_mesa.mk
> @@ -24,8 +24,6 @@
>  # libmesa_st_mesa.a
>  # --
>
> -ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
> -
>  LOCAL_PATH := $(call my-dir)
>
>  # Import variables:
> @@ -72,5 +70,3 @@ LOCAL_STATIC_LIBRARIES += libmesa_nir libmesa_glsl
>  include $(LOCAL_PATH)/Android.gen.mk
>  include $(MESA_COMMON_MK)
>  include $(BUILD_STATIC_LIBRARY)
> -
> -endif # MESA_BUILD_GALLIUM
> diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
> index 72a5593fefad..d4fb670f84ce 100644
> --- a/src/mesa/drivers/dri/Android.mk
> +++ b/src/mesa/drivers/dri/Android.mk
> @@ -56,14 +56,5 @@ MESA_DRI_SHARED_LIBRARIES := \
>  

Re: [Mesa-dev] [PATCH 4/5] Android: drop Android 4.4 (KitKat) support

2017-03-19 Thread Chih-Wei Huang
2017-03-20 9:33 GMT+08:00 Rob Herring :
> Any users of KitKat are likely using an older version of Mesa and
> KitKat support adds complexity to the make files. Dropping support
> allows removing the MESA_LOLLIPOP_BUILD make variable in various make
> files.
>
> Signed-off-by: Rob Herring 
> ---
>  Android.common.mk  | 19 +++
>  Android.mk |  8 
>  src/egl/Android.mk |  4 
>  src/gallium/drivers/nouveau/Android.mk |  5 -
>  src/gallium/drivers/r600/Android.mk|  5 -
>  src/gallium/targets/dri/Android.mk | 11 ++-
>  src/mesa/drivers/dri/i915/Android.mk   |  6 --
>  src/mesa/drivers/dri/i965/Android.mk   |  6 --
>  8 files changed, 9 insertions(+), 55 deletions(-)
>
> diff --git a/Android.common.mk b/Android.common.mk
> index 7431b1d3dc5b..6b64c38d4d30 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -66,7 +66,10 @@ LOCAL_CFLAGS += \
>  LOCAL_CPPFLAGS += \
> -D__STDC_CONSTANT_MACROS \
> -D__STDC_FORMAT_MACROS \
> -   -D__STDC_LIMIT_MACROS
> +   -D__STDC_LIMIT_MACROS \
> +   -D_USING_LIBCXX \

I don't think we still need to define _USING_LIBCXX.
libcxx is enabled since lollipop.

> +   -Wno-error=non-virtual-dtor \
> +   -Wno-non-virtual-dtor \
>
>  # mesa requires at least c99 compiler
>  LOCAL_CONLYFLAGS += \
> @@ -103,17 +106,9 @@ LOCAL_SHARED_LIBRARIES += libdrm
>  endif
>  endif
>
> -LOCAL_CPPFLAGS += \
> -   $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-D_USING_LIBCXX) \
> -   -Wno-error=non-virtual-dtor \
> -   -Wno-non-virtual-dtor
> -
> -ifeq ($(MESA_LOLLIPOP_BUILD),true)
> -  LOCAL_CFLAGS_32 += 
> -DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
> -  LOCAL_CFLAGS_64 += 
> -DDEFAULT_DRIVER_DIR=\"/system/lib64/$(MESA_DRI_MODULE_REL_PATH)\"
> -else
> -  LOCAL_CFLAGS += 
> -DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
> -endif
> +LOCAL_MODULE_REL_PATH ?= $(MESA_DRI_MODULE_REL_PATH)
> +LOCAL_CFLAGS_32 += 
> -DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
> +LOCAL_CFLAGS_64 += 
> -DDEFAULT_DRIVER_DIR=\"/system/lib64/$(MESA_DRI_MODULE_REL_PATH)\"
>
>  # uncomment to keep the debug symbols
>  #LOCAL_STRIP_MODULE := false
> diff --git a/Android.mk b/Android.mk
> index 07a6cbae7486..fdbf22fe643a 100644
> --- a/Android.mk
> +++ b/Android.mk
> @@ -32,14 +32,6 @@
>  MESA_TOP := $(call my-dir)
>
>  MESA_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
> -MESA_ANDROID_MINOR_VERSION := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
> -ifeq ($(filter 1 2 3 4,$(MESA_ANDROID_MAJOR_VERSION)),)
> -MESA_LOLLIPOP_BUILD := true
> -else
> -define local-generated-sources-dir
> -$(call local-intermediates-dir)
> -endef
> -endif
>
>  MESA_DRI_MODULE_REL_PATH := dri
>  MESA_DRI_MODULE_PATH := 
> $(TARGET_OUT_SHARED_LIBRARIES)/$(MESA_DRI_MODULE_REL_PATH)
> diff --git a/src/egl/Android.mk b/src/egl/Android.mk
> index c383d246e87a..72bbe35a5eb0 100644
> --- a/src/egl/Android.mk
> +++ b/src/egl/Android.mk
> @@ -69,11 +69,7 @@ endif # MESA_BUILD_GALLIUM
>
>
>  LOCAL_MODULE := libGLES_mesa
> -ifeq ($(MESA_LOLLIPOP_BUILD),true)
>  LOCAL_MODULE_RELATIVE_PATH := egl
> -else
> -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
> -endif
>
>  include $(MESA_COMMON_MK)
>  include $(BUILD_SHARED_LIBRARY)
> diff --git a/src/gallium/drivers/nouveau/Android.mk 
> b/src/gallium/drivers/nouveau/Android.mk
> index 839a3899cb7b..d499d9918d86 100644
> --- a/src/gallium/drivers/nouveau/Android.mk
> +++ b/src/gallium/drivers/nouveau/Android.mk
> @@ -39,10 +39,5 @@ LOCAL_SRC_FILES := \
>  LOCAL_SHARED_LIBRARIES := libdrm_nouveau
>  LOCAL_MODULE := libmesa_pipe_nouveau
>
> -ifeq ($(MESA_LOLLIPOP_BUILD),true)
> -LOCAL_C_INCLUDES := external/libcxx/include
> -else
> -include external/stlport/libstlport.mk
> -endif
>  include $(GALLIUM_COMMON_MK)
>  include $(BUILD_STATIC_LIBRARY)
> diff --git a/src/gallium/drivers/r600/Android.mk 
> b/src/gallium/drivers/r600/Android.mk
> index 76ec3d048f50..a2fa62360880 100644
> --- a/src/gallium/drivers/r600/Android.mk
> +++ b/src/gallium/drivers/r600/Android.mk
> @@ -36,10 +36,5 @@ LOCAL_STATIC_LIBRARIES := libmesa_amd_common
>  LOCAL_SHARED_LIBRARIES := libdrm_radeon
>  LOCAL_MODULE := libmesa_pipe_r600
>
> -ifeq ($(MESA_LOLLIPOP_BUILD),true)
> -LOCAL_C_INCLUDES := external/libcxx/include
> -else
> -include external/stlport/libstlport.mk
> -endif
>  include $(GALLIUM_COMMON_MK)
>  include $(BUILD_STATIC_LIBRARY)
> diff --git a/src/gallium/targets/dri/Android.mk 
> b/src/gallium/targets/dri/Android.mk
> index dec8f055410e..cbea1ef26a84 100644
> --- a/src/gallium/targets/dri/Android.mk
> +++ b/src/gallium/targets/dri/Android.mk
> @@ -27,13 +27,6 @@ include $(CLEAR_VARS)
>
>  LOCAL_MODULE := gallium_dri
>
> -ifeq ($(MESA_LOLLIPOP_BUILD),true)
> -LOCAL_MODULE_RELATIVE_PATH := $(MESA_DRI_MODULE_REL_PATH)
> -else
> 

Re: [Mesa-dev] [PATCH] android: avoid using libdrm with host modules

2017-02-16 Thread Chih-Wei Huang
2016-11-02 23:42 GMT+08:00 Emil Velikov :
>
> Skimming through the outstanding patches for yours [1] I've tagged
> some [2] as superseded since the functionality has already landed. Let
> me know the status of the rest when you've got the chance.

Sorry I forgot to reply.

> [1] https://patchwork.freedesktop.org/project/mesa/patches/?submitter=15395
>
> [2]
> https://patchwork.freedesktop.org/patch/52321/
> https://patchwork.freedesktop.org/patch/52323/
> https://patchwork.freedesktop.org/patch/52337/

Yes, they are superseded and unnecessary.

> https://patchwork.freedesktop.org/patch/61946/

Not sure about this now.
I guess it's also unnecessary.


-- 
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] [RFC] mesa: drop current draw/read buffer when ctx is released

2016-10-30 Thread Chih-Wei Huang
2016-10-28 22:09 GMT+08:00 Rob Herring :
> +Mauro, Chih-Wei
>
> On Fri, Oct 28, 2016 at 7:22 AM, Rob Clark  wrote:
>> On Fri, Oct 28, 2016 at 1:24 AM, Tapani Pälli  wrote:
>>> On 10/27/2016 01:48 PM, Rob Clark wrote:

 On Thu, Oct 27, 2016 at 2:59 AM, Tapani Pälli 
 wrote:
>
> On 10/27/2016 12:16 AM, Rob Clark wrote:
>>
>> So, not quite sure if this is the *correct* solution, but it is at least
>> *a* solution to a problem with android wallpaper vs mesa that I've been
>> debugging.  Basically, what happens is:
>
>
> Could you tell more how to trigger this, is this with some particular
> live
> wallpaper and has this been working before (regression)? For me at least
> these default wallpapers have been working ok.

 Actually, it is the default static wallpaper that is problematic.  And
 IIRC, it has never worked, at least not with any of the gallium
 drivers (freedreno, virgl, vc4, etc).  Live-wallpaper did work, but
 does not appear to exist in AOSP builds anymore.

 If this works with i965 on android, I'd be curious how.  Or if you're
 android build had some mesa patches that are not upstream?
>>>
>>>
>>> I can confirm that default wallpaper is working on i965. Our Mesa tree
>>> currently looks like this:
>>>
>>> https://github.com/android-ia/external-mesa
>>>
>>> It's now quite a bit behind though because we were dealing with some
>>> non-graphics issues and are planning to rebase soon.
>>
>> I suppose it is possible that it is triggered by something different
>> that mesa/st does vs dri/i965?  Although I find it odd that
>> dri2_make_current() would drop the reference to the EGLSurface when
>> unbinding ctx, but _mesa_make_current() would not drop the reference
>> to the corresponding gl_framebuffer.
>>
>> Maybe the classic driver is holding an extra reference to the
>> EGLSurface so the _eglPutSurface() call in dri2_make_current() does
>> not actually drop the last refcnt?  Which would ensure when the window
>> surface is created it ends up with a different address..
>>
>> but, I wonder if you could try w/ Rob Herring's tree.. this is what we
>> are using for the upstream kernel + AOSP builds[1]:
>>
>>   https://github.com/robherring/mesa/commits/android-m
>>
>> I guess in theory we should both need the same patches on top of
>> mesa..  although also I guess we should also just try to get to the
>> point where we can both use upstream mesa tree directly.
>
> Looks like we have some similar patches for gralloc headers and using
> render node (since I picked up Tomasz's patches).
>
>> [1] see: 
>> https://github.com/robherring/generic_device/wiki/KConfig-based-Multi-platform-Android-Device-(and-Mesa-graphics)
>>
>> Btw, I guess in theory the qemu/x86 build from rob's generic_device
>> stuff should also work on real hw, so I think we should be able to
>> test exact same build that is failing with gallium/virgl with i965.
>> But I don't have any real hw for that.
>
> Mauro or Chih-Wei should be able to answer this (being do static
> wallpapers work in i965?).

Yes, it works i i965.
But it does break on some gallium drivers sometimes.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] android: avoid using libdrm with host modules

2016-10-28 Thread Chih-Wei Huang
Note LOCAL_CFLAGS and LOCAL_SHARED_LIBRARIES in Android.common.mk
are used by both host and target modules. However, commit 112e988
moved libdrm related flags to common. It causes the errors like:

error: 
'out/host/linux-x86/obj32/SHARED_LIBRARIES/libdrm_intermediates/export_includes',
 needed by 
'out/host/linux-x86/obj32/EXECUTABLES/mesa_gen_matypes_intermediates/import_includes',
 missing and no known rule to make it

No reason to use libdrm with host modules.

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 Android.common.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index dee22da..9f64c22 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -82,11 +82,13 @@ LOCAL_CFLAGS += \
-D__STDC_LIMIT_MACROS
 endif
 
+ifneq ($(LOCAL_IS_HOST_MODULE),true)
 # add libdrm if there are hardware drivers
 ifneq ($(filter-out swrast,$(MESA_GPU_DRIVERS)),)
 LOCAL_CFLAGS += -DHAVE_LIBDRM
 LOCAL_SHARED_LIBRARIES += libdrm
 endif
+endif
 
 LOCAL_CPPFLAGS += \
$(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-D_USING_LIBCXX) \
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH] mesa_glinterop: allow building without X and related headers

2016-10-12 Thread Chih-Wei Huang
2016-10-13 1:49 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
> This commit effectively reverts c10dcb2ce837922c6ee4e191e6d6202098a5ee10
> and fixes the typedef redefinition which inspired it.
>
> In order to prevent requiring X packages at build time earlier commit
> forward declared the required X/GLX typedefs. Since that approach
> introduced typedef redefinition (a C11 feature) it was reverted.
>
> To avoid the redefinition while _not_ mandating X and related headers
> forward declare the structs and use those through the header.
>
> As anyone uses the mesa interop header they ensure that the X (or others
> in terms of EGL) headers are included, which ensures that everything is
> resolved within the compilation unit.
>
> Cc: Vinson Lee <v...@freedesktop.org>
> Cc: "12.0" <mesa-sta...@lists.freedesktop.org>
> Cc: Tapani Pälli <tapani.pa...@intel.com>
> Cc: Chih-Wei Huang <cwhu...@android-x86.org>
> Fixes: c10dcb2ce837 ("Revert "mesa_glinterop: remove inclusion of GLX
> header"")
> Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770
> Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
> ---
> TL;DR; Yay typedefs, because they make things so much better ;-)
>
> Tapani/Chih-Wei, this should fix the breakage that you are seing. Please
> let me know if it sorts things on your end.
>
> Vison, this should resolve things on your end as well. A confirmation
> would be great.
> ---
>  include/GL/mesa_glinterop.h | 13 -
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h
> index c6a967e..173476a 100644
> --- a/include/GL/mesa_glinterop.h
> +++ b/include/GL/mesa_glinterop.h
> @@ -52,12 +52,15 @@
>
>  #include 
>  #include 
> -#include 
>
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
>
> +/* Forward declarations to avoid inclusion of GL/glx.h */
> +struct _XDisplay;
> +struct __GLXcontextRec;
> +
>  /* Forward declarations to avoid inclusion of EGL/egl.h */
>  typedef void *EGLDisplay;
>  typedef void *EGLContext;
> @@ -243,7 +246,7 @@ struct mesa_glinterop_export_out {
>   * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
>   */
>  int
> -MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context,
> +MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct 
> __GLXcontextRec *context,
>  struct mesa_glinterop_device_info *out);
>
>
> @@ -268,7 +271,7 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, 
> EGLContext context,
>   * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error
>   */
>  int
> -MesaGLInteropGLXExportObject(Display *dpy, GLXContext context,
> +MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec 
> *context,
>   struct mesa_glinterop_export_in *in,
>   struct mesa_glinterop_export_out *out);
>
> @@ -283,11 +286,11 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext 
> context,
>   struct mesa_glinterop_export_out *out);
>
>
> -typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, 
> GLXContext context,
> +typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, 
> struct __GLXcontextRec *context,
>   struct 
> mesa_glinterop_device_info *out);
>  typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, 
> EGLContext context,
>   struct 
> mesa_glinterop_device_info *out);
> -typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext 
> context,
> +typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, 
> struct __GLXcontextRec *context,
>struct 
> mesa_glinterop_export_in *in,
>struct 
> mesa_glinterop_export_out *out);
>  typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext 
> context,
> --
> 2.10.0
>

Build OK on Android 7.0. Thanks!

BTW, the typedef EGLDisplay and EGLContext
has similar redefinition issues.
Should we fix them in the same way?

[ 95% 667/699] target  C: libGLES_mesa <=
external/mesa/src/egl/drivers/dri2/egl_dri2.c
In file included from external/mesa/src/egl/drivers/dri2/egl_dri2.c:58:
In file included from external/mesa/src/egl/drivers/dri2/egl_dri2.h:73:
In file included from external/mesa/src/egl/main/eglconfig.h:

Re: [Mesa-dev] [PATCH] Revert "mesa_glinterop: remove inclusion of GLX header"

2016-10-12 Thread Chih-Wei Huang
2016-10-04 7:03 GMT+08:00 Vinson Lee :
> This reverts commit 8472045b16b3e4621553fe451a20a9ba9f0d44b6.
>
> Conflicts:
>
> include/GL/mesa_glinterop.h
>
> This patch fixes this build error with GCC 4.4.
>
>   Compiling src/glx/dri_common_interop.c ...
> In file included from src/glx/dri_common_interop.c:33:
> include/GL/mesa_glinterop.h:62: error: redefinition of typedef ‘GLXContext’
> include/GL/glx.h:165: note: previous declaration of ‘GLXContext’ was here
>
> Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770
> Signed-off-by: Vinson Lee 
> ---
>  include/GL/mesa_glinterop.h |5 +
>  1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h
> index 383d7f9..c6a967e 100644
> --- a/include/GL/mesa_glinterop.h
> +++ b/include/GL/mesa_glinterop.h
> @@ -52,15 +52,12 @@
>
>  #include 
>  #include 
> +#include 
>
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
>
> -/* Forward declarations to avoid inclusion of GL/glx.h */
> -typedef struct _XDisplay Display;
> -typedef struct __GLXcontextRec *GLXContext;
> -
>  /* Forward declarations to avoid inclusion of EGL/egl.h */
>  typedef void *EGLDisplay;
>  typedef void *EGLContext;
> --

NACK.
The patch breaks Android build (at least).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] android: fix a build issue with libmesa_st_mesa_32

2016-09-06 Thread Chih-Wei Huang
2016-08-29 16:52 GMT+08:00 Tapani Pälli :
> make sure nir_opcodes.h is in LOCAL_GENERATED_SOURCES otherwise
> build fails with:
>
> "In file included from
> external/mesa/src/mesa/state_tracker/st_glsl_to_nir.cpp:44:
> external/mesa/src/compiler/nir/nir.h:42:10: fatal error: 'nir_opcodes.h' file 
> not found"

Could you explain how to reproduce this error?

Someone also reported a similar error to us recently.
However, from my debugging I can't see how it happens.
Any file which includes nir_opcodes.h should
get this dependency from its .P file:

$OUT/obj/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_nir.P
$OUT/obj_x86/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_nir.P

cwhuang@icm05:~/git/marshmallow-x86$ grep nir_opcodes.h
$OUT/obj/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_nir.P
 
out/target/product/x86_64/gen/STATIC_LIBRARIES/libmesa_nir_intermediates/nir/nir_opcodes.h
\
 
out/target/product/x86_64/gen/STATIC_LIBRARIES/libmesa_nir_intermediates/nir/nir_opcodes.h
:
cwhuang@icm05:~/git/marshmallow-x86$ grep nir_opcodes.h
$OUT/obj_x86/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_nir.P
 
out/target/product/x86_64/gen/STATIC_LIBRARIES/libmesa_nir_intermediates/nir/nir_opcodes.h
\
 
out/target/product/x86_64/gen/STATIC_LIBRARIES/libmesa_nir_intermediates/nir/nir_opcodes.h
:

So I can't reproduce this issue.

Please refer to the discussion:

https://groups.google.com/d/msg/android-x86/EwCIlPer1i8/M439AaULCQAJ

> Signed-off-by: Tapani Pälli 
> ---
>  src/mesa/Android.libmesa_st_mesa.mk | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/mesa/Android.libmesa_st_mesa.mk 
> b/src/mesa/Android.libmesa_st_mesa.mk
> index 785b6de..e70f51e 100644
> --- a/src/mesa/Android.libmesa_st_mesa.mk
> +++ b/src/mesa/Android.libmesa_st_mesa.mk
> @@ -63,6 +63,8 @@ LOCAL_C_INCLUDES := \
>  LOCAL_WHOLE_STATIC_LIBRARIES += \
> libmesa_program
>
> +LOCAL_GENERATED_SOURCES := $(MESA_GEN_NIR_H)
> +
>  LOCAL_STATIC_LIBRARIES += libmesa_nir
>
>  include $(LOCAL_PATH)/Android.gen.mk
> --




-- 
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] Android: apps crashed on Intel Gen9 GPU

2016-05-14 Thread Chih-Wei Huang
2016-05-13 15:30 GMT+08:00 Pohjolainen, Topi <topi.pohjolai...@intel.com>:
> On Thu, May 12, 2016 at 12:25:25AM +0800, Chih-Wei Huang wrote:
>> Testing android-x86 with mesa 11.2.2,
>> I found the Google Play crashed forever on
>> a device with Intel Gen9 GPU (e.g., Skylake).
>>
>> After analyzing, the i965 driver seems to assume
>> irb->mt is not null. For example in
>> brw_meta_fast_clear of brw_meta_fast_clear.c:
>>
>>   struct intel_renderbuffer *irb = intel_renderbuffer(rb);
>>   ...
>>   if (brw->gen >= 9 &&
>>   brw_format_for_mesa_format(irb->mt->format) !=
>> ^ => crashing
>>   brw->render_target_format[irb->mt->format])
>>  clear_type = REP_CLEAR;
>>
>> If I added null checking to irb->mt, it fixes this crashing.
>> However, the app still crashed at other place that
>> accesses irb->mt similarly.
>> (brw_draw.c line 399, gen8_surface_state.c line 432, etc)
>>
>> Please comment how to fix it correctly.
>> Why irb->mt is null but the code assumes it's not?
>
> As far as I understand something has gone wrong before - having an
> intel_renderbuffer without a miptree shouldn't be a reachable state at all.

Thank you for the reply.
When/where should the miptree be set?
How can I debug it?


-- 
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


[Mesa-dev] Android: apps crashed on Intel Gen9 GPU

2016-05-11 Thread Chih-Wei Huang
Testing android-x86 with mesa 11.2.2,
I found the Google Play crashed forever on
a device with Intel Gen9 GPU (e.g., Skylake).

After analyzing, the i965 driver seems to assume
irb->mt is not null. For example in
brw_meta_fast_clear of brw_meta_fast_clear.c:

  struct intel_renderbuffer *irb = intel_renderbuffer(rb);
  ...
  if (brw->gen >= 9 &&
  brw_format_for_mesa_format(irb->mt->format) !=
^ => crashing
  brw->render_target_format[irb->mt->format])
 clear_type = REP_CLEAR;

If I added null checking to irb->mt, it fixes this crashing.
However, the app still crashed at other place that
accesses irb->mt similarly.
(brw_draw.c line 399, gen8_surface_state.c line 432, etc)

Please comment how to fix it correctly.
Why irb->mt is null but the code assumes it's not?


-- 
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] [android-x86-devel] [PATCH] isl: add support for Android libisl static

2016-05-10 Thread Chih-Wei Huang
Hi Mauro,
I think you should put your name on the
Copyright section of the Android.*.mk.
I understand these files are copied.
But it's you who created and modified these files.
So it's better to use your name instead of
Intel, LunarG, ...

2016-05-11 8:31 GMT+08:00 Rob Herring :
> On Tue, May 10, 2016 at 6:56 PM, Mauro Rossi  wrote:
>> This patch adds support for libisl static, needed to build i965.
>>
>> Android.genxml.gen.mk generates the necessary gen%_pack.h headers
>>
>> Android.gen.mk generates isl_format_layout.c
>
> [...]
>
>> diff --git a/src/intel/isl/Makefile.sources b/src/intel/isl/Makefile.sources
>> new file mode 100644
>> index 000..c8eb5b3
>> --- /dev/null
>> +++ b/src/intel/isl/Makefile.sources
>> @@ -0,0 +1,31 @@
>> +libisl_FILES = \
>
> Makefile.am needs to use all of these variables. Do that and this file
> in a separate patch.
>
>> +   isl.c \
>> +   isl.h \
>> +   isl_format.c \
>> +   isl_format_layout.c \
>> +   isl_gen4.c \
>> +   isl_gen4.h \
>> +   isl_gen6.c \
>> +   isl_gen6.h \
>> +   isl_storage_image.c
>> +
>> +libisl_gen7_FILES = \
>> +   isl_gen7.c \
>> +   isl_gen7.h \
>> +   isl_surface_state.c
>> +
>> +libisl_gen75_FILES = \
>> +   isl_surface_state.c
>> +
>> +libisl_gen8_FILES = \
>> +   isl_gen8.c \
>> +   isl_gen8.h \
>> +   isl_surface_state.c
>> +
>> +libisl_gen9_FILES = \
>> +   isl_gen9.c \
>> +   isl_gen9.h \
>> +   isl_surface_state.c
>> +
>> +libisl_GENERATED_FILES = \
>> +   isl_format_layout.c
>> diff --git a/src/mesa/drivers/dri/i965/Android.mk 
>> b/src/mesa/drivers/dri/i965/Android.mk
>> index 9fd3a30..b46d5e3 100644
>> --- a/src/mesa/drivers/dri/i965/Android.mk
>> +++ b/src/mesa/drivers/dri/i965/Android.mk
>> @@ -45,14 +45,16 @@ LOCAL_CFLAGS += \
>>  endif
>>
>>  LOCAL_C_INCLUDES := \
>> -   $(MESA_DRI_C_INCLUDES)
>> +   $(MESA_DRI_C_INCLUDES) \
>> +   $(MESA_TOP)/src/intel
>
> This should not be needed if libisl exports includes.
>
>>  LOCAL_SRC_FILES := \
>> $(i965_compiler_FILES) \
>> $(i965_FILES)
>>
>>  LOCAL_WHOLE_STATIC_LIBRARIES := \
>> -   $(MESA_DRI_WHOLE_STATIC_LIBRARIES)
>> +   $(MESA_DRI_WHOLE_STATIC_LIBRARIES) \
>> +   libisl
>>
>>  LOCAL_SHARED_LIBRARIES := \
>> $(MESA_DRI_SHARED_LIBRARIES) \



-- 
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] [android-x86-devel] [RFC 0/7] android: enable llvmpipe for software rendering

2016-04-29 Thread Chih-Wei Huang
2016-04-29 2:50 GMT+08:00 Rob Herring :
>>
>> I suppose if it's possible to set up some build bot for it which sends
>> out emails complaining when it breaks that would help with the build
>> failures.
>
> I have that in my plans, but it is not there yet. I'm updating to
> master at least weekly and fixing things, but new breakage seems to
> happen faster than getting fixes committed.

Yes, that's exactly what we feel.

> I'm usually the one fixing
> the breakage. Given most people don't have an Android tree, having
> them fix build problems is not all that realistic. I'll happily test
> the fixes though.

Mauro is also working on the master branch.
I think you can co-work with him closer to
avoid duplicate effort.

> BTW, the latest break is from "i965/fs_surface_builder: Add a helper
> for converting GL to ISL formats."

Yes, that's what makes me decide to give up.

I wish I had more time on it but
currently I have to do other stuff.


-- 
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] [android-x86-devel] [RFC 0/7] android: enable llvmpipe for software rendering

2016-04-28 Thread Chih-Wei Huang
2016-04-28 22:22 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
> Hi Chih-Wei,
>
> Thanks for getting these out to the community.
>
> On 28 April 2016 at 08:34, Chih-Wei Huang <cwhu...@android-x86.org> wrote:
>> This is a series of patches developed by Jide Technolody to enable
>> the llvmpipe for software rendering of Android.
>> It makes a device without a Mesa supported GPU could run most modern
>> Android apps.
>>
> Afaict one should only need the extra Android.mk files to get llvmpipe
> considering that softpipe already works.
> Have you/the Jide folks tried the latter already ? Does it work
> without these patches ?

Hmm, interesting point.
Did you mean just adding Android.mk for llvmpipe
is enough?

>> These patches are mainly developed and tested on the 11.0 and 11.2
>> branches. They might not work with the Mesa master branch.
>>
> Humble request - please always aim for master. Doing this will get you
> the latest stable branch for free.
> If you're targeting some old stable branch then you'll will have to
> duplicate the effort to land things in master. And new functionality
> goes _only_ in master

I clearly understand this point.
Actually I've spent several days to try to
make it work on the master branch.
That's why it was delayed -- I supposed to send them
in the last week.

However, the master branch is always broken for android.
There are a lot of build break I need to fix and workaround
or I can't test it. After fixed all the errors and built it OK,
however, it didn't work as expected.
The system boots to Home but all display is garbled.
I'm not sure if I made some mistakes on
fixing the building errors or there are some changes
that really broke these patches.
(the latest commit I've tried in the master is 32cb7d61)
I finally decide to give it up and send them as the current status.
(otherwise it will take too much of my time and delay
my other pending tasks)

Unfortunately the situation is most mesa developers
don't care android so they usually break android build
or functions. Unless the situation is changed it's very hard
for us to follow the master branch closely.

>> The patches depend on some patches developed by Varad Gautam which
>> have not been merged in Mesa master yet, say
>>
>> fc40946 egl: fixup: define droid_image_loader_extension
>> d15901d egl: android: populate dri2_surf->window early
>> cff1928 egl: android: use __DRI_IMAGE_LOADER to get color buffers
>> b556be4 egl: android: experimental dma-buf fd support
>>
>> The dependency may be removed but we haven't tested that yet.
>>
> Afaict none of Varad's work should be required here. It adds an
> alternative (better) method of the already existing functionality.

I also guess that but it need more time to verify that.

> Related: iirc things have gone wrong during the rebase of Varad's work
> in Android-x86. Rob H recently sent some patches (based of Android-x86
> ?) which has some strange/extra code in them.

Yes I notice that but again it need time
to figure what patches are really needed.
However due to the master branch status is horrible
for android so I gave up.

If possible, I'll ask Mauro to follow the master branch
and work with others to fix android stuff
for future android release (i.e., N).
For marshmallow-x86 we will stay in mesa 11.2
and I'll move my time to other pending tasks
for a stable release.

>> WuZhen (7):
>>   st/dri: fix double free of dri_drawable
>>   tgsi: fix stack allocated struct may not be initialized
>>   gallium/swrast: fix dri_sw_dt->data free func not matching alloc func
>>   android: print debug info to logcat
>>   android: enable dlopen
>>   android: enable x86 asm and sse4 for x86 and x86_64
>>   android: support swrast
>
> A couple of high level suggestions:
>  - Please split patches appropriately (more). Some patches are great
> while others should become 3-4 separate ones.

Actually I think the first 6 patches are already good.
The 7th patch is bigger and could probably be split.
Could you suggest how to do it?

>  - Drop the NO_REF_TASK, tested and Change-Id tags. Sadly these don't
> bring much, plus non-Jide people are unlikely to have access to the
> Gerrit and other instances where these are used.

These are Jide's internal comments I just kept it as.
I've no opinion to keep or remove them.
Let WuZhen decide.

> I'll try to look into the individual patches shortly.

Thanks!

-- 
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


[Mesa-dev] [RFC 4/7] android: print debug info to logcat

2016-04-28 Thread Chih-Wei Huang
From: WuZhen <wuz...@jidemail.com>

Redirect logs printed to stderr to logcat.

NO_REF_TASK
tested: local run

Change-Id: I58e3966a608af361b86c54b4c95a92561b711968
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/gallium/auxiliary/os/os_misc.c   | 12 ++--
 src/gallium/auxiliary/util/u_debug.c |  2 +-
 src/gallium/targets/dri/Android.mk   |  1 +
 src/mesa/main/errors.c   | 12 
 4 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_misc.c 
b/src/gallium/auxiliary/os/os_misc.c
index d6b83e9..08c438e 100644
--- a/src/gallium/auxiliary/os/os_misc.c
+++ b/src/gallium/auxiliary/os/os_misc.c
@@ -46,8 +46,10 @@
 
 #endif
 
-
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_CYGWIN) || 
defined(PIPE_OS_SOLARIS)
+#if defined(PIPE_OS_ANDROID)
+#  define LOG_TAG "gallium"
+#  include 
+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_CYGWIN) || 
defined(PIPE_OS_SOLARIS)
 #  include 
 #elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_BSD)
 #  include 
@@ -89,6 +91,12 @@ os_log_message(const char *message)
   fflush(fout);
}
 #else /* !PIPE_SUBSYSTEM_WINDOWS */
+#if defined(PIPE_OS_ANDROID)
+   if (fout == stderr) {
+  ALOGD(message);
+  return;
+   }
+#endif
fflush(stdout);
fputs(message, fout);
fflush(fout);
diff --git a/src/gallium/auxiliary/util/u_debug.c 
b/src/gallium/auxiliary/util/u_debug.c
index db66357..12ceada 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -55,7 +55,7 @@ void
 _debug_vprintf(const char *format, va_list ap)
 {
static char buf[4096] = {'\0'};
-#if defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_EMBEDDED)
+#if defined(PIPE_OS_WINDOWS) || defined(PIPE_OS_ANDROID) || 
defined(PIPE_SUBSYSTEM_EMBEDDED)
/* We buffer until we find a newline. */
size_t len = strlen(buf);
int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
diff --git a/src/gallium/targets/dri/Android.mk 
b/src/gallium/targets/dri/Android.mk
index 03c3795..a14d449 100644
--- a/src/gallium/targets/dri/Android.mk
+++ b/src/gallium/targets/dri/Android.mk
@@ -46,6 +46,7 @@ LOCAL_CFLAGS :=
 
 LOCAL_SHARED_LIBRARIES := \
libdl \
+   liblog \
libglapi \
libexpat \
 
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 9932b4a..1bdd668 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -42,6 +42,10 @@
 #include "util/hash_table.h"
 #include "util/simple_list.h"
 
+#if defined(ANDROID)
+#  define LOG_TAG "mesa"
+#  include 
+#endif
 
 static FILE *LogFile = NULL;
 
@@ -87,6 +91,14 @@ output_if_debug(const char *prefixString, const char 
*outputString,
  fprintf(LogFile, "\n");
   fflush(LogFile);
 
+#if defined(ANDROID)
+  {
+ char buf[4096];
+ _mesa_snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, 
outputString, newline ? "\n" : "");
+ ALOGD(buf);
+  }
+#endif
+
 #if defined(_WIN32)
   /* stderr from windows applications without console is not usually 
* visible, so communicate with the debugger instead */ 
-- 
1.9.1

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


[Mesa-dev] [RFC 3/7] gallium/swrast: fix dri_sw_dt->data free func not matching alloc func

2016-04-28 Thread Chih-Wei Huang
From: WuZhen <wuz...@jidemail.com>

The old code causes crashes when using software rendering.

NO_REF_TASK
tested: local run

Change-Id: Ib1d7f36b9f25ccc13afdd28d1e34f76162d3
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/gallium/winsys/sw/dri/dri_sw_winsys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c 
b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index 5c98f26..94d5092 100644
--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -125,7 +125,7 @@ dri_sw_displaytarget_destroy(struct sw_winsys *ws,
 {
struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
 
-   FREE(dri_sw_dt->data);
+   align_free(dri_sw_dt->data);
 
FREE(dri_sw_dt);
 }
-- 
1.9.1

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


[Mesa-dev] [RFC 6/7] android: enable x86 asm and sse4 for x86 and x86_64

2016-04-28 Thread Chih-Wei Huang
From: WuZhen <wuz...@jidemail.com>

Support multilib compilation use runtime feature selection.

NO_REF_TASK
tested: local run

Change-Id: Iee7961effdecde09cfbdaf09455bfb0912699ae3
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 Android.common.mk| 21 ++---
 Android.mk   |  5 -
 src/mapi/Android.mk  |  3 +++
 src/mesa/Android.gen.mk  | 25 ++---
 src/mesa/Android.libmesa_dricore.mk  | 20 +---
 src/mesa/Android.libmesa_sse41.mk|  5 -
 src/mesa/Android.libmesa_st_mesa.mk  | 20 +---
 src/mesa/Android.mesa_gen_matypes.mk |  7 +--
 src/mesa/drivers/dri/i965/Android.mk |  5 -
 9 files changed, 66 insertions(+), 45 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index d6bf717..93c1465 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -64,13 +64,28 @@ LOCAL_CFLAGS += \
 LOCAL_CONLYFLAGS += \
-std=c99
 
+x86_flags := \
+   -DUSE_SSE41 \
+
+x86_64_flags := \
+   -DUSE_SSE41 \
+
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
-ifeq ($(TARGET_ARCH),x86)
-LOCAL_CFLAGS += \
+x86_flags += \
-DUSE_X86_ASM \
+   -DUSE_MMX_ASM \
+   -DUSE_3DNOW_ASM \
+   -DUSE_SSE_ASM \
+
+x86_64_flags += \
+   -DUSE_X86_64_ASM \
 
 endif
-endif
+
+LOCAL_ASFLAGS_x86 += $(x86_flags)
+LOCAL_ASFLAGS_x86_64 += $(x86_64_flags)
+LOCAL_CFLAGS_x86 += $(x86_flags)
+LOCAL_CFLAGS_x86_64 += $(x86_64_flags)
 
 ifeq ($(MESA_ENABLE_LLVM),true)
 LOCAL_CFLAGS += \
diff --git a/Android.mk b/Android.mk
index 67d894f..368d02e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -63,12 +63,7 @@ $(warning invalid GPU drivers: $(invalid_drivers))
 MESA_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(MESA_GPU_DRIVERS))
 endif
 
-# host and target must be the same arch to generate matypes.h
-ifeq ($(TARGET_ARCH),$(HOST_ARCH))
 MESA_ENABLE_ASM := true
-else
-MESA_ENABLE_ASM := false
-endif
 
 ifneq ($(filter $(classic_drivers), $(MESA_GPU_DRIVERS)),)
 MESA_BUILD_CLASSIC := true
diff --git a/src/mapi/Android.mk b/src/mapi/Android.mk
index 4445218..b654c25 100644
--- a/src/mapi/Android.mk
+++ b/src/mapi/Android.mk
@@ -57,6 +57,9 @@ intermediates := $(call local-generated-sources-dir)
 abi_header := $(intermediates)/$(abi_header)
 LOCAL_GENERATED_SOURCES := $(abi_header)
 
+# workaround build warning
+LOCAL_LDFLAGS_x86 += -Wl,--no-warn-shared-textrel
+
 $(abi_header): PRIVATE_PRINTER := shared-glapi
 
 mapi_abi_headers += $(abi_header)
diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
index e567102..e04482b 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -45,10 +45,11 @@ LOCAL_SRC_FILES := $(filter-out $(sources), 
$(LOCAL_SRC_FILES))
 LOCAL_C_INCLUDES += $(intermediates)/main
 
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
-ifeq ($(TARGET_ARCH),x86)
-sources += x86/matypes.h
-LOCAL_C_INCLUDES += $(intermediates)/x86
-endif
+LOCAL_GENERATED_SOURCES_x86 += $(addprefix $(intermediates)/, x86/matypes.h)
+LOCAL_GENERATED_SOURCES_x86_64 += $(addprefix $(intermediates)/, 
x86_64/matypes.h)
+
+LOCAL_C_INCLUDES_x86 += $(intermediates)/x86
+LOCAL_C_INCLUDES_x86_64 += $(intermediates)/x86_64
 endif
 
 sources += main/git_sha1.h
@@ -79,12 +80,22 @@ $(intermediates)/main/git_sha1.h: $(wildcard 
$(MESA_TOP)/.git/HEAD)
> $@; \
fi
 
-matypes_deps := \
-   $(BUILD_OUT_EXECUTABLES)/mesa_gen_matypes$(BUILD_EXECUTABLE_SUFFIX) \
+matypes_deps32 := \
+   $(BUILD_OUT_EXECUTABLES)/mesa_gen_matypes32$(BUILD_EXECUTABLE_SUFFIX) \
+   $(LOCAL_PATH)/main/mtypes.h \
+   $(LOCAL_PATH)/tnl/t_context.h
+
+matypes_deps64 := \
+   $(BUILD_OUT_EXECUTABLES)/mesa_gen_matypes64$(BUILD_EXECUTABLE_SUFFIX) \
$(LOCAL_PATH)/main/mtypes.h \
$(LOCAL_PATH)/tnl/t_context.h
 
-$(intermediates)/x86/matypes.h: $(matypes_deps) 
+$(intermediates)/x86/matypes.h: $(matypes_deps32)
+   @mkdir -p $(dir $@)
+   @echo "MATYPES: $(PRIVATE_MODULE) <= $(notdir $@)"
+   $(hide) $< > $@
+
+$(intermediates)/x86_64/matypes.h: $(matypes_deps64)
@mkdir -p $(dir $@)
@echo "MATYPES: $(PRIVATE_MODULE) <= $(notdir $@)"
$(hide) $< > $@
diff --git a/src/mesa/Android.libmesa_dricore.mk 
b/src/mesa/Android.libmesa_dricore.mk
index d7647a7..6773b5b 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -31,6 +31,7 @@ LOCAL_PATH := $(call my-dir)
 # Import the following variables:
 # MESA_FILES
 # X86_FILES
+# X86_64_FILES
 include $(LOCAL_PATH)/Makefile.sources
 
 include $(CLEAR_VARS)
@@ -42,19 +43,10 @@ LOCAL_SRC_FILES := \
$(MESA_FILES)
 
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
-ifeq ($(TARGET_ARCH),x86)
-   LOCAL_SRC_FILES += $(X86_FILES)
-endif # x86
+   LOCAL_SRC_FILES_x86 += $(X86_FILES)
+   LOCAL_SRC_FILES_x86_64 += $(X86_64_FILES)
 endif # 

[Mesa-dev] [RFC 2/7] tgsi: fix stack allocated struct may not be initialized

2016-04-28 Thread Chih-Wei Huang
From: WuZhen <wuz...@jidemail.com>

NO_REF_TASK
tested: local run

Change-Id: Ied449126c2059d2654afebdf68972cb00862a4ce
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/gallium/auxiliary/tgsi/tgsi_dump.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c 
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index f232f38..66d801d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -432,6 +432,7 @@ tgsi_dump_declaration(
const struct tgsi_full_declaration *decl )
 {
struct dump_ctx ctx;
+   memset(, 0, sizeof(ctx));
 
ctx.dump_printf = dump_ctx_printf;
 
@@ -480,6 +481,7 @@ void tgsi_dump_property(
const struct tgsi_full_property *prop )
 {
struct dump_ctx ctx;
+   memset(, 0, sizeof(ctx));
 
ctx.dump_printf = dump_ctx_printf;
 
@@ -511,6 +513,7 @@ tgsi_dump_immediate(
const struct tgsi_full_immediate *imm )
 {
struct dump_ctx ctx;
+   memset(, 0, sizeof(ctx));
 
ctx.dump_printf = dump_ctx_printf;
 
@@ -671,6 +674,7 @@ tgsi_dump_instruction(
uint instno )
 {
struct dump_ctx ctx;
+   memset(, 0, sizeof(ctx));
 
ctx.instno = instno;
ctx.immno = instno;
@@ -696,6 +700,7 @@ void
 tgsi_dump_to_file(const struct tgsi_token *tokens, uint flags, FILE *file)
 {
struct dump_ctx ctx;
+   memset(, 0, sizeof(ctx));
 
ctx.iter.prolog = prolog;
ctx.iter.iterate_instruction = iter_instruction;
@@ -766,6 +771,7 @@ tgsi_dump_str(
size_t size)
 {
struct str_dump_ctx ctx;
+   memset(, 0, sizeof(ctx));
 
ctx.base.iter.prolog = prolog;
ctx.base.iter.iterate_instruction = iter_instruction;
@@ -805,6 +811,7 @@ tgsi_dump_instruction_str(
size_t size)
 {
struct str_dump_ctx ctx;
+   memset(, 0, sizeof(ctx));
 
ctx.base.instno = instno;
ctx.base.immno = instno;
-- 
1.9.1

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


[Mesa-dev] [RFC 1/7] st/dri: fix double free of dri_drawable

2016-04-28 Thread Chih-Wei Huang
From: WuZhen <wuz...@jidemail.com>

In the callchain destroy_surface->destroyDrawable->dri_put_drawable->
dri_put_drawable->DestroyBuffer

By the semantic of it, dri_destroy_buffer should not free drawable struct,
all vendor specific and legacy swrast version of the function do not.
wonder why no body else ran into this.

NO_REF_TASK
tested: local run

Change-Id: Ibe82d82d2e34b162e64bf0b8805f8a4553d362d5
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 src/gallium/state_trackers/dri/dri_drawable.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_drawable.c 
b/src/gallium/state_trackers/dri/dri_drawable.c
index adc5128..c72335b 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -176,8 +176,6 @@ dri_destroy_buffer(__DRIdrawable * dPriv)
   pipe_resource_reference(>msaa_textures[i], NULL);
 
swap_fences_unref(drawable);
-
-   FREE(drawable);
 }
 
 /**
-- 
1.9.1

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


[Mesa-dev] [RFC 5/7] android: enable dlopen

2016-04-28 Thread Chih-Wei Huang
From: WuZhen <wuz...@jidemail.com>

NO_REF_TASK
tested: local run

Change-Id: I7c3c03f844ba6fc7ee3d6817d9ee1e806b92aed7
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 Android.common.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Android.common.mk b/Android.common.mk
index 71046e7..d6bf717 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -55,6 +55,7 @@ LOCAL_CFLAGS += \
-DHAVE___BUILTIN_CLZLL \
-DHAVE___BUILTIN_UNREACHABLE \
-DHAVE_PTHREAD=1 \
+   -DHAVE_DLOPEN \
-DTEXTURE_FLOAT_ENABLED \
-fvisibility=hidden \
-Wno-sign-compare
@@ -67,7 +68,6 @@ ifeq ($(strip $(MESA_ENABLE_ASM)),true)
 ifeq ($(TARGET_ARCH),x86)
 LOCAL_CFLAGS += \
-DUSE_X86_ASM \
-   -DHAVE_DLOPEN \
 
 endif
 endif
-- 
1.9.1

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


[Mesa-dev] [RFC 7/7] android: support swrast

2016-04-28 Thread Chih-Wei Huang
From: WuZhen <wuz...@jidemail.com>

System boots up with gles_mesa/softpipe/llvmpipe.

NO_REF_TASK
tested: local run

Change-Id: I629ed0ca9fad12e32270eb8e8bfa9f7681b68474
Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
 Android.mk |   2 +-
 include/GL/internal/dri_interface.h|   9 +-
 src/egl/Android.mk |   1 +
 src/egl/drivers/dri2/egl_dri2.c|   1 +
 src/egl/drivers/dri2/platform_android.c| 386 -
 src/gallium/Android.mk |   2 +-
 src/gallium/drivers/llvmpipe/Android.mk|  37 +++
 src/gallium/include/state_tracker/drm_driver.h |  10 +-
 src/gallium/state_trackers/dri/dri2.c  |   6 +-
 src/gallium/state_trackers/dri/drisw.c |  46 +++
 src/gallium/targets/dri/Android.mk |   8 +-
 src/gallium/winsys/sw/dri/Android.mk   |   2 +
 src/gallium/winsys/sw/dri/dri_sw_winsys.c  |  64 
 src/mesa/drivers/dri/common/dri_util.c |   4 +-
 src/mesa/drivers/dri/common/dri_util.h |   2 +-
 15 files changed, 555 insertions(+), 25 deletions(-)
 create mode 100644 src/gallium/drivers/llvmpipe/Android.mk

diff --git a/Android.mk b/Android.mk
index 368d02e..d09ec16 100644
--- a/Android.mk
+++ b/Android.mk
@@ -77,7 +77,7 @@ else
 MESA_BUILD_GALLIUM := false
 endif
 
-MESA_ENABLE_LLVM := $(if $(filter radeonsi,$(MESA_GPU_DRIVERS)),true,false)
+MESA_ENABLE_LLVM := $(if $(filter radeonsi 
swrast,$(MESA_GPU_DRIVERS)),true,false)
 
 # add subdirectories
 ifneq ($(strip $(MESA_GPU_DRIVERS)),)
diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 6bbd3fa..9061be1 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -62,6 +62,7 @@ typedef struct __DRIdrawableRec   __DRIdrawable;
 typedef struct __DRIconfigRec  __DRIconfig;
 typedef struct __DRIframebufferRec __DRIframebuffer;
 typedef struct __DRIversionRec __DRIversion;
+typedef struct __DRIimageRec   __DRIimage;
 
 typedef struct __DRIcoreExtensionRec   __DRIcoreExtension;
 typedef struct __DRIextensionRec   __DRIextension;
@@ -793,7 +794,9 @@ struct __DRIlegacyExtensionRec {
  * conjunction with the core extension.
  */
 #define __DRI_SWRAST "DRI_SWRast"
-#define __DRI_SWRAST_VERSION 4
+#define __DRI_SWRAST_VERSION 5
+
+struct winsys_handle;
 
 struct __DRIswrastExtensionRec {
 __DRIextension base;
@@ -841,6 +844,10 @@ struct __DRIswrastExtensionRec {
 const __DRIconfig ***driver_configs,
 void *loaderPrivate);
 
+   __DRIimage *(*createImageFromWinsys)(__DRIscreen *_screen,
+int width, int height, int format,
+struct winsys_handle *whandle, int 
pitch,
+void *loaderPrivate);
 };
 
 /** Common DRI function definitions, shared among DRI2 and Image extensions
diff --git a/src/egl/Android.mk b/src/egl/Android.mk
index cc2d98a..e65314b 100644
--- a/src/egl/Android.mk
+++ b/src/egl/Android.mk
@@ -54,6 +54,7 @@ endif
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/egl/main \
$(MESA_TOP)/src/egl/drivers/dri2 \
+   $(MESA_TOP)/src/gallium/include \
 
 LOCAL_STATIC_LIBRARIES := \
libmesa_loader
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 8f50f0c..21aabdd 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -381,6 +381,7 @@ static struct dri2_extension_match 
swrast_driver_extensions[] = {
 
 static struct dri2_extension_match swrast_core_extensions[] = {
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) },
+   { __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) },
{ NULL, 0, 0 }
 };
 
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 24da12d..2546f26 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -37,10 +37,11 @@
 #include "loader.h"
 #include "egl_dri2.h"
 #include "egl_dri2_fallbacks.h"
+#include "state_tracker/drm_driver.h"
 #include "gralloc_drm.h"
 #include "gralloc_drm_handle.h"
 
-static int
+static inline int
 get_format_bpp(int native)
 {
int bpp;
@@ -121,6 +122,8 @@ get_native_buffer_name(struct ANativeWindowBuffer *buf)
return (handle) ? handle->name : 0;
 }
 
+static const gralloc_module_t *gr_module = NULL;
+
 static EGLBoolean
 droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf)
 {
@@ -288,9 +291,14 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT,
 dri2_surf->base.GLColorspac

[Mesa-dev] [RFC 0/7] android: enable llvmpipe for software rendering

2016-04-28 Thread Chih-Wei Huang
This is a series of patches developed by Jide Technolody to enable 
the llvmpipe for software rendering of Android.
It makes a device without a Mesa supported GPU could run most modern
Android apps.

These patches are mainly developed and tested on the 11.0 and 11.2
branches. They might not work with the Mesa master branch.

The patches depend on some patches developed by Varad Gautam which
have not been merged in Mesa master yet, say

fc40946 egl: fixup: define droid_image_loader_extension
d15901d egl: android: populate dri2_surf->window early
cff1928 egl: android: use __DRI_IMAGE_LOADER to get color buffers
b556be4 egl: android: experimental dma-buf fd support

The dependency may be removed but we haven't tested that yet.

WuZhen (7):
  st/dri: fix double free of dri_drawable
  tgsi: fix stack allocated struct may not be initialized
  gallium/swrast: fix dri_sw_dt->data free func not matching alloc func
  android: print debug info to logcat
  android: enable dlopen
  android: enable x86 asm and sse4 for x86 and x86_64
  android: support swrast

 Android.common.mk  |  23 +-
 Android.mk |   7 +-
 include/GL/internal/dri_interface.h|   9 +-
 src/egl/Android.mk |   1 +
 src/egl/drivers/dri2/egl_dri2.c|   1 +
 src/egl/drivers/dri2/platform_android.c| 386 -
 src/gallium/Android.mk |   2 +-
 src/gallium/auxiliary/os/os_misc.c |  12 +-
 src/gallium/auxiliary/tgsi/tgsi_dump.c |   7 +
 src/gallium/auxiliary/util/u_debug.c   |   2 +-
 src/gallium/drivers/llvmpipe/Android.mk|  37 +++
 src/gallium/include/state_tracker/drm_driver.h |  10 +-
 src/gallium/state_trackers/dri/dri2.c  |   6 +-
 src/gallium/state_trackers/dri/dri_drawable.c  |   2 -
 src/gallium/state_trackers/dri/drisw.c |  46 +++
 src/gallium/targets/dri/Android.mk |   9 +-
 src/gallium/winsys/sw/dri/Android.mk   |   2 +
 src/gallium/winsys/sw/dri/dri_sw_winsys.c  |  66 -
 src/mapi/Android.mk|   3 +
 src/mesa/Android.gen.mk|  25 +-
 src/mesa/Android.libmesa_dricore.mk|  20 +-
 src/mesa/Android.libmesa_sse41.mk  |   5 +-
 src/mesa/Android.libmesa_st_mesa.mk|  20 +-
 src/mesa/Android.mesa_gen_matypes.mk   |   7 +-
 src/mesa/drivers/dri/common/dri_util.c |   4 +-
 src/mesa/drivers/dri/common/dri_util.h |   2 +-
 src/mesa/drivers/dri/i965/Android.mk   |   5 -
 src/mesa/main/errors.c |  12 +
 28 files changed, 654 insertions(+), 77 deletions(-)
 create mode 100644 src/gallium/drivers/llvmpipe/Android.mk

-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 0/3] Support for Android RGBX/RGBA formats

2016-04-24 Thread Chih-Wei Huang
2016-04-24 21:50 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
> On 24 April 2016 at 14:20, Marek Olšák <mar...@gmail.com> wrote:
>> On Sun, Apr 24, 2016 at 3:09 PM, Marek Olšák <mar...@gmail.com> wrote:
>>> On Sun, Apr 24, 2016 at 2:16 PM, Marek Olšák <mar...@gmail.com> wrote:
>>>> On Fri, Apr 22, 2016 at 12:41 PM, Chih-Wei Huang
>>>> <cwhu...@android-x86.org> wrote:
>>>>> 2016-04-21 21:42 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
>>>>>>
>>>>>> On 19 April 2016 at 20:38, Rob Herring <r...@kernel.org> wrote:
>>>>>>> The RGBX/RGBA pixel formats used in the Android EGL don't get configs
>>>>>>> created due to the missing formats in the DRI state tracker. This series
>>>>>>> adds the necessary formats for configs and DRI images. Support in GBM is
>>>>>>> also added as it will be needed soon for Android.
>>>>>>>
>>>>>>> AFAICT, this has been a long standing bug in Android-x86 which was
>>>>>>> worked around with the patch "GLSurfaceView: Be less picky about
>>>>>>> EGLConfig alpha sizes". With this series, this patch is no longer needed
>>>>>>> and several other bugs like wallpaper not getting displayed are fixed.
>>>>>>>
>>>>>> In the past similar changes has caused unexpected bugs and/or pert 
>>>>>> regressions.
>>>>>>
>>>>>> Although I doubt we'll notice them with the patches on the ML, thus
>>>>>> I've pushed the lot to get some wider testing.
>>>>>>  Please keep an eye for fires ;-)
>>>>>
>>>>> Could these be back-ported to 11.2?
>>>>
>>>> DEFINITELY NOT.
>>>>
>>>> It's too risky and it has already broken GLX.
>>>
>>> OK so the problem is libGL ignores the red/green/blue mask, therefore
>>> it doesn't distinguish between BGRA and RGBA. Also, DRI always assumes
>>> it's BGRA on the X server side. This patch series also ignores the
>>> red/green/blue mask for imported buffers. That's why DRI2 mostly
>>> works. I haven't tested DRI3.
>>>
>>> libGL could be fixed not to expose RGBA visuals, but that's
>>> insufficient, because Mesa drivers must be loadable by older libGL
>>> too.
>>>
>>> The bottom line is st/dri can't expose RGBA, because it would break
>>> Mesa with old libGL.
>>>
> Speaking of which... I while back I was asking/proposing that we
> deprecate 'too old' loader (libGL) <> dri modules combos. Something
> like ~3 year difference came to mind (functionality based). Do we have
> (m)any people who explicitly test dri module from today and libGL form
> 5-6, 10 years ago ?
>>>
> Ack. Thanks for looking into it Marek !
>
> Emil

> How do you feel on the topic ?
>
>>> Unless you guys come up with a solution, I'll have to revert the st/dri 
>>> change.
>>
>> FYI, I've decided to revert the st/dri commit now to fix the KDE
>> issue.

Why not just limit this commit to Android only?
The RGBA is possibly only used by Android?

Android-x86 community has waited such a fix
for a very long time.
Don't just drop it because it breaks others.


-- 
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 0/3] Support for Android RGBX/RGBA formats

2016-04-22 Thread Chih-Wei Huang
2016-04-21 21:42 GMT+08:00 Emil Velikov :
>
> On 19 April 2016 at 20:38, Rob Herring  wrote:
>> The RGBX/RGBA pixel formats used in the Android EGL don't get configs
>> created due to the missing formats in the DRI state tracker. This series
>> adds the necessary formats for configs and DRI images. Support in GBM is
>> also added as it will be needed soon for Android.
>>
>> AFAICT, this has been a long standing bug in Android-x86 which was
>> worked around with the patch "GLSurfaceView: Be less picky about
>> EGLConfig alpha sizes". With this series, this patch is no longer needed
>> and several other bugs like wallpaper not getting displayed are fixed.
>>
> In the past similar changes has caused unexpected bugs and/or pert 
> regressions.
>
> Although I doubt we'll notice them with the patches on the ML, thus
> I've pushed the lot to get some wider testing.
>  Please keep an eye for fires ;-)

Could these be back-ported to 11.2?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/3] Support for Android RGBX/RGBA formats

2016-04-20 Thread Chih-Wei Huang
2016-04-20 3:38 GMT+08:00 Rob Herring :
> The RGBX/RGBA pixel formats used in the Android EGL don't get configs
> created due to the missing formats in the DRI state tracker. This series
> adds the necessary formats for configs and DRI images. Support in GBM is
> also added as it will be needed soon for Android.
>
> AFAICT, this has been a long standing bug in Android-x86 which was
> worked around with the patch "GLSurfaceView: Be less picky about
> EGLConfig alpha sizes". With this series, this patch is no longer needed
> and several other bugs like wallpaper not getting displayed are fixed.

Sounds great! Thanks a lot for the fix.
I'm always curious why they are not supported
for such a long time.


-- 
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


[Mesa-dev] Latest Mesa is broken on Android-x86?

2016-04-19 Thread Chih-Wei Huang
I just tried the commit d3c98c73d on i965 GPU
but it became black screen on surfaceflinger
starting.

Just hope to know if anyone has tested
and can confirm that. Or it's a stupid mistake
I made.


-- 
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 1/2] glsl: android: add back missing generated glcpp include path

2016-04-18 Thread Chih-Wei Huang
2016-04-16 1:21 GMT+08:00 Emil Velikov <emil.l.veli...@gmail.com>:
> On 14 April 2016 at 20:40, Rob Herring <r...@kernel.org> wrote:
>> Commit 4db8f15a2576 ("glsl: move the android build scripts a level up")
>> dropped a generated include path for glcpp. Add it back adjusting for the
>> new location.
>>
>> Cc: Emil Velikov <emil.veli...@collabora.com>
>> Signed-off-by: Rob Herring <r...@kernel.org>
>> ---
>>  src/compiler/Android.glsl.gen.mk | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/compiler/Android.glsl.gen.mk 
>> b/src/compiler/Android.glsl.gen.mk
>> index b0df8a1..b2ea12c 100644
>> --- a/src/compiler/Android.glsl.gen.mk
>> +++ b/src/compiler/Android.glsl.gen.mk
>> @@ -33,6 +33,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
>>
>>  LOCAL_C_INCLUDES += \
>> $(intermediates)/glsl \
>> +   $(intermediates)/glsl/glcpp \
> Strange neither Autotools nor Scons needs this. What is the (somewhat)
> absolute path of the glcpp and glsl files (both generated and
> distribution).

Probably they are generated in the same source dir?

Android generates these files in the $(intermediates) dir.
Without the patch we got

external/mesa/src/compiler/glsl/glcpp/glcpp-lex.l:30:25: fatal error:
glcpp-parse.h: No such file or directory
 #include "glcpp-parse.h"
 ^
compilation terminated.
make: *** 
[out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_glsl_intermediates/glsl/glcpp/glcpp-lex.o]
Error 1


The series of patches are
Tested-by: Chih-Wei Huang <cwhu...@linux.org.tw>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [android-x86-devel] Re: gralloc_drm_pipe

2016-04-08 Thread Chih-Wei Huang
2016-04-07 13:30 GMT+08:00 Rob Herring <robherri...@gmail.com>:
> On Wed, Apr 6, 2016 at 11:12 AM, Chih-Wei Huang <cwhu...@android-x86.org> 
> wrote:
>
>> I guess the first supported GPU is virgl. Right?
>
> Yes. Any gallium driver really. The classic mesa drivers will need
> their own additions for GBM map/unmap.
>
>> When could we expect it's ready to test?
>
> Not sure. Definitely not until the GBM interface is set. There's not
> really much reason for android-x86 to move to it until it gets flushed
> out.

Could you provide me the patches of mesa?
I'm glad to test it. Thanks!


-- 
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] [android-x86-devel] Re: gralloc_drm_pipe

2016-04-06 Thread Chih-Wei Huang
2016-04-04 6:25 GMT+08:00 Rob Herring <robherri...@gmail.com>:
> On Sun, Apr 3, 2016 at 12:29 PM, Chih-Wei Huang <cwhu...@android-x86.org> 
> wrote:
>> Besides, the module name is still gralloc.drm.
>> How about call it gralloc.gbm?
>
> Eventually yes, but for now it is more convenient for my development
> to keep the name the same.
>
>> That means it can coexist with the current
>> gralloc.drm module so the transition to it
>> will be easier. Agree?
>
> It's not binary compatible, only source compatible ATM, so they can't
> really coexist yet. The gralloc implementation specific dependencies

The co-existence means to put the two gralloc
implementations in the same image and
select which one to be used by GPU at runtime.
This is carried out by our init.sh like

case "$(cat /proc/fb | head -1)" in
*virtiodrmfb)
set_property ro.hardware.gralloc gbm
set_property ro.hardware.hwcomposer drm
;;
0*inteldrmfb|0*radeondrmfb|0*nouveaufb|0*svgadrmfb)
set_property ro.hardware.gralloc drm
set_drm_mode
;;
...
esac

They don't need to be binary or source compatible, I think.

I guess the first supported GPU is virgl. Right?
When could we expect it's ready to test?

> in mesa and hwc is something I'm looking at. They consist of
> retrieving the prime FD for a handle and retrieving the DRM device FD.


-- 
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] [android-x86-devel] Re: gralloc_drm_pipe

2016-04-03 Thread Chih-Wei Huang
2016-04-04 0:53 GMT+08:00 Chih-Wei Huang <cwhu...@android-x86.org>:
> 2016-04-02 4:42 GMT+08:00 Rob Herring <r...@kernel.org>:
>>
>> Here's an initial gralloc implementation based on my GBM map/unmap support:
>>
>> https://github.com/robherring/gbm_gralloc
>>
>> It's based on drm_gralloc, but heavily re-written to collapse some
>> unnecessary layers.

It required a shared library libgbm.
So I guess we have to add an Android.mk
for libgbm in mesa? Do you already have a patch?

Besides, the module name is still gralloc.drm.
How about call it gralloc.gbm?
That means it can coexist with the current
gralloc.drm module so the transition to it
will be easier. Agree?


-- 
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] [android-x86-devel] Re: gralloc_drm_pipe

2016-04-03 Thread Chih-Wei Huang
2016-04-02 4:42 GMT+08:00 Rob Herring :
>
> Here's an initial gralloc implementation based on my GBM map/unmap support:
>
> https://github.com/robherring/gbm_gralloc
>
> It's based on drm_gralloc, but heavily re-written to collapse some
> unnecessary layers.

Thank you for it.

What GPU have you tested with it?

Since it doesn't implement the GRALLOC_HARDWARE_FB0
case in gbm_mod_open, I guess it still needs the
drm_hwcomposer. Right?


-- 
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] [android-x86-devel] Re: gralloc_drm_pipe

2016-03-31 Thread Chih-Wei Huang
2016-04-01 2:40 GMT+08:00 Jaap Jan Meijer <jjmeije...@gmail.com>:
> Op donderdag 31 maart 2016 13:02:36 UTC+2 schreef Chih-Wei Huang:
> Thanks for the patch, I tested it on both x86 and x64 kernels and it doesn't
> crash anymore, previously it did on both.
>
>> Thanks for the fix. I'll apply it.
>> But Jaap uses i915 which is a classical driver.
>> I doubt if it's related to the gallium_dri.so.
>>
>> Jaap, did you use a 64-bit kernel to test?
>
> You are right but because of the driver selection strategy chosen in
> gralloc_drm.c it will always first try the pipe driver whenever it is
> enabled.

As I've said I didn't encounter the crashing so
I don't think it's an issue.

If you didn't enable any pipe driver, it won't try to call
gralloc_drm_drv_create_for_pipe (ENABLE_PIPE is not set).
If you enabled a pipe driver, load_pipe_screen
should exist and it won't crash.

I suspect you changed BOARD_GPU_DRIVERS
but didn't rebuild both drm_gralloc and mesa properly
so the GPU configuration mismatched.
This is considered a flaw of the makefiles
however it's not easy to be fixed.

As a rule of thumb, if you changed BOARD_GPU_DRIVERS,
you should clean both drm_gralloc and mesa object files
manually to ensure they are rebuilt properly.


Anyway, I agree Robh's patch is a safe guard
to avoid some possible issues.

-- 
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] [android-x86-devel] Re: gralloc_drm_pipe

2016-03-31 Thread Chih-Wei Huang
2016-03-31 0:09 GMT+08:00 Rob Herring :
> On Tue, Mar 29, 2016 at 2:49 PM, Jaap Jan Meijer  wrote:
>>
>> First of all, thanks for the hard work!
>>
>> Only one problem I noticed so far: when enabling virgl in drm_gralloc but
>> without support in MESA, MESA / drm_gralloc (?) will just crash during
>> initialization. I don't think it's that important but when I'm only using
>> i915 it shouldn't really need to crash because of this?
>
> The only thing I can see is if load_pipe_screen is NULL, but
> gallium_dri.so is present. Not completely sure if that is possible,
> but I've pushed a fix to check load_pipe_screen to my android-m
> branch.

Thanks for the fix. I'll apply it.
But Jaap uses i915 which is a classical driver.
I doubt if it's related to the gallium_dri.so.

Jaap, did you use a 64-bit kernel to test?



-- 
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] [android-x86-devel] Re: gralloc_drm_pipe

2016-03-23 Thread Chih-Wei Huang
2016-03-24 8:51 GMT+08:00 Rob Clark :
[deleted]
>
> [*] the caveat there is vmwgfx stuff which seems to want to do blits..
> although I'm not entirely sure why or if that is even still requires
> w/ newer vmware players.  But if vmwgfx still really needs the blit
> path, I guess they could still keep using gralloc_drm instead of
> switching to gralloc_gbm ;-)

Did you mean this chunk in gralloc_drm_pipe.c?

   if (strcmp(pm->driver, "vmwgfx") == 0) {
   drm->mode_quirk_vmwgfx = 1;
   drm->swap_mode = DRM_SWAP_COPY;
   }
   else {
   drm->mode_quirk_vmwgfx = 0;
   drm->swap_mode = DRM_SWAP_FLIP;
   }

In my last hacking of gralloc_drm_pipe.c
for vmwgfx, it seems flip just work.
Actually I have tried the two paths but
can't find any explicit differences.
(at least for VM Player 12 I tested)
I guess the blit path isn't needed anymore
so I just removed it:

https://sourceforge.net/p/android-x86/external_drm_gralloc/ci/c04133951d10c4c17c0dfc9b86144b5a5957e17c/
(I need this hacking because pm->driver was removed
by Rohb's "pipe: use gallium loader function")

BTW, the above chunk was written by Chia-I Wu
(commit db29afe6).
He is probably the only one who can explain it better.


-- 
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] LLVMInitializeAMDGPU* undefined?

2016-03-13 Thread Chih-Wei Huang
2016-03-11 11:50 GMT+08:00 Jan Vesely <jan.ves...@rutgers.edu>:
> On Fri, 2016-03-11 at 10:09 +0800, Chih-Wei Huang wrote:
>> cc1: some warnings being treated as errors
>>
>>
>> But I'm still not sure whether if it should be fixed on the mesa
>> side.
>>
>> So my question is, what kind of fix do we want (i.e., acceptable by
>> the upstream)?
>
> this is the result of using llvm without AMDGPU backend. the header
> "llvm-c/Target.h" includes "llvm/Config/Targets.def" and declares
> functions based on backends listed there (selected at llvm build time).
>
> Your "llvm/Config/Targets.def" needs to include this line:
> LLVM_TARGET(AMDGPU)

Ah, thank you for pointed it out.
Originally I thought adding Android.mk for AMDGPU is enough.
I'll try to add this.

Anything else we need to do to "enable" AMDGPU backend?

> otherwise the functions are not declared.
> probably the only patch needed on mesa side is to detect this at
> configure time.

Android doesn't need configure.
What we need is to detect Android version then
we know the llvm version it uses and what backends it has.
The patch is already in android-x86 codebase but
probably not submited to mesa-dev yet.


-- 
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


  1   2   >