* [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header
2024-08-14 9:08 [PATCH RFC 0/6] drm/vkms: Completly split headers Louis Chauvet
@ 2024-08-14 9:08 ` Louis Chauvet
2024-08-15 14:36 ` Maíra Canal
2024-08-20 15:28 ` José Expósito
2024-08-14 9:08 ` [PATCH RFC 2/6] drm/vkms: Extract vkms_writeback header Louis Chauvet
` (4 subsequent siblings)
5 siblings, 2 replies; 14+ messages in thread
From: Louis Chauvet @ 2024-08-14 9:08 UTC (permalink / raw)
To: Rodrigo Siqueira, Melissa Wen, Maíra Canal, Haneen Mohammed,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie
Cc: dri-devel, arthurgrillo, linux-kernel, jeremie.dautheribes,
miquel.raynal, thomas.petazzoni, seanpaul, marcheu,
nicolejadeyee, Louis Chauvet
The vkms_format.h header was already separated from vkms_drv.h, but some
function were missing. Move those function in vkms_format.h.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
| 74 +---------------------------------
| 3 ++
| 80 ++++++++++++++++++++++++++++++++++++-
3 files changed, 84 insertions(+), 73 deletions(-)
--git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 8f6c9e67e671..0db443924a15 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -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
*
--git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 65fdd3999441..5ab84801d8da 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -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"
/**
--git a/drivers/gpu/drm/vkms/vkms_formats.h b/drivers/gpu/drm/vkms/vkms_formats.h
index 852ab9a4cee5..62b06bc26e79 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.h
+++ b/drivers/gpu/drm/vkms/vkms_formats.h
@@ -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);
--
2.44.2
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header
2024-08-14 9:08 ` [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header Louis Chauvet
@ 2024-08-15 14:36 ` Maíra Canal
2024-08-20 15:28 ` José Expósito
1 sibling, 0 replies; 14+ messages in thread
From: Maíra Canal @ 2024-08-15 14:36 UTC (permalink / raw)
To: Louis Chauvet, Rodrigo Siqueira, Melissa Wen, Haneen Mohammed,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie
Cc: dri-devel, arthurgrillo, linux-kernel, jeremie.dautheribes,
miquel.raynal, thomas.petazzoni, seanpaul, marcheu,
nicolejadeyee
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
On 8/14/24 06:08, Louis Chauvet wrote:
> The vkms_format.h header was already separated from vkms_drv.h, but some
> function were missing. Move those function in vkms_format.h.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 8f6c9e67e671..0db443924a15 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -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
> *
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
> index 65fdd3999441..5ab84801d8da 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.c
> +++ b/drivers/gpu/drm/vkms/vkms_formats.c
> @@ -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"
>
> /**
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.h b/drivers/gpu/drm/vkms/vkms_formats.h
> index 852ab9a4cee5..62b06bc26e79 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.h
> +++ b/drivers/gpu/drm/vkms/vkms_formats.h
> @@ -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);
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header
2024-08-14 9:08 ` [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header Louis Chauvet
2024-08-15 14:36 ` Maíra Canal
@ 2024-08-20 15:28 ` José Expósito
1 sibling, 0 replies; 14+ messages in thread
From: José Expósito @ 2024-08-20 15:28 UTC (permalink / raw)
To: louis.chauvet
Cc: airlied, arthurgrillo, daniel, dri-devel, hamohammed.sa,
jeremie.dautheribes, linux-kernel, maarten.lankhorst, mairacanal,
marcheu, melissa.srw, miquel.raynal, mripard, nicolejadeyee,
rodrigosiqueiramelo, seanpaul, thomas.petazzoni, tzimmermann,
José Expósito
Hi 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.
> The vkms_format.h header was already separated from vkms_drv.h, but some
> function were missing. Move those function in vkms_format.h.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 8f6c9e67e671..0db443924a15 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -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.
> #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
> *
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
> index 65fdd3999441..5ab84801d8da 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.c
> +++ b/drivers/gpu/drm/vkms/vkms_formats.c
> @@ -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"
>
> /**
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.h b/drivers/gpu/drm/vkms/vkms_formats.h
> index 852ab9a4cee5..62b06bc26e79 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.h
> +++ b/drivers/gpu/drm/vkms/vkms_formats.h
> @@ -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);
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/6] drm/vkms: Extract vkms_writeback header
2024-08-14 9:08 [PATCH RFC 0/6] drm/vkms: Completly split headers Louis Chauvet
2024-08-14 9:08 ` [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header Louis Chauvet
@ 2024-08-14 9:08 ` Louis Chauvet
2024-08-20 15:28 ` José Expósito
2024-08-14 9:08 ` [PATCH RFC 3/6] drm/vkms: Extract vkms_plane header Louis Chauvet
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Louis Chauvet @ 2024-08-14 9:08 UTC (permalink / raw)
To: Rodrigo Siqueira, Melissa Wen, Maíra Canal, Haneen Mohammed,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie
Cc: dri-devel, arthurgrillo, linux-kernel, jeremie.dautheribes,
miquel.raynal, thomas.petazzoni, seanpaul, marcheu,
nicolejadeyee, Louis Chauvet
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 <louis.chauvet@bootlin.com>
---
| 1 +
| 10 ----------
| 2 +-
| 2 ++
| 2 ++
| 20 ++++++++++++++++++++
6 files changed, 26 insertions(+), 11 deletions(-)
--git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
index f0cae142ac22..825011f696ee 100644
--- a/drivers/gpu/drm/vkms/vkms_composer.c
+++ b/drivers/gpu/drm/vkms/vkms_composer.c
@@ -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)
{
--git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 0db443924a15..46daa2fab6e8 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -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_ */
--git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 5ab84801d8da..cbfa7943e948 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -11,7 +11,7 @@
#include <kunit/visibility.h>
-#include "vkms_drv.h"
+#include "vkms_writeback.h"
#include "vkms_formats.h"
/**
--git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 36db2c8923cb..0c55682337a4 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -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,
--git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
index 7e0302c0830c..4a830a4c4d64 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -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[] = {
--git a/drivers/gpu/drm/vkms/vkms_writeback.h b/drivers/gpu/drm/vkms/vkms_writeback.h
new file mode 100644
index 000000000000..70f0c4c26c23
--- /dev/null
+++ b/drivers/gpu/drm/vkms/vkms_writeback.h
@@ -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
--
2.44.2
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH RFC 2/6] drm/vkms: Extract vkms_writeback header
2024-08-14 9:08 ` [PATCH RFC 2/6] drm/vkms: Extract vkms_writeback header Louis Chauvet
@ 2024-08-20 15:28 ` José Expósito
0 siblings, 0 replies; 14+ messages in thread
From: José Expósito @ 2024-08-20 15:28 UTC (permalink / raw)
To: louis.chauvet
Cc: airlied, arthurgrillo, daniel, dri-devel, hamohammed.sa,
jeremie.dautheribes, linux-kernel, maarten.lankhorst, mairacanal,
marcheu, melissa.srw, miquel.raynal, mripard, nicolejadeyee,
rodrigosiqueiramelo, seanpaul, thomas.petazzoni, tzimmermann,
José Expósito
> 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 <louis.chauvet@bootlin.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index f0cae142ac22..825011f696ee 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -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)
> {
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 0db443924a15..46daa2fab6e8 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -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_ */
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
> index 5ab84801d8da..cbfa7943e948 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.c
> +++ b/drivers/gpu/drm/vkms/vkms_formats.c
> @@ -11,7 +11,7 @@
>
> #include <kunit/visibility.h>
>
> -#include "vkms_drv.h"
> +#include "vkms_writeback.h"
> #include "vkms_formats.h"
Nit: Keep sorted alphabetically
> /**
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 36db2c8923cb..0c55682337a4 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -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,
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index 7e0302c0830c..4a830a4c4d64 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -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
> static const u32 vkms_wb_formats[] = {
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.h b/drivers/gpu/drm/vkms/vkms_writeback.h
> new file mode 100644
> index 000000000000..70f0c4c26c23
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.h
> @@ -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_
> +
> +#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
And here a /* */ comment is used:
#endif /* _VKMS_WRITEBACK_H_ */
Best wishes,
Jose
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 3/6] drm/vkms: Extract vkms_plane header
2024-08-14 9:08 [PATCH RFC 0/6] drm/vkms: Completly split headers Louis Chauvet
2024-08-14 9:08 ` [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header Louis Chauvet
2024-08-14 9:08 ` [PATCH RFC 2/6] drm/vkms: Extract vkms_writeback header Louis Chauvet
@ 2024-08-14 9:08 ` Louis Chauvet
2024-08-20 15:28 ` José Expósito
2024-08-14 9:08 ` [PATCH RFC 4/6] drm/vkms: Rename to_vkms_plane_state to avoid confusion Louis Chauvet
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Louis Chauvet @ 2024-08-14 9:08 UTC (permalink / raw)
To: Rodrigo Siqueira, Melissa Wen, Maíra Canal, Haneen Mohammed,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie
Cc: dri-devel, arthurgrillo, linux-kernel, jeremie.dautheribes,
miquel.raynal, thomas.petazzoni, seanpaul, marcheu,
nicolejadeyee, Louis Chauvet
In order to properly split vkms_output function, extract all
its function to its own header.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
| 2 ++
| 56 ------------------------------
| 3 +-
| 2 +-
| 3 ++
| 65 +++++++++++++++++++++++++++++++++++
| 1 -
| 1 +
8 files changed, 74 insertions(+), 59 deletions(-)
--git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 06e28305d660..6a4de8f7a678 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -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)
{
--git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 46daa2fab6e8..ea73f01fcc74 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -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.
- */
-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;
-
-
-
-/**
- * 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);
--git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index cbfa7943e948..4e8494d4ade4 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -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
--git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 0c55682337a4..09fcf242ecf7 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -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,
--git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 9d85464ee0e9..de2c83e1b02c 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -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,
--git a/drivers/gpu/drm/vkms/vkms_plane.h b/drivers/gpu/drm/vkms/vkms_plane.h
new file mode 100644
index 000000000000..161b44da0240
--- /dev/null
+++ b/drivers/gpu/drm/vkms/vkms_plane.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef _VKMS_PLANE_H
+#define _VKMS_PLANE_H
+
+#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"
+
+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
+ * @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
--git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
index 4a830a4c4d64..740d9e2f3d71 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -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"
--git a/drivers/gpu/drm/vkms/vkms_writeback.h b/drivers/gpu/drm/vkms/vkms_writeback.h
index 70f0c4c26c23..44dff15faff6 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.h
+++ b/drivers/gpu/drm/vkms/vkms_writeback.h
@@ -5,6 +5,7 @@
#include "vkms_drv.h"
#include "vkms_formats.h"
+#include "vkms_plane.h"
struct vkms_crtc;
--
2.44.2
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH RFC 3/6] drm/vkms: Extract vkms_plane header
2024-08-14 9:08 ` [PATCH RFC 3/6] drm/vkms: Extract vkms_plane header Louis Chauvet
@ 2024-08-20 15:28 ` José Expósito
0 siblings, 0 replies; 14+ messages in thread
From: José Expósito @ 2024-08-20 15:28 UTC (permalink / raw)
To: louis.chauvet
Cc: airlied, arthurgrillo, daniel, dri-devel, hamohammed.sa,
jeremie.dautheribes, linux-kernel, maarten.lankhorst, mairacanal,
marcheu, melissa.srw, miquel.raynal, mripard, nicolejadeyee,
rodrigosiqueiramelo, seanpaul, thomas.petazzoni, tzimmermann,
José Expósito
> In order to properly split vkms_output function, extract all
> its function to its own header.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 06e28305d660..6a4de8f7a678 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -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.
>
> #include "vkms_drv.h"
> +#include "vkms_plane.h"
>
> static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
> {
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 46daa2fab6e8..ea73f01fcc74 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -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.
> - */
> -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.
> -
> -
> -
> -/**
> - * 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);
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
> index cbfa7943e948..4e8494d4ade4 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.c
> +++ b/drivers/gpu/drm/vkms/vkms_formats.c
> @@ -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.
>
> /**
> * packed_pixels_offset() - Get the offset of the block containing the pixel at coordinates x/y
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 0c55682337a4..09fcf242ecf7 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -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"
>
> static const struct drm_connector_funcs vkms_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index 9d85464ee0e9..de2c83e1b02c 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -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>
>
> #include "vkms_drv.h"
> #include "vkms_formats.h"
> +#include "vkms_plane.h"
>
> static const u32 vkms_formats[] = {
> DRM_FORMAT_ARGB8888,
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.h b/drivers/gpu/drm/vkms/vkms_plane.h
> new file mode 100644
> index 000000000000..161b44da0240
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_plane.h
> @@ -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_
> +
> +#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
> +
> +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
> + * @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_ */
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index 4a830a4c4d64..740d9e2f3d71 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -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"
>
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.h b/drivers/gpu/drm/vkms/vkms_writeback.h
> index 70f0c4c26c23..44dff15faff6 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.h
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.h
> @@ -5,6 +5,7 @@
>
> #include "vkms_drv.h"
> #include "vkms_formats.h"
> +#include "vkms_plane.h"
>
> struct vkms_crtc;
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 4/6] drm/vkms: Rename to_vkms_plane_state to avoid confusion
2024-08-14 9:08 [PATCH RFC 0/6] drm/vkms: Completly split headers Louis Chauvet
` (2 preceding siblings ...)
2024-08-14 9:08 ` [PATCH RFC 3/6] drm/vkms: Extract vkms_plane header Louis Chauvet
@ 2024-08-14 9:08 ` Louis Chauvet
2024-08-20 15:29 ` José Expósito
2024-08-14 9:08 ` [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header Louis Chauvet
2024-08-14 9:08 ` [PATCH RFC 6/6] drm/vkms: Extract vkms_composer header Louis Chauvet
5 siblings, 1 reply; 14+ messages in thread
From: Louis Chauvet @ 2024-08-14 9:08 UTC (permalink / raw)
To: Rodrigo Siqueira, Melissa Wen, Maíra Canal, Haneen Mohammed,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie
Cc: dri-devel, arthurgrillo, linux-kernel, jeremie.dautheribes,
miquel.raynal, thomas.petazzoni, seanpaul, marcheu,
nicolejadeyee, Louis Chauvet
The 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.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
| 2 +-
| 4 ++--
| 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
--git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 6a4de8f7a678..08e5db07aca6 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -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;
--git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index de2c83e1b02c..e549c9523a34 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -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;
--git a/drivers/gpu/drm/vkms/vkms_plane.h b/drivers/gpu/drm/vkms/vkms_plane.h
index 161b44da0240..68170a75e9c9 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.h
+++ b/drivers/gpu/drm/vkms/vkms_plane.h
@@ -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
--
2.44.2
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH RFC 4/6] drm/vkms: Rename to_vkms_plane_state to avoid confusion
2024-08-14 9:08 ` [PATCH RFC 4/6] drm/vkms: Rename to_vkms_plane_state to avoid confusion Louis Chauvet
@ 2024-08-20 15:29 ` José Expósito
0 siblings, 0 replies; 14+ messages in thread
From: José Expósito @ 2024-08-20 15:29 UTC (permalink / raw)
To: louis.chauvet
Cc: airlied, arthurgrillo, daniel, dri-devel, hamohammed.sa,
jeremie.dautheribes, linux-kernel, maarten.lankhorst, mairacanal,
marcheu, melissa.srw, miquel.raynal, mripard, nicolejadeyee,
rodrigosiqueiramelo, seanpaul, thomas.petazzoni, tzimmermann,
José Expósito
> The 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.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 6a4de8f7a678..08e5db07aca6 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -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;
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index de2c83e1b02c..e549c9523a34 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -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;
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.h b/drivers/gpu/drm/vkms/vkms_plane.h
> index 161b44da0240..68170a75e9c9 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.h
> +++ b/drivers/gpu/drm/vkms/vkms_plane.h
> @@ -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
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header
2024-08-14 9:08 [PATCH RFC 0/6] drm/vkms: Completly split headers Louis Chauvet
` (3 preceding siblings ...)
2024-08-14 9:08 ` [PATCH RFC 4/6] drm/vkms: Rename to_vkms_plane_state to avoid confusion Louis Chauvet
@ 2024-08-14 9:08 ` Louis Chauvet
2024-08-20 15:29 ` José Expósito
2024-08-14 9:08 ` [PATCH RFC 6/6] drm/vkms: Extract vkms_composer header Louis Chauvet
5 siblings, 1 reply; 14+ messages in thread
From: Louis Chauvet @ 2024-08-14 9:08 UTC (permalink / raw)
To: Rodrigo Siqueira, Melissa Wen, Maíra Canal, Haneen Mohammed,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie
Cc: dri-devel, arthurgrillo, linux-kernel, jeremie.dautheribes,
miquel.raynal, thomas.petazzoni, seanpaul, marcheu,
nicolejadeyee, Louis Chauvet
The 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.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
| 2 +-
| 2 +-
| 87 +++++++++++++++++++++++++++++++++++
| 1 +
| 45 ------------------
| 1 +
| 1 -
| 1 +
8 files changed, 92 insertions(+), 48 deletions(-)
--git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
index 825011f696ee..139d249454c4 100644
--- a/drivers/gpu/drm/vkms/vkms_composer.c
+++ b/drivers/gpu/drm/vkms/vkms_composer.c
@@ -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)
--git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 08e5db07aca6..cb6e49a86745 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -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)
--git a/drivers/gpu/drm/vkms/vkms_crtc.h b/drivers/gpu/drm/vkms/vkms_crtc.h
new file mode 100644
index 000000000000..9f5ce21f3425
--- /dev/null
+++ b/drivers/gpu/drm/vkms/vkms_crtc.h
@@ -0,0 +1,87 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef _VKMS_CRTC_H
+#define _VKMS_CRTC_H
+
+#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)
+
+/**
+ * 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
--git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 5aeb43592960..5907877bdfa0 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -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>
--git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index ea73f01fcc74..943ad55e0172 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -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.
*
--git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 09fcf242ecf7..20073a00b200 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -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,
--git a/drivers/gpu/drm/vkms/vkms_plane.h b/drivers/gpu/drm/vkms/vkms_plane.h
index 68170a75e9c9..90554c9fe250 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.h
+++ b/drivers/gpu/drm/vkms/vkms_plane.h
@@ -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 {
--git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
index 740d9e2f3d71..48f3f7f2e2a4 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -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[] = {
--
2.44.2
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header
2024-08-14 9:08 ` [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header Louis Chauvet
@ 2024-08-20 15:29 ` José Expósito
0 siblings, 0 replies; 14+ messages in thread
From: José Expósito @ 2024-08-20 15:29 UTC (permalink / raw)
To: louis.chauvet
Cc: airlied, arthurgrillo, daniel, dri-devel, hamohammed.sa,
jeremie.dautheribes, linux-kernel, maarten.lankhorst, mairacanal,
marcheu, melissa.srw, miquel.raynal, mripard, nicolejadeyee,
rodrigosiqueiramelo, seanpaul, thomas.petazzoni, tzimmermann,
José Expósito
> The vkms crtc functions are defined in a different .c, so make the same
The VKMS CRTC...
> thing for the function declaration in the headers and create vkms_crtc.h.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index 825011f696ee..139d249454c4 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -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)
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 08e5db07aca6..cb6e49a86745 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -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)
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.h b/drivers/gpu/drm/vkms/vkms_crtc.h
> new file mode 100644
> index 000000000000..9f5ce21f3425
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.h
> @@ -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_
> +#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)
> +
> +/**
> + * 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_ */
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 5aeb43592960..5907877bdfa0 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -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"
> #include <drm/drm_print.h>
> #include <drm/drm_debugfs.h>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index ea73f01fcc74..943ad55e0172 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -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.
> *
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 09fcf242ecf7..20073a00b200 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -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,
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.h b/drivers/gpu/drm/vkms/vkms_plane.h
> index 68170a75e9c9..90554c9fe250 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.h
> +++ b/drivers/gpu/drm/vkms/vkms_plane.h
> @@ -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 {
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index 740d9e2f3d71..48f3f7f2e2a4 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -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[] = {
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 6/6] drm/vkms: Extract vkms_composer header
2024-08-14 9:08 [PATCH RFC 0/6] drm/vkms: Completly split headers Louis Chauvet
` (4 preceding siblings ...)
2024-08-14 9:08 ` [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header Louis Chauvet
@ 2024-08-14 9:08 ` Louis Chauvet
2024-08-20 15:30 ` José Expósito
5 siblings, 1 reply; 14+ messages in thread
From: Louis Chauvet @ 2024-08-14 9:08 UTC (permalink / raw)
To: Rodrigo Siqueira, Melissa Wen, Maíra Canal, Haneen Mohammed,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie
Cc: dri-devel, arthurgrillo, linux-kernel, jeremie.dautheribes,
miquel.raynal, thomas.petazzoni, seanpaul, marcheu,
nicolejadeyee, Louis Chauvet
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 <louis.chauvet@bootlin.com>
---
| 2 ++
| 18 ++++++++++++++++++
| 1 +
| 11 -----------
| 1 +
5 files changed, 22 insertions(+), 11 deletions(-)
--git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
index 139d249454c4..15ef07ed304e 100644
--- a/drivers/gpu/drm/vkms/vkms_composer.c
+++ b/drivers/gpu/drm/vkms/vkms_composer.c
@@ -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"
--git a/drivers/gpu/drm/vkms/vkms_composer.h b/drivers/gpu/drm/vkms/vkms_composer.h
new file mode 100644
index 000000000000..91b33af1e013
--- /dev/null
+++ b/drivers/gpu/drm/vkms/vkms_composer.h
@@ -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
--git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index cb6e49a86745..6fae43932b60 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -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)
--git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 943ad55e0172..f74a5c2045f9 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -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_ */
--git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
index 48f3f7f2e2a4..5e75880a5845 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -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,
--
2.44.2
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH RFC 6/6] drm/vkms: Extract vkms_composer header
2024-08-14 9:08 ` [PATCH RFC 6/6] drm/vkms: Extract vkms_composer header Louis Chauvet
@ 2024-08-20 15:30 ` José Expósito
0 siblings, 0 replies; 14+ messages in thread
From: José Expósito @ 2024-08-20 15:30 UTC (permalink / raw)
To: louis.chauvet
Cc: airlied, arthurgrillo, daniel, dri-devel, hamohammed.sa,
jeremie.dautheribes, linux-kernel, maarten.lankhorst, mairacanal,
marcheu, melissa.srw, miquel.raynal, mripard, nicolejadeyee,
rodrigosiqueiramelo, seanpaul, thomas.petazzoni, tzimmermann,
José Expósito
> 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 <louis.chauvet@bootlin.com>
Reviewed-by: José Expósito <jose.exposito89@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index 139d249454c4..15ef07ed304e 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -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"
>
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.h b/drivers/gpu/drm/vkms/vkms_composer.h
> new file mode 100644
> index 000000000000..91b33af1e013
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_composer.h
> @@ -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_
> +#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_ */
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index cb6e49a86745..6fae43932b60 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -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"
> static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 943ad55e0172..f74a5c2045f9 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -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_ */
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index 48f3f7f2e2a4..5e75880a5845 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -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"
> static const u32 vkms_wb_formats[] = {
> DRM_FORMAT_ARGB8888,
>
^ permalink raw reply [flat|nested] 14+ messages in thread