a0e6a017 | 23-May-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: Fix race-condition between the hrtimer and the atomic commit
Currently, it is possible for the composer to be set as enabled and then as disabled without a proper call for the vkms_vblank_
drm/vkms: Fix race-condition between the hrtimer and the atomic commit
Currently, it is possible for the composer to be set as enabled and then as disabled without a proper call for the vkms_vblank_simulate(). This is problematic, because the driver would skip one CRC output, causing CRC tests to fail. Therefore, we need to make sure that, for each time the composer is set as enabled, a composer job is added to the queue.
In order to provide this guarantee, add a mutex that will lock before the composer is set as enabled and will unlock only after the composer job is added to the queue. This way, we can have a guarantee that the driver won't skip a CRC entry.
This race-condition is affecting the IGT test "writeback-check-output", making the test fail and also, leaking writeback framebuffers, as the writeback job is queued, but it is not signaled. This patch avoids both problems.
[v2]: * Create a new mutex and keep the spinlock across the atomic commit in order to avoid interrupts that could result in deadlocks.
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230523123207.173976-1-mcanal@igalia.com
show more ...
|
cc4fd293 | 09-May-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: Isolate writeback pixel conversion functions
All convertions from the ARGB16161616 format follow the same structure. Instead of repeting the same structure for each supported format, creat
drm/vkms: Isolate writeback pixel conversion functions
All convertions from the ARGB16161616 format follow the same structure. Instead of repeting the same structure for each supported format, create a function to encapsulate the common logic and isolate the pixel conversion functions in a callback function.
Suggested-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230515135204.115393-4-mcanal@igalia.com
show more ...
|
e2a47217 | 15-May-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: Enable ARGB8888 support for writeback
The VKMS already has a function to convert ARGB16161616 to ARGB8888, so it is possible to use this function to provide the writeback support for the A
drm/vkms: Enable ARGB8888 support for writeback
The VKMS already has a function to convert ARGB16161616 to ARGB8888, so it is possible to use this function to provide the writeback support for the ARGB8888 format. Therefore, add the ARGB8888 format to the writeback format list.
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230515135204.115393-3-mcanal@igalia.com
show more ...
|
fc429807 | 08-May-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: Fix all kernel-doc warnings of the vkms_composer file
Fix the following warnings:
drivers/gpu/drm/vkms/vkms_composer.c:42: warning: Function parameter or member 'frame_info' not described
drm/vkms: Fix all kernel-doc warnings of the vkms_composer file
Fix the following warnings:
drivers/gpu/drm/vkms/vkms_composer.c:42: warning: Function parameter or member 'frame_info' not described in 'pre_mul_alpha_blend' drivers/gpu/drm/vkms/vkms_composer.c:42: warning: Excess function parameter 'src_frame_info' description in 'pre_mul_alpha_blend' drivers/gpu/drm/vkms/vkms_composer.c:93: warning: Cannot understand * @wb_frame_info: The writeback frame buffer metadata on line 93 - I thought it was a doc line
by correcting variable names and adding function name.
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230508220030.434118-2-mcanal@igalia.com
show more ...
|
cd075550 | 18-Apr-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: add rotate-270 property
Currently, vkms supports the rotate-90, rotate-180, reflect-x and reflect-y properties. Therefore, improve the vkms IGT test coverage by adding the rotate-270 prope
drm/vkms: add rotate-270 property
Currently, vkms supports the rotate-90, rotate-180, reflect-x and reflect-y properties. Therefore, improve the vkms IGT test coverage by adding the rotate-270 property to vkms. The rotation was implement by software: rotate the way the blending occurs by making the source x axis be the destination y axis and the source y axis be the destination x axis and reverse-read the axis.
Now, vkms supports all possible rotation values.
Tested with igt@kms_rotation_crc@primary-rotation-270 [1], and igt@kms_rotation_crc@sprite-rotation-270 [1].
[1] https://patchwork.freedesktop.org/series/116025/
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230418130525.128733-6-mcanal@igalia.com
show more ...
|
cf7f8c67 | 18-Apr-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: add rotate-90 property
Currently, vkms only supports the rotate-180, reflect-x and reflect-y properties. Therefore, improve the vkms IGT test coverage by adding the rotate-90 property to v
drm/vkms: add rotate-90 property
Currently, vkms only supports the rotate-180, reflect-x and reflect-y properties. Therefore, improve the vkms IGT test coverage by adding the rotate-90 property to vkms. The rotation was implement by software: rotate the way the blending occurs by making the source x axis be the destination y axis and the source y axis be the destination x axis.
Tested with igt@kms_rotation_crc@primary-rotation-90 [1], igt@kms_rotation_crc@sprite-rotation-90 [1], and igt@kms_rotation_crc@sprite-rotation-90-pos-100-0 [1].
[1] https://patchwork.freedesktop.org/series/116025/
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230418130525.128733-5-mcanal@igalia.com
show more ...
|
1ce76fae | 18-Apr-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: add reflect-y and rotate-180 property
Currently, vkms only supports the reflect-x property. Therefore, add the reflect-y property to vkms through a software implementation of the operation
drm/vkms: add reflect-y and rotate-180 property
Currently, vkms only supports the reflect-x property. Therefore, add the reflect-y property to vkms through a software implementation of the operation. This is possible by reverse reading the y axis during the blending.
Note that, by implementing the reflect-x and reflect-y properties, it is also possible to add the rotate-180 property, as it is a combination of those two properties.
Tested with igt@kms_rotation_crc@primary-reflect-y [1], igt@kms_rotation_crc@sprite-reflect-y [1], igt@kms_rotation_crc@primary-rotation-180, igt@kms_rotation_crc@sprite-rotation-180, and igt@kms_rotation_crc@cursor-rotation-180.
[1] https://patchwork.freedesktop.org/series/116025/
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230418130525.128733-4-mcanal@igalia.com
show more ...
|
a03f0285 | 20-Apr-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: allow full alpha blending on all planes
Before commit bc0d7fdefec6 ("drm: vkms: Supports to the case where primary plane doesn't match the CRTC"), the composition was executed on top of th
drm/vkms: allow full alpha blending on all planes
Before commit bc0d7fdefec6 ("drm: vkms: Supports to the case where primary plane doesn't match the CRTC"), the composition was executed on top of the primary plane. Therefore, the primary plane was not able to support the alpha channel. After commit bc0d7fdefec6, this is possible, as the composition is now executed on top of the CRTC.
So, allow all planes to support the alpha channel, making full alpha blending possible in vkms.
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230420232228.273340-1-mcanal@igalia.com
show more ...
|
17e05aeb | 16-Jan-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: Use drmm_mode_config_init()
Use drmm_mode_config_init() instead of drm_mode_config_init(), as it allows us to assure that the resource will be properly cleaned.
Signed-off-by: Maíra Canal
drm/vkms: Use drmm_mode_config_init()
Use drmm_mode_config_init() instead of drm_mode_config_init(), as it allows us to assure that the resource will be properly cleaned.
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230116205800.1266227-2-mcanal@igalia.com
show more ...
|
e3adc46d | 06-Apr-2023 |
Javier Martinez Canillas <javierm@redhat.com> |
drm/vkms: Remove <drm/drm_simple_kms_helper.h> include
The driver doesn't use simple-KMS helpers to set a simple display pipeline but only the drm_simple_encoder_init() function to initialize an enc
drm/vkms: Remove <drm/drm_simple_kms_helper.h> include
The driver doesn't use simple-KMS helpers to set a simple display pipeline but only the drm_simple_encoder_init() function to initialize an encoder.
That helper is just a wrapper of drm_encoder_init(), but passing a struct drm_encoder_funcs that sets the .destroy handler to drm_encoder_cleanup().
Since the <drm/drm_simple_kms_helper.h> header is only included for this helper and because the connector is initialized with drm_connector_init() as well, do the same for the encoder and drop the header include.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Maíra Canal <mcanal@igalia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230406110235.3092055-3-javierm@redhat.com
show more ...
|
4a1b5d18 | 24-Mar-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: allow the primary plane to be positioned
Before commit bc0d7fdefec6 ("drm: vkms: Supports to the case where primary plane doesn't match the CRTC"), the composition was executed on top of t
drm/vkms: allow the primary plane to be positioned
Before commit bc0d7fdefec6 ("drm: vkms: Supports to the case where primary plane doesn't match the CRTC"), the composition was executed on top of the primary plane. Therefore, the primary plane needed to cover the entire CRTC. After commit bc0d7fdefec6, this is no longer necessary, as the composition is now executed on top of the CRTC.
Then, allow the primary plane to be positioned in such a way that it doesn't cover the entire CRTC.
This patch was tested with the vkms IGT testlist and all tests passed successfully. Moreover, the test igt@kms_universal_plane@universal-plane-pageflip-windowed-pipe-A used to fail and now is passing.
Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230324164226.256084-3-mcanal@igalia.com
show more ...
|
6e41acd2 | 11-Jan-2023 |
Maíra Canal <mcanal@igalia.com> |
drm/vkms: reintroduce prepare_fb and cleanup_fb functions
With commit 359c6649cd9a ("drm/gem: Implement shadow-plane {begin, end}_fb_access with vmap"), the behavior of the shadow-plane helpers chan
drm/vkms: reintroduce prepare_fb and cleanup_fb functions
With commit 359c6649cd9a ("drm/gem: Implement shadow-plane {begin, end}_fb_access with vmap"), the behavior of the shadow-plane helpers changed and the vunmap is now performed at the end of the current pageflip, instead of the end of the following pageflip.
By performing the vunmap at the end of the current pageflip, invalid memory is accessed by the vkms during the plane composition, as the data is being unmapped before being used, as reported by the following warning:
[ 275.866047] BUG: unable to handle page fault for address: ffffb382814e8002 [ 275.866055] #PF: supervisor read access in kernel mode [ 275.866058] #PF: error_code(0x0000) - not-present page [ 275.866061] PGD 1000067 P4D 1000067 PUD 110a067 PMD 46e3067 PTE 0 [ 275.866066] Oops: 0000 [#1] PREEMPT SMP PTI [ 275.866070] CPU: 2 PID: 49 Comm: kworker/u8:2 Not tainted 6.1.0-rc6-00018-gb357e7ac1b73-dirty #54 [ 275.866074] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 [ 275.866076] Workqueue: vkms_composer vkms_composer_worker [vkms] [ 275.866084] RIP: 0010:XRGB8888_to_argb_u16+0x5c/0xa0 [vkms] [ 275.866092] Code: bf 56 0a 0f af 56 70 48 8b 76 28 01 ca 49 83 f8 02 41 b9 01 00 00 00 4d 0f 43 c8 48 01 f2 48 83 c2 02 31 f6 66 c7 04 f0 ff ff <0f> b6 0c b2 89 cf c1 e7 08 09 cf 66 89 7c f0 02 0f b6 4c b2 ff 89 [ 275.866095] RSP: 0018:ffffb382801b7db0 EFLAGS: 00010246 [ 275.866098] RAX: ffff896336ace000 RBX: ffff896310e293c0 RCX: 0000000000000000 [ 275.866101] RDX: ffffb382814e8002 RSI: 0000000000000000 RDI: ffffb382801b7de8 [ 275.866103] RBP: 0000000000001400 R08: 0000000000000280 R09: 0000000000000280 [ 275.866105] R10: 0000000000000010 R11: ffffffffc011d990 R12: ffff896302a1ece0 [ 275.866107] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000080008001 [ 275.866109] FS: 0000000000000000(0000) GS:ffff89637dd00000(0000) knlGS:0000000000000000 [ 275.866112] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 275.866114] CR2: ffffb382814e8002 CR3: 0000000003bb4000 CR4: 00000000000006e0 [ 275.866120] Call Trace: [ 275.866123] <TASK> [ 275.866124] compose_active_planes+0x1c4/0x380 [vkms] [ 275.866132] vkms_composer_worker+0x9f/0x130 [vkms] [ 275.866139] process_one_work+0x1c0/0x370 [ 275.866160] worker_thread+0x221/0x410 [ 275.866164] ? worker_clr_flags+0x50/0x50 [ 275.866167] kthread+0xe1/0x100 [ 275.866172] ? kthread_blkcg+0x30/0x30 [ 275.866176] ret_from_fork+0x22/0x30 [ 275.866181] </TASK> [ 275.866182] Modules linked in: vkms [ 275.866186] CR2: ffffb382814e8002 [ 275.866191] ---[ end trace 0000000000000000 ]---
Therefore, introduce again prepare_fb and cleanup_fb functions to the vkms, which were previously removed on commit b43e2ec03b0d ("drm/vkms: Let shadow-plane helpers prepare the plane's FB").
Fixes: 359c6649cd9a ("drm/gem: Implement shadow-plane {begin, end}_fb_access with vmap") Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maíra Canal <mcanal@igalia.com> Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230111131304.106039-1-mcanal@igalia.com
show more ...
|