* [PATCH 1/3] drm/vkms: Formatting and typo fix
2024-08-14 8:46 [PATCH 0/3] drm/vkms: Miscelanious clarifications Louis Chauvet
@ 2024-08-14 8:46 ` Louis Chauvet
2024-08-15 14:05 ` Maíra Canal
2024-08-14 8:46 ` [PATCH 2/3] drm/vkms: Rename index to possible_crtc Louis Chauvet
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Louis Chauvet @ 2024-08-14 8:46 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
Some newlines were missing around comments.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
drivers/gpu/drm/vkms/vkms_drv.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 6860bee8e981..5aeb43592960 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -163,9 +163,11 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
dev->mode_config.max_height = YRES_MAX;
dev->mode_config.cursor_width = 512;
dev->mode_config.cursor_height = 512;
- /* FIXME: There's a confusion between bpp and depth between this and
+ /*
+ * FIXME: There's a confusion between bpp and depth between this and
* fbdev helpers. We have to go with 0, meaning "pick the default",
- * which ix XRGB8888 in all cases. */
+ * which is XRGB8888 in all cases.
+ */
dev->mode_config.preferred_depth = 0;
dev->mode_config.helper_private = &vkms_mode_config_helpers;
--
2.44.2
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 1/3] drm/vkms: Formatting and typo fix
2024-08-14 8:46 ` [PATCH 1/3] drm/vkms: Formatting and typo fix Louis Chauvet
@ 2024-08-15 14:05 ` Maíra Canal
0 siblings, 0 replies; 11+ messages in thread
From: Maíra Canal @ 2024-08-15 14:05 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
On 8/14/24 05:46, Louis Chauvet wrote:
> Some newlines were missing around comments.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Applied to drm/misc/drm-misc-next!
Best Regards,
- Maíra
> ---
> drivers/gpu/drm/vkms/vkms_drv.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 6860bee8e981..5aeb43592960 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -163,9 +163,11 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
> dev->mode_config.max_height = YRES_MAX;
> dev->mode_config.cursor_width = 512;
> dev->mode_config.cursor_height = 512;
> - /* FIXME: There's a confusion between bpp and depth between this and
> + /*
> + * FIXME: There's a confusion between bpp and depth between this and
> * fbdev helpers. We have to go with 0, meaning "pick the default",
> - * which ix XRGB8888 in all cases. */
> + * which is XRGB8888 in all cases.
> + */
> dev->mode_config.preferred_depth = 0;
> dev->mode_config.helper_private = &vkms_mode_config_helpers;
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] drm/vkms: Rename index to possible_crtc
2024-08-14 8:46 [PATCH 0/3] drm/vkms: Miscelanious clarifications Louis Chauvet
2024-08-14 8:46 ` [PATCH 1/3] drm/vkms: Formatting and typo fix Louis Chauvet
@ 2024-08-14 8:46 ` Louis Chauvet
2024-08-15 14:07 ` Maíra Canal
2024-08-14 8:47 ` [PATCH 3/3] drm/vkms: Add documentation Louis Chauvet
2024-08-15 14:02 ` [PATCH 0/3] drm/vkms: Miscelanious clarifications Maíra Canal
3 siblings, 1 reply; 11+ messages in thread
From: Louis Chauvet @ 2024-08-14 8:46 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 meaning of index was not clear. Replace them with crtc_index to
clearly indicate its usage.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
drivers/gpu/drm/vkms/vkms_drv.h | 4 ++--
drivers/gpu/drm/vkms/vkms_output.c | 13 +++++++------
drivers/gpu/drm/vkms/vkms_plane.c | 4 ++--
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 526bf5207524..3028678e4f9b 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -222,10 +222,10 @@ struct vkms_device {
int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
struct drm_plane *primary, struct drm_plane *cursor);
-int vkms_output_init(struct vkms_device *vkmsdev, int index);
+int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index);
struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
- enum drm_plane_type type, int index);
+ enum drm_plane_type type, int possible_crtc_index);
/* CRC Support */
const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 5ce70dd946aa..d42ca7d10389 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -31,12 +31,12 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = {
.get_modes = vkms_conn_get_modes,
};
-static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
+static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int possible_crtc_index,
struct drm_crtc *crtc)
{
struct vkms_plane *overlay;
- overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index);
+ overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, possible_crtc_index);
if (IS_ERR(overlay))
return PTR_ERR(overlay);
@@ -46,7 +46,7 @@ static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
return 0;
}
-int vkms_output_init(struct vkms_device *vkmsdev, int index)
+int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
{
struct vkms_output *output = &vkmsdev->output;
struct drm_device *dev = &vkmsdev->drm;
@@ -58,20 +58,21 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
int writeback;
unsigned int n;
- primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
+ primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index);
+
if (IS_ERR(primary))
return PTR_ERR(primary);
if (vkmsdev->config->overlay) {
for (n = 0; n < NUM_OVERLAY_PLANES; n++) {
- ret = vkms_add_overlay_plane(vkmsdev, index, crtc);
+ ret = vkms_add_overlay_plane(vkmsdev, possible_crtc_index, crtc);
if (ret)
return ret;
}
}
if (vkmsdev->config->cursor) {
- cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index);
+ cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, possible_crtc_index);
if (IS_ERR(cursor))
return PTR_ERR(cursor);
}
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 03716616f819..9d85464ee0e9 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -219,12 +219,12 @@ static const struct drm_plane_helper_funcs vkms_plane_helper_funcs = {
};
struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
- enum drm_plane_type type, int index)
+ enum drm_plane_type type, int possible_crtc_index)
{
struct drm_device *dev = &vkmsdev->drm;
struct vkms_plane *plane;
- plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << index,
+ plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << possible_crtc_index,
&vkms_plane_funcs,
vkms_formats, ARRAY_SIZE(vkms_formats),
NULL, type, NULL);
--
2.44.2
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 2/3] drm/vkms: Rename index to possible_crtc
2024-08-14 8:46 ` [PATCH 2/3] drm/vkms: Rename index to possible_crtc Louis Chauvet
@ 2024-08-15 14:07 ` Maíra Canal
2024-08-26 16:22 ` Louis Chauvet
0 siblings, 1 reply; 11+ messages in thread
From: Maíra Canal @ 2024-08-15 14:07 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
On 8/14/24 05:46, Louis Chauvet wrote:
> The meaning of index was not clear. Replace them with crtc_index to
> clearly indicate its usage.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
IMHO no need for this patch, especially considering that you are going
to change those lines anyway in a future series.
I'd just drop it.
Best Regards,
- Maíra
> ---
> drivers/gpu/drm/vkms/vkms_drv.h | 4 ++--
> drivers/gpu/drm/vkms/vkms_output.c | 13 +++++++------
> drivers/gpu/drm/vkms/vkms_plane.c | 4 ++--
> 3 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 526bf5207524..3028678e4f9b 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -222,10 +222,10 @@ struct vkms_device {
> int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> struct drm_plane *primary, struct drm_plane *cursor);
>
> -int vkms_output_init(struct vkms_device *vkmsdev, int index);
> +int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index);
>
> struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> - enum drm_plane_type type, int index);
> + enum drm_plane_type type, int possible_crtc_index);
>
> /* CRC Support */
> const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 5ce70dd946aa..d42ca7d10389 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -31,12 +31,12 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = {
> .get_modes = vkms_conn_get_modes,
> };
>
> -static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
> +static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int possible_crtc_index,
> struct drm_crtc *crtc)
> {
> struct vkms_plane *overlay;
>
> - overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index);
> + overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, possible_crtc_index);
> if (IS_ERR(overlay))
> return PTR_ERR(overlay);
>
> @@ -46,7 +46,7 @@ static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
> return 0;
> }
>
> -int vkms_output_init(struct vkms_device *vkmsdev, int index)
> +int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> {
> struct vkms_output *output = &vkmsdev->output;
> struct drm_device *dev = &vkmsdev->drm;
> @@ -58,20 +58,21 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
> int writeback;
> unsigned int n;
>
> - primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
> + primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index);
> +
> if (IS_ERR(primary))
> return PTR_ERR(primary);
>
> if (vkmsdev->config->overlay) {
> for (n = 0; n < NUM_OVERLAY_PLANES; n++) {
> - ret = vkms_add_overlay_plane(vkmsdev, index, crtc);
> + ret = vkms_add_overlay_plane(vkmsdev, possible_crtc_index, crtc);
> if (ret)
> return ret;
> }
> }
>
> if (vkmsdev->config->cursor) {
> - cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index);
> + cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, possible_crtc_index);
> if (IS_ERR(cursor))
> return PTR_ERR(cursor);
> }
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index 03716616f819..9d85464ee0e9 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -219,12 +219,12 @@ static const struct drm_plane_helper_funcs vkms_plane_helper_funcs = {
> };
>
> struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> - enum drm_plane_type type, int index)
> + enum drm_plane_type type, int possible_crtc_index)
> {
> struct drm_device *dev = &vkmsdev->drm;
> struct vkms_plane *plane;
>
> - plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << index,
> + plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << possible_crtc_index,
> &vkms_plane_funcs,
> vkms_formats, ARRAY_SIZE(vkms_formats),
> NULL, type, NULL);
>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 2/3] drm/vkms: Rename index to possible_crtc
2024-08-15 14:07 ` Maíra Canal
@ 2024-08-26 16:22 ` Louis Chauvet
0 siblings, 0 replies; 11+ messages in thread
From: Louis Chauvet @ 2024-08-26 16:22 UTC (permalink / raw)
To: Maíra Canal
Cc: Rodrigo Siqueira, Melissa Wen, Haneen Mohammed, Daniel Vetter,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, dri-devel, arthurgrillo, linux-kernel,
jeremie.dautheribes, miquel.raynal, thomas.petazzoni, seanpaul,
marcheu, nicolejadeyee
Le 15/08/24 - 11:07, Maíra Canal a écrit :
> On 8/14/24 05:46, Louis Chauvet wrote:
> > The meaning of index was not clear. Replace them with crtc_index to
> > clearly indicate its usage.
> >
> > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
>
> IMHO no need for this patch, especially considering that you are going
> to change those lines anyway in a future series.
>
> I'd just drop it.
True, I will drop it for the next iteration. It was a step for me to
understand the initialization process, but as you said, my next series
complelty remove it, so I will remove this patch.
Thanks for your reviews,
Louis Chauvet
> Best Regards,
> - Maíra
>
> > ---
> > drivers/gpu/drm/vkms/vkms_drv.h | 4 ++--
> > drivers/gpu/drm/vkms/vkms_output.c | 13 +++++++------
> > drivers/gpu/drm/vkms/vkms_plane.c | 4 ++--
> > 3 files changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> > index 526bf5207524..3028678e4f9b 100644
> > --- a/drivers/gpu/drm/vkms/vkms_drv.h
> > +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> > @@ -222,10 +222,10 @@ struct vkms_device {
> > int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> > struct drm_plane *primary, struct drm_plane *cursor);
> >
> > -int vkms_output_init(struct vkms_device *vkmsdev, int index);
> > +int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index);
> >
> > struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> > - enum drm_plane_type type, int index);
> > + enum drm_plane_type type, int possible_crtc_index);
> >
> > /* CRC Support */
> > const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
> > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> > index 5ce70dd946aa..d42ca7d10389 100644
> > --- a/drivers/gpu/drm/vkms/vkms_output.c
> > +++ b/drivers/gpu/drm/vkms/vkms_output.c
> > @@ -31,12 +31,12 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = {
> > .get_modes = vkms_conn_get_modes,
> > };
> >
> > -static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
> > +static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int possible_crtc_index,
> > struct drm_crtc *crtc)
> > {
> > struct vkms_plane *overlay;
> >
> > - overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index);
> > + overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, possible_crtc_index);
> > if (IS_ERR(overlay))
> > return PTR_ERR(overlay);
> >
> > @@ -46,7 +46,7 @@ static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index,
> > return 0;
> > }
> >
> > -int vkms_output_init(struct vkms_device *vkmsdev, int index)
> > +int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> > {
> > struct vkms_output *output = &vkmsdev->output;
> > struct drm_device *dev = &vkmsdev->drm;
> > @@ -58,20 +58,21 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
> > int writeback;
> > unsigned int n;
> >
> > - primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
> > + primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index);
> > +
> > if (IS_ERR(primary))
> > return PTR_ERR(primary);
> >
> > if (vkmsdev->config->overlay) {
> > for (n = 0; n < NUM_OVERLAY_PLANES; n++) {
> > - ret = vkms_add_overlay_plane(vkmsdev, index, crtc);
> > + ret = vkms_add_overlay_plane(vkmsdev, possible_crtc_index, crtc);
> > if (ret)
> > return ret;
> > }
> > }
> >
> > if (vkmsdev->config->cursor) {
> > - cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index);
> > + cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, possible_crtc_index);
> > if (IS_ERR(cursor))
> > return PTR_ERR(cursor);
> > }
> > diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> > index 03716616f819..9d85464ee0e9 100644
> > --- a/drivers/gpu/drm/vkms/vkms_plane.c
> > +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> > @@ -219,12 +219,12 @@ static const struct drm_plane_helper_funcs vkms_plane_helper_funcs = {
> > };
> >
> > struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> > - enum drm_plane_type type, int index)
> > + enum drm_plane_type type, int possible_crtc_index)
> > {
> > struct drm_device *dev = &vkmsdev->drm;
> > struct vkms_plane *plane;
> >
> > - plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << index,
> > + plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << possible_crtc_index,
> > &vkms_plane_funcs,
> > vkms_formats, ARRAY_SIZE(vkms_formats),
> > NULL, type, NULL);
> >
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] drm/vkms: Add documentation
2024-08-14 8:46 [PATCH 0/3] drm/vkms: Miscelanious clarifications Louis Chauvet
2024-08-14 8:46 ` [PATCH 1/3] drm/vkms: Formatting and typo fix Louis Chauvet
2024-08-14 8:46 ` [PATCH 2/3] drm/vkms: Rename index to possible_crtc Louis Chauvet
@ 2024-08-14 8:47 ` Louis Chauvet
2024-08-15 14:30 ` Maíra Canal
2024-08-19 15:07 ` José Expósito
2024-08-15 14:02 ` [PATCH 0/3] drm/vkms: Miscelanious clarifications Maíra Canal
3 siblings, 2 replies; 11+ messages in thread
From: Louis Chauvet @ 2024-08-14 8:47 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
Add documentation around vkms_output and its initialization.
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------
drivers/gpu/drm/vkms/vkms_output.c | 12 +++++-
2 files changed, 80 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 3028678e4f9b..8f6c9e67e671 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -147,29 +147,51 @@ struct vkms_color_lut {
};
/**
- * vkms_crtc_state - Driver specific CRTC state
+ * struct vkms_crtc_state - Driver specific CRTC state
+ *
* @base: base CRTC state
* @composer_work: work struct to compose and add CRC entries
- * @n_frame_start: start frame number for computed CRC
- * @n_frame_end: end frame number for computed CRC
+ *
+ * @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;
- /* stack of active planes for crc computation, should be in z order */
struct vkms_plane_state **active_planes;
struct vkms_writeback_job *active_writeback;
struct vkms_color_lut gamma_lut;
- /* below four are protected by vkms_output.composer_lock */
bool crc_pending;
bool wb_pending;
u64 frame_start;
u64 frame_end;
};
+/**
+ * struct vkms_output - Internal representation of all output components in vkms
+ *
+ * @crtc: Base crtc in drm
+ * @encoder: DRM encoder used for this output
+ * @connector: DRM connector used for this output
+ * @wb_connecter: DRM writeback connector used for this output
+ * @vblank_hrtimer:
+ * @period_ns:
+ * @composer_workq: Ordered workqueue for composer_work
+ * @lock: Lock used to project concurrent acces to the composer
+ * @composer_enabled: Protected by @lock.
+ * @composer_state:
+ * @composer_lock: Lock used internally to protect @composer_state members
+ */
struct vkms_output {
struct drm_crtc crtc;
struct drm_encoder encoder;
@@ -177,28 +199,38 @@ struct vkms_output {
struct drm_writeback_connector wb_connector;
struct hrtimer vblank_hrtimer;
ktime_t period_ns;
- /* ordered wq for composer_work */
struct workqueue_struct *composer_workq;
- /* protects concurrent access to composer */
spinlock_t lock;
- /* protected by @lock */
bool composer_enabled;
struct vkms_crtc_state *composer_state;
spinlock_t composer_lock;
};
-struct vkms_device;
-
+/**
+ * struct vkms_config - General configuration for VKMS driver
+ *
+ * @writeback: If true, a writeback buffer can be attached to the CRTC
+ * @cursor: If true, a cursor plane is created in the VKMS device
+ * @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device
+ * @dev: Used to store the current vkms device. Only set when the device is instancied.
+ */
struct vkms_config {
bool writeback;
bool cursor;
bool overlay;
- /* only set when instantiated */
struct vkms_device *dev;
};
+/**
+ * struct vkms_device - Description of a vkms device
+ *
+ * @drm - Base device in drm
+ * @platform - Associated platform device
+ * @output - Configuration and sub-components of the vkms device
+ * @config: Configuration used in this vkms device
+ */
struct vkms_device {
struct drm_device drm;
struct platform_device *platform;
@@ -206,6 +238,10 @@ struct vkms_device {
const struct vkms_config *config;
};
+/*
+ * The following helpers are used to convert a member of a struct into its parent.
+ */
+
#define drm_crtc_to_vkms_output(target) \
container_of(target, struct vkms_output, crtc)
@@ -218,12 +254,33 @@ struct vkms_device {
#define to_vkms_plane_state(target)\
container_of(target, struct vkms_plane_state, base.base)
-/* CRTC */
+/**
+ * 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.
+ *
+ * @vkmsdev: vkms device to initialize
+ * @possible_crtc_index: Crtc which can be attached to the planes. The caller must ensure that
+ * possible_crtc_index is positive and less or equals to 31.
+ */
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);
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index d42ca7d10389..36db2c8923cb 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -21,6 +21,7 @@ static int vkms_conn_get_modes(struct drm_connector *connector)
{
int count;
+ /* Use the default modes list from drm */
count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
@@ -58,8 +59,13 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
int writeback;
unsigned int n;
+ /*
+ * Initialize used plane. One primary plane is required to perform the composition.
+ *
+ * The overlay and cursor planes are not mandatory, but can be used to perform complex
+ * composition.
+ */
primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index);
-
if (IS_ERR(primary))
return PTR_ERR(primary);
@@ -96,6 +102,10 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
DRM_ERROR("Failed to init encoder\n");
goto err_encoder;
}
+ /*
+ * This is an hardcoded value to select crtc for the encoder.
+ * 1 here designate the first registered CRTC, the one allocated in [1]
+ */
encoder->possible_crtcs = 1;
ret = drm_connector_attach_encoder(connector, encoder);
--
2.44.2
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 3/3] drm/vkms: Add documentation
2024-08-14 8:47 ` [PATCH 3/3] drm/vkms: Add documentation Louis Chauvet
@ 2024-08-15 14:30 ` Maíra Canal
2024-08-19 15:07 ` José Expósito
1 sibling, 0 replies; 11+ messages in thread
From: Maíra Canal @ 2024-08-15 14:30 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,
I'd make this patch more incremental. First, send me a patch based on
drm-misc-next with the new documentation for the things that already
exists. Then, when you add a new field, you add the documentation with
it.
On 8/14/24 05:47, Louis Chauvet wrote:
> Add documentation around vkms_output and its initialization.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------
> drivers/gpu/drm/vkms/vkms_output.c | 12 +++++-
> 2 files changed, 80 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 3028678e4f9b..8f6c9e67e671 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -147,29 +147,51 @@ struct vkms_color_lut {
> };
>
> /**
> - * vkms_crtc_state - Driver specific CRTC state
> + * struct vkms_crtc_state - Driver specific CRTC state
> + *
> * @base: base CRTC state
> * @composer_work: work struct to compose and add CRC entries
> - * @n_frame_start: start frame number for computed CRC
> - * @n_frame_end: end frame number for computed CRC
> + *
> + * @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.
Apart from being protected by @vkms_output.composer_lock, what those
variables represent?
> */
> struct vkms_crtc_state {
> struct drm_crtc_state base;
> struct work_struct composer_work;
>
> int num_active_planes;
> - /* stack of active planes for crc computation, should be in z order */
> struct vkms_plane_state **active_planes;
> struct vkms_writeback_job *active_writeback;
> struct vkms_color_lut gamma_lut;
>
> - /* below four are protected by vkms_output.composer_lock */
> bool crc_pending;
> bool wb_pending;
> u64 frame_start;
> u64 frame_end;
> };
>
> +/**
> + * struct vkms_output - Internal representation of all output components in vkms
> + *
> + * @crtc: Base crtc in drm
s/crtc/CRTC and s/drm/DRM
> + * @encoder: DRM encoder used for this output
> + * @connector: DRM connector used for this output
> + * @wb_connecter: DRM writeback connector used for this output
> + * @vblank_hrtimer:
> + * @period_ns:
Empty?
> + * @composer_workq: Ordered workqueue for composer_work
Add reference to composer_work
> + * @lock: Lock used to project concurrent acces to the composer
s/acces/access
> + * @composer_enabled: Protected by @lock.
> + * @composer_state:
Empty?
> + * @composer_lock: Lock used internally to protect @composer_state members
> + */
> struct vkms_output {
> struct drm_crtc crtc;
> struct drm_encoder encoder;
> @@ -177,28 +199,38 @@ struct vkms_output {
> struct drm_writeback_connector wb_connector;
> struct hrtimer vblank_hrtimer;
> ktime_t period_ns;
> - /* ordered wq for composer_work */
> struct workqueue_struct *composer_workq;
> - /* protects concurrent access to composer */
> spinlock_t lock;
>
> - /* protected by @lock */
> bool composer_enabled;
> struct vkms_crtc_state *composer_state;
>
> spinlock_t composer_lock;
> };
>
> -struct vkms_device;
> -
> +/**
> + * struct vkms_config - General configuration for VKMS driver
> + *
> + * @writeback: If true, a writeback buffer can be attached to the CRTC
> + * @cursor: If true, a cursor plane is created in the VKMS device
> + * @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device
> + * @dev: Used to store the current vkms device. Only set when the device is instancied.
s/instancied/instantiated
> + */
> struct vkms_config {
> bool writeback;
> bool cursor;
> bool overlay;
> - /* only set when instantiated */
> struct vkms_device *dev;
> };
>
> +/**
> + * struct vkms_device - Description of a vkms device
> + *
> + * @drm - Base device in drm
s/drm/DRM
> + * @platform - Associated platform device
> + * @output - Configuration and sub-components of the vkms device
> + * @config: Configuration used in this vkms device
> + */
> struct vkms_device {
> struct drm_device drm;
> struct platform_device *platform;
> @@ -206,6 +238,10 @@ struct vkms_device {
> const struct vkms_config *config;
> };
>
> +/*
> + * The following helpers are used to convert a member of a struct into its parent.
> + */
> +
> #define drm_crtc_to_vkms_output(target) \
> container_of(target, struct vkms_output, crtc)
>
> @@ -218,12 +254,33 @@ struct vkms_device {
> #define to_vkms_plane_state(target)\
> container_of(target, struct vkms_plane_state, base.base)
>
> -/* CRTC */
> +/**
> + * vkms_crtc_init() - Initialize a crtc for vkms
> + * @dev: drm_device associated with the vkms buffer
DRM device
> + * @crtc: uninitialized crtc device
> + * @primary: primary plane to attach to the crtc
> + * @cursor plane to attach to the crtc
s/crtc/CRTC everywhere
> + */
New line
> 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.
> + *
> + * @vkmsdev: vkms device to initialize
> + * @possible_crtc_index: Crtc which can be attached to the planes. The caller must ensure that
> + * possible_crtc_index is positive and less or equals to 31.
> + */
>
Delete line
> 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
s/crtc/CRTC everywhere
> + * 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);
>
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index d42ca7d10389..36db2c8923cb 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -21,6 +21,7 @@ static int vkms_conn_get_modes(struct drm_connector *connector)
> {
> int count;
>
> + /* Use the default modes list from drm */
s/drm/DRM
> count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
> drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
>
> @@ -58,8 +59,13 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> int writeback;
> unsigned int n;
>
> + /*
> + * Initialize used plane. One primary plane is required to perform the composition.
> + *
> + * The overlay and cursor planes are not mandatory, but can be used to perform complex
> + * composition.
> + */
> primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index);
> -
> if (IS_ERR(primary))
> return PTR_ERR(primary);
>
> @@ -96,6 +102,10 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> DRM_ERROR("Failed to init encoder\n");
> goto err_encoder;
> }
> + /*
> + * This is an hardcoded value to select crtc for the encoder.
> + * 1 here designate the first registered CRTC, the one allocated in [1]
Where is [1]?
Best Regards,
- Maíra
> + */
> encoder->possible_crtcs = 1;
>
> ret = drm_connector_attach_encoder(connector, encoder);
>
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 3/3] drm/vkms: Add documentation
2024-08-14 8:47 ` [PATCH 3/3] drm/vkms: Add documentation Louis Chauvet
2024-08-15 14:30 ` Maíra Canal
@ 2024-08-19 15:07 ` José Expósito
2024-08-29 13:36 ` Louis Chauvet
1 sibling, 1 reply; 11+ messages in thread
From: José Expósito @ 2024-08-19 15:07 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
Hi Louis,
Thanks for this patch, adding some minor review comments:
> Add documentation around vkms_output and its initialization.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------
> drivers/gpu/drm/vkms/vkms_output.c | 12 +++++-
> 2 files changed, 80 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 3028678e4f9b..8f6c9e67e671 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -147,29 +147,51 @@ struct vkms_color_lut {
> };
>
> /**
> - * vkms_crtc_state - Driver specific CRTC state
> + * struct vkms_crtc_state - Driver specific CRTC state
Not in this line, but around line 55, the documentation for vkms_plane_state
is missing the "struct" keyword:
- * vkms_plane_state - Driver specific plane state
+ * struct vkms_plane_state - Driver specific plane state
I'd be nice to add it since we are improving the documentation.
> + *
> * @base: base CRTC state
> * @composer_work: work struct to compose and add CRC entries
> - * @n_frame_start: start frame number for computed CRC
> - * @n_frame_end: end frame number for computed CRC
> + *
> + * @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;
> - /* stack of active planes for crc computation, should be in z order */
> struct vkms_plane_state **active_planes;
> struct vkms_writeback_job *active_writeback;
> struct vkms_color_lut gamma_lut;
>
> - /* below four are protected by vkms_output.composer_lock */
> bool crc_pending;
> bool wb_pending;
> u64 frame_start;
> u64 frame_end;
> };
>
> +/**
> + * struct vkms_output - Internal representation of all output components in vkms
I think that VKMS is usually spelled in capital letters in other places.
> + *
> + * @crtc: Base crtc in drm
> + * @encoder: DRM encoder used for this output
> + * @connector: DRM connector used for this output
> + * @wb_connecter: DRM writeback connector used for this output
> + * @vblank_hrtimer:
> + * @period_ns:
My suggestion when reviewing a previous version of this patch in your
GitHub fork was:
@vblank_hrtimer: Timer used to simulate vblank events
@period_ns: vblank period, in nanoseconds
> + * @composer_workq: Ordered workqueue for composer_work
> + * @lock: Lock used to project concurrent acces to the composer
> + * @composer_enabled: Protected by @lock.
> + * @composer_state:
I think that @composer_state is "Protected by @lock" as well.
> + * @composer_lock: Lock used internally to protect @composer_state members
> + */
> struct vkms_output {
> struct drm_crtc crtc;
> struct drm_encoder encoder;
> @@ -177,28 +199,38 @@ struct vkms_output {
> struct drm_writeback_connector wb_connector;
> struct hrtimer vblank_hrtimer;
> ktime_t period_ns;
> - /* ordered wq for composer_work */
> struct workqueue_struct *composer_workq;
> - /* protects concurrent access to composer */
> spinlock_t lock;
>
> - /* protected by @lock */
> bool composer_enabled;
> struct vkms_crtc_state *composer_state;
>
> spinlock_t composer_lock;
> };
>
> -struct vkms_device;
> -
> +/**
> + * struct vkms_config - General configuration for VKMS driver
> + *
> + * @writeback: If true, a writeback buffer can be attached to the CRTC
> + * @cursor: If true, a cursor plane is created in the VKMS device
> + * @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device
> + * @dev: Used to store the current vkms device. Only set when the device is instancied.
s/vkms/VKMS and s/instancied/instantiated
> + */
> struct vkms_config {
> bool writeback;
> bool cursor;
> bool overlay;
> - /* only set when instantiated */
> struct vkms_device *dev;
> };
>
> +/**
> + * struct vkms_device - Description of a vkms device
s/vkms/VKMS
> + *
> + * @drm - Base device in drm
> + * @platform - Associated platform device
> + * @output - Configuration and sub-components of the vkms device
s/vkms/VKMS
> + * @config: Configuration used in this vkms device
s/vkms/VKMS
> + */
> struct vkms_device {
> struct drm_device drm;
> struct platform_device *platform;
> @@ -206,6 +238,10 @@ struct vkms_device {
> const struct vkms_config *config;
> };
>
> +/*
> + * The following helpers are used to convert a member of a struct into its parent.
> + */
> +
> #define drm_crtc_to_vkms_output(target) \
> container_of(target, struct vkms_output, crtc)
>
> @@ -218,12 +254,33 @@ struct vkms_device {
> #define to_vkms_plane_state(target)\
> container_of(target, struct vkms_plane_state, base.base)
>
> -/* CRTC */
> +/**
> + * vkms_crtc_init() - Initialize a crtc for vkms
s/vkms/VKMS
> + * @dev: drm_device associated with the vkms buffer
s/vkms/VKMS
> + * @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.
s/vkms/VKMS
> + *
> + * @vkmsdev: vkms device to initialize
s/vkms/VKMS
> + * @possible_crtc_index: Crtc which can be attached to the planes. The caller must ensure that
> + * possible_crtc_index is positive and less or equals to 31.
Missing "@". Also, since the second patch of this series won't be applied,
remember to rename the documentation to "@index".
> + */
>
> int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index);
>
> +/**
> + * vkms_plane_init() - Initialize a plane
> + *
> + * @vkmsdev: vkms device containing the plane
s/vkms/VKMS
> + * @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);
>
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index d42ca7d10389..36db2c8923cb 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -21,6 +21,7 @@ static int vkms_conn_get_modes(struct drm_connector *connector)
> {
> int count;
>
> + /* Use the default modes list from drm */
> count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
> drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
>
> @@ -58,8 +59,13 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> int writeback;
> unsigned int n;
>
> + /*
> + * Initialize used plane. One primary plane is required to perform the composition.
> + *
> + * The overlay and cursor planes are not mandatory, but can be used to perform complex
> + * composition.
> + */
> primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index);
> -
> if (IS_ERR(primary))
> return PTR_ERR(primary);
>
> @@ -96,6 +102,10 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> DRM_ERROR("Failed to init encoder\n");
> goto err_encoder;
> }
> + /*
> + * This is an hardcoded value to select crtc for the encoder.
s/an/a
> + * 1 here designate the first registered CRTC, the one allocated in [1]
> + */
I think that replacing "= 1;" with "= BIT(0);" might help to understand
that possible_crtcs is a bitmask and also that CRTC 0 is used by default.
We might even be able to drop the comment... Even though this will change
with our configfs changes quite a lot.
> encoder->possible_crtcs = 1;
>
> ret = drm_connector_attach_encoder(connector, encoder);
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 3/3] drm/vkms: Add documentation
2024-08-19 15:07 ` José Expósito
@ 2024-08-29 13:36 ` Louis Chauvet
0 siblings, 0 replies; 11+ messages in thread
From: Louis Chauvet @ 2024-08-29 13:36 UTC (permalink / raw)
To: José Expósito
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
Le 19/08/24 - 17:07, José Expósito a écrit :
> Hi Louis,
>
> Thanks for this patch, adding some minor review comments:
>
> > Add documentation around vkms_output and its initialization.
> >
> > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> > ---
> > drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------
> > drivers/gpu/drm/vkms/vkms_output.c | 12 +++++-
> > 2 files changed, 80 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> > index 3028678e4f9b..8f6c9e67e671 100644
> > --- a/drivers/gpu/drm/vkms/vkms_drv.h
> > +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> > @@ -147,29 +147,51 @@ struct vkms_color_lut {
> > };
> >
> > /**
> > - * vkms_crtc_state - Driver specific CRTC state
> > + * struct vkms_crtc_state - Driver specific CRTC state
>
> Not in this line, but around line 55, the documentation for vkms_plane_state
> is missing the "struct" keyword:
This is fixed by [1], but I can move this patch here.
[1]: https://lore.kernel.org/all/20240802-yuv-v9-3-08a706669e16@bootlin.com/
> - * vkms_plane_state - Driver specific plane state
> + * struct vkms_plane_state - Driver specific plane state
>
> I'd be nice to add it since we are improving the documentation.
>
> > + *
> > * @base: base CRTC state
> > * @composer_work: work struct to compose and add CRC entries
> > - * @n_frame_start: start frame number for computed CRC
> > - * @n_frame_end: end frame number for computed CRC
> > + *
> > + * @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;
> > - /* stack of active planes for crc computation, should be in z order */
> > struct vkms_plane_state **active_planes;
> > struct vkms_writeback_job *active_writeback;
> > struct vkms_color_lut gamma_lut;
> >
> > - /* below four are protected by vkms_output.composer_lock */
> > bool crc_pending;
> > bool wb_pending;
> > u64 frame_start;
> > u64 frame_end;
> > };
> >
> > +/**
> > + * struct vkms_output - Internal representation of all output components in vkms
>
> I think that VKMS is usually spelled in capital letters in other places.
>
> > + *
> > + * @crtc: Base crtc in drm
> > + * @encoder: DRM encoder used for this output
> > + * @connector: DRM connector used for this output
> > + * @wb_connecter: DRM writeback connector used for this output
> > + * @vblank_hrtimer:
> > + * @period_ns:
>
> My suggestion when reviewing a previous version of this patch in your
> GitHub fork was:
>
> @vblank_hrtimer: Timer used to simulate vblank events
> @period_ns: vblank period, in nanoseconds
>
> > + * @composer_workq: Ordered workqueue for composer_work
> > + * @lock: Lock used to project concurrent acces to the composer
> > + * @composer_enabled: Protected by @lock.
> > + * @composer_state:
>
> I think that @composer_state is "Protected by @lock" as well.
>
> > + * @composer_lock: Lock used internally to protect @composer_state members
> > + */
> > struct vkms_output {
> > struct drm_crtc crtc;
> > struct drm_encoder encoder;
> > @@ -177,28 +199,38 @@ struct vkms_output {
> > struct drm_writeback_connector wb_connector;
> > struct hrtimer vblank_hrtimer;
> > ktime_t period_ns;
> > - /* ordered wq for composer_work */
> > struct workqueue_struct *composer_workq;
> > - /* protects concurrent access to composer */
> > spinlock_t lock;
> >
> > - /* protected by @lock */
> > bool composer_enabled;
> > struct vkms_crtc_state *composer_state;
> >
> > spinlock_t composer_lock;
> > };
> >
> > -struct vkms_device;
> > -
> > +/**
> > + * struct vkms_config - General configuration for VKMS driver
> > + *
> > + * @writeback: If true, a writeback buffer can be attached to the CRTC
> > + * @cursor: If true, a cursor plane is created in the VKMS device
> > + * @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device
> > + * @dev: Used to store the current vkms device. Only set when the device is instancied.
>
> s/vkms/VKMS and s/instancied/instantiated
>
> > + */
> > struct vkms_config {
> > bool writeback;
> > bool cursor;
> > bool overlay;
> > - /* only set when instantiated */
> > struct vkms_device *dev;
> > };
> >
> > +/**
> > + * struct vkms_device - Description of a vkms device
>
> s/vkms/VKMS
>
> > + *
> > + * @drm - Base device in drm
> > + * @platform - Associated platform device
> > + * @output - Configuration and sub-components of the vkms device
>
> s/vkms/VKMS
>
> > + * @config: Configuration used in this vkms device
>
> s/vkms/VKMS
>
> > + */
> > struct vkms_device {
> > struct drm_device drm;
> > struct platform_device *platform;
> > @@ -206,6 +238,10 @@ struct vkms_device {
> > const struct vkms_config *config;
> > };
> >
> > +/*
> > + * The following helpers are used to convert a member of a struct into its parent.
> > + */
> > +
> > #define drm_crtc_to_vkms_output(target) \
> > container_of(target, struct vkms_output, crtc)
> >
> > @@ -218,12 +254,33 @@ struct vkms_device {
> > #define to_vkms_plane_state(target)\
> > container_of(target, struct vkms_plane_state, base.base)
> >
> > -/* CRTC */
> > +/**
> > + * vkms_crtc_init() - Initialize a crtc for vkms
>
> s/vkms/VKMS
>
> > + * @dev: drm_device associated with the vkms buffer
>
> s/vkms/VKMS
>
> > + * @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.
>
> s/vkms/VKMS
>
> > + *
> > + * @vkmsdev: vkms device to initialize
>
> s/vkms/VKMS
>
> > + * @possible_crtc_index: Crtc which can be attached to the planes. The caller must ensure that
> > + * possible_crtc_index is positive and less or equals to 31.
>
> Missing "@". Also, since the second patch of this series won't be applied,
> remember to rename the documentation to "@index".
> > + */
> >
> > int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index);
> >
> > +/**
> > + * vkms_plane_init() - Initialize a plane
> > + *
> > + * @vkmsdev: vkms device containing the plane
>
> s/vkms/VKMS
>
> > + * @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);
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> > index d42ca7d10389..36db2c8923cb 100644
> > --- a/drivers/gpu/drm/vkms/vkms_output.c
> > +++ b/drivers/gpu/drm/vkms/vkms_output.c
> > @@ -21,6 +21,7 @@ static int vkms_conn_get_modes(struct drm_connector *connector)
> > {
> > int count;
> >
> > + /* Use the default modes list from drm */
> > count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
> > drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
> >
> > @@ -58,8 +59,13 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> > int writeback;
> > unsigned int n;
> >
> > + /*
> > + * Initialize used plane. One primary plane is required to perform the composition.
> > + *
> > + * The overlay and cursor planes are not mandatory, but can be used to perform complex
> > + * composition.
> > + */
> > primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index);
> > -
> > if (IS_ERR(primary))
> > return PTR_ERR(primary);
> >
> > @@ -96,6 +102,10 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index)
> > DRM_ERROR("Failed to init encoder\n");
> > goto err_encoder;
> > }
> > + /*
> > + * This is an hardcoded value to select crtc for the encoder.
>
> s/an/a
>
> > + * 1 here designate the first registered CRTC, the one allocated in [1]
> > + */
>
> I think that replacing "= 1;" with "= BIT(0);" might help to understand
> that possible_crtcs is a bitmask and also that CRTC 0 is used by default.
> We might even be able to drop the comment... Even though this will change
> with our configfs changes quite a lot.
This comment was mainly for me to understand why there is this =1.
I will change it to =BIT(0) for clarity, but keep the comment as it is not
obvious why this value is hardcoded.
> > encoder->possible_crtcs = 1;
> >
> > ret = drm_connector_attach_encoder(connector, encoder);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] drm/vkms: Miscelanious clarifications
2024-08-14 8:46 [PATCH 0/3] drm/vkms: Miscelanious clarifications Louis Chauvet
` (2 preceding siblings ...)
2024-08-14 8:47 ` [PATCH 3/3] drm/vkms: Add documentation Louis Chauvet
@ 2024-08-15 14:02 ` Maíra Canal
3 siblings, 0 replies; 11+ messages in thread
From: Maíra Canal @ 2024-08-15 14:02 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,
On 8/14/24 05:46, Louis Chauvet wrote:
> This series does not introduce functionnal changes, only some
> documentation and renaming to clarify the code.
>
> This series is based on [1].
>
> [1]: https://lore.kernel.org/all/20240814-writeback_line_by_line-v2-0-36541c717569@bootlin.com/
There is no need to base this series on four other series, as these
three patches are completely independent.
Best Regards,
- Maíra
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> Louis Chauvet (3):
> drm/vkms: Formatting and typo fix
> drm/vkms: Rename index to possible_crtc
> drm/vkms: Add documentation
>
> drivers/gpu/drm/vkms/vkms_drv.c | 6 ++-
> drivers/gpu/drm/vkms/vkms_drv.h | 85 +++++++++++++++++++++++++++++++-------
> drivers/gpu/drm/vkms/vkms_output.c | 23 ++++++++---
> drivers/gpu/drm/vkms/vkms_plane.c | 4 +-
> 4 files changed, 94 insertions(+), 24 deletions(-)
> ---
> base-commit: 219b45d023ed0902b05c5902a4f31c2c38bcf68c
> change-id: 20240520-google-clarifications-dede8dcbe38a
> prerequisite-message-id: <20240809-yuv-v10-0-1a7c764166f7@bootlin.com>
> 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: <20240814-b4-new-color-formats-v2-0-8b3499cfe90e@bootlin.com>
> 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: <20240814-writeback_line_by_line-v2-0-36541c717569@bootlin.com>
> prerequisite-patch-id: df699289213021fa202fcdf1b4bdff513d09caa2
> prerequisite-patch-id: 59d021ccb166fbe2962de9cda72aceb3caa9cabe
> prerequisite-patch-id: 895ace6d58b3776798791705b7b05e26b8d37c7b
>
> Best regards,
^ permalink raw reply [flat|nested] 11+ messages in thread