diff options
author | Vinod Govindapillai <vinod.govindapillai@intel.com> | 2024-06-11 11:04:13 +0300 |
---|---|---|
committer | Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> | 2024-06-12 15:27:14 +0300 |
commit | 5df3cea3d866d7430cc3497a56ffcb01c0dce033 (patch) | |
tree | f7319472b59fa0ead79e2e7b707025c03925a52b /lib | |
parent | 04b0d0efe9787212b07c3c619d5eff485bdaf967 (diff) |
lib/i915/fbc: add fbc frame size check helper functions
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/i915/intel_fbc.c | 55 | ||||
-rw-r--r-- | lib/i915/intel_fbc.h | 2 |
2 files changed, 57 insertions, 0 deletions
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 |