mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
drm/amd/display: Fix amdgpu_dm KUnit allmodconfig build
[Why]
With CONFIG_DRM_AMD_DC_KUNIT_TEST=m, allmodconfig only defines the
_MODULE variant. Four KUnit helper headers gate their declarations
with #ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST, so the declarations vanish
while the matching .c files (driven by IS_ENABLED() via
STATIC_IFN_KUNIT) keep the functions non-static. The build breaks
with implicit declarations and -Werror=missing-prototypes.
amdgpu_dm_crc.h additionally uses symbols that its test file does not
pull in indirectly, amdgpu_dm_colorop_test.c has a copy-paste
duplicate function with the wrong expected bitmask, and the three
colorop TF bitmasks are not exported for modpost.
[How]
- Switch the crc/hdcp/color/psr KUnit guards to IS_ENABLED().
- Make amdgpu_dm_crc.h self-contained (dc_types.h + forward decl).
- Rename the duplicated shaper test back to its intended name and
fix its expected bitmask.
- Export amdgpu_dm_supported_{degam,shaper,blnd}_tfs via
EXPORT_IF_KUNIT().
Assisted-by: Copilot:claude-4-opus
Reviewed-by: Alex Hung <alex.hung@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
b0687d047b
commit
651479b69a
|
|
@ -42,7 +42,7 @@ struct dc_rgb;
|
|||
struct fixed31_32;
|
||||
struct tetrahedral_params;
|
||||
|
||||
#ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST
|
||||
#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
|
||||
/*
|
||||
* Prototypes for functions exposed to KUnit tests. The enum types
|
||||
* used below (dc_transfer_func_predefined, amdgpu_transfer_function,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_dm_colorop.h"
|
||||
#include "amdgpu_dm_kunit_helpers.h"
|
||||
#include "dc.h"
|
||||
|
||||
const u64 amdgpu_dm_supported_degam_tfs =
|
||||
|
|
@ -38,18 +39,21 @@ const u64 amdgpu_dm_supported_degam_tfs =
|
|||
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
|
||||
EXPORT_IF_KUNIT(amdgpu_dm_supported_degam_tfs);
|
||||
|
||||
const u64 amdgpu_dm_supported_shaper_tfs =
|
||||
BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
|
||||
EXPORT_IF_KUNIT(amdgpu_dm_supported_shaper_tfs);
|
||||
|
||||
const u64 amdgpu_dm_supported_blnd_tfs =
|
||||
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
|
||||
EXPORT_IF_KUNIT(amdgpu_dm_supported_blnd_tfs);
|
||||
|
||||
#define MAX_COLOR_PIPELINE_OPS 10
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,11 @@
|
|||
#ifndef AMD_DAL_DEV_AMDGPU_DM_AMDGPU_DM_CRC_H_
|
||||
#define AMD_DAL_DEV_AMDGPU_DM_AMDGPU_DM_CRC_H_
|
||||
|
||||
#include "dc_types.h"
|
||||
|
||||
struct drm_crtc;
|
||||
struct dm_crtc_state;
|
||||
struct amdgpu_device;
|
||||
|
||||
enum amdgpu_dm_pipe_crc_source {
|
||||
AMDGPU_DM_PIPE_CRC_SOURCE_NONE = 0,
|
||||
|
|
@ -148,7 +151,7 @@ void amdgpu_dm_crtc_secure_display_create_contexts(struct amdgpu_device *adev);
|
|||
#define amdgpu_dm_crtc_secure_display_create_contexts(x)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST
|
||||
#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
|
||||
enum amdgpu_dm_pipe_crc_source dm_parse_crc_source(const char *source);
|
||||
bool dm_is_crc_source_crtc(enum amdgpu_dm_pipe_crc_source src);
|
||||
bool dm_is_crc_source_dprx(enum amdgpu_dm_pipe_crc_source src);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void hdcp_destroy(struct kobject *kobj, struct hdcp_workqueue *work);
|
|||
|
||||
struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct cp_psp *cp_psp, struct dc *dc);
|
||||
|
||||
#ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST
|
||||
#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
|
||||
void process_output(struct hdcp_workqueue *hdcp_work);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ bool amdgpu_dm_psr_set_event(struct amdgpu_display_manager *dm,
|
|||
struct dc_stream_state *stream, bool set_event, enum psr_event event,
|
||||
bool wait_for_disable);
|
||||
|
||||
#ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST
|
||||
#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
|
||||
void amdgpu_dm_psr_fill_caps(struct dc_link *link, struct psr_caps *caps);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ static void dm_test_supported_shaper_tfs_has_gamma22(struct kunit *test)
|
|||
BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
|
||||
}
|
||||
|
||||
static void dm_test_supported_degam_tfs_no_extra_bits(struct kunit *test)
|
||||
static void dm_test_supported_shaper_tfs_no_extra_bits(struct kunit *test)
|
||||
{
|
||||
u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
|
||||
u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF) |
|
||||
BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
|
||||
|
||||
KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_shaper_tfs, expected);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user