<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/gpu/drm/vkms, branch v6.1.53</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.53</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.53'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-07-19T14:21:18+00:00</updated>
<entry>
<title>drm/vkms: Fix RGB565 pixel conversion</title>
<updated>2023-07-19T14:21:18+00:00</updated>
<author>
<name>Maíra Canal</name>
<email>mcanal@igalia.com</email>
</author>
<published>2023-05-12T10:40:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7a3c39e34cab4a991379e3781bea0d44d8fb0e3e'/>
<id>urn:sha1:7a3c39e34cab4a991379e3781bea0d44d8fb0e3e</id>
<content type='text'>
[ Upstream commit ab87f558dcfb2562c3497e89600dec798a446665 ]

Currently, the pixel conversion isn't rounding the fixed-point values
before assigning it to the RGB coefficients, which is causing the IGT
pixel-format tests to fail. So, use the drm_fixp2int_round() fixed-point
helper to round the values when assigning it to the RGB coefficients.

Tested with igt@kms_plane@pixel-format and igt@kms_plane@pixel-format-source-clamping.

[v2]:
    * Use drm_fixp2int_round() to fix the pixel conversion instead of
      casting the values to s32 (Melissa Wen).

Fixes: 89b03aeaef16 ("drm/vkms: fix 32bit compilation error by replacing macros")
Signed-off-by: Maíra Canal &lt;mcanal@igalia.com&gt;
Reviewed-by: Arthur Grillo &lt;arthurgrillo@riseup.net&gt;
Signed-off-by: Maíra Canal &lt;mairacanal@riseup.net&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20230512104044.65034-2-mcanal@igalia.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>drm/vkms: isolate pixel conversion functionality</title>
<updated>2023-07-19T14:21:18+00:00</updated>
<author>
<name>Maíra Canal</name>
<email>mcanal@igalia.com</email>
</author>
<published>2023-04-18T13:05:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fa4ee16e814a41a2afcaa85d443dfa2a923e9e38'/>
<id>urn:sha1:fa4ee16e814a41a2afcaa85d443dfa2a923e9e38</id>
<content type='text'>
[ Upstream commit 322d716a3e8a74fb75cd0f657647be4df253fd2f ]

Currently, the pixel conversion functions repeat the same loop to
iterate the rows. Instead of repeating the same code for each pixel
format, create a function to wrap the loop and isolate the pixel
conversion functionality.

Suggested-by: Arthur Grillo &lt;arthurgrillo@riseup.net&gt;
Signed-off-by: Maíra Canal &lt;mcanal@igalia.com&gt;
Reviewed-by: Arthur Grillo &lt;arthurgrillo@riseup.net&gt;
Signed-off-by: Maíra Canal &lt;mairacanal@riseup.net&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20230418130525.128733-2-mcanal@igalia.com
Stable-dep-of: ab87f558dcfb ("drm/vkms: Fix RGB565 pixel conversion")
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>drm/vkms: Fix null-ptr-deref in vkms_release()</title>
<updated>2023-03-10T08:33:09+00:00</updated>
<author>
<name>Yuan Can</name>
<email>yuancan@huawei.com</email>
</author>
<published>2022-11-01T06:51:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=596f1ba3987e601e31a5abf1f75ce1d2635aceac'/>
<id>urn:sha1:596f1ba3987e601e31a5abf1f75ce1d2635aceac</id>
<content type='text'>
[ Upstream commit 2fe2a8f40c21161ffe7653cc234e7934db5b7cc5 ]

A null-ptr-deref is triggered when it tries to destroy the workqueue in
vkms-&gt;output.composer_workq in vkms_release().

 KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f]
 CPU: 5 PID: 17193 Comm: modprobe Not tainted 6.0.0-11331-gd465bff130bf #24
 RIP: 0010:destroy_workqueue+0x2f/0x710
 ...
 Call Trace:
  &lt;TASK&gt;
  ? vkms_config_debugfs_init+0x50/0x50 [vkms]
  __devm_drm_dev_alloc+0x15a/0x1c0 [drm]
  vkms_init+0x245/0x1000 [vkms]
  do_one_initcall+0xd0/0x4f0
  do_init_module+0x1a4/0x680
  load_module+0x6249/0x7110
  __do_sys_finit_module+0x140/0x200
  do_syscall_64+0x35/0x80
  entry_SYSCALL_64_after_hwframe+0x46/0xb0

The reason is that an OOM happened which triggers the destroy of the
workqueue, however, the workqueue is alloced in the later process,
thus a null-ptr-deref happened. A simple call graph is shown as below:

 vkms_init()
  vkms_create()
    devm_drm_dev_alloc()
      __devm_drm_dev_alloc()
        devm_drm_dev_init()
          devm_add_action_or_reset()
            devm_add_action() # an error happened
            devm_drm_dev_init_release()
              drm_dev_put()
                kref_put()
                  drm_dev_release()
                    vkms_release()
                      destroy_workqueue() # null-ptr-deref happened
    vkms_modeset_init()
      vkms_output_init()
        vkms_crtc_init() # where the workqueue get allocated

Fix this by checking if composer_workq is NULL before passing it to
the destroy_workqueue() in vkms_release().

Fixes: 6c234fe37c57 ("drm/vkms: Implement CRC debugfs API")
Signed-off-by: Yuan Can &lt;yuancan@huawei.com&gt;
Reviewed-by: Melissa Wen &lt;mwen@igalia.com&gt;
Signed-off-by: Melissa Wen &lt;melissa.srw@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20221101065156.41584-3-yuancan@huawei.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>drm/vkms: Fix memory leak in vkms_init()</title>
<updated>2023-03-10T08:33:09+00:00</updated>
<author>
<name>Yuan Can</name>
<email>yuancan@huawei.com</email>
</author>
<published>2022-11-01T06:51:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bebd60ec3bf21062f103e32e6203c6daabdbd51b'/>
<id>urn:sha1:bebd60ec3bf21062f103e32e6203c6daabdbd51b</id>
<content type='text'>
[ Upstream commit 0d0b368b9d104b437e1f4850ae94bdb9a3601e89 ]

A memory leak was reported after the vkms module install failed.

unreferenced object 0xffff88810bc28520 (size 16):
  comm "modprobe", pid 9662, jiffies 4298009455 (age 42.590s)
  hex dump (first 16 bytes):
    01 01 00 64 81 88 ff ff 00 00 dc 0a 81 88 ff ff  ...d............
  backtrace:
    [&lt;00000000e7561ff8&gt;] kmalloc_trace+0x27/0x60
    [&lt;000000000b1954a0&gt;] 0xffffffffc45200a9
    [&lt;00000000abbf1da0&gt;] do_one_initcall+0xd0/0x4f0
    [&lt;000000001505ee87&gt;] do_init_module+0x1a4/0x680
    [&lt;00000000958079ad&gt;] load_module+0x6249/0x7110
    [&lt;00000000117e4696&gt;] __do_sys_finit_module+0x140/0x200
    [&lt;00000000f74b12d2&gt;] do_syscall_64+0x35/0x80
    [&lt;000000008fc6fcde&gt;] entry_SYSCALL_64_after_hwframe+0x46/0xb0

The reason is that the vkms_init() returns without checking the return
value of vkms_create(), and if the vkms_create() failed, the config
allocated at the beginning of vkms_init() is leaked.

 vkms_init()
   config = kmalloc(...) # config allocated
   ...
   return vkms_create() # vkms_create failed and config is leaked

Fix this problem by checking return value of vkms_create() and free the
config if error happened.

Fixes: 2df7af93fdad ("drm/vkms: Add vkms_config type")
Signed-off-by: Yuan Can &lt;yuancan@huawei.com&gt;
Reviewed-by: Melissa Wen &lt;mwen@igalia.com&gt;
Signed-off-by: Melissa Wen &lt;melissa.srw@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20221101065156.41584-2-yuancan@huawei.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge drm/drm-next into drm-misc-next</title>
<updated>2022-09-14T11:22:18+00:00</updated>
<author>
<name>Maxime Ripard</name>
<email>maxime@cerno.tech</email>
</author>
<published>2022-09-14T11:22:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a108772d03d8bdb43258218b00bfe43bbe1e8800'/>
<id>urn:sha1:a108772d03d8bdb43258218b00bfe43bbe1e8800</id>
<content type='text'>
We need 6.0-rc1 to merge the backlight rework PR.

Signed-off-by: Maxime Ripard &lt;maxime@cerno.tech&gt;
</content>
</entry>
<entry>
<title>drm/vkms: fix 32bit compilation error by replacing macros</title>
<updated>2022-09-11T12:28:56+00:00</updated>
<author>
<name>Melissa Wen</name>
<email>mwen@igalia.com</email>
</author>
<published>2022-09-10T19:03:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=89b03aeaef16f8ab48c10c399f97c836bdbae838'/>
<id>urn:sha1:89b03aeaef16f8ab48c10c399f97c836bdbae838</id>
<content type='text'>
Replace vkms_formats macro for fixed-point operations with functions
from drm/drm_fixed.h to do the same job and fix 32-bit compilation
errors.

v2:
- don't cast results to s32 (Igor)
- add missing drm_fixp2int conversion (Igor)

Fixes: a19c2ac9858 ("drm: vkms: Add support to the RGB565 format")
Tested-by: Sudip Mukherjee &lt;sudipm.mukherjee@gmail.com&gt; (v1)
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt; (v1)
Reported-by: Sudip Mukherjee &lt;sudipm.mukherjee@gmail.com&gt;
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Melissa Wen &lt;mwen@igalia.com&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220910190303.682897-1-mwen@igalia.com
</content>
</entry>
<entry>
<title>drm/vkms: fix variable dereferenced before check warning</title>
<updated>2022-09-10T22:18:56+00:00</updated>
<author>
<name>Harshit Mogalapalli</name>
<email>harshit.m.mogalapalli@oracle.com</email>
</author>
<published>2022-09-08T10:56:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=aaa65520280e96dc47fa5065b74bddff30279abe'/>
<id>urn:sha1:aaa65520280e96dc47fa5065b74bddff30279abe</id>
<content type='text'>
Smatch warns:

drivers/gpu/drm/vkms/vkms_plane.c:110 vkms_plane_atomic_update() warn:
 variable dereferenced before check 'fb' (see line 108)

Fix the warning by moving the dereference after the NULL check.

Fixes: 8ba1648567e2 ("drm: vkms: Refactor the plane composer to accept new formats")
Signed-off-by: Harshit Mogalapalli &lt;harshit.m.mogalapalli@oracle.com&gt;
Reviewed-by: Melissa Wen &lt;mwen@igalia.com&gt;
Signed-off-by: Melissa Wen &lt;melissa.srw@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220908105623.72777-1-harshit.m.mogalapalli@oracle.com
</content>
</entry>
<entry>
<title>drm: vkms: Add support to the RGB565 format</title>
<updated>2022-09-05T21:25:08+00:00</updated>
<author>
<name>Igor Torrente</name>
<email>igormtorrente@gmail.com</email>
</author>
<published>2022-09-05T19:08:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=396369d6754993e40f1c84b2e22e40e92dfa4c49'/>
<id>urn:sha1:396369d6754993e40f1c84b2e22e40e92dfa4c49</id>
<content type='text'>
This commit also adds new helper macros to deal with fixed-point
arithmetic.

It was done to improve the precision of the conversion to ARGB16161616
since the "conversion ratio" is not an integer.

V3: Adapt the handlers to the new format introduced in patch 7 V3.
V5: Minor improvements
V6: Minor improvements (Pekka Paalanen)

Reviewed-by: Melissa Wen &lt;mwen@igalia.com&gt;
Signed-off-by: Igor Torrente &lt;igormtorrente@gmail.com&gt;
Signed-off-by: Melissa Wen &lt;melissa.srw@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220905190811.25024-10-igormtorrente@gmail.com
</content>
</entry>
<entry>
<title>drm: vkms: Adds XRGB_16161616 and ARGB_1616161616 formats</title>
<updated>2022-09-05T21:23:38+00:00</updated>
<author>
<name>Igor Torrente</name>
<email>igormtorrente@gmail.com</email>
</author>
<published>2022-09-05T19:08:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3675d8a1726337bd1e839a185e0a7ce0bc459b6b'/>
<id>urn:sha1:3675d8a1726337bd1e839a185e0a7ce0bc459b6b</id>
<content type='text'>
This will be useful to write tests that depends on these formats.

ARGB and XRGB follows the a similar implementation of the former formats.
Just adjusting for 16 bits per channel.

V3: Adapt the handlers to the new format introduced in patch 7 V3.
V5: Minor improvements
    Added le16_to_cpu/cpu_to_le16 to the 16 bits color read/writes.

Reviewed-by: Melissa Wen &lt;mwen@igalia.com&gt;
Signed-off-by: Igor Torrente &lt;igormtorrente@gmail.com&gt;
Signed-off-by: Melissa Wen &lt;melissa.srw@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220905190811.25024-9-igormtorrente@gmail.com
</content>
</entry>
<entry>
<title>drm: vkms: Supports to the case where primary plane doesn't match the CRTC</title>
<updated>2022-09-05T21:18:42+00:00</updated>
<author>
<name>Igor Torrente</name>
<email>igormtorrente@gmail.com</email>
</author>
<published>2022-09-05T19:08:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bc0d7fdefec62e0cb83c1bcd3c7bd033f5e826e0'/>
<id>urn:sha1:bc0d7fdefec62e0cb83c1bcd3c7bd033f5e826e0</id>
<content type='text'>
We will remove the current assumption that the primary plane has the
same size and position as CRTC and that the primary plane is the
bottom-most in zpos order, or is even enabled. At least as far
as the blending machinery is concerned.

For that we will add CRTC dimension information to `vkms_crtc_state`
and add a opaque black backgound color.

Because now we need to fill the background, we had a loss in
performance with this change. Results running the IGT[1] test
`igt@kms_cursor_crc@pipe-a-cursor-512x512-onscreen` ten times:

|                  Frametime                   |
|:--------------------------------------------:|
|  Implementation |  Previous |   This commit  |
|:---------------:|:---------:|:--------------:|
| frametime range |  5~18 ms  |     10~22 ms   |
|     Average     |  8.47 ms  |     12.32 ms   |

[1] IGT commit id: bc3f6833a12221a46659535dac06ebb312490eb4

V6: Improve the commit description (Pekka Paalanen).
    Update some comments (Pekka Paalanen).
    Remove some fields from `vkms_crtc_state` and move where
    some variables are set (Pekka Paalanen).

Reviewed-by: Melissa Wen &lt;mwen@igalia.com&gt;
Signed-off-by: Igor Torrente &lt;igormtorrente@gmail.com&gt;
Signed-off-by: Melissa Wen &lt;melissa.srw@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220905190811.25024-8-igormtorrente@gmail.com
</content>
</entry>
</feed>
