suspicious conditions in amd display driver
Denis Efremov
efremov at linux.com
Wed Sep 2 16:22:56 UTC 2020
Hi,
I've found suspicious code patterns in amd display driver.
For me they looks like redundant comparisons, but maybe it's logic bugs
and dm_444_16, dm_whole_buffer_for_single_stream_interleave should be changed to
other variables in second disjuncts.
Here are they:
diff -u -p ./drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c /tmp/nothing/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
--- ./drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
+++ /tmp/nothing/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
@@ -3235,7 +3235,6 @@ static bool CalculateBytePerPixelAnd256B
*BytePerPixelDETC = 0;
*BytePerPixelY = 4;
*BytePerPixelC = 0;
- } else if (SourcePixelFormat == dm_444_16 || SourcePixelFormat == dm_444_16) { // <== same comparison with dm_444_16
*BytePerPixelDETY = 2;
*BytePerPixelDETC = 0;
*BytePerPixelY = 2;
@@ -5515,7 +5514,6 @@ static void CalculateWatermarksAndDRAMSp
if (WritebackPixelFormat[k] == dm_444_64) {
WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2;
}
- if (mode_lib->vba.WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave || mode_lib->vba.WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave) { // <== same comparison with dm_whole_buffer_for_single_stream_interleave
diff -u -p ./drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c /tmp/nothing/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
--- ./drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
+++ /tmp/nothing/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
@@ -279,7 +279,6 @@ static bool CalculateBytePerPixelAnd256B
*BytePerPixelDETC = 0;
*BytePerPixelY = 4;
*BytePerPixelC = 0;
- } else if (SourcePixelFormat == dm_444_16 || SourcePixelFormat == dm_444_16) { // <== same comparison with dm_444_16
*BytePerPixelDETY = 2;
*BytePerPixelDETC = 0;
*BytePerPixelY = 2;
Thanks,
Denis
More information about the amd-gfx
mailing list