mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Louis Chauvet <louis.chauvet@bootlin.com>
To: "Rodrigo Siqueira" <rodrigosiqueiramelo@gmail.com>,
	"Melissa Wen" <melissa.srw@gmail.com>,
	"Maíra Canal" <mairacanal@riseup.net>,
	"Haneen Mohammed" <hamohammed.sa@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net,
	 linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com,
	 miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com,
	 seanpaul@google.com, marcheu@google.com,
	nicolejadeyee@google.com,
	 Louis Chauvet <louis.chauvet@bootlin.com>
Subject: [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header
Date: Wed, 14 Aug 2024 11:08:58 +0200	[thread overview]
Message-ID: <20240814-google-split-headers-v1-5-51712f088f5d@bootlin.com> (raw)
In-Reply-To: <20240814-google-split-headers-v1-0-51712f088f5d@bootlin.com>

The vkms crtc functions are defined in a different .c, so make the same
thing for the function declaration in the headers and create vkms_crtc.h.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
 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
+
+#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
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"
 
 #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[] = {

-- 
2.44.2


  parent reply	other threads:[~2024-08-14  9:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14  9:08 [PATCH RFC 0/6] drm/vkms: Completly split headers Louis Chauvet
2024-08-14  9:08 ` [PATCH RFC 1/6] drm/vkms: Properly extract vkms_formats header Louis Chauvet
2024-08-15 14:36   ` Maíra Canal
2024-08-20 15:28   ` José Expósito
2024-08-14  9:08 ` [PATCH RFC 2/6] drm/vkms: Extract vkms_writeback header Louis Chauvet
2024-08-20 15:28   ` José Expósito
2024-08-14  9:08 ` [PATCH RFC 3/6] drm/vkms: Extract vkms_plane header Louis Chauvet
2024-08-20 15:28   ` José Expósito
2024-08-14  9:08 ` [PATCH RFC 4/6] drm/vkms: Rename to_vkms_plane_state to avoid confusion Louis Chauvet
2024-08-20 15:29   ` José Expósito
2024-08-14  9:08 ` Louis Chauvet [this message]
2024-08-20 15:29   ` [PATCH RFC 5/6] drm/vkms: Extract vkms_crtc header José Expósito
2024-08-14  9:08 ` [PATCH RFC 6/6] drm/vkms: Extract vkms_composer header Louis Chauvet
2024-08-20 15:30   ` José Expósito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240814-google-split-headers-v1-5-51712f088f5d@bootlin.com \
    --to=louis.chauvet@bootlin.com \
    --cc=airlied@gmail.com \
    --cc=arthurgrillo@riseup.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=jeremie.dautheribes@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mairacanal@riseup.net \
    --cc=marcheu@google.com \
    --cc=melissa.srw@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mripard@kernel.org \
    --cc=nicolejadeyee@google.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=seanpaul@google.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®