From: jsg Date: Sun, 13 Aug 2023 10:25:34 +0000 (+0000) Subject: drm/amd/display: Ensure that planes are in the same order X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a3d5b211dc9564c36f5ee6e0bd72c4a384ad478d;p=openbsd drm/amd/display: Ensure that planes are in the same order From Rodrigo Siqueira 63eeb50fa11009cc4c82919b040c361c4ea0f14e in linux-6.1.y/6.1.45 bb46a6a9bab134b9d15043ea8fa9d6c276e938b8 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 5acc0b43f58..2eefe97aff7 100644 --- a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -351,6 +351,19 @@ static inline bool is_dc_timing_adjust_needed(struct dm_crtc_state *old_state, return false; } +static inline void reverse_planes_order(struct dc_surface_update *array_of_surface_update, + int planes_count) +{ + int i, j; + struct dc_surface_update surface_updates_temp; + + for (i = 0, j = planes_count - 1; i < j; i++, j--) { + surface_updates_temp = array_of_surface_update[i]; + array_of_surface_update[i] = array_of_surface_update[j]; + array_of_surface_update[j] = surface_updates_temp; + } +} + /** * update_planes_and_stream_adapter() - Send planes to be updated in DC * @@ -367,6 +380,8 @@ static inline bool update_planes_and_stream_adapter(struct dc *dc, struct dc_stream_update *stream_update, struct dc_surface_update *array_of_surface_update) { + reverse_planes_order(array_of_surface_update, planes_count); + /* * Previous frame finished and HW is ready for optimization. */