[PATCH 05/10] drm/tests: Add test for drm_framebuffer_cleanup()

Maxime Ripard mripard at kernel.org
Mon Sep 11 08:00:41 UTC 2023


On Fri, Sep 08, 2023 at 05:42:07PM -0300, Maira Canal wrote:
> Hi Carlos,
> 
> On 9/4/23 14:22, Carlos wrote:
> > Hi Maíra,
> > 
> > On 8/26/23 11:06, Maíra Canal wrote:
> > > Hi Carlos,
> > > 
> > > On 8/25/23 13:07, Carlos Eduardo Gallo Filho wrote:
> > > > Add a single KUnit test case for the drm_framebuffer_cleanup function.
> > > > 
> > > > Signed-off-by: Carlos Eduardo Gallo Filho <gcarlos at disroot.org>
> > > > ---
> > > >   drivers/gpu/drm/tests/drm_framebuffer_test.c | 49 ++++++++++++++++++++
> > > >   1 file changed, 49 insertions(+)
> > > > 
> > > > diff --git a/drivers/gpu/drm/tests/drm_framebuffer_test.c
> > > > b/drivers/gpu/drm/tests/drm_framebuffer_test.c
> > > > index 0e0e8216bbbc..16d9cf4bed88 100644
> > > > --- a/drivers/gpu/drm/tests/drm_framebuffer_test.c
> > > > +++ b/drivers/gpu/drm/tests/drm_framebuffer_test.c
> > > > @@ -370,6 +370,9 @@ static int drm_framebuffer_test_init(struct
> > > > kunit *test)
> > > >       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, mock);
> > > >       dev = &mock->dev;
> > > >   +    mutex_init(&dev->mode_config.fb_lock);
> > > 
> > > What about drmm_mutex_init()?
> > I took a look into it and as far I understand it would be useful if
> > the drm_device was allocated with drmm_kalloc(), sure? As far we
> 
> I'm not sure if we can allocate drm_device with drmm_kzalloc(), as we
> need a DRM device for drmm_kzalloc(). drmm_kzalloc() is just a
> &drm_device managed version of kzalloc().

We should use drm_kunit_helper_alloc_drm_device_with_driver

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230911/32aa2fc9/attachment-0001.sig>


More information about the dri-devel mailing list