Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Govindapillai <vinod.govindapillai@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: vinod.govindapillai@intel.com, juha-pekka.heikkila@intel.com,
	jouni.hogander@intel.com, jonathan.cavitt@intel.com
Subject: [PATCH i-g-t v2 2/5] lib/i915/fbc: add fbc frame size check helper functions
Date: Mon, 10 Jun 2024 14:59:38 +0300	[thread overview]
Message-ID: <20240610115941.35279-3-vinod.govindapillai@intel.com> (raw)
In-Reply-To: <20240610115941.35279-1-vinod.govindapillai@intel.com>

Add helper functions to check maximum plane size fbc can be
supported in a display version.

v2: Add function to get max plane size for FBC (Jonathan Cavitt)

Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> #v1
Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
---
 lib/i915/intel_fbc.c | 55 ++++++++++++++++++++++++++++++++++++++++++++
 lib/i915/intel_fbc.h |  2 ++
 2 files changed, 57 insertions(+)

diff --git a/lib/i915/intel_fbc.c b/lib/i915/intel_fbc.c
index 07ed7f469..2096bd996 100644
--- a/lib/i915/intel_fbc.c
+++ b/lib/i915/intel_fbc.c
@@ -99,3 +99,58 @@ bool intel_fbc_wait_until_enabled(int device, enum pipe pipe)
 
 	return enabled;
 }
+
+/**
+ * intel_fbc_max_plane_size
+ *
+ * @fd: fd of the device
+ * @width: To get the max supported width
+ * @height: To get the max supported height
+ *
+ * Function to update maximum plane size supported by FBC per platform
+ *
+ * Returns:
+ * None
+ */
+void intel_fbc_max_plane_size(int fd, uint32_t *width, uint32_t *height)
+{
+	const uint32_t dev_id = intel_get_drm_devid(fd);
+	const struct intel_device_info *info = intel_get_device_info(dev_id);
+	int ver = info->graphics_ver;
+
+	if (ver >= 10) {
+		*width = 5120;
+		*height = 4096;
+	} else if (ver >= 8 || IS_HASWELL(fd)) {
+		*width = 4096;
+		*height = 4096;
+	} else if (IS_G4X(fd) || ver >= 5) {
+		*width = 4096;
+		*height = 2048;
+	} else {
+		*width = 2048;
+		*height = 1536;
+	}
+}
+
+
+/**
+ * intel_fbc_plane_size_supported
+ *
+ * @fd: fd of the device
+ * @width: width of the plane to be checked
+ * @height: height of the plane to be checked
+ *
+ * Checks if the plane size is supported for FBC
+ *
+ * Returns:
+ * true if plane size is within the range as per the FBC supported size restrictions per platform
+ */
+bool intel_fbc_plane_size_supported(int fd, uint32_t width, uint32_t height)
+{
+	unsigned int max_w, max_h;
+
+	intel_fbc_max_plane_size(fd, &max_w, &max_h);
+
+	return width <= max_w && height <= max_h;
+}
diff --git a/lib/i915/intel_fbc.h b/lib/i915/intel_fbc.h
index 995dc7f1e..5cca5dfd9 100644
--- a/lib/i915/intel_fbc.h
+++ b/lib/i915/intel_fbc.h
@@ -14,5 +14,7 @@
 bool intel_fbc_supported_on_chipset(int device, enum pipe pipe);
 bool intel_fbc_wait_until_enabled(int device, enum pipe pipe);
 bool intel_fbc_is_enabled(int device, enum pipe pipe, int log_level);
+void intel_fbc_max_plane_size(int fd, uint32_t *width, uint32_t *height);
+bool intel_fbc_plane_size_supported(int device, uint32_t width, uint32_t height);
 
 #endif
-- 
2.34.1


  parent reply	other threads:[~2024-06-10 12:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 11:59 [PATCH i-g-t v2 0/5] tests/kms_dirtyfb: few fbc related updates Vinod Govindapillai
2024-06-10 11:59 ` [PATCH i-g-t v2 1/5] lib/i915/fbc: print current fbc status if cannot be enabled Vinod Govindapillai
2024-06-10 11:59 ` Vinod Govindapillai [this message]
2024-06-10 11:59 ` [PATCH i-g-t v2 3/5] tests/kms_dirtyfb: disable psr feature only if psr possible Vinod Govindapillai
2024-06-10 11:59 ` [PATCH i-g-t v2 4/5] tests/kms_dirtyfb: populate modeinfo before feature support check Vinod Govindapillai
2024-06-10 14:36   ` Cavitt, Jonathan
2024-06-10 11:59 ` [PATCH i-g-t v2 5/5] tests/kms_dirtyfb: ensure plane size is within fbc supported limit Vinod Govindapillai
2024-06-10 12:41 ` ✓ Fi.CI.BAT: success for tests/kms_dirtyfb: few fbc related updates (rev2) Patchwork
2024-06-10 13:45 ` ✓ CI.xeBAT: " Patchwork
2024-06-10 15:31 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-06-11  8:11   ` Govindapillai, Vinod
2024-06-10 15:44 ` ✗ CI.xeFULL: " Patchwork
2024-06-11  8:06   ` Govindapillai, Vinod

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=20240610115941.35279-3-vinod.govindapillai@intel.com \
    --to=vinod.govindapillai@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=jouni.hogander@intel.com \
    --cc=juha-pekka.heikkila@intel.com \
    /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