sweet: override the SetRefreshRate HWC builtin display function

* This function causes the refresh rate to change randomly, and
  produces flickering on the display

* Override the original function by renaming the symbol so linker
  uses the symbol from the shim instead of the original library's
  symbol

Signed-off-by: daniml3 <daniel@danielml.dev>
Change-Id: I2fa6b3f834df79c32d22f5a057da2108cc9cacab
This commit is contained in:
daniml3 2021-08-22 16:34:00 +02:00 committed by basamaryan
parent 0f7f63e182
commit d934151ef3
4 changed files with 38 additions and 0 deletions

View File

@ -39,6 +39,9 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/display/qdcm_calib_data_xiaomi_k6_38_0c_0a_fhd_dsc_video_dsi_panel.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_xiaomi_k6_38_0c_0a_fhd_dsc_video_dsi_panel.xml
PRODUCT_PACKAGES += \
libsdmcore-shim
# Fstab
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/rootdir/etc/fstab.qcom:$(TARGET_COPY_OUT_RAMDISK)/fstab.qcom \

8
display/Android.bp Normal file
View File

@ -0,0 +1,8 @@
cc_library_shared {
name: "libsdmcore-shim",
srcs: [
"display_builtin.cpp"
],
required: ["libsdmcore-patch"],
vendor: true,
}

24
display/Android.mk Normal file
View File

@ -0,0 +1,24 @@
LOCAL_PATH := $(call my-dir)
HWC := hwcomposer.$(TARGET_BOARD_PLATFORM)
LIBSDMCORE := $(TARGET_OUT_VENDOR)/lib64/libsdmcore.so
HWCOMPOSER := $(TARGET_OUT_VENDOR)/lib64/hw/$(HWC).so
ORIGINAL_SYMBOL := _ZN3sdm14DisplayBuiltIn14SetRefreshRateEjb
CUSTOM_SYMBOL := _ZN3sdm14DisplayBuiltIn14SetRefreshCustEjb
include $(CLEAR_VARS)
LOCAL_MODULE := libsdmcore-patch
LOCAL_PREBUILT_MODULE_FILE := /dev/null
LOCAL_MODULE_CLASS := ETC
LOCAL_VENDOR_MODULE := true
LOCAL_REQUIRED_MODULES := $(HWC) libsdmcore
LOCAL_POST_INSTALL_CMD := \
cp $(PRODUCT_OUT)/symbols/vendor/lib64/libsdmcore.so $(LIBSDMCORE) && \
cp $(PRODUCT_OUT)/symbols/vendor/lib64/hw/$(HWC).so $(HWCOMPOSER) && \
sed -i s/$(ORIGINAL_SYMBOL)/$(CUSTOM_SYMBOL)/g $(LIBSDMCORE) && \
sed -i s/libdisplaydebug/libsdmcore-shim/g $(HWCOMPOSER) && \
rm $(TARGET_OUT_VENDOR)/etc/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

View File

@ -0,0 +1,3 @@
#include <stdint.h>
extern "C" void _ZN3sdm14DisplayBuiltIn14SetRefreshCustEjb(uint32_t, bool) {}