The HDMI and DP colorspace property probes and the legacy gamma probe
are the only top-level probes that are not wrapped in
AC_KERNEL_DO_BACKGROUND. They run in the shared configure directory,
one at a time, while every other probe runs in parallel in its own
temporary directory.

Running in the shared directory also lets a probe see a conftest.o left
there by an earlier one. Before commit a4e55d0e6d9a ("drm/amdkcl: string
objtool from cflags for conftest") the probe command ended in
"; objtool ... conftest.o", so a failed compile was hidden by objtool
succeeding on that stale object. On v5.17 this defined
HAVE_DRM_MODE_CREATE_{HDMI,DP}_COLORSPACE_PROPERTY_2ARGS for kernels
that only have the 1-argument functions. That commit removed the cause;
running these probes in background like the others removes the shared
state as well.

Wrap each probe separately rather than the colorspace group as a whole:
AC_AMDGPU_DRM_CONNECT_ATTACH_COLORSPACE_PROPERTY already runs in
background, and a job started from inside another one is not in $procs,
so AC_KERNEL_WAIT would not wait for it.

The generated config.h is unchanged.

Link: https://github.com/ROCm/amdgpu/issues/228
Signed-off-by: Jiaming Fan <[email protected]>
---
This was a real bug in the ROCm 6.0.0 DKMS package on kernel v5.17, which
I reported in issue #228. It is already fixed on master by a4e55d0e6d9a,
so this patch does not fix a bug there; it only makes these three probes
consistent with the rest. Feel free to drop it if you prefer to leave
them as they are.

 ...rm_mode_create_hdmi_colorspace_property.m4 | 40 ++++++++++---------
 .../drm/amd/dkms/m4/struct_drm_crtc_funcs.m4  | 12 +++---
 2 files changed, 29 insertions(+), 23 deletions(-)

diff --git 
a/drivers/gpu/drm/amd/dkms/m4/drm_mode_create_hdmi_colorspace_property.m4 
b/drivers/gpu/drm/amd/dkms/m4/drm_mode_create_hdmi_colorspace_property.m4
index ecc33db..3d7eee7 100644
--- a/drivers/gpu/drm/amd/dkms/m4/drm_mode_create_hdmi_colorspace_property.m4
+++ b/drivers/gpu/drm/amd/dkms/m4/drm_mode_create_hdmi_colorspace_property.m4
@@ -20,30 +20,34 @@ dnl # commit v6.1-5783-g08383039cd19
 dnl # drm/connector: Allow drivers to pass list of supported colorspaces
 dnl #
 AC_DEFUN([AC_AMDGPU_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY], [
-       AC_KERNEL_TRY_COMPILE_SYMBOL([
-                       #include <drm/drm_connector.h>
-        ], [
-            drm_mode_create_hdmi_colorspace_property(NULL, 0);
-               ], [drm_mode_create_hdmi_colorspace_property], 
[drivers/gpu/drm/drm_connector.c], [
-                               
AC_DEFINE(HAVE_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY_2ARGS, 1,
-                       [drm_mode_create_hdmi_colorspace_property() has 2 args])
-               ])
-]) 
+       AC_KERNEL_DO_BACKGROUND([
+               AC_KERNEL_TRY_COMPILE_SYMBOL([
+                       #include <drm/drm_connector.h>
+               ], [
+                       drm_mode_create_hdmi_colorspace_property(NULL, 0);
+               ], [drm_mode_create_hdmi_colorspace_property], 
[drivers/gpu/drm/drm_connector.c], [
+                       
AC_DEFINE(HAVE_DRM_MODE_CREATE_HDMI_COLORSPACE_PROPERTY_2ARGS, 1,
+                               [drm_mode_create_hdmi_colorspace_property() has 
2 args])
+               ])
+       ])
+])
 
 dnl #
 dnl # commit v6.1-5783-g08383039cd19
 dnl # drm/connector: Allow drivers to pass list of supported colorspaces
 dnl #
 AC_DEFUN([AC_AMDGPU_DRM_MODE_CREATE_DP_COLORSPACE_PROPERTY], [
-       AC_KERNEL_TRY_COMPILE_SYMBOL([
-                       #include <drm/drm_connector.h>
-        ], [
-            drm_mode_create_dp_colorspace_property(NULL, 0);
-               ], [drm_mode_create_dp_colorspace_property], 
[drivers/gpu/drm/drm_connector.c], [
-                               
AC_DEFINE(HAVE_DRM_MODE_CREATE_DP_COLORSPACE_PROPERTY_2ARGS, 1,
-                       [drm_mode_create_dp_colorspace_property() has 2 args])
-               ])
-])             
+       AC_KERNEL_DO_BACKGROUND([
+               AC_KERNEL_TRY_COMPILE_SYMBOL([
+                       #include <drm/drm_connector.h>
+               ], [
+                       drm_mode_create_dp_colorspace_property(NULL, 0);
+               ], [drm_mode_create_dp_colorspace_property], 
[drivers/gpu/drm/drm_connector.c], [
+                       
AC_DEFINE(HAVE_DRM_MODE_CREATE_DP_COLORSPACE_PROPERTY_2ARGS, 1,
+                               [drm_mode_create_dp_colorspace_property() has 2 
args])
+               ])
+       ])
+])
 
 
 AC_DEFUN([AC_AMDGPU_DRM_MODE_CREATE_COLORSPACE_PROPERTY_FUNCS], [
diff --git a/drivers/gpu/drm/amd/dkms/m4/struct_drm_crtc_funcs.m4 
b/drivers/gpu/drm/amd/dkms/m4/struct_drm_crtc_funcs.m4
index 6b53674..9e9acbc 100644
--- a/drivers/gpu/drm/amd/dkms/m4/struct_drm_crtc_funcs.m4
+++ b/drivers/gpu/drm/amd/dkms/m4/struct_drm_crtc_funcs.m4
@@ -23,13 +23,15 @@ dnl #
 dnl # v5.10-1961-g6ca2ab8086af drm: automatic legacy gamma support
 dnl #
 AC_DEFUN([AC_AMDGPU_STRUCT_DRM_CRTC_FUNCS_GAMMA_SET_OPTIONAL], [
-       AC_KERNEL_TRY_COMPILE_SYMBOL([
-               #include <drm/drm_atomic_helper.h>
-       ], [
-               drm_atomic_helper_legacy_gamma_set(NULL, NULL, NULL, NULL, 0, 
NULL);
-       ], [drm_atomic_helper_legacy_gamma_set], 
[drivers/gpu/drm/drm_atomic_helper.c],[],[
+       AC_KERNEL_DO_BACKGROUND([
+               AC_KERNEL_TRY_COMPILE_SYMBOL([
+                       #include <drm/drm_atomic_helper.h>
+               ], [
+                       drm_atomic_helper_legacy_gamma_set(NULL, NULL, NULL, 
NULL, 0, NULL);
+               ], [drm_atomic_helper_legacy_gamma_set], 
[drivers/gpu/drm/drm_atomic_helper.c],[],[
                        
AC_DEFINE(HAVE_STRUCT_DRM_CRTC_FUNCS_GAMMA_SET_OPTIONAL, 1,
                                [HAVE_STRUCT_DRM_CRTC_FUNCS_GAMMA_SET_OPTIONAL 
is available])
+               ])
        ])
 ])
 
-- 
2.56.0


Reply via email to