[PATCH] drm/i915: Fix selecting CONFIG_DRM_KUNIT_TEST in debug builds

Imre Deak imre.deak at intel.com
Thu Jul 24 19:29:47 UTC 2025


On Thu, Jul 24, 2025 at 05:31:28PM +0100, Ruben Wauters wrote:
> On Thu, 2025-07-24 at 12:26 -0400, Rodrigo Vivi wrote:
> > On Thu, Jul 24, 2025 at 12:02:37PM +0300, Imre Deak wrote:
> > > Selecting an option which depends on other options only works if
> > > the
> > > dependencies are guaranteed to be selected (as these dependencies
> > > will
> > > not be automatically selected). CONFIG_DRM_KUNIT_TEST depends on
> > > DRM,
> > > MMU and KUNIT the first two of which are guaranteed to be selected
> > > for
> > > i915, but the last one is not. Hence, selecting
> > > CONFIG_DRM_KUNIT_TEST in
> > > i915 debug builds may result in CONFIG_DRM_KUNIT_TEST being
> > > selected
> > > without the CONFIG_KUNIT dependency being selected. This causes at
> > > least
> > > the following compile error:
> > > 
> my bad, I guess I fundamentally misunderstood how the Kconfig system
> worked, and assumed that if you selected one all the dependencies were
> automatically selected. I guess this passed me by in testing cause I
> already had CONFIG_KUNIT selected and didn't think to de-select it,
> apologies.

IME, it's easy to get the Kconfig dependency semantics wrong. Unless I
get it wrong, 'depends on' will never select the options listed after
it, it only determines if its parent option is visible during manual
selection (and similarly if it's valid to select the same parent option
from an other option automatically with 'select'). Maybe 'depends on' is
a misnomer and 'visible if' or 'available if' would better describe its
purpose.

> > > drivers/gpu/drm/tests/drm_bridge_test.c: In function
> > > ‘drm_test_bridge_alloc_init’:
> > > drivers/gpu/drm/tests/drm_bridge_test.c:449:21: error: implicit
> > > declaration of function ‘kunit_device_register’; did you mean
> > > ‘root_device_register’? [-Werror=implicit-function-declaration]
> > >   449 |         priv->dev = kunit_device_register(test, "drm-
> > > bridge-dev");
> > > 
> > > Fix the above by selecting CONFIG_DRM_KUNIT_TEST only if
> > > CONFIG_KUNIT is
> > > also selected.
> > 
> > Perhaps DRM_KUNIT_TEST should select CONFIG_KUNIT ?!
> 
> This was how I thoguht it already functioned, I guess not? I'm not sure
> if that's intentional or not but I guess it is a problem regardless
> > 
> > But well, let's fix our own mess on our side. I'm sorry for missing
> > this detail. :/
> > 
> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > 
> > > 
> > > Fixes: 17133255a322 ("drm/i915: replace DRM_DEBUG_SELFTEST with
> > > DRM_KUNIT_TEST")
> > > Cc: Ruben Wauters <rubenru09 at aol.com>
> > > Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > > Signed-off-by: Imre Deak <imre.deak at intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/Kconfig.debug | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/Kconfig.debug
> > > b/drivers/gpu/drm/i915/Kconfig.debug
> > > index b15b1cecb3aad..3562a02ef7adc 100644
> > > --- a/drivers/gpu/drm/i915/Kconfig.debug
> > > +++ b/drivers/gpu/drm/i915/Kconfig.debug
> > > @@ -50,7 +50,7 @@ config DRM_I915_DEBUG
> > >  	select DRM_VGEM # used by igt/prime_vgem (dmabuf interop
> > > checks)
> > >  	select DRM_DEBUG_MM if DRM=y
> > >  	select DRM_EXPORT_FOR_TESTS if m
> > > -	select DRM_KUNIT_TEST
> > > +	select DRM_KUNIT_TEST if KUNIT
> > >  	select DMABUF_SELFTESTS
> > >  	select SW_SYNC # signaling validation framework
> > > (igt/syncobj*)
> > >  	select DRM_I915_WERROR
> > > -- 
> > > 2.49.1
> 
> Ruben Wauters


More information about the Intel-gfx mailing list