drm/amd/display: Fix KUnit test crash after global alpha change

[WHY]
amdgpu_dm_plane_fill_blending_from_plane_state added drm_to_adev() but
dm_test_fill_blending_global_alpha did not initialize
plane_state->plane, causing a NULL pointer dereference.

[HOW]
Add an amdgpu_device and drm_plane so the plane->dev
dereference is valid in the test.

Fixes: 829769f1cf ("drm/amd/display: scale plane global alpha to 12 bits on DCN 4.2")
Cc: PingLei.Lin@amd.com
Assisted-by: Copilot:Claude-Opus-4.6
Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Alex Hung 2026-06-16 09:47:28 -06:00 committed by Alex Deucher
parent 829769f1cf
commit dcce6246e6

View File

@ -184,12 +184,19 @@ static void dm_test_fill_blending_coverage_alpha_format(struct kunit *test)
*/
static void dm_test_fill_blending_global_alpha(struct kunit *test)
{
struct amdgpu_device *adev;
struct drm_plane plane = {0};
struct drm_plane_state state = { 0 };
bool per_pixel_alpha;
bool pre_multiplied_alpha;
bool global_alpha;
int global_alpha_value;
adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL);
KUNIT_ASSERT_NOT_NULL(test, adev);
plane.dev = &adev->ddev;
state.plane = &plane;
state.pixel_blend_mode = DRM_MODE_BLEND_PIXEL_NONE;
state.alpha = 0x8000;