The GSoC journey is coming to a close. In just over 100 days, I gained more experience in open-source development than I could ever imagine in this period.

Prior to GSoC, I was not used to regularly submit patches to the mailing lists. Now, I’ve sent many patches and revisions. I believe my interaction with the community will only grow. I learned so much about the tools and workflow of kernel development.

After this experience, I’m more than certain that I want to make this a job, contributing to open-source is fun, so why not make this a living :)

Goals

The main goal of the project was to increase the code coverage on the DRM core helper functions by creating unit tests.

As the coverage of all helpers is a big task for the time period, I decided to create tests for the drm_format_helper.c functions.

Throughout the project, other side tasks appeared. I will list the contributions made below.

GSoC contributions

Linux Kernel - VKMS

VKMS is a software-only model of a KMS driver that is useful for testing and running X (or similar) on headless machines.

This was, unexpectedly, a big part of my GSoC. I learned a lot about color formats and how a graphics driver works. Currently, only one piece of my work was upstreamed, the rest needs more work and was postponed in favor of the primary project goal.

Patch Status
drm/vkms: Add support to 1D gamma LUT Accepted

For more information go check my blogpost about the whole process.

IGT

IGT GPU Tools is a collection of tools for the development and testing of DRM drivers. While working on VKMS I used heavily the IGT framework for testing, in one occasion a bug made a test to stop working on the VKMS, so a submitted a patch to fix that.

Patch Status
lib/igt_fb: Add check for intel device on use_enginecopy Accepted

Linux Kernel - DRM

In the DRM subsystem, I’ve done the main project goal, contributed by adding unit tests, and also helped to fix some bugs that appeared while working on the tests. With the sent patches I got 71.5% of line coverage and 85.7% of function coverage on the drm_format_helper.c.

Patch Status
drm/tests: Remove CONFIG_DRM_FBDEV_EMULATION on .kunitconfig Rejected
drm/tests: Alloc drm_device on drm_exec tests Accepted
drm/tests: Test default pitch fallback Accepted
drm/tests: Add KUnit tests for drm_fb_swab() Accepted
drm/tests: Add KUnit tests for drm_fb_clip_offset() Accepted
drm/tests: Add KUnit tests for drm_fb_build_fourcc_list() Accepted
drm/tests: Add multi-plane support to conversion_buf_size() Accepted
drm/tests: Add KUnit tests for drm_fb_memcpy() Accepted

Challenges Faced

I think the most difficult task was describing my work. Either on blog posts or in the commit messages, it takes a lot of work to write what you’ve done concisely and clearly. With time you get the way of things, but I think I can improve on this subject.

Moreover, many times I had to debug some problems. I already knew how to use GDB, but using it in the kernel is a little more cumbersome. After searching, reading the documentation, and getting tips from my mentors, I got it working.

On the VKMS, I had to create new features, this requires a lot of thought. I made a lot of diagrams in my head to understand how the color formats would be displayed in memory, and yet most of my work hasn’t seen the light of day XD.

What is left to do

I was able to do most of the proposed tasks. But the drm_xfrm_toio was left out due to the difficulty of testing it, as it uses IO memory. I tested the drm_fb_blit(), but I’m waiting for the acceptance of the patchset to send it, with that patch the line coverage will go to 89.2% and the function coverage will go to 94.3%.

Community Interaction

Besides patch submission, I reviewed some patches too. Going to the other side, I enjoyed thinking about how a piece of code could be improved.

Also, on one occasion I started a discussion about the best way to solve an issue by sending a patch. This got me a Reported-by tag on the patch that fixed the bug.

Patch
Re: [PATCH] drm/format_helper: Add Kunit tests for drm_fb_xrgb8888_to_mono()
Re: [PATCH] drm/format_helper: Add Kunit tests for drm_fb_xrgb8888_to_mono()
Re: [PATCH v2] drm/format-helper: Make conversion_buf_size() support sub-byte pixel fmts
Re: [PATCH v3 1/2] drm/format-helper: Add Kunit tests for drm_fb_xrgb8888_to_mono()
Re: [PATCH 1/5] drm/tests: Test drm_rect_intersect()
Re: [PATCH v2 1/5] drm/tests: Test drm_rect_intersect()
Re: [PATCH v2 1/7] drm/vkms: isolate pixel conversion functionality
Re: [PATCH v3 1/6] drm/vkms: isolate pixel conversion functionality
Re: [PATCH v4 3/5] drm/tests: Add test cases for drm_rect_calc_vscale()
Re: [PATCH v2 1/2] drm/vkms: allow full alpha blending on all planes
Re: [PATCH v2 1/2] drm: Add fixed-point helper to get rounded integer values
Re: [PATCH v2 2/2] drm/vkms: Fix RGB565 pixel conversion
Re: [PATCH v3 1/2] drm: Add fixed-point helper to get rounded integer values
Re: [PATCH 0/3] drm/vkms: Minor Improvements
Re: [PATCH v2] drm/vkms: Fix race-condition between the hrtimer and the atomic commit
Re: [PATCH] drm/tests: Add test case for drm_rect_clip_scaled()
Re: [PATCH v4] drm/vkms: Add support to 1D gamma LUT
Re: [PATCH] drm/tests: Remove CONFIG_DRM_FBDEV_EMULATION on .kunitconfig
Re: [PATCH] drm/tests: Remove CONFIG_DRM_FBDEV_EMULATION on .kunitconfig
Re: [PATCH] drm/tests: Alloc drm_device on drm_exec tests
Re: [PATCH] drm: Drop select FRAMEBUFFER_CONSOLE for DRM_FBDEV_EMULATION
Re: [PATCH -next 6/7] drm/format-helper: Remove unnecessary NULL values
Re: [PATCH 6/6] drm/format-helper: Add KUnit tests for drm_fb_memcpy()
Re: [PATCH v2 6/6] drm/tests: Add KUnit tests for drm_fb_memcpy()

Moreover, I use a Thunderbird addon to make the diff properly highlyted. When I was tinkering with the configuration, I noticed that the CSS of the configuration menu was wrong, so it made the user experience pretty bad.

I sent a patch fixing that to the maintainer of the addon, this patch generated a discussion that made a whole change in the CSS file due to Thunderbird updates.

Acknowledgments

I’d like to thank my mentors, André “Tony” Almeida, Maíra Canal, and Tales L. Aparecida. Their support and expertise were invaluable throughout this journey.

Moreover, I thank the X.Org Foundation for allowing me to participate in this program, and also for accepting my talk proposal on the XDC 2023.

Lastly, I thank my colleague Carlos Eduardo Gallo for exchanging knowledge during the weekly meetings.