CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core

2023-08-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug 15 05:01:58 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core:
amdgpu_dc_stream.c

Log Message:
avoid a GCC 12 warning.

there's a 1-element long array and a loop conditional that tries to see
if indexes for it are not identical.  as these indexes will always both
be 0, the only valid index, the condition is always false.  GCC 12
triggers a strange warning on this code that can never run (see below),
so simply assert the array size is 1 and comment the rest.

amdgpu_dc_stream.c:470:55: error: array subscript [0, 0] is outside array 
bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
  470 | stream->writeback_info[j] = 
stream->writeback_info[i];


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core

2023-08-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug 15 05:01:58 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core:
amdgpu_dc_stream.c

Log Message:
avoid a GCC 12 warning.

there's a 1-element long array and a loop conditional that tries to see
if indexes for it are not identical.  as these indexes will always both
be 0, the only valid index, the condition is always false.  GCC 12
triggers a strange warning on this code that can never run (see below),
so simply assert the array size is 1 and comment the rest.

amdgpu_dc_stream.c:470:55: error: array subscript [0, 0] is outside array 
bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
  470 | stream->writeback_info[j] = 
stream->writeback_info[i];


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c:1.2 src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c:1.2	Sat Dec 18 23:45:02 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c	Tue Aug 15 05:01:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_dc_stream.c,v 1.2 2021/12/18 23:45:02 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_dc_stream.c,v 1.3 2023/08/15 05:01:57 mrg Exp $	*/
 
 /*
  * Copyright 2012-15 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dc_stream.c,v 1.2 2021/12/18 23:45:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dc_stream.c,v 1.3 2023/08/15 05:01:57 mrg Exp $");
 
 #include 
 #include 
@@ -465,9 +465,18 @@ bool dc_stream_remove_writeback(struct d
 	/* remove writeback info for disabled writeback pipes from stream */
 	for (i = 0, j = 0; i < stream->num_wb_info; i++) {
 		if (stream->writeback_info[i].wb_enabled) {
+#ifdef __NetBSD__
+			/*
+			 * XXXGCC12
+			 * The array is only 1 entry long, so i and j must
+			 * always be 0 here, so the below test fails.
+			 */
+			CTASSERT(ARRAY_SIZE(stream->writeback_info) == 1);
+#else
 			if (i != j)
 /* trim the array */
 stream->writeback_info[j] = stream->writeback_info[i];
+#endif
 			j++;
 		}
 	}



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 11:22:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core:
amdgpu_dc_link_dp.c

Log Message:
amdgpu: Fix bogus enum.

Cherry-picked from:

commit a110f3750bf8b93764f13bd1402c7cba03d15d61
Author: Arnd Bergmann 
Date:   Mon Oct 26 22:00:30 2020 +0100

drm/amdgpu: fix incorrect enum type

core_link_write_dpcd() returns enum dc_status, not ddc_result:

display/dc/core/dc_link_dp.c: In function 'dp_set_panel_mode':
display/dc/core/dc_link_dp.c:4237:11: warning: implicit conversion from 'enu
m dc_status' to 'enum ddc_result'
[-Wenum-conversion]

Avoid the warning by using the correct enum in the caller.

Fixes: 0b226322434c ("drm/amd/display: Synchronous DisplayPort Link 
Training")
Signed-off-by: Arnd Bergmann 
Signed-off-by: Alex Deucher 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c:1.4 src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c:1.4	Sun Dec 19 10:59:36 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c	Sun Dec 19 11:22:40 2021
@@ -1,8 +1,8 @@
-/*	$NetBSD: amdgpu_dc_link_dp.c,v 1.4 2021/12/19 10:59:36 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_dc_link_dp.c,v 1.5 2021/12/19 11:22:40 riastradh Exp $	*/
 
 /* Copyright 2015 Advanced Micro Devices, Inc. */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dc_link_dp.c,v 1.4 2021/12/19 10:59:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dc_link_dp.c,v 1.5 2021/12/19 11:22:40 riastradh Exp $");
 
 #include "dm_services.h"
 #include "dc.h"
@@ -4010,7 +4010,7 @@ void dp_set_panel_mode(struct dc_link *l
 
 		if (edp_config_set.bits.PANEL_MODE_EDP
 			!= panel_mode_edp) {
-			enum ddc_result result = DDC_RESULT_UNKNOWN;
+			enum dc_status result = DC_ERROR_UNEXPECTED;
 
 			edp_config_set.bits.PANEL_MODE_EDP =
 			panel_mode_edp;
@@ -4020,7 +4020,7 @@ void dp_set_panel_mode(struct dc_link *l
 _config_set.raw,
 sizeof(edp_config_set.raw));
 
-			ASSERT(result == DDC_RESULT_SUCESSFULL);
+			ASSERT(result == DC_OK);
 		}
 	}
 	DC_LOG_DETECTION_DP_CAPS("Link: %d eDP panel mode supported: %d "



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 11:22:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core:
amdgpu_dc_link_dp.c

Log Message:
amdgpu: Fix bogus enum.

Cherry-picked from:

commit a110f3750bf8b93764f13bd1402c7cba03d15d61
Author: Arnd Bergmann 
Date:   Mon Oct 26 22:00:30 2020 +0100

drm/amdgpu: fix incorrect enum type

core_link_write_dpcd() returns enum dc_status, not ddc_result:

display/dc/core/dc_link_dp.c: In function 'dp_set_panel_mode':
display/dc/core/dc_link_dp.c:4237:11: warning: implicit conversion from 'enu
m dc_status' to 'enum ddc_result'
[-Wenum-conversion]

Avoid the warning by using the correct enum in the caller.

Fixes: 0b226322434c ("drm/amd/display: Synchronous DisplayPort Link 
Training")
Signed-off-by: Arnd Bergmann 
Signed-off-by: Alex Deucher 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_link_dp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.