intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Mahesh Kumar <mahesh1.kumar@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: daniel.vetter@intel.com, dri-devel@lists.freedesktop.org
Subject: [PATCH V2 4/4] drm/crc: add pre_crc_read function
Date: Tue, 21 Aug 2018 14:08:58 +0530	[thread overview]
Message-ID: <20180821083858.26275-5-mahesh1.kumar@intel.com> (raw)
In-Reply-To: <20180821083858.26275-1-mahesh1.kumar@intel.com>

This patch implements a callback function which will be called before
crc read. In this function driver can implement any preparation work
required for successfully reading CRC data.

Changes Since V1:
 - rebase

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
---
 drivers/gpu/drm/drm_debugfs_crc.c |  8 ++++++++
 include/drm/drm_crtc.h            | 14 ++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index 00e743153e94..e303c194c080 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -274,6 +274,14 @@ static ssize_t crtc_crc_read(struct file *filep, char __user *user_buf,
 		return 0;
 	}
 
+	if (crtc->funcs->pre_crc_read) {
+		ret = crtc->funcs->pre_crc_read(crtc);
+		if (ret) {
+			spin_unlock_irq(&crc->lock);
+			return ret;
+		}
+	}
+
 	/* Nothing to read? */
 	while (crtc_crc_data_count(crc) == 0) {
 		if (filep->f_flags & O_NONBLOCK) {
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index b21437bc95bf..19c2bf63935e 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -761,6 +761,20 @@ struct drm_crtc_funcs {
 	 */
 	int (*verify_crc_source)(struct drm_crtc *crtc, const char *source,
 				 size_t *values_cnt);
+	/**
+	 * @pre_crc_read:
+	 *
+	 * Driver callback for performing any preparation work required by
+	 * driver before reading CRC
+	 *
+	 * This callback is optional if the driver does not support CRC
+	 * generation or no prework is required before reading the crc
+	 *
+	 * RETURNS:
+	 *
+	 * 0 on success or a negative error code on failure.
+	 */
+	int (*pre_crc_read)(struct drm_crtc *crtc);
 	/**
 	 * @get_crc_sources:
 	 *
-- 
2.16.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-08-21  8:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21  8:38 [PATCH 0/4] Improve crc-core driver interface Mahesh Kumar
2018-08-21  8:38 ` [PATCH V3 1/4] drm/vkms/crc: Implement verify_crc_source callback Mahesh Kumar
2018-08-21  8:38 ` [PATCH V5 2/4] drm/crc: Cleanup crtc_crc_open function Mahesh Kumar
2018-08-21  8:38 ` [PATCH V4 3/4] Revert "drm: crc: Wait for a frame before returning from open()" Mahesh Kumar
2018-08-21  8:38 ` Mahesh Kumar [this message]
2018-08-21 15:56   ` [PATCH V2 4/4] drm/crc: add pre_crc_read function Rodrigo Vivi
2018-08-22 10:37   ` Maarten Lankhorst
2018-08-22 16:54     ` Rodrigo Vivi
2018-08-21  9:01 ` ✓ Fi.CI.BAT: success for Improve crc-core driver interface (rev14) Patchwork
2018-08-21  9:51 ` ✓ Fi.CI.IGT: " Patchwork

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=20180821083858.26275-5-mahesh1.kumar@intel.com \
    --to=mahesh1.kumar@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).