diff mbox

[2/2] drm/i915/drrs: debugfs for notifying the fb status change

Message ID 1427132684-27946-3-git-send-email-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ramalingam C March 23, 2015, 5:44 p.m. UTC
Debugfs entry called i915_drrs_fb_status is created to provide
the fb status change notifications.

This will call the drrs_invalidate and drrs_flush funcs, based on
debugfs write instead of front buffer tracking.

DO NOT MERGE: This change is to test the DRRS with IGT, independent of
front buffer tracking. This change will be dropped as soon as front
buffer tracker fully functional.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c |   61 +++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

Comments

Shuang He March 25, 2015, 1:24 a.m. UTC | #1
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6032
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  275/275              275/275
ILK                                  303/303              303/303
SNB                 -1              304/304              303/304
IVB                                  339/339              339/339
BYT                                  287/287              287/287
HSW                                  361/361              361/361
BDW                                  310/310              310/310
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*SNB  igt@pm_rpm@fences      PASS(2)      DMESG_WARN(1)PASS(1)
Note: You need to pay more attention to line start with '*'
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 007c7d7..0ce4d94 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -51,6 +51,11 @@  static const char *yesno(int v)
 	return v ? "yes" : "no";
 }
 
+struct __attribute__((packed, aligned(16))) fb_status {
+	bool rendered;
+	unsigned fb_bits;
+};
+
 /* As the drm_debugfs_init() routines are called before dev->dev_private is
  * allocated we need to hook into the minor for release. */
 static int
@@ -3866,6 +3871,61 @@  static const struct file_operations i915_display_crc_ctl_fops = {
 	.write = display_crc_ctl_write
 };
 
+static int drrs_fb_status_show(struct seq_file *m, void *data)
+{
+	seq_puts(m, "\n");
+	return 0;
+}
+
+static int drrs_fb_status_open(struct inode *inode, struct file *file)
+{
+	struct drm_device *dev = inode->i_private;
+
+	return single_open(file, drrs_fb_status_show, dev);
+}
+
+static ssize_t drrs_fb_status_write(struct file *file, const char __user *ubuf,
+				     size_t len, loff_t *offp)
+{
+	struct seq_file *m = file->private_data;
+	struct drm_device *dev = m->private;
+	struct fb_status fb_status;
+	int ret;
+
+	DRM_DEBUG("\n");
+	if (len == 0)
+		return 0;
+
+	if (copy_from_user(&fb_status, ubuf, sizeof(fb_status))) {
+		ret = -EFAULT;
+		goto out;
+	}
+
+	DRM_DEBUG("FB rendered:%s fb_bits: %u\n",
+				fb_status.rendered ? "Yes" : "No",
+						fb_status.fb_bits);
+
+	if (fb_status.rendered)
+		intel_edp_drrs_flush(dev, fb_status.fb_bits);
+	else
+		intel_edp_drrs_invalidate(dev, fb_status.fb_bits);
+
+out:
+	if (ret < 0)
+		return ret;
+
+	*offp += len;
+	return len;
+}
+static const struct file_operations i915_drrs_fb_status_fops = {
+	.owner = THIS_MODULE,
+	.open = drrs_fb_status_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+	.write = drrs_fb_status_write
+};
+
 static void wm_latency_show(struct seq_file *m, const uint16_t wm[8])
 {
 	struct drm_device *dev = m->private;
@@ -4713,6 +4773,7 @@  static const struct i915_debugfs_files {
 	{"i915_spr_wm_latency", &i915_spr_wm_latency_fops},
 	{"i915_cur_wm_latency", &i915_cur_wm_latency_fops},
 	{"i915_fbc_false_color", &i915_fbc_fc_fops},
+	{"i915_drrs_fb_status", &i915_drrs_fb_status_fops},
 };
 
 void intel_display_crc_init(struct drm_device *dev)