From: Alex Hung <[email protected]>
[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: cba0cc70f251 ("drm/amd/display: scale plane global alpha to 12 bits on
DCN 4.2")
Cc: [email protected]
Assisted-by: Copilot:Claude-Opus-4.6
Reviewed-by: Bhawanpreet Lakha <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: George Zhang <[email protected]>
---
.../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
index deec75857c0e..071c28abaa8a 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
@@ -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;
--
2.53.0