diff --git a/display/Android.bp b/display/Android.bp index 63dd76e..1a90b51 100644 --- a/display/Android.bp +++ b/display/Android.bp @@ -4,14 +4,14 @@ package { sh_binary { name: "dump_display_userdebug.sh", - src: "dump_display_userdebug.sh", + src: "common/dump_display_userdebug.sh", vendor: true, sub_dir: "dump", } cc_binary { - name: "dump_display", - srcs: ["dump_display.cpp"], + name: "dump_exynos_display", + srcs: ["exynos/dump_display.cpp"], cflags: [ "-Wall", "-Wextra", @@ -26,8 +26,8 @@ cc_binary { } cc_binary { - name: "dump_second_display", - srcs: ["dump_second_display.cpp"], + name: "dump_exynos_second_display", + srcs: ["exynos/dump_second_display.cpp"], cflags: [ "-Wall", "-Wextra", @@ -40,3 +40,33 @@ cc_binary { relative_install_path: "dump", } +cc_binary { + name: "dump_pixel_display", + srcs: ["pixel/dump_display.cpp"], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + shared_libs: [ + "libbase", + "libdump", + ], + vendor: true, + relative_install_path: "dump", +} + +cc_binary { + name: "dump_pixel_second_display", + srcs: ["pixel/dump_second_display.cpp"], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + shared_libs: [ + "libdump", + ], + vendor: true, + relative_install_path: "dump", +} diff --git a/display/dump_display_userdebug.sh b/display/common/dump_display_userdebug.sh similarity index 100% rename from display/dump_display_userdebug.sh rename to display/common/dump_display_userdebug.sh diff --git a/display/dump_exynos_display.mk b/display/dump_exynos_display.mk new file mode 100644 index 0000000..d20ba9d --- /dev/null +++ b/display/dump_exynos_display.mk @@ -0,0 +1,4 @@ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/display/sepolicy/exynos + +PRODUCT_PACKAGES_DEBUG += dump_display_userdebug.sh +PRODUCT_PACKAGES += dump_exynos_display diff --git a/display/dump_exynos_second_display.mk b/display/dump_exynos_second_display.mk new file mode 100644 index 0000000..5a6afe6 --- /dev/null +++ b/display/dump_exynos_second_display.mk @@ -0,0 +1,3 @@ +PRODUCT_PACKAGES += dump_exynos_second_display +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/display/sepolicy_second_display/exynos + diff --git a/display/dump.mk b/display/dump_pixel_display.mk similarity index 69% rename from display/dump.mk rename to display/dump_pixel_display.mk index 2af14da..e9e7b73 100644 --- a/display/dump.mk +++ b/display/dump_pixel_display.mk @@ -1,4 +1,4 @@ -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/display/sepolicy +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/display/sepolicy/pixel PRODUCT_PACKAGES_DEBUG += dump_display_userdebug.sh -PRODUCT_PACKAGES += dump_display +PRODUCT_PACKAGES += dump_pixel_display diff --git a/display/dump_pixel_second_display.mk b/display/dump_pixel_second_display.mk new file mode 100644 index 0000000..15cf7fd --- /dev/null +++ b/display/dump_pixel_second_display.mk @@ -0,0 +1,3 @@ +PRODUCT_PACKAGES += dump_pixel_second_display +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/display/sepolicy_second_display/pixel + diff --git a/display/dump_second_display.mk b/display/dump_second_display.mk deleted file mode 100644 index dfab73e..0000000 --- a/display/dump_second_display.mk +++ /dev/null @@ -1,3 +0,0 @@ -PRODUCT_PACKAGES += dump_second_display -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/display/sepolicy_second_display - diff --git a/display/dump_display.cpp b/display/exynos/dump_display.cpp similarity index 90% rename from display/dump_display.cpp rename to display/exynos/dump_display.cpp index f57a134..2e03a63 100644 --- a/display/dump_display.cpp +++ b/display/exynos/dump_display.cpp @@ -18,7 +18,7 @@ int main() { setbuf(stdout, NULL); - dumpFileContent("DECON-0 counters /sys/class/drm/card0/device/decon0/counters", "/sys/class/drm/card0/device/decon0/counters"); + dumpFileContent("DECON-0 counters", "/sys/class/drm/card0/device/decon0/counters"); dumpFileContent("CRTC-0 event log", "/sys/kernel/debug/dri/0/crtc-0/event"); runCommand("libdisplaycolor", "/vendor/bin/dumpsys displaycolor -v"); diff --git a/display/dump_second_display.cpp b/display/exynos/dump_second_display.cpp similarity index 89% rename from display/dump_second_display.cpp rename to display/exynos/dump_second_display.cpp index 9590c7f..c05ce9a 100644 --- a/display/dump_second_display.cpp +++ b/display/exynos/dump_second_display.cpp @@ -16,7 +16,7 @@ #include int main() { - dumpFileContent("DECON-1 counters /sys/class/drm/card0/device/decon1/counters", "/sys/class/drm/card0/device/decon1/counters"); + dumpFileContent("DECON-1 counters", "/sys/class/drm/card0/device/decon1/counters"); dumpFileContent("CRTC-1 event log", "/sys/kernel/debug/dri/0/crtc-1/event"); dumpFileContent("Secondary panel name", "/sys/class/drm/card0/device/secondary-panel/panel_name"); diff --git a/display/pixel/dump_display.cpp b/display/pixel/dump_display.cpp new file mode 100644 index 0000000..1014977 --- /dev/null +++ b/display/pixel/dump_display.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include + +int main() { + setbuf(stdout, NULL); + dumpFileContent("CRTC-0 status", "/sys/kernel/debug/dri/0/crtc-0/status"); + runCommand("libdisplaycolor", "/vendor/bin/dumpsys displaycolor -v"); + + dumpFileContent("Primary panel name", "/sys/class/drm/card0/device/primary-panel/panel_name"); + dumpFileContent("Primary panel extra info", "/sys/class/drm/card0/device/primary-panel/panel_extinfo"); + dumpFileContent("Primary panel power Vreg", "/sys/class/drm/card0/device/primary-panel/panel_pwr_vreg"); + dumpFileContent("Primary panel power mode register", "/sys/class/drm/card0/device/primary-panel/power_mode"); + return 0; +} diff --git a/display/pixel/dump_second_display.cpp b/display/pixel/dump_second_display.cpp new file mode 100644 index 0000000..92e6e99 --- /dev/null +++ b/display/pixel/dump_second_display.cpp @@ -0,0 +1,25 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +int main() { + dumpFileContent("CRTC-1 status", "/sys/kernel/debug/dri/0/crtc-1/status"); + + dumpFileContent("Secondary panel name", "/sys/class/drm/card0/device/secondary-panel/panel_name"); + dumpFileContent("Secondary panel extra info", "/sys/class/drm/card0/device/secondary-panel/panel_extinfo"); + dumpFileContent("Secondary panel power mode register", "/sys/class/drm/card0/device/secondary-panel/power_mode"); + return 0; +} diff --git a/display/sepolicy/dump_display.te b/display/sepolicy/dump_display.te deleted file mode 100644 index 3e2cb69..0000000 --- a/display/sepolicy/dump_display.te +++ /dev/null @@ -1,15 +0,0 @@ -# Display (dump for bugreport) -pixel_bugreport(dump_display) - -allow dump_display sysfs_display:file r_file_perms; -allow dump_display vendor_displaycolor_service:service_manager find; -binder_call(dump_display, hal_graphics_composer_default) -allow dump_display vendor_dumpsys:file execute_no_trans; -allow dump_display vendor_shell_exec:file execute_no_trans; - -userdebug_or_eng(` - allow dump_display vendor_dri_debugfs:dir r_dir_perms; - allow dump_display vendor_dri_debugfs:file r_file_perms; -') -vndbinder_use(dump_display) - diff --git a/display/sepolicy/dump_display_userdebug.te b/display/sepolicy/dump_display_userdebug.te deleted file mode 100644 index c08fb29..0000000 --- a/display/sepolicy/dump_display_userdebug.te +++ /dev/null @@ -1,11 +0,0 @@ -# Display eng/userdebug (dump for bugreport) -pixel_bugreport(dump_display_userdebug) - -userdebug_or_eng(` - allow dump_display_userdebug vendor_toolbox_exec:file execute_no_trans; - allow dump_display_userdebug vendor_log_file:dir search; - allow dump_display_userdebug vendor_hwc_log_file:dir r_dir_perms; - allow dump_display_userdebug vendor_hwc_log_file:file r_file_perms; - allow dump_display_userdebug debugfs_tracing_instances:dir search; - allow dump_display_userdebug debugfs_tracing_instances:file r_file_perms; -') diff --git a/display/sepolicy/exynos/dump_display.te b/display/sepolicy/exynos/dump_display.te new file mode 100644 index 0000000..0b4f0c7 --- /dev/null +++ b/display/sepolicy/exynos/dump_display.te @@ -0,0 +1,15 @@ +# Display (dump for bugreport) +pixel_bugreport(dump_exynos_display) + +allow dump_exynos_display sysfs_display:file r_file_perms; +allow dump_exynos_display vendor_displaycolor_service:service_manager find; +binder_call(dump_exynos_display, hal_graphics_composer_default) +allow dump_exynos_display vendor_dumpsys:file execute_no_trans; +allow dump_exynos_display vendor_shell_exec:file execute_no_trans; + +userdebug_or_eng(` + allow dump_exynos_display vendor_dri_debugfs:dir r_dir_perms; + allow dump_exynos_display vendor_dri_debugfs:file r_file_perms; +') +vndbinder_use(dump_exynos_display) + diff --git a/display/sepolicy/exynos/dump_display_userdebug.te b/display/sepolicy/exynos/dump_display_userdebug.te new file mode 100644 index 0000000..1b8dd11 --- /dev/null +++ b/display/sepolicy/exynos/dump_display_userdebug.te @@ -0,0 +1,11 @@ +# Display eng/userdebug (dump for bugreport) +pixel_bugreport(dump_exynos_display_userdebug) + +userdebug_or_eng(` + allow dump_exynos_display_userdebug vendor_toolbox_exec:file execute_no_trans; + allow dump_exynos_display_userdebug vendor_log_file:dir search; + allow dump_exynos_display_userdebug vendor_hwc_log_file:dir r_dir_perms; + allow dump_exynos_display_userdebug vendor_hwc_log_file:file r_file_perms; + allow dump_exynos_display_userdebug debugfs_tracing_instances:dir search; + allow dump_exynos_display_userdebug debugfs_tracing_instances:file r_file_perms; +') diff --git a/display/sepolicy/file.te b/display/sepolicy/exynos/file.te similarity index 100% rename from display/sepolicy/file.te rename to display/sepolicy/exynos/file.te diff --git a/display/sepolicy/exynos/file_contexts b/display/sepolicy/exynos/file_contexts new file mode 100644 index 0000000..2a0854f --- /dev/null +++ b/display/sepolicy/exynos/file_contexts @@ -0,0 +1,5 @@ +/vendor/bin/dump/dump_display_userdebug\.sh u:object_r:dump_exynos_display_userdebug_exec:s0 +/vendor/bin/dump/dump_exynos_display u:object_r:dump_exynos_display_exec:s0 + +/data/vendor/log/hwc(/.*)? u:object_r:vendor_hwc_log_file:s0 + diff --git a/display/sepolicy/genfs_contexts b/display/sepolicy/exynos/genfs_contexts similarity index 100% rename from display/sepolicy/genfs_contexts rename to display/sepolicy/exynos/genfs_contexts diff --git a/display/sepolicy/exynos/hal_graphics_composer_default.te b/display/sepolicy/exynos/hal_graphics_composer_default.te new file mode 100644 index 0000000..86e2d96 --- /dev/null +++ b/display/sepolicy/exynos/hal_graphics_composer_default.te @@ -0,0 +1,3 @@ +allow hal_graphics_composer_default dump_exynos_display:fifo_file { append write }; +allow hal_graphics_composer_default dump_exynos_display:fd use; + diff --git a/display/sepolicy/vndservice.te b/display/sepolicy/exynos/vndservice.te similarity index 100% rename from display/sepolicy/vndservice.te rename to display/sepolicy/exynos/vndservice.te diff --git a/display/sepolicy/vndservice_contexts b/display/sepolicy/exynos/vndservice_contexts similarity index 100% rename from display/sepolicy/vndservice_contexts rename to display/sepolicy/exynos/vndservice_contexts diff --git a/display/sepolicy/hal_graphics_composer_default.te b/display/sepolicy/hal_graphics_composer_default.te deleted file mode 100644 index c644559..0000000 --- a/display/sepolicy/hal_graphics_composer_default.te +++ /dev/null @@ -1,3 +0,0 @@ -allow hal_graphics_composer_default dump_display:fifo_file { append write }; -allow hal_graphics_composer_default dump_display:fd use; - diff --git a/display/sepolicy/pixel/dump_display.te b/display/sepolicy/pixel/dump_display.te new file mode 100644 index 0000000..5f7c5c0 --- /dev/null +++ b/display/sepolicy/pixel/dump_display.te @@ -0,0 +1,15 @@ +# Display (dump for bugreport) +pixel_bugreport(dump_pixel_display) + +allow dump_pixel_display sysfs_display:file r_file_perms; +allow dump_pixel_display vendor_displaycolor_service:service_manager find; +binder_call(dump_pixel_display, hal_graphics_composer_default) +allow dump_pixel_display vendor_dumpsys:file execute_no_trans; +allow dump_pixel_display vendor_shell_exec:file execute_no_trans; + +userdebug_or_eng(` + allow dump_pixel_display vendor_dri_debugfs:dir r_dir_perms; + allow dump_pixel_display vendor_dri_debugfs:file r_file_perms; +') +vndbinder_use(dump_pixel_display) + diff --git a/display/sepolicy/pixel/dump_display_userdebug.te b/display/sepolicy/pixel/dump_display_userdebug.te new file mode 100644 index 0000000..33b9da6 --- /dev/null +++ b/display/sepolicy/pixel/dump_display_userdebug.te @@ -0,0 +1,11 @@ +# Display eng/userdebug (dump for bugreport) +pixel_bugreport(dump_pixel_display_userdebug) + +userdebug_or_eng(` + allow dump_pixel_display_userdebug vendor_toolbox_exec:file execute_no_trans; + allow dump_pixel_display_userdebug vendor_log_file:dir search; + allow dump_pixel_display_userdebug vendor_hwc_log_file:dir r_dir_perms; + allow dump_pixel_display_userdebug vendor_hwc_log_file:file r_file_perms; + allow dump_pixel_display_userdebug debugfs_tracing_instances:dir search; + allow dump_pixel_display_userdebug debugfs_tracing_instances:file r_file_perms; +') diff --git a/display/sepolicy/pixel/file.te b/display/sepolicy/pixel/file.te new file mode 100644 index 0000000..e3f2382 --- /dev/null +++ b/display/sepolicy/pixel/file.te @@ -0,0 +1,3 @@ +type vendor_hwc_log_file, file_type, data_file_type; +type vendor_dri_debugfs, fs_type, debugfs_type; + diff --git a/display/sepolicy/file_contexts b/display/sepolicy/pixel/file_contexts similarity index 55% rename from display/sepolicy/file_contexts rename to display/sepolicy/pixel/file_contexts index 66118d0..17fb960 100644 --- a/display/sepolicy/file_contexts +++ b/display/sepolicy/pixel/file_contexts @@ -1,5 +1,5 @@ -/vendor/bin/dump/dump_display_userdebug\.sh u:object_r:dump_display_userdebug_exec:s0 -/vendor/bin/dump/dump_display u:object_r:dump_display_exec:s0 +/vendor/bin/dump/dump_display_userdebug\.sh u:object_r:dump_pixel_display_userdebug_exec:s0 +/vendor/bin/dump/dump_pixel_display u:object_r:dump_pixel_display_exec:s0 /data/vendor/log/hwc(/.*)? u:object_r:vendor_hwc_log_file:s0 diff --git a/display/sepolicy/pixel/genfs_contexts b/display/sepolicy/pixel/genfs_contexts new file mode 100644 index 0000000..7c46278 --- /dev/null +++ b/display/sepolicy/pixel/genfs_contexts @@ -0,0 +1,3 @@ + +genfscon debugfs /dri/0/crtc- u:object_r:vendor_dri_debugfs:s0 +genfscon sysfs /module/drm/parameters/debug u:object_r:sysfs_display:s0 diff --git a/display/sepolicy/pixel/hal_graphics_composer_default.te b/display/sepolicy/pixel/hal_graphics_composer_default.te new file mode 100644 index 0000000..9e028a0 --- /dev/null +++ b/display/sepolicy/pixel/hal_graphics_composer_default.te @@ -0,0 +1,3 @@ +allow hal_graphics_composer_default dump_pixel_display:fifo_file { append write }; +allow hal_graphics_composer_default dump_pixel_display:fd use; + diff --git a/display/sepolicy/pixel/vndservice.te b/display/sepolicy/pixel/vndservice.te new file mode 100644 index 0000000..5c3693b --- /dev/null +++ b/display/sepolicy/pixel/vndservice.te @@ -0,0 +1,2 @@ +type vendor_displaycolor_service, vndservice_manager_type; + diff --git a/display/sepolicy/pixel/vndservice_contexts b/display/sepolicy/pixel/vndservice_contexts new file mode 100644 index 0000000..9276f97 --- /dev/null +++ b/display/sepolicy/pixel/vndservice_contexts @@ -0,0 +1,2 @@ +displaycolor u:object_r:vendor_displaycolor_service:s0 + diff --git a/display/sepolicy_second_display/dump_second_display.te b/display/sepolicy_second_display/dump_second_display.te deleted file mode 100644 index 62d9c2d..0000000 --- a/display/sepolicy_second_display/dump_second_display.te +++ /dev/null @@ -1,9 +0,0 @@ -pixel_bugreport(dump_second_display) - -allow dump_second_display sysfs_display:file r_file_perms; - -userdebug_or_eng(` - allow dump_second_display vendor_dri_debugfs:dir r_dir_perms; - allow dump_second_display vendor_dri_debugfs:file r_file_perms; -') - diff --git a/display/sepolicy_second_display/exynos/dump_second_display.te b/display/sepolicy_second_display/exynos/dump_second_display.te new file mode 100644 index 0000000..70e86b8 --- /dev/null +++ b/display/sepolicy_second_display/exynos/dump_second_display.te @@ -0,0 +1,9 @@ +pixel_bugreport(dump_exynos_second_display) + +allow dump_exynos_second_display sysfs_display:file r_file_perms; + +userdebug_or_eng(` + allow dump_exynos_second_display vendor_dri_debugfs:dir r_dir_perms; + allow dump_exynos_second_display vendor_dri_debugfs:file r_file_perms; +') + diff --git a/display/sepolicy_second_display/exynos/file_contexts b/display/sepolicy_second_display/exynos/file_contexts new file mode 100644 index 0000000..02150f5 --- /dev/null +++ b/display/sepolicy_second_display/exynos/file_contexts @@ -0,0 +1,2 @@ +/vendor/bin/dump/dump_exynos_second_display u:object_r:dump_exynos_second_display_exec:s0 + diff --git a/display/sepolicy_second_display/file_contexts b/display/sepolicy_second_display/file_contexts deleted file mode 100644 index d9bb31c..0000000 --- a/display/sepolicy_second_display/file_contexts +++ /dev/null @@ -1,2 +0,0 @@ -/vendor/bin/dump/dump_second_display u:object_r:dump_second_display_exec:s0 - diff --git a/display/sepolicy_second_display/pixel/dump_second_display.te b/display/sepolicy_second_display/pixel/dump_second_display.te new file mode 100644 index 0000000..12dc81f --- /dev/null +++ b/display/sepolicy_second_display/pixel/dump_second_display.te @@ -0,0 +1,9 @@ +pixel_bugreport(dump_pixel_second_display) + +allow dump_pixel_second_display sysfs_display:file r_file_perms; + +userdebug_or_eng(` + allow dump_pixel_second_display vendor_dri_debugfs:dir r_dir_perms; + allow dump_pixel_second_display vendor_dri_debugfs:file r_file_perms; +') + diff --git a/display/sepolicy_second_display/pixel/file_contexts b/display/sepolicy_second_display/pixel/file_contexts new file mode 100644 index 0000000..686c63a --- /dev/null +++ b/display/sepolicy_second_display/pixel/file_contexts @@ -0,0 +1,2 @@ +/vendor/bin/dump/dump_pixel_second_display u:object_r:dump_pixel_second_display_exec:s0 +