[PATCH RFC 2/6] drm/vkms: Extract vkms_writeback header

José Expósito jose.exposito89 at gmail.com
Tue Aug 20 15:28:28 UTC 2024


> The vkms writeback functions are defined in a different .c, so
> make the same thing for the function declaration in the headers and create
> vkms_writeback.h.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>

Reviewed-by: José Expósito <jose.exposito89 at gmail.com>

> ---
>  drivers/gpu/drm/vkms/vkms_composer.c  |  1 +
>  drivers/gpu/drm/vkms/vkms_drv.h       | 10 ----------
>  drivers/gpu/drm/vkms/vkms_formats.c   |  2 +-
>  drivers/gpu/drm/vkms/vkms_output.c    |  2 ++
>  drivers/gpu/drm/vkms/vkms_writeback.c |  2 ++
>  drivers/gpu/drm/vkms/vkms_writeback.h | 20 ++++++++++++++++++++
>  6 files changed, 26 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index f0cae142ac22..825011f696ee 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -12,6 +12,7 @@
>  #include <linux/minmax.h>
>  
>  #include "vkms_drv.h"
> +#include "vkms_writeback.h"
>  
>  static u16 pre_mul_blend_channel(u16 src, u16 dst, u16 alpha)
>  {
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 0db443924a15..46daa2fab6e8 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -46,13 +46,6 @@ struct vkms_frame_info {
>  };
>  
>  
> -struct vkms_writeback_job {
> -	struct iosys_map data[DRM_FORMAT_MAX_PLANES];
> -	struct vkms_frame_info wb_frame_info;
> -	pixel_write_line_t pixel_write;
> -};
> -
> -
>  struct vkms_plane_state;
>  
>  
> @@ -225,7 +218,4 @@ int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
>  void vkms_composer_worker(struct work_struct *work);
>  void vkms_set_composer(struct vkms_output *out, bool enabled);
>  
> -/* Writeback */
> -int vkms_enable_writeback_connector(struct vkms_device *vkmsdev);
> -
>  #endif /* _VKMS_DRV_H_ */
> diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
> index 5ab84801d8da..cbfa7943e948 100644
> --- a/drivers/gpu/drm/vkms/vkms_formats.c
> +++ b/drivers/gpu/drm/vkms/vkms_formats.c
> @@ -11,7 +11,7 @@
>  
>  #include <kunit/visibility.h>
>  
> -#include "vkms_drv.h"
> +#include "vkms_writeback.h"
>  #include "vkms_formats.h"

Nit: Keep sorted alphabetically

>  /**
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 36db2c8923cb..0c55682337a4 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -5,6 +5,8 @@
>  #include <drm/drm_edid.h>
>  #include <drm/drm_probe_helper.h>
>  
> +#include "vkms_writeback.h"
> +
>  static const struct drm_connector_funcs vkms_connector_funcs = {
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  	.destroy = drm_connector_cleanup,
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index 7e0302c0830c..4a830a4c4d64 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -10,8 +10,10 @@
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_gem_shmem_helper.h>
> +#include <drm/drm_framebuffer.h>
>  
>  #include "vkms_drv.h"
> +#include "vkms_writeback.h"
>  #include "vkms_formats.h"

The same here

>  static const u32 vkms_wb_formats[] = {
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.h b/drivers/gpu/drm/vkms/vkms_writeback.h
> new file mode 100644
> index 000000000000..70f0c4c26c23
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +
> +#ifndef _VKMS_WRITEBACK_H
> +#define _VKMS_WRITEBACK_H

The style for guards used in the other files is:

#ifndef _VKMS_WRITEBACK_H_
#define _VKMS_WRITEBACK_H_

> +
> +#include "vkms_drv.h"
> +#include "vkms_formats.h"
> +
> +struct vkms_crtc;
> +
> +struct vkms_writeback_job {
> +	struct iosys_map data[DRM_FORMAT_MAX_PLANES];
> +	struct vkms_frame_info wb_frame_info;
> +	pixel_write_line_t pixel_write;
> +};
> +
> +/* Writeback */
> +int vkms_enable_writeback_connector(struct vkms_device *vkmsdev);
> +
> +#endif //_VKMS_WRITEBACK_H

And here a /* */ comment is used:

#endif /* _VKMS_WRITEBACK_H_ */

Best wishes,
Jose


More information about the dri-devel mailing list