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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_debugfs.c |   61 +++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

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)
-- 
1.7.9.5

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





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux