Skip to contentSkip to conversation

drm: crc: Call wake_up_interruptible() each time there is a new CRC entry

PATCH In review Benjamin Gaignard 2 participants 3 messages Jan 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 drm: crc: Call wake_up_interruptible() each time there is a new CRC entry

Each time new data has being added in CRC list inform reader by calling wake_up_interruptible().
This should avoid to do it in all drivers.

Cc Tomeu Vizoso <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs_crc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_debugfs_crc.c +2 -0
index 8b0eeee..96891c4 100644
@@ -363,6 +363,8 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
 
 	spin_unlock(&crc->lock);
 
+	wake_up_interruptible(&crc->wq);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(drm_crtc_add_crc_entry);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH v2 2/2 drm: sti: implement CRC capture API

Use CRC API to retrieve the 3 crc values from hardware.

---
This patch should be applied on top of drm-misc branch where Tomeu has change crc.lock.

Cc Tomeu Vizoso <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/sti/sti_crtc.c  | 23 ++++++++++++++++++
 drivers/gpu/drm/sti/sti_mixer.c | 52 +++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_mixer.h |  4 ++++
 3 files changed, 79 insertions(+)
drivers/gpu/drm/sti/sti_crtc.c +23 -0
index e992bed..caf5d61 100644
@@ -20,6 +20,8 @@
 #include "sti_vid.h"
 #include "sti_vtg.h"
 
+#define CRC_SAMPLES 3
+
 static void sti_crtc_enable(struct drm_crtc *crtc)
 {
 	struct sti_mixer *mixer = to_sti_mixer(crtc);
@@ -253,6 +255,7 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 	unsigned long flags;
 	struct sti_private *priv;
 	unsigned int pipe;
+	u32 crcs[CRC_SAMPLES];
 
 	priv = crtc->dev->dev_private;
 	pipe = drm_crtc_index(crtc);
@@ -275,6 +278,9 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 	}
 	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
+	if (!sti_mixer_read_crcs(mixer, &crcs[0], &crcs[1], &crcs[2]))
+		drm_crtc_add_crc_entry(crtc, false, 0, crcs);
+
 	if (mixer->status == STI_MIXER_DISABLING) {
 		struct drm_plane *p;
 
@@ -343,6 +349,22 @@ static int sti_crtc_late_register(struct drm_crtc *crtc)
 	return 0;
 }
 
+int sti_set_crc_source(struct drm_crtc *crtc, const char *source,
+		       size_t *values_cnt)
+{
+	struct sti_mixer *mixer = to_sti_mixer(crtc);
+
+	*values_cnt = CRC_SAMPLES;
+
+	if (!source)
+		return sti_mixer_set_crc_status(mixer, false);
+
+	if (source && strcmp(source, "auto") == 0)
+		return sti_mixer_set_crc_status(mixer, true);
+
+	return -EINVAL;
+}
+
 static const struct drm_crtc_funcs sti_crtc_funcs = {
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
@@ -352,6 +374,7 @@ static int sti_crtc_late_register(struct drm_crtc *crtc)
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.late_register = sti_crtc_late_register,
+	.set_crc_source = sti_set_crc_source,
 };
 
 bool sti_crtc_is_main(struct drm_crtc *crtc)
drivers/gpu/drm/sti/sti_mixer.c +52 -0

82 lines not on this page · raw message

drivers/gpu/drm/sti/sti_mixer.h +4 -0
index 830a3c4..b16feb1 100644
@@ -55,6 +55,10 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,
 
 void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
 
+int sti_mixer_set_crc_status(struct sti_mixer *mixer, bool enable);
+int sti_mixer_read_crcs(struct sti_mixer *mixer,
+			u32 *sign1, u32 *sign2, u32 *sign3);
+
 int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);
 
 /* depth in Cross-bar control = z order */
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Benjamin Gaignard
Quoted 7 lines · Benjamin Gaignard

Each time new data has being added in CRC list inform reader by calling wake_up_interruptible().
This should avoid to do it in all drivers.

Cc Tomeu Vizoso <[email protected]>
Cc Daniel Vetter <[email protected]>

Applied with Tomeu's irc r-b.

Thanks, Daniel

Quoted 20 lines
---
 drivers/gpu/drm/drm_debugfs_crc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_debugfs_crc.c +2 -0
index 8b0eeee..96891c4 100644
@@ -363,6 +363,8 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
 
 	spin_unlock(&crc->lock);
 
+	wake_up_interruptible(&crc->wq);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(drm_crtc_add_crc_entry);
Signature · 1 line
1.9.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel