diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000000..2ce60729c8 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,80 @@ +load("//build/kernel/kleaf:kernel.bzl", "ddk_headers") + +package( + default_visibility = [ + "//visibility:public"], +) + +ddk_headers( + name = "display_drivers_configs", + hdrs = glob([ + "config/*.h", + ]), + includes = ["config"] +) + +ddk_headers( + name = "linux_includes", + hdrs = glob([ + "include/linux/*.h", + ]), + includes = ["include"] +) + +ddk_headers( + name = "uapi_headers", + hdrs = glob([ + "include/uapi/display/drm/*.h", + "include/uapi/display/hdcp/*.h", + "include/uapi/display/media/*.h", + ]), + includes = ["include/uapi/display"] +) + +ddk_headers( + name = "dp_headers", + hdrs = glob([ + "msm/dp/*.h", + ]), + includes = ["msm/dp"] +) + +ddk_headers( + name = "dsi_headers", + hdrs = glob([ + "msm/dsi/*.h", + ]), + includes = ["msm/dsi"] +) + +ddk_headers( + name = "sde_headers", + hdrs = glob([ + "msm/sde/*.h", + ]), + includes = ["msm/sde"] +) + +ddk_headers( + name = "rotator_headers", + hdrs = glob([ + "rotator/*.h", + ]), + includes = ["rotator"] +) + +ddk_headers( + name = "msm_headers", + hdrs = glob([ + "msm/*.h", + ]), + includes = ["msm"] +) + +ddk_headers( + name = "display_drivers_headers", + hdrs = [":display_drivers_configs", ":linux_includes", ":uapi_headers", ":msm_headers",":dp_headers",":dsi_headers",":sde_headers",":rotator_headers"] +) + +load(":target.bzl", "define_pineapple") +define_pineapple() diff --git a/display_driver_build.bzl b/display_driver_build.bzl new file mode 100644 index 0000000000..5469d26d4e --- /dev/null +++ b/display_driver_build.bzl @@ -0,0 +1,111 @@ +load("//build/kernel/kleaf:kernel.bzl", "ddk_module", "ddk_submodule") +load("//build/bazel_common_rules/dist:dist.bzl", "copy_to_dist_dir") +load("//msm-kernel:target_variants.bzl", "get_all_variants") + +def _register_module_to_map(module_map, name, path, config_option, srcs, config_srcs, deps, config_deps): + processed_config_srcs = {} + nested_config = {} + + for config_src_name in config_srcs: + config_src = config_srcs[config_src_name] + + if type(config_src) == "list": + processed_config_srcs[config_src_name] = {True: config_src} + else: + processed_config_srcs[config_src_name] = config_src + if type(config_src) == "dict": + nested_config = config_src + + for nested_src, nest_name in nested_config.items(): + if nested_src == "True": + for nest_src in nest_name: + final_srcs = nest_name[nest_src] + processed_config_srcs[nest_src] = final_srcs + module = struct( + name = name, + path = path, + srcs = srcs, + config_srcs = processed_config_srcs, + config_option = config_option, + deps = deps, + ) + + module_map[name] = module + +def _get_config_choices(map, options): + choices = [] + for option in map: + choices.extend(map[option].get(option in options,[])) + return choices + +def _get_kernel_build_options(modules, config_options): + all_options = {option: True for option in config_options} + all_options = all_options | {module.config_option: True for module in modules if module.config_option} + return all_options + +def _get_kernel_build_module_srcs(module, options, formatter): + srcs = module.srcs + _get_config_choices(module.config_srcs, options) + print("-",module.name,",",module.config_option,",srcs =",srcs) + module_path = "{}/".format(module.path) if module.path else "" + return ["{}{}".format(module_path, formatter(src)) for src in srcs] + +def _get_kernel_build_module_deps(module, options, formatter): + return [formatter(dep) for dep in module.deps] + +def display_module_entry(hdrs = []): + module_map = {} + + def register(name, path = None, config_option = None, srcs = [], config_srcs = {}, deps = [], config_deps = {}): + _register_module_to_map(module_map, name, path, config_option, srcs, config_srcs, deps, config_deps) + return struct( + register = register, + get = module_map.get, + hdrs = hdrs, + module_map = module_map + ) + +def define_target_variant_modules(target, variant, registry, modules, config_options = []): + kernel_build = "{}_{}".format(target, variant) + kernel_build_label = "//msm-kernel:{}".format(kernel_build) + modules = [registry.get(module_name) for module_name in modules] + options = _get_kernel_build_options(modules, config_options) + build_print = lambda message : print("{}: {}".format(kernel_build, message)) + formatter = lambda s : s.replace("%b", kernel_build).replace("%t", target) + headers = ["//msm-kernel:all_headers"] + registry.hdrs + all_module_rules = [] + + for module in modules: + rule_name = "{}_{}".format(kernel_build, module.name) + module_srcs = _get_kernel_build_module_srcs(module, options, formatter) + + if not module_srcs: + continue + + ddk_submodule( + name = rule_name, + srcs = module_srcs, + out = "{}.ko".format(module.name), + deps = headers + _get_kernel_build_module_deps(module, options, formatter), + local_defines = options.keys(), + ) + all_module_rules.append(rule_name) + + ddk_module( + name = "{}_display_drivers".format(kernel_build), + kernel_build = kernel_build_label, + deps = all_module_rules, + ) + copy_to_dist_dir( + name = "{}_display_drivers_dist".format(kernel_build), + data = [":{}_display_drivers".format(kernel_build)], + dist_dir = "out/target/product/{}/dlkm/lib/modules/".format(target), + flat = True, + wipe_dist_dir = False, + allow_duplicate_filenames = False, + mode_overrides = {"**/*": "644"}, + log = "info", + ) + +def define_consolidate_gki_modules(target, registry, modules, config_options = []): + for (targets, variant) in get_all_variants(): + define_target_variant_modules(targets, variant, registry, modules, config_options) diff --git a/display_modules.bzl b/display_modules.bzl new file mode 100644 index 0000000000..bee80bb003 --- /dev/null +++ b/display_modules.bzl @@ -0,0 +1,183 @@ +load(":display_driver_build.bzl", "display_module_entry") + +display_driver_modules = display_module_entry([":display_drivers_headers"]) +module_entry = display_driver_modules.register + +#---------- MSM-DRM MODULE ------------------------- + +module_entry( + name = "msm_drm", + config_option = "CONFIG_DRM_MSM", + path = None, + config_srcs = { + "CONFIG_HDCP_QSEECOM": [ + "hdcp/msm_hdcp.c", + "msm/dp/dp_hdcp2p2.c", + "msm/sde_hdcp_1x.c", + "msm/sde_hdcp_2x.c", + ], + "CONFIG_DRM_SDE_VM" : [ + "msm/sde/sde_vm_common.c", + "msm/sde/sde_vm_primary.c", + "msm/sde/sde_vm_trusted.c", + "msm/sde/sde_vm_msgq.c", + ], + "CONFIG_DRM_MSM_DP" : [ + "msm/dp/dp_altmode.c", + "msm/dp/dp_parser.c", + "msm/dp/dp_power.c", + "msm/dp/dp_catalog.c", + "msm/dp/dp_catalog_v420.c", + "msm/dp/dp_catalog_v200.c", + "msm/dp/dp_aux.c", + "msm/dp/dp_panel.c", + "msm/dp/dp_link.c", + "msm/dp/dp_ctrl.c", + "msm/dp/dp_audio.c", + "msm/dp/dp_debug.c", + "msm/dp/dp_hpd.c", + "msm/dp/dp_aux_bridge.c", + "msm/dp/dp_bridge_hpd.c", + "msm/dp/dp_mst_sim.c", + "msm/dp/dp_mst_sim_helper.c", + "msm/dp/dp_gpio_hpd.c", + "msm/dp/dp_lphw_hpd.c", + "msm/dp/dp_display.c", + "msm/dp/dp_drm.c", + "msm/dp/dp_pll.c", + "msm/dp/dp_pll_5nm.c", + "msm/dp/dp_pll_4nm.c", + ], + "CONFIG_DRM_MSM_DP_MST" : [ + "msm/dp/dp_mst_drm.c", + ], + "CONFIG_DRM_MSM_DP_USBPD_LEGACY" : [ + "msm/dp/dp_usbpd.c", + ], + "CONFIG_DRM_MSM_SDE" : [ + "msm/sde/sde_crtc.c", + "msm/sde/sde_encoder.c", + "msm/sde/sde_encoder_dce.c", + "msm/sde/sde_encoder_phys_vid.c", + "msm/sde/sde_encoder_phys_cmd.c", + "msm/sde/sde_irq.c", + "msm/sde/sde_core_irq.c", + "msm/sde/sde_core_perf.c", + "msm/sde/sde_rm.c", + "msm/sde/sde_kms_utils.c", + "msm/sde/sde_kms.c", + "msm/sde/sde_plane.c", + "msm/sde/sde_connector.c", + "msm/sde/sde_color_processing.c", + "msm/sde/sde_vbif.c", + "msm/sde_dbg.c", + "msm/sde_dbg_evtlog.c", + "msm/sde_io_util.c", + "msm/sde_vm_event.c", + "msm/sde/sde_hw_reg_dma_v1_color_proc.c", + "msm/sde/sde_hw_color_proc_v4.c", + "msm/sde/sde_hw_ad4.c", + "msm/sde/sde_hw_uidle.c", + "msm/sde_edid_parser.c", + "msm/sde/sde_hw_catalog.c", + "msm/sde/sde_hw_cdm.c", + "msm/sde/sde_hw_dspp.c", + "msm/sde/sde_hw_intf.c", + "msm/sde/sde_hw_lm.c", + "msm/sde/sde_hw_ctl.c", + "msm/sde/sde_hw_util.c", + "msm/sde/sde_hw_sspp.c", + "msm/sde/sde_hw_wb.c", + "msm/sde/sde_hw_pingpong.c", + "msm/sde/sde_hw_top.c", + "msm/sde/sde_hw_interrupts.c", + "msm/sde/sde_hw_vbif.c", + "msm/sde/sde_formats.c", + "msm/sde_power_handle.c", + "msm/sde/sde_hw_color_processing_v1_7.c", + "msm/sde/sde_reg_dma.c", + "msm/sde/sde_hw_reg_dma_v1.c", + "msm/sde/sde_hw_dsc.c", + "msm/sde/sde_hw_dsc_1_2.c", + "msm/sde/sde_hw_vdc.c", + "msm/sde/sde_hw_ds.c", + "msm/sde/sde_fence.c", + "msm/sde/sde_hw_qdss.c", + "msm/sde_dsc_helper.c", + "msm/sde_vdc_helper.c", + "msm/sde/sde_hw_dnsc_blur.c", + "msm/sde/sde_hw_rc.c", + ], + "CONFIG_DRM_SDE_WB" : [ + "msm/sde/sde_wb.c", + "msm/sde/sde_encoder_phys_wb.c" + ], + "CONFIG_DRM_SDE_RSC" : [ + "msm/sde_rsc.c", + "msm/sde_rsc_hw.c", + "msm/sde_rsc_hw_v3.c", + ], + "CONFIG_DRM_MSM_DSI" : [ + "msm/dsi/dsi_phy.c", + "msm/dsi/dsi_pwr.c", + "msm/dsi/dsi_phy_hw_v3_0.c", + "msm/dsi/dsi_phy_hw_v4_0.c", + "msm/dsi/dsi_phy_hw_v5_0.c", + "msm/dsi/dsi_phy_timing_calc.c", + "msm/dsi/dsi_phy_timing_v3_0.c", + "msm/dsi/dsi_phy_timing_v4_0.c", + "msm/dsi/dsi_pll.c", + "msm/dsi/dsi_pll_5nm.c", + "msm/dsi/dsi_pll_4nm.c", + "msm/dsi/dsi_ctrl_hw_cmn.c", + "msm/dsi/dsi_ctrl_hw_2_2.c", + "msm/dsi/dsi_ctrl.c", + "msm/dsi/dsi_catalog.c", + "msm/dsi/dsi_drm.c", + "msm/dsi/dsi_display.c", + "msm/dsi/dsi_panel.c", + "msm/dsi/dsi_clk_manager.c", + "msm/dsi/dsi_display_test.c", + ], + "CONFIG_DSI_PARSER" : [ + "msm/dsi/dsi_parser.c", + ], + "CONFIG_THERMAL_OF" : [ + "msm/msm_cooling_device.c", + ], + "CONFIG_DRM_MSM" : [ + "msm/msm_atomic.c", + "msm/msm_fb.c", + "msm/msm_drv.c", + "msm/msm_gem.c", + "msm/msm_gem_prime.c", + "msm/msm_gem_vma.c", + "msm/msm_smmu.c", + "msm/msm_prop.c", + ], + "CONFIG_MSM_SDE_ROTATOR":{ + True: [ + "rotator/sde_rotator_dev.c", + "rotator/sde_rotator_core.c", + "rotator/sde_rotator_base.c ", + "rotator/sde_rotator_formats.c", + "rotator/sde_rotator_util.c", + "rotator/sde_rotator_io_util.c", + "rotator/sde_rotator_smmu.c", + "rotator/sde_rotator_r1_wb.c", + "rotator/sde_rotator_r1_pipe.c ", + "rotator/sde_rotator_r1_ctl.c", + "rotator/sde_rotator_r1.c", + "rotator/sde_rotator_r3.c"], + "CONFIG_SYNC_FILE":["rotator/sde_rotator_sync.c"], + "CONFIG_DEBUG_FS":["rotator/sde_rotator_debug.c", + "rotator/sde_rotator_r1_debug.c", + "rotator/sde_rotator_r3_debug.c"], + }, + }, + deps = [ + "//vendor/qcom/opensource/mm-drivers:%b_mm_drivers", + "//vendor/qcom/opensource/mmrm-driver:%b_mmrm_driver", + "//vendor/qcom/opensource/securemsm-kernel:%b_hdcp_qseecom_dlkm" + ], +) diff --git a/msm/dp/dp_pll_4nm.c b/msm/dp/dp_pll_4nm.c index af9a2fd41b..77eda7c596 100644 --- a/msm/dp/dp_pll_4nm.c +++ b/msm/dp/dp_pll_4nm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ /* @@ -23,7 +23,6 @@ #include #include #include -#include "clk-regmap-mux.h" #include "dp_hpd.h" #include "dp_debug.h" #include "dp_pll.h" diff --git a/msm/dp/dp_pll_5nm.c b/msm/dp/dp_pll_5nm.c index 9ddd9ae35d..d8cc841734 100644 --- a/msm/dp/dp_pll_5nm.c +++ b/msm/dp/dp_pll_5nm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */ @@ -24,7 +24,6 @@ #include #include #include -#include "clk-regmap-mux.h" #include "dp_hpd.h" #include "dp_debug.h" #include "dp_pll.h" diff --git a/msm/dsi/dsi_pll.h b/msm/dsi/dsi_pll.h index e78d94a20b..07a1f9912d 100644 --- a/msm/dsi/dsi_pll.h +++ b/msm/dsi/dsi_pll.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef __DSI_PLL_H @@ -12,9 +12,6 @@ #include #include #include -#include "clk-regmap.h" -#include "clk-regmap-divider.h" -#include "clk-regmap-mux.h" #include "dsi_defs.h" #include "dsi_hw.h" diff --git a/msm/sde_dbg.h b/msm/sde_dbg.h index 29b885c8b4..89397cb0fa 100644 --- a/msm/sde_dbg.h +++ b/msm/sde_dbg.h @@ -1,13 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */ #ifndef SDE_DBG_H_ #define SDE_DBG_H_ -#include +#include #include #include #include diff --git a/target.bzl b/target.bzl new file mode 100644 index 0000000000..90413cd22e --- /dev/null +++ b/target.bzl @@ -0,0 +1,27 @@ +load(":display_modules.bzl", "display_driver_modules") +load(":display_driver_build.bzl", "define_consolidate_gki_modules") + +def define_pineapple(): + define_consolidate_gki_modules( + target = "pineapple", + registry = display_driver_modules, + modules = [ + "msm_drm", + ], + config_options = [ + "CONFIG_DRM_MSM_SDE", + "CONFIG_SYNC_FILE", + "CONFIG_DRM_MSM_DSI", + "CONFIG_DRM_MSM_DP", + "CONFIG_DRM_MSM_DP_MST", + "CONFIG_DSI_PARSER", + "CONFIG_DRM_SDE_WB", + "CONFIG_DRM_SDE_RSC", + "CONFIG_DRM_MSM_REGISTER_LOGGING", + "CONFIG_QCOM_MDSS_PLL", + "CONFIG_HDCP_QSEECOM", + "CONFIG_DRM_SDE_VM", + "CONFIG_QCOM_WCD939X_I2C", + "CONFIG_THERMAL_OF", + ], +) \ No newline at end of file