Hi Srikar & Louis,
On 01/12/24 02:36, Louis Chauvet wrote:
+Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
On 30/11/24 - 13:49, Ananta Srikar Puranam wrote:
Dear Louis Chauvet,
Hi Srikar!
I was able to successfully compile Linux with VKMS enabled and have set up
igt-gpu-tests in a QEMU machine. I can now run some tests successfully.
Congratulation!
I have a surface-level understanding of the DRM and KMS subsystems
(framebuffers, planes, CRTCs, encoders, and connectors) and am eager to dive
deeper into the VKMS module and contribute.
I am very happy to see some interest in VKMS development, do you have a
specific feature that you want to test?
I understand VKMS helps test the DRM subsystem, but I’m struggling to fully
grasp how the absence of visible display output aligns with its testing
goals. Any guidance on this would be highly appreciated.
That the whole point of "V"KMS, everything is virtual, even the display
output :)
There are two way to get some information about the output content:
- CRC compuation [1]
- Writeback connector [2]
The CRC will allows you to write a test like this:
create_reference_image();
ref_crc = grab_crc();
test_procedure();
test_crc = grab_crc();
assert(ref_crc, test_crc);
This is used in the igt test "kms_plane" to test color conversion, they
compute a reference CRC and then test the conversion between multiple
formats [3].
The writeback connector is useful to grab a "screenshot" of the output,
but it is a bit less efficient. It can be used when a simple "reference
CRC" is not possible.
To grab a picture from the writeback connector, you have to do something
like this:
setup_pipeline();
wb_fb = create_fb();
while (true) {
send_fb_to_wb_connector(wb_fb);
wait_for_picture();
do_something_with_result(wb_fb);
}
There is a writeback example in igt [4], but I don't know how it works.
[1]:https://elixir.bootlin.com/linux/v6.12.1/source/drivers/gpu/drm/vkms/vkms_composer.c#L209
[2]:https://elixir.bootlin.com/linux/v6.12.1/source/drivers/gpu/drm/vkms/vkms_writeback.c#L171
[3]:https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/tests/kms_plane.c#L1036
[4]:https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/tests/kms_writeback.c
Additionally, I noticed the TODO item to add the plane feature (background
color KMS property). It seems like a good starting point, and I would be
grateful for direction on how to approach it.
I think this is the good direction, yes!
All your patches must be on top of drm-misc-next [5]. If you are not
familiar with kernel contribution, I invite you to look at the kernel
documentation [6] and at the amazing b4 tool [7].
For the implementation itself, I think you have to work in the function
blend, probably around the fill_background function [8]. You also need to
attach a BACKGROUND property on the CRTC [9]. I think you have to do it
somewhere in crtc initialization [10].
I implemented this feature to VKMS last year [1], but there were some
discussion about the user-space use of this feature, so the development
got stalled. I encourage you to read through the discussion.
The thing is: when implementing a new DRM uAPI, you need a correspondent
user-space implementation. From the DRM docs [2],
"The short summary is that any addition of DRM uAPI requires
corresponding open-sourced userspace patches, and those patches must be
reviewed and ready for merging into a suitable and canonical upstream
project."
Therefore, it is important to talk to the user-space compositors
community to check their requirements and see if they need this
property.
[1]
https://lore.kernel.org/dri-devel/20230410125435.128689-1-mcanal@xxxxxxxxxx/T/
[2]
https://docs.kernel.org/gpu/drm-uapi.html#open-source-userspace-requirements
Best Regards,
- Maíra
[5]:https://gitlab.freedesktop.org/drm/misc/kernel/-/tree/drm-misc-next
[6]:https://docs.kernel.org/process/contribution-maturity-model.html
[7]:https://b4.docs.kernel.org/
[8]:https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/vkms/vkms_composer.c#L389
[9]:https://drmdb.emersion.fr/properties/3435973836/BACKGROUND
[10]:https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/vkms/vkms_crtc.c?ref_type=heads#L273
Thank you for your time, and I look forward to your guidance.
Best regards,
Srikar