mbox series

[v5,0/9] Add new formats support to vkms

Message ID 20220404204515.42144-1-igormtorrente@gmail.com (mailing list archive)
Headers show
Series Add new formats support to vkms | expand

Message

Igor Matheus Andrade Torrente April 4, 2022, 8:45 p.m. UTC
Summary
=======
This series of patches refactor some vkms components in order to introduce
new formats to the planes and writeback connector.

Now in the blend function, the plane's pixels are converted to ARGB16161616
and then blended together.

The CRC is calculated based on the ARGB1616161616 buffer. And if required,
this buffer is copied/converted to the writeback buffer format.

And to handle the pixel conversion, new functions were added to convert
from a specific format to ARGB16161616 (the reciprocal is also true).

Tests
=====
This patch series was tested using the following igt tests:
-t ".*kms_plane.*"
-t ".*kms_writeback.*"
-t ".*kms_cursor_crc*"
-t ".*kms_flip.*"

New tests passing
-------------------
- pipe-A-cursor-size-change
- pipe-A-cursor-alpha-transparent

Performance
-----------
It's running slightly faster than the current implementation.

Results running the IGT[1] test
`igt@kms_cursor_crc@pipe-a-cursor-512x512-onscreen` ten times:

|                  Frametime                   |
|:--------------------------------------------:|
|  Implementation |  Current  |   This commit  |
|:---------------:|:---------:|:--------------:|
| frametime range |  9~22 ms  |     10~22 ms   |
|     Average     |  11.4 ms  |     12.32 ms   |

Memory consumption
==================
It consumes less memory than the current implementation in
the common case (more detail in the commit message).

| Memory consumption (output dimensions) |
|:--------------------------------------:|
|       Current      |     This patch    |
|:------------------:|:-----------------:|
|   Width * Heigth   |     2 * Width     |

[1] IGT commit id: bc3f6833a12221a46659535dac06ebb312490eb4

XRGB to ARGB behavior
=====================
During the development, I decided to always fill the alpha channel of
the output pixel whenever the conversion from a format without an alpha
channel to ARGB16161616 is necessary. Therefore, I ignore the value
received from the XRGB and overwrite the value with 0xFFFF.

Primary plane and CRTC size
===========================
This patch series reworks the blend function to accept a primary plane with
a different size and position from CRTC.
Because now we need to fill the background, we had a loss in
performance with this change

---
Igor Torrente (9):
  drm: vkms: Alloc the compose frame using vzalloc
  drm: vkms: Replace hardcoded value of `vkms_composer.map` to
    DRM_FORMAT_MAX_PLANES
  drm: vkms: Rename `vkms_composer` to `vkms_frame_info`
  drm: drm_atomic_helper: Add a new helper to deal with the writeback
    connector validation
  drm: vkms: Add fb information to `vkms_writeback_job`
  drm: vkms: Refactor the plane composer to accept new formats
  drm: vkms: Supports to the case where primary plane doesn't match the
    CRTC
  drm: vkms: Adds XRGB_16161616 and ARGB_1616161616 formats
  drm: vkms: Add support to the RGB565 format

 Documentation/gpu/vkms.rst            |  13 +-
 drivers/gpu/drm/drm_atomic_helper.c   |  39 ++++
 drivers/gpu/drm/vkms/Makefile         |   1 +
 drivers/gpu/drm/vkms/vkms_composer.c  | 325 ++++++++++++--------------
 drivers/gpu/drm/vkms/vkms_crtc.c      |   4 +
 drivers/gpu/drm/vkms/vkms_drv.h       |  41 +++-
 drivers/gpu/drm/vkms/vkms_formats.c   | 298 +++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_formats.h   |  12 +
 drivers/gpu/drm/vkms/vkms_plane.c     |  50 ++--
 drivers/gpu/drm/vkms/vkms_writeback.c |  35 ++-
 include/drm/drm_atomic_helper.h       |   3 +
 11 files changed, 596 insertions(+), 225 deletions(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_formats.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_formats.h

Comments

Melissa Wen June 13, 2022, 9:52 a.m. UTC | #1
On 04/04, Igor Torrente wrote:
> Summary
> =======
> This series of patches refactor some vkms components in order to introduce
> new formats to the planes and writeback connector.
> 
> Now in the blend function, the plane's pixels are converted to ARGB16161616
> and then blended together.
> 
> The CRC is calculated based on the ARGB1616161616 buffer. And if required,
> this buffer is copied/converted to the writeback buffer format.
> 
> And to handle the pixel conversion, new functions were added to convert
> from a specific format to ARGB16161616 (the reciprocal is also true).
> 
> Tests
> =====
> This patch series was tested using the following igt tests:
> -t ".*kms_plane.*"
> -t ".*kms_writeback.*"
> -t ".*kms_cursor_crc*"
> -t ".*kms_flip.*"
> 
> New tests passing
> -------------------
> - pipe-A-cursor-size-change
> - pipe-A-cursor-alpha-transparent
> 
> Performance
> -----------
> It's running slightly faster than the current implementation.
> 
> Results running the IGT[1] test
> `igt@kms_cursor_crc@pipe-a-cursor-512x512-onscreen` ten times:
> 
> |                  Frametime                   |
> |:--------------------------------------------:|
> |  Implementation |  Current  |   This commit  |
> |:---------------:|:---------:|:--------------:|
> | frametime range |  9~22 ms  |     10~22 ms   |
> |     Average     |  11.4 ms  |     12.32 ms   |
> 
> Memory consumption
> ==================
> It consumes less memory than the current implementation in
> the common case (more detail in the commit message).
> 
> | Memory consumption (output dimensions) |
> |:--------------------------------------:|
> |       Current      |     This patch    |
> |:------------------:|:-----------------:|
> |   Width * Heigth   |     2 * Width     |
> 
> [1] IGT commit id: bc3f6833a12221a46659535dac06ebb312490eb4
> 
> XRGB to ARGB behavior
> =====================
> During the development, I decided to always fill the alpha channel of
> the output pixel whenever the conversion from a format without an alpha
> channel to ARGB16161616 is necessary. Therefore, I ignore the value
> received from the XRGB and overwrite the value with 0xFFFF.
> 
> Primary plane and CRTC size
> ===========================
> This patch series reworks the blend function to accept a primary plane with
> a different size and position from CRTC.
> Because now we need to fill the background, we had a loss in
> performance with this change
> 
> ---
Hi Igor,

Thanks for this effort.

> Igor Torrente (9):
>   drm: vkms: Alloc the compose frame using vzalloc

As this first patch fixes an error on vkms, I cherry-picked it and
applied to drm-misc-next.

For remaining patches, looking forward the next version addressing
feedback and rebasing them too.

Best Regards,

Melissa

>   drm: vkms: Replace hardcoded value of `vkms_composer.map` to
>     DRM_FORMAT_MAX_PLANES
>   drm: vkms: Rename `vkms_composer` to `vkms_frame_info`
>   drm: drm_atomic_helper: Add a new helper to deal with the writeback
>     connector validation
>   drm: vkms: Add fb information to `vkms_writeback_job`
>   drm: vkms: Refactor the plane composer to accept new formats
>   drm: vkms: Supports to the case where primary plane doesn't match the
>     CRTC
>   drm: vkms: Adds XRGB_16161616 and ARGB_1616161616 formats
>   drm: vkms: Add support to the RGB565 format
> 
>  Documentation/gpu/vkms.rst            |  13 +-
>  drivers/gpu/drm/drm_atomic_helper.c   |  39 ++++
>  drivers/gpu/drm/vkms/Makefile         |   1 +
>  drivers/gpu/drm/vkms/vkms_composer.c  | 325 ++++++++++++--------------
>  drivers/gpu/drm/vkms/vkms_crtc.c      |   4 +
>  drivers/gpu/drm/vkms/vkms_drv.h       |  41 +++-
>  drivers/gpu/drm/vkms/vkms_formats.c   | 298 +++++++++++++++++++++++
>  drivers/gpu/drm/vkms/vkms_formats.h   |  12 +
>  drivers/gpu/drm/vkms/vkms_plane.c     |  50 ++--
>  drivers/gpu/drm/vkms/vkms_writeback.c |  35 ++-
>  include/drm/drm_atomic_helper.h       |   3 +
>  11 files changed, 596 insertions(+), 225 deletions(-)
>  create mode 100644 drivers/gpu/drm/vkms/vkms_formats.c
>  create mode 100644 drivers/gpu/drm/vkms/vkms_formats.h
> 
> -- 
> 2.30.2
>
Igor Matheus Andrade Torrente June 13, 2022, 8:26 p.m. UTC | #2
Hi Melissa,

On 6/13/22 06:52, Melissa Wen wrote:
> On 04/04, Igor Torrente wrote:
>> Summary
>> =======
>> This series of patches refactor some vkms components in order to introduce
>> new formats to the planes and writeback connector.
>>
>> Now in the blend function, the plane's pixels are converted to ARGB16161616
>> and then blended together.
>>
>> The CRC is calculated based on the ARGB1616161616 buffer. And if required,
>> this buffer is copied/converted to the writeback buffer format.
>>
>> And to handle the pixel conversion, new functions were added to convert
>> from a specific format to ARGB16161616 (the reciprocal is also true).
>>
>> Tests
>> =====
>> This patch series was tested using the following igt tests:
>> -t ".*kms_plane.*"
>> -t ".*kms_writeback.*"
>> -t ".*kms_cursor_crc*"
>> -t ".*kms_flip.*"
>>
>> New tests passing
>> -------------------
>> - pipe-A-cursor-size-change
>> - pipe-A-cursor-alpha-transparent
>>
>> Performance
>> -----------
>> It's running slightly faster than the current implementation.
>>
>> Results running the IGT[1] test
>> `igt@kms_cursor_crc@pipe-a-cursor-512x512-onscreen` ten times:
>>
>> |                  Frametime                   |
>> |:--------------------------------------------:|
>> |  Implementation |  Current  |   This commit  |
>> |:---------------:|:---------:|:--------------:|
>> | frametime range |  9~22 ms  |     10~22 ms   |
>> |     Average     |  11.4 ms  |     12.32 ms   |
>>
>> Memory consumption
>> ==================
>> It consumes less memory than the current implementation in
>> the common case (more detail in the commit message).
>>
>> | Memory consumption (output dimensions) |
>> |:--------------------------------------:|
>> |       Current      |     This patch    |
>> |:------------------:|:-----------------:|
>> |   Width * Heigth   |     2 * Width     |
>>
>> [1] IGT commit id: bc3f6833a12221a46659535dac06ebb312490eb4
>>
>> XRGB to ARGB behavior
>> =====================
>> During the development, I decided to always fill the alpha channel of
>> the output pixel whenever the conversion from a format without an alpha
>> channel to ARGB16161616 is necessary. Therefore, I ignore the value
>> received from the XRGB and overwrite the value with 0xFFFF.
>>
>> Primary plane and CRTC size
>> ===========================
>> This patch series reworks the blend function to accept a primary plane with
>> a different size and position from CRTC.
>> Because now we need to fill the background, we had a loss in
>> performance with this change
>>
>> ---
> Hi Igor,
> 
> Thanks for this effort.
> 
>> Igor Torrente (9):
>>    drm: vkms: Alloc the compose frame using vzalloc
> 
> As this first patch fixes an error on vkms, I cherry-picked it and
> applied to drm-misc-next.

Oh right. I will skip it then!

Best Regards,
---
Igor Torrente

> 
> For remaining patches, looking forward the next version addressing
> feedback and rebasing them too.
> 
> Best Regards,
> 
> Melissa
> 
>>    drm: vkms: Replace hardcoded value of `vkms_composer.map` to
>>      DRM_FORMAT_MAX_PLANES
>>    drm: vkms: Rename `vkms_composer` to `vkms_frame_info`
>>    drm: drm_atomic_helper: Add a new helper to deal with the writeback
>>      connector validation
>>    drm: vkms: Add fb information to `vkms_writeback_job`
>>    drm: vkms: Refactor the plane composer to accept new formats
>>    drm: vkms: Supports to the case where primary plane doesn't match the
>>      CRTC
>>    drm: vkms: Adds XRGB_16161616 and ARGB_1616161616 formats
>>    drm: vkms: Add support to the RGB565 format
>>
>>   Documentation/gpu/vkms.rst            |  13 +-
>>   drivers/gpu/drm/drm_atomic_helper.c   |  39 ++++
>>   drivers/gpu/drm/vkms/Makefile         |   1 +
>>   drivers/gpu/drm/vkms/vkms_composer.c  | 325 ++++++++++++--------------
>>   drivers/gpu/drm/vkms/vkms_crtc.c      |   4 +
>>   drivers/gpu/drm/vkms/vkms_drv.h       |  41 +++-
>>   drivers/gpu/drm/vkms/vkms_formats.c   | 298 +++++++++++++++++++++++
>>   drivers/gpu/drm/vkms/vkms_formats.h   |  12 +
>>   drivers/gpu/drm/vkms/vkms_plane.c     |  50 ++--
>>   drivers/gpu/drm/vkms/vkms_writeback.c |  35 ++-
>>   include/drm/drm_atomic_helper.h       |   3 +
>>   11 files changed, 596 insertions(+), 225 deletions(-)
>>   create mode 100644 drivers/gpu/drm/vkms/vkms_formats.c
>>   create mode 100644 drivers/gpu/drm/vkms/vkms_formats.h
>>
>> -- 
>> 2.30.2
>>