From patchwork Mon Mar 23 17:44:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 6074701 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9716BBF910 for ; Mon, 23 Mar 2015 17:50:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDA0B20320 for ; Mon, 23 Mar 2015 17:50:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C4552202C8 for ; Mon, 23 Mar 2015 17:50:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 407AB6E60A; Mon, 23 Mar 2015 10:50:29 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C8986E60D for ; Mon, 23 Mar 2015 10:50:27 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 23 Mar 2015 10:50:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,453,1422950400"; d="scan'208";a="545077448" Received: from ramaling-desktop.iind.intel.com ([10.223.26.95]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2015 10:50:25 -0700 From: Ramalingam C To: intel-gfx@lists.freedesktop.org, rodrigo.vivi@intel.com, daniel@ffwll.ch Date: Mon, 23 Mar 2015 23:14:43 +0530 Message-Id: <1427132684-27946-3-git-send-email-ramalingam.c@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1427132684-27946-1-git-send-email-ramalingam.c@intel.com> References: <1427132684-27946-1-git-send-email-ramalingam.c@intel.com> Cc: paulo.r.zanoni@intel.com Subject: [Intel-gfx] [PATCH 2/2] drm/i915/drrs: debugfs for notifying the fb status change X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) --- 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)