drm/vkms: Miscelanious clarifications
Louis Chauvet
maintainercover drm/vkms: Miscelanious clarifications
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/[email protected]/
---
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: <[email protected]>
prerequisite-patch-id: ae2d8b2efbbaa9decce56632c498c87e708288b3
prerequisite-patch-id: c26b6d4867eaf6566195aa0002765357d4f69f8c
prerequisite-patch-id: 8791d34a6f3148dc518da5249453067e40d346e3
prerequisite-patch-id: 26ec7cd5a449004bcfd6ce483671f87655f8635c
prerequisite-patch-id: 2e855ba871f2e99d4b6b7d85da2ddac6bb32262e
prerequisite-patch-id: 82523a917646793deeec7cdcc7ff286bd924fd21
prerequisite-patch-id: 0e355e5316281f53ab5e97ab6e63b0a682f3eb9e
prerequisite-patch-id: 7a63d245a377d5f5283f48e8f52421b912811752
prerequisite-patch-id: dda6bf4692cd1795c489ff58e72c0841ea8ffbc4
prerequisite-patch-id: f70e535b6086cc587975fbfa75741f485f679a32
prerequisite-patch-id: 6c2aa2645c7d854951608aa4d15a02e076abe1fe
prerequisite-patch-id: dc61c6d3db73053fc36e115af561e0c42b467de2
prerequisite-patch-id: deda292af6d8bbf6762b0bf4d351ffd2225995d8
prerequisite-patch-id: 18554f49b53cbcfd4a8ca50dc83b17dd3cf96474
prerequisite-patch-id: 5633292e10132d29be2467812e6e2e824cfedb67
prerequisite-patch-id: 43f37e9c1bc041d491e41dfb59548ed258a1e071
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: d10db4cb12a88de2e5f6440e9fcf5ddda191e3cd
prerequisite-patch-id: 16bac0ef1f1dc010a72ce2faae66631797d23d3f
prerequisite-patch-id: 8e0e5cc0727e8fd2d14ebafc5538fd987c2dd38e
prerequisite-patch-id: 32bad3bf3df46d042e9edd4c1259c2e2a3fb8975
prerequisite-patch-id: 4bd9e4cef308abd17b7b274a5575a3de73a1503b
prerequisite-patch-id: a98fac5a2c60fe23fbc6a455e9a4ab8b0f187ee8
prerequisite-patch-id: 62c8d109a22b9978f755255b67f13fe74fb7008d
prerequisite-patch-id: baa8da4871dd90b03a07c6d9ddb45e10929ee70a
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: df699289213021fa202fcdf1b4bdff513d09caa2
prerequisite-patch-id: 59d021ccb166fbe2962de9cda72aceb3caa9cabe
prerequisite-patch-id: 895ace6d58b3776798791705b7b05e26b8d37c7b
Best regards,
Signature · 1 line
Louis Chauvet <[email protected]>
Louis Chauvet
maintainerPATCH 1/3 drm/vkms: Formatting and typo fix
Some newlines were missing around comments.
--- drivers/gpu/drm/vkms/vkms_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/vkms_drv.c +4 -2
@@ -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;
Signature · 1 line
2.44.2
Maíra Canal
AppliedRe: [PATCH 1/3] drm/vkms: Formatting and typo fix
Quoted 3 lines · Louis Chauvet
Some newlines were missing around comments.
Signed-off-by Louis Chauvet <[email protected]>
Applied to drm/misc/drm-misc-next!
Best Regards,
- Maíra
Quoted 23 lines
--- drivers/gpu/drm/vkms/vkms_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/vkms/vkms_drv.c +4
-2@@ -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;
Louis Chauvet
maintainerPATCH 2/3 drm/vkms: Rename index to possible_crtc
In reply to Louis ChauvetThe meaning of index was not clear. Replace them with crtc_index to clearly indicate its usage.
--- 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(-)
drivers/gpu/drm/vkms/vkms_drv.h +2 -2
@@ -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,
drivers/gpu/drm/vkms/vkms_output.c +7 -6
@@ -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); }
drivers/gpu/drm/vkms/vkms_plane.c +2 -2
@@ -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 );
Signature · 1 line
2.44.2
Re: [PATCH 2/3] drm/vkms: Rename index to possible_crtc
Quoted 4 lines · Louis Chauvet
The meaning of index was not clear. Replace them with
crtc_indexto clearly indicate its usage.Signed-off-by Louis Chauvet <[email protected]>
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
Quoted 96 lines
--- 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(-)drivers/gpu/drm/vkms/vkms_drv.h +2
-2@@ -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,drivers/gpu/drm/vkms/vkms_output.c +7
-6@@ -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); }drivers/gpu/drm/vkms/vkms_plane.c +2
-2@@ -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
maintainerRe: [PATCH 2/3] drm/vkms: Rename index to possible_crtc
Quoted 10 lines · Maíra Canal
Quoted 4 lines · Louis Chauvet
The meaning of index was not clear. Replace them with
crtc_indexto clearly indicate its usage.Signed-off-by Louis Chauvet <[email protected]>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
Quoted 99 lines
Best Regards,
- MaíraQuoted 96 lines
--- 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(-)drivers/gpu/drm/vkms/vkms_drv.h +2
-2@@ -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,drivers/gpu/drm/vkms/vkms_output.c +7
-6@@ -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); }drivers/gpu/drm/vkms/vkms_plane.c +2
-2@@ -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 );
Signature · 3 lines
Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Louis Chauvet
maintainerPATCH 3/3 drm/vkms: Add documentation
In reply to Louis ChauvetAdd documentation around vkms_output and its initialization.
--- drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------ drivers/gpu/drm/vkms/vkms_output.c | 12 +++++- 2 files changed, 80 insertions(+), 13 deletions(-)
drivers/gpu/drm/vkms/vkms_drv.h +69 -12
@@ -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);
drivers/gpu/drm/vkms/vkms_output.c +11 -1
@@ -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);
Signature · 1 line
2.44.2
Re: [PATCH 3/3] drm/vkms: Add documentation
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.
Quoted 22 lines · Louis Chauvet
Add documentation around
vkms_outputand its initialization.Signed-off-by Louis Chauvet <[email protected]>--- drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------ drivers/gpu/drm/vkms/vkms_output.c | 12 +++++- 2 files changed, 80 insertions(+), 13 deletions(-)drivers/gpu/drm/vkms/vkms_drv.h +2
-2@@ -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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 162
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +9
-1-* @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?
Quoted 12 lines
drivers/gpu/drm/vkms/vkms_drv.h +0
-2*/ 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 */
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 183
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +4
-0bool 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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 188
Quoted 5 lines
drivers/gpu/drm/vkms/vkms_drv.h +5
-0+* @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?
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 189
Quoted 1 line
drivers/gpu/drm/vkms/vkms_drv.h +1
-0+* @composer_workq: Ordered workqueue for composer_work
Add reference to composer_work
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 190
Quoted 1 line
drivers/gpu/drm/vkms/vkms_drv.h +1
-0+* @lock: Lock used to project concurrent acces to the composer
s/acces/access
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 192
Quoted 2 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-0+* @composer_enabled: Protected by @lock. +* @composer_state:
Empty?
Quoted 20 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-3+* @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; };
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 217
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +7
-2-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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 229
Quoted 13 lines
drivers/gpu/drm/vkms/vkms_drv.h +5
-1+*/ 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
Quoted 19 lines
drivers/gpu/drm/vkms/vkms_drv.h +8
-0+* @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)
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 259
Quoted 7 lines
drivers/gpu/drm/vkms/vkms_drv.h +3
-1@@ -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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 262
Quoted 3 lines
drivers/gpu/drm/vkms/vkms_drv.h +3
-0+* @crtc: uninitialized crtc device +* @primary: primary plane to attach to the crtc +* @cursor plane to attach to the crtc
s/crtc/CRTC everywhere
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 263
Quoted 1 line
drivers/gpu/drm/vkms/vkms_drv.h +1
-0+*/
New line
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 273
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +7
-0int 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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 281
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_drv.h +6
-0int 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
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-0+* 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);drivers/gpu/drm/vkms/vkms_output.c +0
-0
drivers/gpu/drm/vkms/vkms_output.c static int vkms_conn_get_modes(struct drm_connector *connector) · line 24
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_output.c +1
-0@@ -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
Quoted 19 lines
drivers/gpu/drm/vkms/vkms_output.c +6
-1count =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);
drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) · line 107
Quoted 6 lines
drivers/gpu/drm/vkms/vkms_output.c +3
-0@@ -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
Quoted 5 lines
drivers/gpu/drm/vkms/vkms_output.c +1
-0+*/ encoder->possible_crtcs =1 ; ret =drm_connector_attach_encoder (connector, encoder);
PATCH 3/3 drm/vkms: Add documentation
In reply to Louis ChauvetHi Louis,
Thanks for this patch, adding some minor review comments:
Quoted 13 lines
Add documentation around
vkms_outputand its initialization.Signed-off-by Louis Chauvet <[email protected]>--- drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------ drivers/gpu/drm/vkms/vkms_output.c | 12 +++++- 2 files changed, 80 insertions(+), 13 deletions(-)drivers/gpu/drm/vkms/vkms_drv.h +0
-0
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 150
Quoted 5 lines
drivers/gpu/drm/vkms/vkms_drv.h +1
-1@@ -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.
Quoted 25 lines
drivers/gpu/drm/vkms/vkms_drv.h +11
-3+* * @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;
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 181
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-1-/* 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.
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 188
Quoted 7 lines
drivers/gpu/drm/vkms/vkms_drv.h +7
-0+* +* @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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 192
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_drv.h +4
-0+* @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.
Quoted 20 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-3+* @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; };
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 217
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +7
-2-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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 227
Quoted 11 lines
drivers/gpu/drm/vkms/vkms_drv.h +3
-1+*/ 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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 231
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_drv.h +4
-0+* +* @drm - Base device in drm +* @platform - Associated platform device +* @output - Configuration and sub-components of the vkms device
s/vkms/VKMS
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 232
Quoted 1 line
drivers/gpu/drm/vkms/vkms_drv.h +1
-0+* @config: Configuration used in this vkms device
s/vkms/VKMS
Quoted 16 lines
drivers/gpu/drm/vkms/vkms_drv.h +5
-0+*/ 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)
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 258
Quoted 6 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-1@@ -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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 259
Quoted 1 line
drivers/gpu/drm/vkms/vkms_drv.h +1
-0+* @dev: drm_device associated with the vkms buffer
s/vkms/VKMS
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 267
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_drv.h +6
-0+* @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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 269
Quoted 2 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-0+* +* @vkmsdev: vkms device to initialize
s/vkms/VKMS
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 271
Quoted 2 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-0+* @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".
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 279
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_drv.h +5
-0+*/ 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
Quoted 35 lines
drivers/gpu/drm/vkms/vkms_drv.h +4
-0+* @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);drivers/gpu/drm/vkms/vkms_output.c +7
-1@@ -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);
drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) · line 106
Quoted 5 lines
drivers/gpu/drm/vkms/vkms_output.c +2
-0@@ -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
drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) · line 108
Quoted 2 lines
drivers/gpu/drm/vkms/vkms_output.c +2
-0+* 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.
Quoted 3 lines
drivers/gpu/drm/vkms/vkms_output.c +0
-0encoder->possible_crtcs =1 ; ret =drm_connector_attach_encoder (connector, encoder);
Louis Chauvet
maintainerRe: [PATCH 3/3] drm/vkms: Add documentation
Quoted 19 lines · José Expósito
Hi Louis,
Thanks for this patch, adding some minor review comments:
Quoted 15 lines
Add documentation around
vkms_outputand its initialization.Signed-off-by Louis Chauvet <[email protected]>--- drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------ drivers/gpu/drm/vkms/vkms_output.c | 12 +++++- 2 files changed, 80 insertions(+), 13 deletions(-)drivers/gpu/drm/vkms/vkms_drv.h +0
-0@@ -147,29 +147,51 @@ struct vkms_color_lut { };
Quoted 6 lines
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 150
Quoted 3 lines
drivers/gpu/drm/vkms/vkms_drv.h +1
-1/** -* 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_stateis missing the "struct" keyword:
This is fixed by [1], but I can move this patch here.
[1]: https://lore.kernel.org/all/[email protected]/
Quoted 226 lines
- *
vkms_plane_state- Driver specific plane state
+ * structvkms_plane_state- Driver specific plane stateI'd be nice to add it since we are improving the documentation.
Quoted 25 lines
drivers/gpu/drm/vkms/vkms_drv.h +11
-3+* * @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;drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 181
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-1-/* 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.
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 188
Quoted 7 lines
drivers/gpu/drm/vkms/vkms_drv.h +7
-0+* +* @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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_color_lut { · line 192
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_drv.h +4
-0+* @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.
Quoted 20 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-3+* @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; };drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 217
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_drv.h +7
-2-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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 227
Quoted 11 lines
drivers/gpu/drm/vkms/vkms_drv.h +3
-1+*/ 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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 231
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_drv.h +4
-0+* +* @drm - Base device in drm +* @platform - Associated platform device +* @output - Configuration and sub-components of the vkms device s/vkms/VKMS
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_output { · line 232
Quoted 1 line
drivers/gpu/drm/vkms/vkms_drv.h +1
-0+* @config: Configuration used in this vkms device s/vkms/VKMS
Quoted 16 lines
drivers/gpu/drm/vkms/vkms_drv.h +5
-0+*/ 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)drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 258
Quoted 6 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-1@@ -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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 259
Quoted 1 line
drivers/gpu/drm/vkms/vkms_drv.h +1
-0+* @dev: drm_device associated with the vkms buffer s/vkms/VKMS
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 267
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_drv.h +6
-0+* @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
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 269
Quoted 2 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-0+* +* @vkmsdev: vkms device to initialize s/vkms/VKMS
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 271
Quoted 2 lines
drivers/gpu/drm/vkms/vkms_drv.h +2
-0+* @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".
drivers/gpu/drm/vkms/vkms_drv.h struct vkms_device { · line 279
Quoted 8 lines
drivers/gpu/drm/vkms/vkms_drv.h +5
-0+*/ 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
Quoted 35 lines
drivers/gpu/drm/vkms/vkms_drv.h +4
-0+* @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);drivers/gpu/drm/vkms/vkms_output.c +7
-1@@ -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);drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) · line 106
Quoted 5 lines
drivers/gpu/drm/vkms/vkms_output.c +2
-0@@ -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
Quoted 7 lines
drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) · line 108
Quoted 2 lines
drivers/gpu/drm/vkms/vkms_output.c +2
-0+* 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_crtcsis 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.
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/vkms/vkms_output.c +0
-0encoder->possible_crtcs =1 ; ret =drm_connector_attach_encoder (connector, encoder);
Hi Louis,
Quoted 6 lines · Louis Chauvet
This series does not introduce functionnal changes, only some documentation and renaming to clarify the code.
This series is based on [1].
There is no need to base this series on four other series, as these three patches are completely independent.
Best Regards,
- Maíra
Quoted 48 lines
Signed-off-by Louis Chauvet <[email protected]>---
Louis Chauvet (3):
drm/vkms: Formatting and typo fix
drm/vkms: Rename index topossible_crtc
drm/vkms: Add documentationdrivers/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: <[email protected]>
prerequisite-patch-id:ae2d8b2efbbaa9decce56632c498c87e708288b3
prerequisite-patch-id:c26b6d4867eaf6566195aa0002765357d4f69f8c
prerequisite-patch-id:8791d34a6f3148dc518da5249453067e40d346e3
prerequisite-patch-id:26ec7cd5a449004bcfd6ce483671f87655f8635c
prerequisite-patch-id:2e855ba871f2e99d4b6b7d85da2ddac6bb32262e
prerequisite-patch-id:82523a917646793deeec7cdcc7ff286bd924fd21
prerequisite-patch-id:0e355e5316281f53ab5e97ab6e63b0a682f3eb9e
prerequisite-patch-id:7a63d245a377d5f5283f48e8f52421b912811752
prerequisite-patch-id:dda6bf4692cd1795c489ff58e72c0841ea8ffbc4
prerequisite-patch-id:f70e535b6086cc587975fbfa75741f485f679a32
prerequisite-patch-id:6c2aa2645c7d854951608aa4d15a02e076abe1fe
prerequisite-patch-id:dc61c6d3db73053fc36e115af561e0c42b467de2
prerequisite-patch-id:deda292af6d8bbf6762b0bf4d351ffd2225995d8
prerequisite-patch-id:18554f49b53cbcfd4a8ca50dc83b17dd3cf96474
prerequisite-patch-id:5633292e10132d29be2467812e6e2e824cfedb67
prerequisite-patch-id:43f37e9c1bc041d491e41dfb59548ed258a1e071
prerequisite-message-id: <[email protected]>
prerequisite-patch-id:d10db4cb12a88de2e5f6440e9fcf5ddda191e3cd
prerequisite-patch-id:16bac0ef1f1dc010a72ce2faae66631797d23d3f
prerequisite-patch-id:8e0e5cc0727e8fd2d14ebafc5538fd987c2dd38e
prerequisite-patch-id:32bad3bf3df46d042e9edd4c1259c2e2a3fb8975
prerequisite-patch-id:4bd9e4cef308abd17b7b274a5575a3de73a1503b
prerequisite-patch-id:a98fac5a2c60fe23fbc6a455e9a4ab8b0f187ee8
prerequisite-patch-id:62c8d109a22b9978f755255b67f13fe74fb7008d
prerequisite-patch-id:baa8da4871dd90b03a07c6d9ddb45e10929ee70a
prerequisite-message-id: <[email protected]>
prerequisite-patch-id:df699289213021fa202fcdf1b4bdff513d09caa2
prerequisite-patch-id:59d021ccb166fbe2962de9cda72aceb3caa9cabe
prerequisite-patch-id:895ace6d58b3776798791705b7b05e26b8d37c7bBest regards,