drm/vkms: Completly split headers
Louis Chauvet
maintainercover drm/vkms: Completly split headers
VKMS code is already splitted in many files. In order to avoid mixing code, this series aims to properly add a header for each .c.
It will help for the readability as each function defined in a .c will be declared in its own .h, and not mixed with other in a big vkms_drv.h. This will help a lot for the managment of multiple devices and the introduction of ConfigFS.
This series depends on [1].
[1]: https://lore.kernel.org/all/[email protected]/
---
Louis Chauvet (6):
drm/vkms: Properly extract vkms_formats header drm/vkms: Extract vkms_writeback header drm/vkms: Extract vkms_plane header
drm/vkms: Rename to_vkms_plane_state to avoid confusion drm/vkms: Extract vkms_crtc header
drm/vkms: Extract vkms_composer header
drivers/gpu/drm/vkms/vkms_composer.c | 5 +- drivers/gpu/drm/vkms/vkms_composer.h | 18 ++++ drivers/gpu/drm/vkms/vkms_crtc.c | 7 +- drivers/gpu/drm/vkms/vkms_crtc.h | 87 +++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 192 ---------------------------------- drivers/gpu/drm/vkms/vkms_formats.c | 4 + drivers/gpu/drm/vkms/vkms_formats.h | 80 +++++++++++++- drivers/gpu/drm/vkms/vkms_output.c | 5 +- drivers/gpu/drm/vkms/vkms_plane.c | 7 +- drivers/gpu/drm/vkms/vkms_plane.h | 64 ++++++++++++ drivers/gpu/drm/vkms/vkms_writeback.c | 5 +- drivers/gpu/drm/vkms/vkms_writeback.h | 21 ++++ 13 files changed, 296 insertions(+), 200 deletions(-)
---
base-commit: 219b45d023ed0902b05c5902a4f31c2c38bcf68c
change-id: 20240521-google-split-headers-4a3705228f32
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: ae2d8b2efbbaa9decce56632c498c87e708288b3
prerequisite-patch-id: c26b6d4867eaf6566195aa0002765357d4f69f8c
prerequisite-patch-id: 8791d34a6f3148dc518da5249453067e40d346e3
prerequisite-patch-id: 26ec7cd5a449004bcfd6ce483671f87655f8635c
prerequisite-patch-id: 2e855ba871f2e99d4b6b7d85da2ddac6bb32262e
prerequisite-patch-id: 82523a917646793deeec7cdcc7ff286bd924fd21
prerequisite-patch-id: 0e355e5316281f53ab5e97ab6e63b0a682f3eb9e
prerequisite-patch-id: 7a63d245a377d5f5283f48e8f52421b912811752
prerequisite-patch-id: dda6bf4692cd1795c489ff58e72c0841ea8ffbc4
prerequisite-patch-id: f70e535b6086cc587975fbfa75741f485f679a32
prerequisite-patch-id: 6c2aa2645c7d854951608aa4d15a02e076abe1fe
prerequisite-patch-id: dc61c6d3db73053fc36e115af561e0c42b467de2
prerequisite-patch-id: deda292af6d8bbf6762b0bf4d351ffd2225995d8
prerequisite-patch-id: 18554f49b53cbcfd4a8ca50dc83b17dd3cf96474
prerequisite-patch-id: 5633292e10132d29be2467812e6e2e824cfedb67
prerequisite-patch-id: 43f37e9c1bc041d491e41dfb59548ed258a1e071
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: d10db4cb12a88de2e5f6440e9fcf5ddda191e3cd
prerequisite-patch-id: 16bac0ef1f1dc010a72ce2faae66631797d23d3f
prerequisite-patch-id: 8e0e5cc0727e8fd2d14ebafc5538fd987c2dd38e
prerequisite-patch-id: 32bad3bf3df46d042e9edd4c1259c2e2a3fb8975
prerequisite-patch-id: 4bd9e4cef308abd17b7b274a5575a3de73a1503b
prerequisite-patch-id: a98fac5a2c60fe23fbc6a455e9a4ab8b0f187ee8
prerequisite-patch-id: 62c8d109a22b9978f755255b67f13fe74fb7008d
prerequisite-patch-id: baa8da4871dd90b03a07c6d9ddb45e10929ee70a
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: df699289213021fa202fcdf1b4bdff513d09caa2
prerequisite-patch-id: 59d021ccb166fbe2962de9cda72aceb3caa9cabe
prerequisite-patch-id: 895ace6d58b3776798791705b7b05e26b8d37c7b
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: a4408d1de7730262456bdd618d3cb86f5f5b01ba
prerequisite-patch-id: f215b5aee5644d2e5b1b2af0bb0f4f1e7609558b
prerequisite-patch-id: d4f3b4c714324c5f326af3daba394899e6663d75
Best regards,
Signature · 1 line
Louis Chauvet <[email protected]>
Louis Chauvet
maintainerRFC PATCH 1/6 drm/vkms: Properly extract vkms_formats header
The vkms_format.h header was already separated from vkms_drv.h, but some function were missing. Move those function in vkms_format.h.
--- drivers/gpu/drm/vkms/vkms_drv.h | 74 +--------------------------------- drivers/gpu/drm/vkms/vkms_formats.c | 3 ++ drivers/gpu/drm/vkms/vkms_formats.h | 80 ++++++++++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 73 deletions(-)
drivers/gpu/drm/vkms/vkms_drv.h +2 -72
@@ -12,6 +12,8 @@#include <drm/drm_encoder.h> #include <drm/drm_writeback.h> +#include "vkms_formats.h" +#define XRES_MIN 10#define YRES_MIN 10
@@ -43,29 +45,6 @@ struct vkms_frame_info {unsigned int rotation; }; -struct pixel_argb_u16 { -u16 a, r, g, b; -}; - -struct line_buffer { -size_t n_pixels; -struct pixel_argb_u16 *pixels; -}; - -struct vkms_writeback_job ; -/** -* typedef pixel_write_line_t - These functions are used to read a pixel line from a -* struct pixel_argb_u16 buffer, convert it and write it in the @wb job. -* -* @wb: the writeback job to write the output of the conversion -* @in_pixels: Source buffer containing the line to convert -* @count: The width of a line -* @x_start: The x (width) coordinate in the destination plane -* @y_start: The y (height) coordinate in the destination plane -*/ -typedef void (*pixel_write_line_t )(struct vkms_writeback_job *wb, -struct pixel_argb_u16 *in_pixels,int count,int x_start, -int y_start);struct vkms_writeback_job {struct iosys_map data[DRM_FORMAT_MAX_PLANES ];
@@ -73,53 +52,10 @@ struct vkms_writeback_job {pixel_write_line_t pixel_write; }; -/** -* enum pixel_read_direction - Enum used internaly by VKMS to represent a reading direction in a -* plane. -*/ -enum pixel_read_direction { -READ_BOTTOM_TO_TOP , -READ_TOP_TO_BOTTOM , -READ_RIGHT_TO_LEFT , -READ_LEFT_TO_RIGHT -};struct vkms_plane_state ; -/** -* typedef pixel_read_line_t - These functions are used to read a pixel line in the source frame, -* convert it to `struct pixel_argb_u16` and write it to @out_pixel. -* -* @plane: plane used as source for the pixel value -* @x_start: X (width) coordinate of the first pixel to copy. The caller must ensure that x_start -* is non-negative and smaller than @plane->frame_info->fb->width. -* @y_start: Y (height) coordinate of the first pixel to copy. The caller must ensure that y_start -* is non-negative and smaller than @plane->frame_info->fb->height. -* @direction: direction to use for the copy, starting at @x_start/@y_start -* @count: number of pixels to copy -* @out_pixel: pointer where to write the pixel values. They will be written from @out_pixel[0] -* (included) to @out_pixel[@count] (excluded). The caller must ensure that out_pixel have a -* length of at least @count. -*/ -typedef void (*pixel_read_line_t )(const struct vkms_plane_state *plane,int x_start, -int y_start,enum pixel_read_direction direction,int count, -struct pixel_argb_u16 out_pixel[]); -/** -* struct conversion_matrix - Matrix to use for a specific encoding and range -* -* @matrix: Conversion matrix from yuv to rgb. The matrix is stored in a row-major manner and is -* used to compute rgb values from yuv values: -* [[r],[g],[b]] = @matrix * [[y],[u],[v]] -* OR for yvu formats: -* [[r],[g],[b]] = @matrix * [[y],[v],[u]] -* The values of the matrix are signed fixed-point values with 32 bits fractional part. -* @y_offset: Offset to apply on the y value. -*/ -struct conversion_matrix { -s64 matrix[3 ][3 ]; -int y_offset; -};/** * struct vkms_plane_state - Driver specific plane state
@@ -140,12 +76,6 @@ struct vkms_plane {struct drm_plane base; }; -struct vkms_color_lut { -struct drm_color_lut *base; -size_t lut_length; -s64 channel_value2index_ratio; -}; -/** * struct vkms_crtc_state - Driver specific CRTC state *
drivers/gpu/drm/vkms/vkms_formats.c +3 -0
@@ -6,9 +6,12 @@#include <drm/drm_blend.h> #include <drm/drm_rect.h> #include <drm/drm_fixed.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_framebuffer.h> #include <kunit/visibility.h> +#include "vkms_drv.h" #include "vkms_formats.h" /**
drivers/gpu/drm/vkms/vkms_formats.h +79 -1
86 lines not on this page · raw message
Signature · 1 line
2.44.2
Re: [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header
Hi Louis,
Most of the code extracted in this patch was previously introduced by you in patches that I didn't apply yet. Therefore, I believe you could just add the code in vkms_formats.c in the original series.
Best Regards,
- Maíra
Quoted 229 lines · Louis Chauvet
The
vkms_format.hheader was already separated fromvkms_drv.h, but some function were missing. Move those function invkms_format.h.Signed-off-by Louis Chauvet <[email protected]>--- drivers/gpu/drm/vkms/vkms_drv.h | 74 +--------------------------------- drivers/gpu/drm/vkms/vkms_formats.c | 3 ++ drivers/gpu/drm/vkms/vkms_formats.h | 80 ++++++++++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 73 deletions(-)drivers/gpu/drm/vkms/vkms_drv.h +2
-72@@ -12,6 +12,8 @@#include <drm/drm_encoder.h> #include <drm/drm_writeback.h> +#include "vkms_formats.h" +#define XRES_MIN 10#define YRES_MIN 10@@ -43,29 +45,6 @@ struct vkms_frame_info {unsigned int rotation; }; -struct pixel_argb_u16 { -u16 a, r, g, b; -}; - -struct line_buffer { -size_t n_pixels; -struct pixel_argb_u16 *pixels; -}; - -struct vkms_writeback_job ; -/** -* typedef pixel_write_line_t - These functions are used to read a pixel line from a -* struct pixel_argb_u16 buffer, convert it and write it in the @wb job. -* -* @wb: the writeback job to write the output of the conversion -* @in_pixels: Source buffer containing the line to convert -* @count: The width of a line -* @x_start: The x (width) coordinate in the destination plane -* @y_start: The y (height) coordinate in the destination plane -*/ -typedef void (*pixel_write_line_t )(struct vkms_writeback_job *wb, -struct pixel_argb_u16 *in_pixels,int count,int x_start, -int y_start);struct vkms_writeback_job {struct iosys_map data[DRM_FORMAT_MAX_PLANES ];@@ -73,53 +52,10 @@ struct vkms_writeback_job {pixel_write_line_t pixel_write; }; -/** -* enum pixel_read_direction - Enum used internaly by VKMS to represent a reading direction in a -* plane. -*/ -enum pixel_read_direction { -READ_BOTTOM_TO_TOP , -READ_TOP_TO_BOTTOM , -READ_RIGHT_TO_LEFT , -READ_LEFT_TO_RIGHT -};struct vkms_plane_state ; -/** -* typedef pixel_read_line_t - These functions are used to read a pixel line in the source frame, -* convert it to `struct pixel_argb_u16` and write it to @out_pixel. -* -* @plane: plane used as source for the pixel value -* @x_start: X (width) coordinate of the first pixel to copy. The caller must ensure that x_start -* is non-negative and smaller than @plane->frame_info->fb->width. -* @y_start: Y (height) coordinate of the first pixel to copy. The caller must ensure that y_start -* is non-negative and smaller than @plane->frame_info->fb->height. -* @direction: direction to use for the copy, starting at @x_start/@y_start -* @count: number of pixels to copy -* @out_pixel: pointer where to write the pixel values. They will be written from @out_pixel[0] -* (included) to @out_pixel[@count] (excluded). The caller must ensure that out_pixel have a -* length of at least @count. -*/ -typedef void (*pixel_read_line_t )(const struct vkms_plane_state *plane,int x_start, -int y_start,enum pixel_read_direction direction,int count, -struct pixel_argb_u16 out_pixel[]); -/** -* struct conversion_matrix - Matrix to use for a specific encoding and range -* -* @matrix: Conversion matrix from yuv to rgb. The matrix is stored in a row-major manner and is -* used to compute rgb values from yuv values: -* [[r],[g],[b]] = @matrix * [[y],[u],[v]] -* OR for yvu formats: -* [[r],[g],[b]] = @matrix * [[y],[v],[u]] -* The values of the matrix are signed fixed-point values with 32 bits fractional part. -* @y_offset: Offset to apply on the y value. -*/ -struct conversion_matrix { -s64 matrix[3 ][3 ]; -int y_offset; -};/** * struct vkms_plane_state - Driver specific plane state @@ -140,12 +76,6 @@ struct vkms_plane {struct drm_plane base; }; -struct vkms_color_lut { -struct drm_color_lut *base; -size_t lut_length; -s64 channel_value2index_ratio; -}; -/** * struct vkms_crtc_state - Driver specific CRTC state * drivers/gpu/drm/vkms/vkms_formats.c +3
-0@@ -6,9 +6,12 @@#include <drm/drm_blend.h> #include <drm/drm_rect.h> #include <drm/drm_fixed.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_framebuffer.h> #include <kunit/visibility.h> +#include "vkms_drv.h" #include "vkms_formats.h" /** drivers/gpu/drm/vkms/vkms_formats.h +79
-1@@ -3,7 +3,85 @@#ifndef _VKMS_FORMATS_H_#define _VKMS_FORMATS_H_ -#include "vkms_drv.h" +#include <drm/drm_color_mgmt.h> + +struct vkms_plane_state ; +struct vkms_writeback_job ; + +struct pixel_argb_u16 { +u16 a, r, g, b; +}; + +/** +* typedef pixel_write_line_t - These functions are used to read a pixel line from a +* struct pixel_argb_u16 buffer, convert it and write it in the @wb_job. +* +* @wb: the writeback job to write the output of the conversion +* @in_pixels: Source buffer containing the line to convert +* @count: The width of a line +* @x_start: The x (width) coordinate in the destination plane +* @y_start: The y (height) coordinate in the destination plane +*/ +typedef void (*pixel_write_line_t )(struct vkms_writeback_job *wb, +struct pixel_argb_u16 *in_pixels,int count,int x_start, +int y_start); + +struct line_buffer { +size_t n_pixels; +struct pixel_argb_u16 *pixels; +}; + +/** +* enum pixel_read_direction - Enum used internaly by VKMS to represent a reading direction in a +* plane. +*/ +enum pixel_read_direction { +READ_BOTTOM_TO_TOP , +READ_TOP_TO_BOTTOM , +READ_RIGHT_TO_LEFT , +READ_LEFT_TO_RIGHT +}; + +/** +* struct conversion_matrix - Matrix to use for a specific encoding and range +* +* @matrix: Conversion matrix from yuv to rgb. The matrix is stored in a row-major manner and is +* used to compute rgb values from yuv values: +* [[r],[g],[b]] = @matrix * [[y],[u],[v]] +* OR for yvu formats: +* [[r],[g],[b]] = @matrix * [[y],[v],[u]] +* The values of the matrix are signed fixed-point values with 32 bits fractional part. +* @y_offset: Offset to apply on the y value. +*/ +struct conversion_matrix { +s64 matrix[3 ][3 ]; +int y_offset; +}; + +struct vkms_color_lut { +struct drm_color_lut *base; +size_t lut_length; +s64 channel_value2index_ratio; +}; + +/** +* typedef pixel_read_line_t - These functions are used to read a pixel line in the source frame, +* convert it to `struct pixel_argb_u16` and write it to @out_pixel. +* +* @plane: plane used as source for the pixel value +* @x_start: X (width) coordinate of the first pixel to copy. The caller must ensure that x_start +* is non-negative and smaller than @plane->frame_info->fb->width. +* @y_start: Y (height) coordinate of the first pixel to copy. The caller must ensure that y_start +* is non-negative and smaller than @plane->frame_info->fb->height. +* @direction: direction to use for the copy, starting at @x_start/@y_start +* @count: number of pixels to copy +* @out_pixel: pointer where to write the pixel values. They will be written from @out_pixel[0] +* (included) to @out_pixel[@count] (excluded). The caller must ensure that out_pixel have a +* length of at least @count. +*/ +typedef void (*pixel_read_line_t )(const struct vkms_plane_state *plane,int x_start, +int y_start,enum pixel_read_direction direction,int count, +struct pixel_argb_u16 out_pixel[]);pixel_read_line_t get_pixel_read_line_function (u32 format);
RFC PATCH 1/6 drm/vkms: Properly extract vkms_formats header
In reply to Louis ChauvetHi Louis,
Thanks for refactoring this, it make things a bit easier to find.
I already reviewed this series on your GitHub fork, but I'm adding the missing fixes here as well so we can discusse them in the right forum.
Since these patches only move code around, I wonder if it'd make sense to merge them before the complex changes, like configfs.
For reference, I already rebased them on top drm-misc-next as part of my review work:
https://github.com/JoseExposito/linux/commits/patch-vkms-header-refactor/
It is easy to do, but the decision to rebase or not depends on how much it impacts the other series you are trying to get merged. I'll leave that up to you and the maintainers.
Quoted 4 lines
The
vkms_format.hheader was already separated fromvkms_drv.h, but some function were missing. Move those function invkms_format.h.Signed-off-by Louis Chauvet <[email protected]>
Quoted 11 lines
--- drivers/gpu/drm/vkms/vkms_drv.h | 74 +--------------------------------- drivers/gpu/drm/vkms/vkms_formats.c | 3 ++ drivers/gpu/drm/vkms/vkms_formats.h | 80 ++++++++++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 73 deletions(-)drivers/gpu/drm/vkms/vkms_drv.h +0
-0
drivers/gpu/drm/vkms/vkms_drv.h line 16
Quoted 5 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-0@@ -12,6 +12,8 @@#include <drm/drm_encoder.h> #include <drm/drm_writeback.h> +#include "vkms_formats.h" +
A general thought about includes to comment on. While including vkms_drv.h from any other header or source file should be fine, including other vkms_*.h headers could lead to circular dependencies if included from the wrong file. Commenting on this becase, when I rebased this series on top of drm-misc-next, I hit a few compiler errors due to circular dependencies.
I think that forward declaring always (if possible) could be a good approach. Also, patch 5/6 of this series removes this include and I guess it is because you found the same issues I did. What do you think about forward declaring when possible?
On a different topic: The structures moved to vkms_formats.h are used in vkms_composer.c, so, even though it compiles as it is, it'd be nice to add this include in vkms_composer.c as well.
Quoted 207 lines
drivers/gpu/drm/vkms/vkms_drv.h +0
-72#define XRES_MIN 10#define YRES_MIN 10@@ -43,29 +45,6 @@ struct vkms_frame_info {unsigned int rotation; }; -struct pixel_argb_u16 { -u16 a, r, g, b; -}; - -struct line_buffer { -size_t n_pixels; -struct pixel_argb_u16 *pixels; -}; - -struct vkms_writeback_job ; -/** -* typedef pixel_write_line_t - These functions are used to read a pixel line from a -* struct pixel_argb_u16 buffer, convert it and write it in the @wb job. -* -* @wb: the writeback job to write the output of the conversion -* @in_pixels: Source buffer containing the line to convert -* @count: The width of a line -* @x_start: The x (width) coordinate in the destination plane -* @y_start: The y (height) coordinate in the destination plane -*/ -typedef void (*pixel_write_line_t )(struct vkms_writeback_job *wb, -struct pixel_argb_u16 *in_pixels,int count,int x_start, -int y_start);struct vkms_writeback_job {struct iosys_map data[DRM_FORMAT_MAX_PLANES ];@@ -73,53 +52,10 @@ struct vkms_writeback_job {pixel_write_line_t pixel_write; }; -/** -* enum pixel_read_direction - Enum used internaly by VKMS to represent a reading direction in a -* plane. -*/ -enum pixel_read_direction { -READ_BOTTOM_TO_TOP , -READ_TOP_TO_BOTTOM , -READ_RIGHT_TO_LEFT , -READ_LEFT_TO_RIGHT -};struct vkms_plane_state ; -/** -* typedef pixel_read_line_t - These functions are used to read a pixel line in the source frame, -* convert it to `struct pixel_argb_u16` and write it to @out_pixel. -* -* @plane: plane used as source for the pixel value -* @x_start: X (width) coordinate of the first pixel to copy. The caller must ensure that x_start -* is non-negative and smaller than @plane->frame_info->fb->width. -* @y_start: Y (height) coordinate of the first pixel to copy. The caller must ensure that y_start -* is non-negative and smaller than @plane->frame_info->fb->height. -* @direction: direction to use for the copy, starting at @x_start/@y_start -* @count: number of pixels to copy -* @out_pixel: pointer where to write the pixel values. They will be written from @out_pixel[0] -* (included) to @out_pixel[@count] (excluded). The caller must ensure that out_pixel have a -* length of at least @count. -*/ -typedef void (*pixel_read_line_t )(const struct vkms_plane_state *plane,int x_start, -int y_start,enum pixel_read_direction direction,int count, -struct pixel_argb_u16 out_pixel[]); -/** -* struct conversion_matrix - Matrix to use for a specific encoding and range -* -* @matrix: Conversion matrix from yuv to rgb. The matrix is stored in a row-major manner and is -* used to compute rgb values from yuv values: -* [[r],[g],[b]] = @matrix * [[y],[u],[v]] -* OR for yvu formats: -* [[r],[g],[b]] = @matrix * [[y],[v],[u]] -* The values of the matrix are signed fixed-point values with 32 bits fractional part. -* @y_offset: Offset to apply on the y value. -*/ -struct conversion_matrix { -s64 matrix[3 ][3 ]; -int y_offset; -};/** * struct vkms_plane_state - Driver specific plane state @@ -140,12 +76,6 @@ struct vkms_plane {struct drm_plane base; }; -struct vkms_color_lut { -struct drm_color_lut *base; -size_t lut_length; -s64 channel_value2index_ratio; -}; -/** * struct vkms_crtc_state - Driver specific CRTC state * drivers/gpu/drm/vkms/vkms_formats.c +3
-0@@ -6,9 +6,12 @@#include <drm/drm_blend.h> #include <drm/drm_rect.h> #include <drm/drm_fixed.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_framebuffer.h> #include <kunit/visibility.h> +#include "vkms_drv.h" #include "vkms_formats.h" /** drivers/gpu/drm/vkms/vkms_formats.h +79
-1@@ -3,7 +3,85 @@#ifndef _VKMS_FORMATS_H_#define _VKMS_FORMATS_H_ -#include "vkms_drv.h" +#include <drm/drm_color_mgmt.h> + +struct vkms_plane_state ; +struct vkms_writeback_job ; + +struct pixel_argb_u16 { +u16 a, r, g, b; +}; + +/** +* typedef pixel_write_line_t - These functions are used to read a pixel line from a +* struct pixel_argb_u16 buffer, convert it and write it in the @wb_job. +* +* @wb: the writeback job to write the output of the conversion +* @in_pixels: Source buffer containing the line to convert +* @count: The width of a line +* @x_start: The x (width) coordinate in the destination plane +* @y_start: The y (height) coordinate in the destination plane +*/ +typedef void (*pixel_write_line_t )(struct vkms_writeback_job *wb, +struct pixel_argb_u16 *in_pixels,int count,int x_start, +int y_start); + +struct line_buffer { +size_t n_pixels; +struct pixel_argb_u16 *pixels; +}; + +/** +* enum pixel_read_direction - Enum used internaly by VKMS to represent a reading direction in a +* plane. +*/ +enum pixel_read_direction { +READ_BOTTOM_TO_TOP , +READ_TOP_TO_BOTTOM , +READ_RIGHT_TO_LEFT , +READ_LEFT_TO_RIGHT +}; + +/** +* struct conversion_matrix - Matrix to use for a specific encoding and range +* +* @matrix: Conversion matrix from yuv to rgb. The matrix is stored in a row-major manner and is +* used to compute rgb values from yuv values: +* [[r],[g],[b]] = @matrix * [[y],[u],[v]] +* OR for yvu formats: +* [[r],[g],[b]] = @matrix * [[y],[v],[u]] +* The values of the matrix are signed fixed-point values with 32 bits fractional part. +* @y_offset: Offset to apply on the y value. +*/ +struct conversion_matrix { +s64 matrix[3 ][3 ]; +int y_offset; +}; + +struct vkms_color_lut { +struct drm_color_lut *base; +size_t lut_length; +s64 channel_value2index_ratio; +}; + +/** +* typedef pixel_read_line_t - These functions are used to read a pixel line in the source frame, +* convert it to `struct pixel_argb_u16` and write it to @out_pixel. +* +* @plane: plane used as source for the pixel value +* @x_start: X (width) coordinate of the first pixel to copy. The caller must ensure that x_start +* is non-negative and smaller than @plane->frame_info->fb->width. +* @y_start: Y (height) coordinate of the first pixel to copy. The caller must ensure that y_start +* is non-negative and smaller than @plane->frame_info->fb->height. +* @direction: direction to use for the copy, starting at @x_start/@y_start +* @count: number of pixels to copy +* @out_pixel: pointer where to write the pixel values. They will be written from @out_pixel[0] +* (included) to @out_pixel[@count] (excluded). The caller must ensure that out_pixel have a +* length of at least @count. +*/ +typedef void (*pixel_read_line_t )(const struct vkms_plane_state *plane,int x_start, +int y_start,enum pixel_read_direction direction,int count, +struct pixel_argb_u16 out_pixel[]);pixel_read_line_t get_pixel_read_line_function (u32 format);
Louis Chauvet
maintainerRFC PATCH 2/6 drm/vkms: Extract vkms_writeback header
In reply to Louis ChauvetThe vkms writeback functions are defined in a different .c, so make the same thing for the function declaration in the headers and create vkms_writeback.h.
--- drivers/gpu/drm/vkms/vkms_composer.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 10 ---------- drivers/gpu/drm/vkms/vkms_formats.c | 2 +- drivers/gpu/drm/vkms/vkms_output.c | 2 ++ drivers/gpu/drm/vkms/vkms_writeback.c | 2 ++ drivers/gpu/drm/vkms/vkms_writeback.h | 20 ++++++++++++++++++++ 6 files changed, 26 insertions(+), 11 deletions(-)
drivers/gpu/drm/vkms/vkms_composer.c +1 -0
@@ -12,6 +12,7 @@#include <linux/minmax.h> #include "vkms_drv.h" +#include "vkms_writeback.h" static u16 pre_mul_blend_channel (u16 src,u16 dst,u16 alpha) {
drivers/gpu/drm/vkms/vkms_drv.h +0 -10
@@ -46,13 +46,6 @@ struct vkms_frame_info { }; -struct vkms_writeback_job { -struct iosys_map data[DRM_FORMAT_MAX_PLANES ]; -struct vkms_frame_info wb_frame_info; -pixel_write_line_t pixel_write; -}; - -struct vkms_plane_state ;
@@ -225,7 +218,4 @@ int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name,void vkms_composer_worker (struct work_struct *work);void vkms_set_composer (struct vkms_output *out,bool enabled); -/* Writeback */ -int vkms_enable_writeback_connector (struct vkms_device *vkmsdev); -#endif /* _VKMS_DRV_H_ */
drivers/gpu/drm/vkms/vkms_formats.c +1 -1
@@ -11,7 +11,7 @@#include <kunit/visibility.h> -#include "vkms_drv.h" +#include "vkms_writeback.h" #include "vkms_formats.h" /**
drivers/gpu/drm/vkms/vkms_output.c +2 -0
@@ -5,6 +5,8 @@#include <drm/drm_edid.h> #include <drm/drm_probe_helper.h> +#include "vkms_writeback.h" +static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .destroy = drm_connector_cleanup,
drivers/gpu/drm/vkms/vkms_writeback.c +2 -0
@@ -10,8 +10,10 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_shmem_helper.h> +#include <drm/drm_framebuffer.h> #include "vkms_drv.h" +#include "vkms_writeback.h" #include "vkms_formats.h" static const u32 vkms_wb_formats[] = {
drivers/gpu/drm/vkms/vkms_writeback.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _VKMS_WRITEBACK_H +#define _VKMS_WRITEBACK_H + +#include "vkms_drv.h" +#include "vkms_formats.h" + +struct vkms_crtc ; + +struct vkms_writeback_job { +struct iosys_map data[DRM_FORMAT_MAX_PLANES ]; +struct vkms_frame_info wb_frame_info; +pixel_write_line_t pixel_write; +}; + +/* Writeback */ +int vkms_enable_writeback_connector (struct vkms_device *vkmsdev); + +#endif //_VKMS_WRITEBACK_H
Signature · 1 line
2.44.2
RFC PATCH 2/6 drm/vkms: Extract vkms_writeback header
Quoted 5 lines
The vkms writeback functions are defined in a different .c, so make the same thing for the function declaration in the headers and create
vkms_writeback.h.Signed-off-by Louis Chauvet <[email protected]>
Quoted 52 lines
--- drivers/gpu/drm/vkms/vkms_composer.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 10 ---------- drivers/gpu/drm/vkms/vkms_formats.c | 2 +- drivers/gpu/drm/vkms/vkms_output.c | 2 ++ drivers/gpu/drm/vkms/vkms_writeback.c | 2 ++ drivers/gpu/drm/vkms/vkms_writeback.h | 20 ++++++++++++++++++++ 6 files changed, 26 insertions(+), 11 deletions(-)drivers/gpu/drm/vkms/vkms_composer.c +1
-0@@ -12,6 +12,7 @@#include <linux/minmax.h> #include "vkms_drv.h" +#include "vkms_writeback.h" static u16 pre_mul_blend_channel (u16 src,u16 dst,u16 alpha) {drivers/gpu/drm/vkms/vkms_drv.h +0
-10@@ -46,13 +46,6 @@ struct vkms_frame_info { }; -struct vkms_writeback_job { -struct iosys_map data[DRM_FORMAT_MAX_PLANES ]; -struct vkms_frame_info wb_frame_info; -pixel_write_line_t pixel_write; -}; - -struct vkms_plane_state ;@@ -225,7 +218,4 @@ int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name,void vkms_composer_worker (struct work_struct *work);void vkms_set_composer (struct vkms_output *out,bool enabled); -/* Writeback */ -int vkms_enable_writeback_connector (struct vkms_device *vkmsdev); -#endif /* _VKMS_DRV_H_ */ drivers/gpu/drm/vkms/vkms_formats.c +0
-0
drivers/gpu/drm/vkms/vkms_formats.c line 15
Quoted 6 lines
drivers/gpu/drm/vkms/vkms_formats.c +1
-1@@ -11,7 +11,7 @@#include <kunit/visibility.h> -#include "vkms_drv.h" +#include "vkms_writeback.h" #include "vkms_formats.h"
Nit: Keep sorted alphabetically
Quoted 19 lines
drivers/gpu/drm/vkms/vkms_formats.c +0
-0/** drivers/gpu/drm/vkms/vkms_output.c +2
-0@@ -5,6 +5,8 @@#include <drm/drm_edid.h> #include <drm/drm_probe_helper.h> +#include "vkms_writeback.h" +static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .destroy = drm_connector_cleanup,drivers/gpu/drm/vkms/vkms_writeback.c +0
-0
drivers/gpu/drm/vkms/vkms_writeback.c line 17
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_writeback.c +2
-0@@ -10,8 +10,10 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_shmem_helper.h> +#include <drm/drm_framebuffer.h> #include "vkms_drv.h" +#include "vkms_writeback.h" #include "vkms_formats.h"
The same here
drivers/gpu/drm/vkms/vkms_writeback.h line 4
Quoted 11 lines
drivers/gpu/drm/vkms/vkms_writeback.c +0
-0static const u32 vkms_wb_formats[] = {drivers/gpu/drm/vkms/vkms_writeback.h new file +4
-0@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _VKMS_WRITEBACK_H +#define _VKMS_WRITEBACK_H
The style for guards used in the other files is:
#ifndef _VKMS_WRITEBACK_H_
#define _VKMS_WRITEBACK_H_
Quoted 6 lines
drivers/gpu/drm/vkms/vkms_writeback.h new file +6
-0+ +#include "vkms_drv.h" +#include "vkms_formats.h" + +struct vkms_crtc ; +
drivers/gpu/drm/vkms/vkms_writeback.h line 20
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_writeback.h new file +10
-0+struct vkms_writeback_job { +struct iosys_map data[DRM_FORMAT_MAX_PLANES ]; +struct vkms_frame_info wb_frame_info; +pixel_write_line_t pixel_write; +}; + +/* Writeback */ +int vkms_enable_writeback_connector (struct vkms_device *vkmsdev); + +#endif //_VKMS_WRITEBACK_H
And here a /* */ comment is used:
#endif /* _VKMS_WRITEBACK_H_ */
Best wishes,
Jose
Louis Chauvet
maintainerRFC PATCH 3/6 drm/vkms: Extract vkms_plane header
In reply to Louis ChauvetIn order to properly split vkms_output function, extract all its function to its own header.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 2 ++ drivers/gpu/drm/vkms/vkms_drv.h | 56 ------------------------------ drivers/gpu/drm/vkms/vkms_formats.c | 3 +- drivers/gpu/drm/vkms/vkms_output.c | 2 +- drivers/gpu/drm/vkms/vkms_plane.c | 3 ++ drivers/gpu/drm/vkms/vkms_plane.h | 65 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_writeback.c | 1 - drivers/gpu/drm/vkms/vkms_writeback.h | 1 + 8 files changed, 74 insertions(+), 59 deletions(-)
drivers/gpu/drm/vkms/vkms_crtc.c +2 -0
@@ -6,8 +6,10 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_vblank.h> +#include <drm/drm_print.h> #include "vkms_drv.h" +#include "vkms_plane.h" static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer) {
drivers/gpu/drm/vkms/vkms_drv.h +0 -56
74 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_formats.c +2 -1
@@ -11,8 +11,9 @@#include <kunit/visibility.h> -#include "vkms_writeback.h" +#include "vkms_plane.h" #include "vkms_formats.h" +#include "vkms_writeback.h" /** * packed_pixels_offset() - Get the offset of the block containing the pixel at coordinates x/y
drivers/gpu/drm/vkms/vkms_output.c +1 -1
@@ -1,11 +1,11 @@// SPDX-License-Identifier: GPL-2.0+ -#include "vkms_drv.h" #include <drm/drm_atomic_helper.h> #include <drm/drm_edid.h> #include <drm/drm_probe_helper.h> #include "vkms_writeback.h" +#include "vkms_plane.h" static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes,
drivers/gpu/drm/vkms/vkms_plane.c +3 -0
@@ -8,9 +8,12 @@#include <drm/drm_fourcc.h> #include <drm/drm_gem_atomic_helper.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_framebuffer.h> +#include <drm/drm_print.h> #include "vkms_drv.h" #include "vkms_formats.h" +#include "vkms_plane.h" static const u32 vkms_formats[] = {DRM_FORMAT_ARGB8888 ,
drivers/gpu/drm/vkms/vkms_plane.h new file +65 -0
65 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_writeback.c +0 -1
@@ -12,7 +12,6 @@#include <drm/drm_gem_shmem_helper.h> #include <drm/drm_framebuffer.h> -#include "vkms_drv.h" #include "vkms_writeback.h" #include "vkms_formats.h"
drivers/gpu/drm/vkms/vkms_writeback.h +1 -0
@@ -5,6 +5,7 @@#include "vkms_drv.h" #include "vkms_formats.h" +#include "vkms_plane.h" struct vkms_crtc ;
Signature · 1 line
2.44.2
RFC PATCH 3/6 drm/vkms: Extract vkms_plane header
Quoted 4 lines
In order to properly split
vkms_outputfunction, extract all its function to its own header.Signed-off-by Louis Chauvet <[email protected]>
Quoted 16 lines
--- drivers/gpu/drm/vkms/vkms_crtc.c | 2 ++ drivers/gpu/drm/vkms/vkms_drv.h | 56 ------------------------------ drivers/gpu/drm/vkms/vkms_formats.c | 3 +- drivers/gpu/drm/vkms/vkms_output.c | 2 +- drivers/gpu/drm/vkms/vkms_plane.c | 3 ++ drivers/gpu/drm/vkms/vkms_plane.h | 65 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_writeback.c | 1 - drivers/gpu/drm/vkms/vkms_writeback.h | 1 + 8 files changed, 74 insertions(+), 59 deletions(-)drivers/gpu/drm/vkms/vkms_crtc.c +0
-0
drivers/gpu/drm/vkms/vkms_crtc.c line 9
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_crtc.c +1
-0@@ -6,8 +6,10 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_vblank.h> +#include <drm/drm_print.h>
Seems unrelated to this change? Anyway, it'd be nice to place it after drm_probe_helper.h.
Quoted 24 lines
drivers/gpu/drm/vkms/vkms_crtc.c +1
-0#include "vkms_drv.h" +#include "vkms_plane.h" static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer) {drivers/gpu/drm/vkms/vkms_drv.h +0
-10@@ -27,48 +27,6 @@#define VKMS_LUT_SIZE 256 -/** -* struct vkms_frame_info - Structure to store the state of a frame -* -* @fb: backing drm framebuffer -* @src: source rectangle of this frame in the source framebuffer, stored in 16.16 fixed-point form -* @dst: destination rectangle in the crtc buffer, stored in whole pixel units -* @map: see drm_shadow_plane_state@data -* @rotation: rotation applied to the source. -* -* @src and @dst should have the same size modulo the rotation.
drivers/gpu/drm/vkms/vkms_drv.h line 49
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +0
-10-*/ -struct vkms_frame_info { -struct drm_framebuffer *fb; -struct drm_rect src, dst; -struct iosys_map map[DRM_FORMAT_MAX_PLANES ]; -unsigned int rotation; -}; - - -struct vkms_plane_state ;
I guess this forward declaration was added by a previous patch in a different series, but it is not required. Mentioning just in case you'd like to fix it in the correct patch.
Quoted 58 lines
drivers/gpu/drm/vkms/vkms_drv.h +0
-36- - - -/** -* struct vkms_plane_state - Driver specific plane state -* @base: base plane state -* @frame_info: data required for composing computation -* @pixel_read_line: function to read a pixel line in this plane. The creator of a -* struct vkms_plane_state must ensure that this pointer is valid -* @conversion_matrix: matrix used for yuv formats to convert to rgb -*/ -struct vkms_plane_state { -struct drm_shadow_plane_state base; -struct vkms_frame_info *frame_info; -pixel_read_line_t pixel_read_line; -struct conversion_matrix conversion_matrix; -}; - -struct vkms_plane { -struct drm_plane base; -}; -/** * struct vkms_crtc_state - Driver specific CRTC state * @@ -174,9 +132,6 @@ struct vkms_device {#define to_vkms_crtc_state (target)\ container_of(target, struct vkms_crtc_state, base) -#define to_vkms_plane_state (target)\ - container_of(target, struct vkms_plane_state, base.base) -/** * vkms_crtc_init() - Initialize a crtc for vkms * @dev: drm_device associated with the vkms buffer @@ -196,17 +151,6 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,int vkms_output_init (struct vkms_device *vkmsdev,int possible_crtc_index); -/** -* vkms_plane_init() - Initialize a plane -* -* @vkmsdev: vkms device containing the plane -* @type: type of plane to initialize -* @possible_crtc_index: Crtc which can be attached to the plane. The caller must ensure that -* possible_crtc_index is positive and less or equals to 31. -*/ -struct vkms_plane *vkms_plane_init (struct vkms_device *vkmsdev, -enum drm_plane_type type,int possible_crtc_index); -/* CRC Support */ const char *const *vkms_get_crc_sources (struct drm_crtc *crtc,size_t *count);drivers/gpu/drm/vkms/vkms_formats.c +0
-0
drivers/gpu/drm/vkms/vkms_formats.c line 16
Quoted 7 lines
drivers/gpu/drm/vkms/vkms_formats.c +2
-1@@ -11,8 +11,9 @@#include <kunit/visibility.h> -#include "vkms_writeback.h" +#include "vkms_plane.h" #include "vkms_formats.h" +#include "vkms_writeback.h"
The #include "vkms_writeback.h" was added by the previous patch. We can avoid moving it here by adding it at the bottom. plane.h should go after formats.h.
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_formats.c +0
-0/** * packed_pixels_offset() - Get the offset of the block containing the pixel at coordinates x/y drivers/gpu/drm/vkms/vkms_output.c +0
-0
drivers/gpu/drm/vkms/vkms_output.c line 8
Quoted 9 lines
drivers/gpu/drm/vkms/vkms_output.c +1
-1@@ -1,11 +1,11 @@// SPDX-License-Identifier: GPL-2.0+ -#include "vkms_drv.h" #include <drm/drm_atomic_helper.h> #include <drm/drm_edid.h> #include <drm/drm_probe_helper.h> #include "vkms_writeback.h" +#include "vkms_plane.h"
#include "vkms_plane.h"
#include "vkms_writeback.h"
drivers/gpu/drm/vkms/vkms_plane.c line 12
Quoted 13 lines
drivers/gpu/drm/vkms/vkms_output.c +0
-0static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes,drivers/gpu/drm/vkms/vkms_plane.c +2
-0@@ -8,9 +8,12 @@#include <drm/drm_fourcc.h> #include <drm/drm_gem_atomic_helper.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_framebuffer.h> +#include <drm/drm_print.h>
#include <drm/drm_fourcc.h>
+#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_print.h>
Quoted 13 lines
drivers/gpu/drm/vkms/vkms_plane.c +1
-0#include "vkms_drv.h" #include "vkms_formats.h" +#include "vkms_plane.h" static const u32 vkms_formats[] = {DRM_FORMAT_ARGB8888 ,drivers/gpu/drm/vkms/vkms_plane.h new file +0
-0
drivers/gpu/drm/vkms/vkms_plane.h line 4
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_plane.h new file +4
-0@@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _VKMS_PLANE_H +#define _VKMS_PLANE_H
#ifndef _VKMS_PLANE_H_
#define _VKMS_PLANE_H_
drivers/gpu/drm/vkms/vkms_plane.h line 12
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_plane.h new file +8
-0+ +#include <drm/drm_framebuffer.h> +#include <drm/drm_plane.h> +#include <drm/drm_gem_atomic_helper.h> +#include <linux/iosys-map.h> + +#include "vkms_drv.h" +#include "vkms_formats.h"
While including "vkms_drv.h" from other headers should be fine
Quoted 43 lines
drivers/gpu/drm/vkms/vkms_plane.h new file +43
-0+ +struct vkms_plane { +struct drm_plane base; +}; + +/** +* struct vkms_plane_state - Driver specific plane state +* @base: base plane state +* @frame_info: data required for composing computation +* @pixel_read_line: function to read a pixel line in this plane. The creator of a vkms_plane_state +* must ensure that this pointer is valid +* @conversion_matrix: matrix used for yuv formats to convert to rgb +*/ +struct vkms_plane_state { +struct drm_shadow_plane_state base; +struct vkms_frame_info *frame_info; +pixel_read_line_t pixel_read_line; +struct conversion_matrix conversion_matrix; +}; + +/** +* struct vkms_frame_info - structure to store the state of a frame +* +* @fb: backing drm framebuffer +* @src: source rectangle of this frame in the source framebuffer, stored in 16.16 fixed-point form +* @dst: destination rectangle in the crtc buffer, stored in whole pixel units +* @map: see drm_shadow_plane_state@data +* @rotation: rotation applied to the source. +* +* @src and @dst should have the same size modulo the rotation. +*/ +struct vkms_frame_info { +struct drm_framebuffer *fb; +struct drm_rect src, dst; +struct iosys_map map[DRM_FORMAT_MAX_PLANES ]; +unsigned int rotation; +}; + +/** +* vkms_plane_init() - Initialize a plane +* +* @vkmsdev: vkms device containing the plane +* @type: type of plane to initialize
drivers/gpu/drm/vkms/vkms_plane.h line 65
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_plane.h new file +10
-0+* @possible_crtc_index: Crtc which can be attached to the plane. The caller must ensure that +* possible_crtc_index is positive and less or equals to 31. +*/ +struct vkms_plane *vkms_plane_init (struct vkms_device *vkmsdev, +enum drm_plane_type type,int possible_crtc_index); + +#define to_vkms_plane_state (target)\ + container_of(target, struct vkms_plane_state, base.base) + +#endif //_VKMS_PLANE_H
#endif /* _VKMS_PLANE_H_ */
Quoted 25 lines
drivers/gpu/drm/vkms/vkms_writeback.c +0
-1@@ -12,7 +12,6 @@#include <drm/drm_gem_shmem_helper.h> #include <drm/drm_framebuffer.h> -#include "vkms_drv.h" #include "vkms_writeback.h" #include "vkms_formats.h" drivers/gpu/drm/vkms/vkms_writeback.h +1
-0@@ -5,6 +5,7 @@#include "vkms_drv.h" #include "vkms_formats.h" +#include "vkms_plane.h" struct vkms_crtc ;
Louis Chauvet
maintainerRFC PATCH 4/6 drm/vkms: Rename to_vkms_plane_state to avoid confusion
In reply to Louis ChauvetThe macro to_vkms_plane_state was not explicit about its expected content. Rename it to drm_plane_state_to_vkms_plane_state to avoid confusion and help the reader.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 2 +- drivers/gpu/drm/vkms/vkms_plane.c | 4 ++-- drivers/gpu/drm/vkms/vkms_plane.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vkms/vkms_crtc.c +1 -1
@@ -212,7 +212,7 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc,continue ; vkms_state->active_planes[i++] = -to_vkms_plane_state (plane_state); +drm_plane_state_to_vkms_plane_state (plane_state); }return 0 ;
drivers/gpu/drm/vkms/vkms_plane.c +2 -2
@@ -80,7 +80,7 @@ vkms_plane_duplicate_state(struct drm_plane *plane)static void vkms_plane_destroy_state (struct drm_plane *plane,struct drm_plane_state *old_state) { -struct vkms_plane_state *vkms_state =to_vkms_plane_state (old_state); +struct vkms_plane_state *vkms_state =drm_plane_state_to_vkms_plane_state (old_state);struct drm_crtc *crtc = vkms_state->base.base.crtc;if (crtc && vkms_state->frame_info->fb) {
@@ -139,7 +139,7 @@ static void vkms_plane_atomic_update(struct drm_plane *plane,return ; fmt = fb->format->format; - vkms_plane_state =to_vkms_plane_state (new_state); + vkms_plane_state =drm_plane_state_to_vkms_plane_state (new_state); shadow_plane_state = &vkms_plane_state->base; frame_info = vkms_plane_state->frame_info;
drivers/gpu/drm/vkms/vkms_plane.h +1 -1
@@ -59,7 +59,7 @@ struct vkms_frame_info {struct vkms_plane *vkms_plane_init (struct vkms_device *vkmsdev,enum drm_plane_type type,int possible_crtc_index); -#define to_vkms_plane_state (target)\ +#define drm_plane_state_to_vkms_plane_state (target) \ container_of(target, struct vkms_plane_state, base.base)#endif //_VKMS_PLANE_H
Signature · 1 line
2.44.2
RFC PATCH 4/6 drm/vkms: Rename to_vkms_plane_state to avoid confusion
Quoted 5 lines
The macro
to_vkms_plane_statewas not explicit about its expected content. Rename it todrm_plane_state_to_vkms_plane_stateto avoid confusion and help the reader.Signed-off-by Louis Chauvet <[email protected]>
Quoted 55 lines
--- drivers/gpu/drm/vkms/vkms_crtc.c | 2 +- drivers/gpu/drm/vkms/vkms_plane.c | 4 ++-- drivers/gpu/drm/vkms/vkms_plane.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/vkms/vkms_crtc.c +1
-1@@ -212,7 +212,7 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc,continue ; vkms_state->active_planes[i++] = -to_vkms_plane_state (plane_state); +drm_plane_state_to_vkms_plane_state (plane_state); }return 0 ;drivers/gpu/drm/vkms/vkms_plane.c +2
-2@@ -80,7 +80,7 @@ vkms_plane_duplicate_state(struct drm_plane *plane)static void vkms_plane_destroy_state (struct drm_plane *plane,struct drm_plane_state *old_state) { -struct vkms_plane_state *vkms_state =to_vkms_plane_state (old_state); +struct vkms_plane_state *vkms_state =drm_plane_state_to_vkms_plane_state (old_state);struct drm_crtc *crtc = vkms_state->base.base.crtc;if (crtc && vkms_state->frame_info->fb) {@@ -139,7 +139,7 @@ static void vkms_plane_atomic_update(struct drm_plane *plane,return ; fmt = fb->format->format; - vkms_plane_state =to_vkms_plane_state (new_state); + vkms_plane_state =drm_plane_state_to_vkms_plane_state (new_state); shadow_plane_state = &vkms_plane_state->base; frame_info = vkms_plane_state->frame_info;drivers/gpu/drm/vkms/vkms_plane.h +1
-1@@ -59,7 +59,7 @@ struct vkms_frame_info {struct vkms_plane *vkms_plane_init (struct vkms_device *vkmsdev,enum drm_plane_type type,int possible_crtc_index); -#define to_vkms_plane_state (target)\ +#define drm_plane_state_to_vkms_plane_state (target) \ container_of(target, struct vkms_plane_state, base.base)#endif //_VKMS_PLANE_H
Louis Chauvet
maintainerRFC PATCH 5/6 drm/vkms: Extract vkms_crtc header
In reply to Louis ChauvetThe vkms crtc functions are defined in a different .c, so make the same thing for the function declaration in the headers and create vkms_crtc.h.
--- drivers/gpu/drm/vkms/vkms_composer.c | 2 +- drivers/gpu/drm/vkms/vkms_crtc.c | 2 +- drivers/gpu/drm/vkms/vkms_crtc.h | 87 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 45 ------------------ drivers/gpu/drm/vkms/vkms_output.c | 1 + drivers/gpu/drm/vkms/vkms_plane.h | 1 - drivers/gpu/drm/vkms/vkms_writeback.c | 1 + 8 files changed, 92 insertions(+), 48 deletions(-)
drivers/gpu/drm/vkms/vkms_composer.c +1 -1
@@ -11,7 +11,7 @@#include <drm/drm_vblank.h> #include <linux/minmax.h> -#include "vkms_drv.h" +#include "vkms_crtc.h" #include "vkms_writeback.h" static u16 pre_mul_blend_channel (u16 src,u16 dst,u16 alpha)
drivers/gpu/drm/vkms/vkms_crtc.c +1 -1
@@ -8,7 +8,7 @@#include <drm/drm_vblank.h> #include <drm/drm_print.h> -#include "vkms_drv.h" +#include "vkms_crtc.h" #include "vkms_plane.h" static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer)
drivers/gpu/drm/vkms/vkms_crtc.h new file +87 -0
87 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_drv.c +1 -0
@@ -27,6 +27,7 @@#include <drm/drm_vblank.h> #include "vkms_drv.h" +#include "vkms_crtc.h" #include <drm/drm_print.h> #include <drm/drm_debugfs.h>
drivers/gpu/drm/vkms/vkms_drv.h +0 -45
63 lines not on this page · raw message
drivers/gpu/drm/vkms/vkms_output.c +1 -0
@@ -6,6 +6,7 @@#include "vkms_writeback.h" #include "vkms_plane.h" +#include "vkms_crtc.h" static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes,
drivers/gpu/drm/vkms/vkms_plane.h +0 -1
@@ -8,7 +8,6 @@#include <drm/drm_gem_atomic_helper.h> #include <linux/iosys-map.h> -#include "vkms_drv.h" #include "vkms_formats.h" struct vkms_plane {
drivers/gpu/drm/vkms/vkms_writeback.c +1 -0
@@ -13,6 +13,7 @@#include <drm/drm_framebuffer.h> #include "vkms_writeback.h" +#include "vkms_crtc.h" #include "vkms_formats.h" static const u32 vkms_wb_formats[] = {
Signature · 1 line
2.44.2
RFC PATCH 5/6 drm/vkms: Extract vkms_crtc header
Quoted 1 line
The vkms crtc functions are defined in a different .c, so make the same
The VKMS CRTC...
Quoted 3 lines
thing for the function declaration in the headers and create
vkms_crtc.h.Signed-off-by Louis Chauvet <[email protected]>
Quoted 43 lines
--- drivers/gpu/drm/vkms/vkms_composer.c | 2 +- drivers/gpu/drm/vkms/vkms_crtc.c | 2 +- drivers/gpu/drm/vkms/vkms_crtc.h | 87 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 45 ------------------ drivers/gpu/drm/vkms/vkms_output.c | 1 + drivers/gpu/drm/vkms/vkms_plane.h | 1 - drivers/gpu/drm/vkms/vkms_writeback.c | 1 + 8 files changed, 92 insertions(+), 48 deletions(-)drivers/gpu/drm/vkms/vkms_composer.c +1
-1@@ -11,7 +11,7 @@#include <drm/drm_vblank.h> #include <linux/minmax.h> -#include "vkms_drv.h" +#include "vkms_crtc.h" #include "vkms_writeback.h" static u16 pre_mul_blend_channel (u16 src,u16 dst,u16 alpha)drivers/gpu/drm/vkms/vkms_crtc.c +1
-1@@ -8,7 +8,7 @@#include <drm/drm_vblank.h> #include <drm/drm_print.h> -#include "vkms_drv.h" +#include "vkms_crtc.h" #include "vkms_plane.h" static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer)drivers/gpu/drm/vkms/vkms_crtc.h new file +0
-0
drivers/gpu/drm/vkms/vkms_crtc.h line 4
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_crtc.h new file +4
-0@@ -0,0 +1,87 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _VKMS_CRTC_H +#define _VKMS_CRTC_H
#ifndef _VKMS_CRTC_H_
#define _VKMS_CRTC_H_
Quoted 72 lines
drivers/gpu/drm/vkms/vkms_crtc.h new file +72
-0+#include <drm/drm_writeback.h> +#include <drm/drm_crtc.h> +#include <linux/workqueue_types.h> + +#include "vkms_writeback.h" +#include "vkms_plane.h" + +/** +* struct vkms_crtc_state - Driver specific CRTC state +* +* @base: base CRTC state +* @composer_work: work struct to compose and add CRC entries +* +* @num_active_planes: Number of active planes +* @active_planes: List containing all the active planes (counted by +* @num_active_planes). They should be stored in z-order. +* @active_writeback: Current active writeback job +* @gamma_lut: Look up table for gamma used in this CRTC +* @crc_pending: Protected by @vkms_output.composer_lock. +* @wb_pending: Protected by @vkms_output.composer_lock. +* @frame_start: Protected by @vkms_output.composer_lock. +* @frame_end: Protected by @vkms_output.composer_lock. +*/ +struct vkms_crtc_state { +struct drm_crtc_state base; +struct work_struct composer_work; + +int num_active_planes; +struct vkms_plane_state **active_planes; +struct vkms_writeback_job *active_writeback; +struct vkms_color_lut gamma_lut; + +bool crc_pending; +bool wb_pending; +u64 frame_start; +u64 frame_end; +}; + +/** +* struct vkms_crtc - crtc internal representation +* +* @crtc: Base crtc in drm +* @wb_connecter: DRM writeback connector used for this output +* @vblank_hrtimer: +* @period_ns: +* @event: +* @composer_workq: Ordered workqueue for composer_work +* @lock: Lock used to project concurrent acces to the composer +* @composer_enabled: Protected by @lock. +* @composer_lock: Lock used internally to protect @composer_state members +* @composer_state: Protected by @lock. +*/ +struct vkms_crtc { +struct drm_crtc base; + +struct drm_writeback_connector wb_connector; +struct hrtimer vblank_hrtimer; +ktime_t period_ns; +struct drm_pending_vblank_event *event; +struct workqueue_struct *composer_workq; +spinlock_t lock; + +bool composer_enabled; +struct vkms_crtc_state *composer_state; + +spinlock_t composer_lock; +}; + +#define to_vkms_crtc_state (target)\ + container_of(target, struct vkms_crtc_state, base) + +/**
drivers/gpu/drm/vkms/vkms_crtc.h line 87
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_crtc.h new file +10
-0+* vkms_crtc_init() - Initialize a crtc for vkms +* @dev: drm_device associated with the vkms buffer +* @crtc: uninitialized crtc device +* @primary: primary plane to attach to the crtc +* @cursor plane to attach to the crtc +*/ +int vkms_crtc_init (struct drm_device *dev,struct drm_crtc *crtc, +struct drm_plane *primary,struct drm_plane *cursor); + +#endif //_VKMS_CRTC_H
#endif /* _VKMS_CRTC_H_ */
drivers/gpu/drm/vkms/vkms_drv.c line 30
Quoted 9 lines
drivers/gpu/drm/vkms/vkms_drv.c +1
-0@@ -27,6 +27,7 @@#include <drm/drm_vblank.h> #include "vkms_drv.h" +#include "vkms_crtc.h"
It might make sense to leave drv.h on top as it is the main file, but if you are going to stick to alphabetical order:
+#include "vkms_crtc.h"
#include "vkms_drv.h"
Quoted 109 lines
drivers/gpu/drm/vkms/vkms_drv.c +0
-0#include <drm/drm_print.h> #include <drm/drm_debugfs.h> drivers/gpu/drm/vkms/vkms_drv.h +0
-45@@ -12,8 +12,6 @@#include <drm/drm_encoder.h> #include <drm/drm_writeback.h> -#include "vkms_formats.h" -#define XRES_MIN 10#define YRES_MIN 10@@ -27,37 +25,6 @@#define VKMS_LUT_SIZE 256 -/** -* struct vkms_crtc_state - Driver specific CRTC state -* -* @base: base CRTC state -* @composer_work: work struct to compose and add CRC entries -* -* @num_active_planes: Number of active planes -* @active_planes: List containing all the active planes (counted by -* @num_active_planes). They should be stored in z-order. -* @active_writeback: Current active writeback job -* @gamma_lut: Look up table for gamma used in this CRTC -* @crc_pending: Protected by @vkms_output.composer_lock. -* @wb_pending: Protected by @vkms_output.composer_lock. -* @frame_start: Protected by @vkms_output.composer_lock. -* @frame_end: Protected by @vkms_output.composer_lock. -*/ -struct vkms_crtc_state { -struct drm_crtc_state base; -struct work_struct composer_work; - -int num_active_planes; -struct vkms_plane_state **active_planes; -struct vkms_writeback_job *active_writeback; -struct vkms_color_lut gamma_lut; - -bool crc_pending; -bool wb_pending; -u64 frame_start; -u64 frame_end; -}; -/** * struct vkms_output - Internal representation of all output components in vkms * @@ -129,18 +96,6 @@ struct vkms_device {#define drm_device_to_vkms_device (target) \ container_of(target, struct vkms_device, drm) -#define to_vkms_crtc_state (target)\ - container_of(target, struct vkms_crtc_state, base) - -/** -* vkms_crtc_init() - Initialize a crtc for vkms -* @dev: drm_device associated with the vkms buffer -* @crtc: uninitialized crtc device -* @primary: primary plane to attach to the crtc -* @cursor plane to attach to the crtc -*/ -int vkms_crtc_init (struct drm_device *dev,struct drm_crtc *crtc, -struct drm_plane *primary,struct drm_plane *cursor);/** * vkms_output_init() - Initialize all sub-components needed for a vkms device. * drivers/gpu/drm/vkms/vkms_output.c +1
-0@@ -6,6 +6,7 @@#include "vkms_writeback.h" #include "vkms_plane.h" +#include "vkms_crtc.h" static const struct drm_connector_funcs vkms_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes,drivers/gpu/drm/vkms/vkms_plane.h +0
-1@@ -8,7 +8,6 @@#include <drm/drm_gem_atomic_helper.h> #include <linux/iosys-map.h> -#include "vkms_drv.h" #include "vkms_formats.h" struct vkms_plane {drivers/gpu/drm/vkms/vkms_writeback.c +1
-0@@ -13,6 +13,7 @@#include <drm/drm_framebuffer.h> #include "vkms_writeback.h" +#include "vkms_crtc.h" #include "vkms_formats.h" static const u32 vkms_wb_formats[] = {
Louis Chauvet
maintainerRFC PATCH 6/6 drm/vkms: Extract vkms_composer header
In reply to Louis ChauvetThe vkms composer functions are defined in a different .c, so make the same thing for the function declaration in the headers and create vkms_composer.h.
--- drivers/gpu/drm/vkms/vkms_composer.c | 2 ++ drivers/gpu/drm/vkms/vkms_composer.h | 18 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_crtc.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 11 ----------- drivers/gpu/drm/vkms/vkms_writeback.c | 1 + 5 files changed, 22 insertions(+), 11 deletions(-)
drivers/gpu/drm/vkms/vkms_composer.c +2 -0
@@ -10,7 +10,9 @@#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_vblank.h> #include <linux/minmax.h> +#include <drm/drm_print.h> +#include "vkms_composer.h" #include "vkms_crtc.h" #include "vkms_writeback.h"
drivers/gpu/drm/vkms/vkms_composer.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _VKMS_COMPOSER_H +#define _VKMS_COMPOSER_H + +#include "vkms_drv.h" +#include "vkms_crtc.h" + +void vkms_composer_worker (struct work_struct *work); +void vkms_set_composer (struct vkms_output *out,bool enabled); + +/* CRC Support */ +const char *const *vkms_get_crc_sources (struct drm_crtc *crtc,size_t *count); +int vkms_set_crc_source (struct drm_crtc *crtc,const char *src_name); +int vkms_verify_crc_source (struct drm_crtc *crtc,const char *source_name, +size_t *values_cnt); + +#endif //_VKMS_COMPOSER_H
drivers/gpu/drm/vkms/vkms_crtc.c +1 -0
@@ -9,6 +9,7 @@#include <drm/drm_print.h> #include "vkms_crtc.h" +#include "vkms_composer.h" #include "vkms_plane.h" static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer)
drivers/gpu/drm/vkms/vkms_drv.h +0 -11
@@ -106,15 +106,4 @@ struct vkms_device {int vkms_output_init (struct vkms_device *vkmsdev,int possible_crtc_index); -/* CRC Support */ -const char *const *vkms_get_crc_sources (struct drm_crtc *crtc, -size_t *count); -int vkms_set_crc_source (struct drm_crtc *crtc,const char *src_name); -int vkms_verify_crc_source (struct drm_crtc *crtc,const char *source_name, -size_t *values_cnt); - -/* Composer Support */ -void vkms_composer_worker (struct work_struct *work); -void vkms_set_composer (struct vkms_output *out,bool enabled); -#endif /* _VKMS_DRV_H_ */
drivers/gpu/drm/vkms/vkms_writeback.c +1 -0
@@ -15,6 +15,7 @@#include "vkms_writeback.h" #include "vkms_crtc.h" #include "vkms_formats.h" +#include "vkms_composer.h" static const u32 vkms_wb_formats[] = {DRM_FORMAT_ARGB8888 ,
Signature · 1 line
2.44.2
RFC PATCH 6/6 drm/vkms: Extract vkms_composer header
Quoted 5 lines
The vkms composer functions are defined in a different .c, so make the same thing for the function declaration in the headers and create
vkms_composer.h.Signed-off-by Louis Chauvet <[email protected]>
Quoted 28 lines
--- drivers/gpu/drm/vkms/vkms_composer.c | 2 ++ drivers/gpu/drm/vkms/vkms_composer.h | 18 ++++++++++++++++++ drivers/gpu/drm/vkms/vkms_crtc.c | 1 + drivers/gpu/drm/vkms/vkms_drv.h | 11 ----------- drivers/gpu/drm/vkms/vkms_writeback.c | 1 + 5 files changed, 22 insertions(+), 11 deletions(-)drivers/gpu/drm/vkms/vkms_composer.c +2
-0@@ -10,7 +10,9 @@#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_vblank.h> #include <linux/minmax.h> +#include <drm/drm_print.h> +#include "vkms_composer.h" #include "vkms_crtc.h" #include "vkms_writeback.h" drivers/gpu/drm/vkms/vkms_composer.h new file +0
-0
drivers/gpu/drm/vkms/vkms_composer.h line 4
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_composer.h new file +4
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _VKMS_COMPOSER_H +#define _VKMS_COMPOSER_H
#ifndef _VKMS_COMPOSER_H_
#define _VKMS_COMPOSER_H_
drivers/gpu/drm/vkms/vkms_composer.h line 18
Quoted 13 lines
drivers/gpu/drm/vkms/vkms_composer.h new file +13
-0+#include "vkms_drv.h" +#include "vkms_crtc.h" + +void vkms_composer_worker (struct work_struct *work); +void vkms_set_composer (struct vkms_output *out,bool enabled); + +/* CRC Support */ +const char *const *vkms_get_crc_sources (struct drm_crtc *crtc,size_t *count); +int vkms_set_crc_source (struct drm_crtc *crtc,const char *src_name); +int vkms_verify_crc_source (struct drm_crtc *crtc,const char *source_name, +size_t *values_cnt); + +#endif //_VKMS_COMPOSER_H
#endif /* _VKMS_COMPOSER_H_ */
drivers/gpu/drm/vkms/vkms_crtc.c line 13
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_crtc.c +1
-0@@ -9,6 +9,7 @@#include <drm/drm_print.h> #include "vkms_crtc.h" +#include "vkms_composer.h" #include "vkms_plane.h"
+#include "vkms_composer.h"
#include "vkms_crtc.h"
#include "vkms_plane.h"
Quoted 26 lines
drivers/gpu/drm/vkms/vkms_crtc.c +0
-0static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer)drivers/gpu/drm/vkms/vkms_drv.h +0
-11@@ -106,15 +106,4 @@ struct vkms_device {int vkms_output_init (struct vkms_device *vkmsdev,int possible_crtc_index); -/* CRC Support */ -const char *const *vkms_get_crc_sources (struct drm_crtc *crtc, -size_t *count); -int vkms_set_crc_source (struct drm_crtc *crtc,const char *src_name); -int vkms_verify_crc_source (struct drm_crtc *crtc,const char *source_name, -size_t *values_cnt); - -/* Composer Support */ -void vkms_composer_worker (struct work_struct *work); -void vkms_set_composer (struct vkms_output *out,bool enabled); -#endif /* _VKMS_DRV_H_ */ drivers/gpu/drm/vkms/vkms_writeback.c +0
-0
drivers/gpu/drm/vkms/vkms_writeback.c line 18
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_writeback.c +1
-0@@ -15,6 +15,7 @@#include "vkms_writeback.h" #include "vkms_crtc.h" #include "vkms_formats.h" +#include "vkms_composer.h"
#include "vkms_crtc.h"
+#include "vkms_composer.h"
#include "vkms_formats.h"
Quoted 3 lines
drivers/gpu/drm/vkms/vkms_writeback.c +0
-0static const u32 vkms_wb_formats[] = {DRM_FORMAT_ARGB8888 ,