linux/drivers/gpu/drm/amd/display/dc/dml/calcs
Rafal Ostrowski c1199393ec drm/amd/display: Refactor surface_update_flags to flat struct with helpers
[Why]
The union surface_update_flags type uses a union with a raw
uint32_t member to allow bulk clear/set/test operations on the
bitfield. This couples the struct layout to a specific integer
width, breaks when the number of flag bits exceeds 32, and
scatters raw-access patterns across many call sites. Replacing
the union with a plain struct and adding explicit helper
functions makes the intent clearer and prepares the code for
future flag-set expansion.

[How]
Rename union surface_update_flags to struct pipe_update_bits
and remove the union wrapper, the .bits sub-struct, and the
.raw member. Add inline helpers in dc.h:
surface_update_flags_clear(), surface_update_flags_set_full(),
and surface_update_flags_is_any_set() that operate on the new
struct via memset/memcmp. Add stream_update_flags_clear() and
stream_update_flags_set_full() in dc_stream.h for the stream
update flags union. Update all callers: change the type name,
replace .bits.field with .field, replace .raw = 0 with the
clear helper, replace .raw = 0xFFFFFFFF with the set_full
helper, and replace .raw boolean tests with is_any_set.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Rafal Ostrowski <rafal.ostrowski@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-06-17 16:15:51 -04:00
..
dcn_calc_auto.c drm/amd/display: Fix narrowing boundaries in dml 2026-04-28 14:30:03 -04:00
dcn_calc_auto.h
dcn_calc_math.c drm/amd/display: Fix narrowing boundaries in dml 2026-04-28 14:30:03 -04:00
dcn_calcs.c drm/amd/display: Refactor surface_update_flags to flat struct with helpers 2026-06-17 16:15:51 -04:00