lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240820152940.2881-1-jose.exposito89@gmail.com>
Date: Tue, 20 Aug 2024 17:29:39 +0200
From: José Expósito <jose.exposito89@...il.com>
To: louis.chauvet@...tlin.com
Cc: airlied@...il.com,
	arthurgrillo@...eup.net,
	daniel@...ll.ch,
	dri-devel@...ts.freedesktop.org,
	hamohammed.sa@...il.com,
	jeremie.dautheribes@...tlin.com,
	linux-kernel@...r.kernel.org,
	maarten.lankhorst@...ux.intel.com,
	mairacanal@...eup.net,
	marcheu@...gle.com,
	melissa.srw@...il.com,
	miquel.raynal@...tlin.com,
	mripard@...nel.org,
	nicolejadeyee@...gle.com,
	rodrigosiqueiramelo@...il.com,
	seanpaul@...gle.com,
	thomas.petazzoni@...tlin.com,
	tzimmermann@...e.de,
	José Expósito <jose.exposito89@...il.com>
Subject: [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header

> The vkms crtc functions are defined in a different .c, so make the same

The VKMS CRTC...

> thing for the function declaration in the headers and create vkms_crtc.h.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>

Reviewed-by: José Expósito <jose.exposito89@...il.com>

> ---
>  drivers/gpu/drm/vkms/vkms_composer.c  |  2 +-
>  drivers/gpu/drm/vkms/vkms_crtc.c      |  2 +-
>  drivers/gpu/drm/vkms/vkms_crtc.h      | 87 +++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/vkms/vkms_drv.c       |  1 +
>  drivers/gpu/drm/vkms/vkms_drv.h       | 45 ------------------
>  drivers/gpu/drm/vkms/vkms_output.c    |  1 +
>  drivers/gpu/drm/vkms/vkms_plane.h     |  1 -
>  drivers/gpu/drm/vkms/vkms_writeback.c |  1 +
>  8 files changed, 92 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index 825011f696ee..139d249454c4 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -11,7 +11,7 @@
>  #include <drm/drm_vblank.h>
>  #include <linux/minmax.h>
>  
> -#include "vkms_drv.h"
> +#include "vkms_crtc.h"
>  #include "vkms_writeback.h"
>  
>  static u16 pre_mul_blend_channel(u16 src, u16 dst, u16 alpha)
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 08e5db07aca6..cb6e49a86745 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -8,7 +8,7 @@
>  #include <drm/drm_vblank.h>
>  #include <drm/drm_print.h>
>  
> -#include "vkms_drv.h"
> +#include "vkms_crtc.h"
>  #include "vkms_plane.h"
>  
>  static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.h b/drivers/gpu/drm/vkms/vkms_crtc.h
> new file mode 100644
> index 000000000000..9f5ce21f3425
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.h
> @@ -0,0 +1,87 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +
> +#ifndef _VKMS_CRTC_H
> +#define _VKMS_CRTC_H

#ifndef _VKMS_CRTC_H_
#define _VKMS_CRTC_H_

> +#include <drm/drm_writeback.h>
> +#include <drm/drm_crtc.h>
> +#include <linux/workqueue_types.h>
> +
> +#include "vkms_writeback.h"
> +#include "vkms_plane.h"
> +
> +/**
> + * struct vkms_crtc_state - Driver specific CRTC state
> + *
> + * @base: base CRTC state
> + * @composer_work: work struct to compose and add CRC entries
> + *
> + * @num_active_planes: Number of active planes
> + * @active_planes: List containing all the active planes (counted by
> + *  @num_active_planes). They should be stored in z-order.
> + * @active_writeback: Current active writeback job
> + * @gamma_lut: Look up table for gamma used in this CRTC
> + * @crc_pending: Protected by @vkms_output.composer_lock.
> + * @wb_pending: Protected by @vkms_output.composer_lock.
> + * @frame_start: Protected by @vkms_output.composer_lock.
> + * @frame_end: Protected by @vkms_output.composer_lock.
> + */
> +struct vkms_crtc_state {
> +	struct drm_crtc_state base;
> +	struct work_struct composer_work;
> +
> +	int num_active_planes;
> +	struct vkms_plane_state **active_planes;
> +	struct vkms_writeback_job *active_writeback;
> +	struct vkms_color_lut gamma_lut;
> +
> +	bool crc_pending;
> +	bool wb_pending;
> +	u64 frame_start;
> +	u64 frame_end;
> +};
> +
> +/**
> + * struct vkms_crtc - crtc internal representation
> + *
> + * @crtc: Base crtc in drm
> + * @wb_connecter: DRM writeback connector used for this output
> + * @vblank_hrtimer:
> + * @period_ns:
> + * @event:
> + * @composer_workq: Ordered workqueue for composer_work
> + * @lock: Lock used to project concurrent acces to the composer
> + * @composer_enabled: Protected by @lock.
> + * @composer_lock: Lock used internally to protect @composer_state members
> + * @composer_state: Protected by @lock.
> + */
> +struct vkms_crtc {
> +	struct drm_crtc base;
> +
> +	struct drm_writeback_connector wb_connector;
> +	struct hrtimer vblank_hrtimer;
> +	ktime_t period_ns;
> +	struct drm_pending_vblank_event *event;
> +	struct workqueue_struct *composer_workq;
> +	spinlock_t lock;
> +
> +	bool composer_enabled;
> +	struct vkms_crtc_state *composer_state;
> +
> +	spinlock_t composer_lock;
> +};
> +
> +#define to_vkms_crtc_state(target)\
> +	container_of(target, struct vkms_crtc_state, base)
> +
> +/**
> + * vkms_crtc_init() - Initialize a crtc for vkms
> + * @dev: drm_device associated with the vkms buffer
> + * @crtc: uninitialized crtc device
> + * @primary: primary plane to attach to the crtc
> + * @cursor plane to attach to the crtc
> + */
> +int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> +		   struct drm_plane *primary, struct drm_plane *cursor);
> +
> +#endif //_VKMS_CRTC_H

#endif /* _VKMS_CRTC_H_ */

> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 5aeb43592960..5907877bdfa0 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -27,6 +27,7 @@
>  #include <drm/drm_vblank.h>
>  
>  #include "vkms_drv.h"
> +#include "vkms_crtc.h"

It might make sense to leave drv.h on top as it is the main file, but if you
are going to stick to alphabetical order:

+#include "vkms_crtc.h"
 #include "vkms_drv.h"

>  #include <drm/drm_print.h>
>  #include <drm/drm_debugfs.h>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index ea73f01fcc74..943ad55e0172 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -12,8 +12,6 @@
>  #include <drm/drm_encoder.h>
>  #include <drm/drm_writeback.h>
>  
> -#include "vkms_formats.h"
> -
>  #define XRES_MIN    10
>  #define YRES_MIN    10
>  
> @@ -27,37 +25,6 @@
>  
>  #define VKMS_LUT_SIZE 256
>  
> -/**
> - * struct vkms_crtc_state - Driver specific CRTC state
> - *
> - * @base: base CRTC state
> - * @composer_work: work struct to compose and add CRC entries
> - *
> - * @num_active_planes: Number of active planes
> - * @active_planes: List containing all the active planes (counted by
> - *  @num_active_planes). They should be stored in z-order.
> - * @active_writeback: Current active writeback job
> - * @gamma_lut: Look up table for gamma used in this CRTC
> - * @crc_pending: Protected by @vkms_output.composer_lock.
> - * @wb_pending: Protected by @vkms_output.composer_lock.
> - * @frame_start: Protected by @vkms_output.composer_lock.
> - * @frame_end: Protected by @vkms_output.composer_lock.
> - */
> -struct vkms_crtc_state {
> -	struct drm_crtc_state base;
> -	struct work_struct composer_work;
> -
> -	int num_active_planes;
> -	struct vkms_plane_state **active_planes;
> -	struct vkms_writeback_job *active_writeback;
> -	struct vkms_color_lut gamma_lut;
> -
> -	bool crc_pending;
> -	bool wb_pending;
> -	u64 frame_start;
> -	u64 frame_end;
> -};
> -
>  /**
>   * struct vkms_output - Internal representation of all output components in vkms
>   *
> @@ -129,18 +96,6 @@ struct vkms_device {
>  #define drm_device_to_vkms_device(target) \
>  	container_of(target, struct vkms_device, drm)
>  
> -#define to_vkms_crtc_state(target)\
> -	container_of(target, struct vkms_crtc_state, base)
> -
> -/**
> - * vkms_crtc_init() - Initialize a crtc for vkms
> - * @dev: drm_device associated with the vkms buffer
> - * @crtc: uninitialized crtc device
> - * @primary: primary plane to attach to the crtc
> - * @cursor plane to attach to the crtc
> - */
> -int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> -		   struct drm_plane *primary, struct drm_plane *cursor);
>  /**
>   * vkms_output_init() - Initialize all sub-components needed for a vkms device.
>   *
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 09fcf242ecf7..20073a00b200 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -6,6 +6,7 @@
>  
>  #include "vkms_writeback.h"
>  #include "vkms_plane.h"
> +#include "vkms_crtc.h"
>  
>  static const struct drm_connector_funcs vkms_connector_funcs = {
>  	.fill_modes = drm_helper_probe_single_connector_modes,
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.h b/drivers/gpu/drm/vkms/vkms_plane.h
> index 68170a75e9c9..90554c9fe250 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.h
> +++ b/drivers/gpu/drm/vkms/vkms_plane.h
> @@ -8,7 +8,6 @@
>  #include <drm/drm_gem_atomic_helper.h>
>  #include <linux/iosys-map.h>
>  
> -#include "vkms_drv.h"
>  #include "vkms_formats.h"
>  
>  struct vkms_plane {
> diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> index 740d9e2f3d71..48f3f7f2e2a4 100644
> --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> @@ -13,6 +13,7 @@
>  #include <drm/drm_framebuffer.h>
>  
>  #include "vkms_writeback.h"
> +#include "vkms_crtc.h"
>  #include "vkms_formats.h"
>  
>  static const u32 vkms_wb_formats[] = {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ