From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org, zbigniew.kempczynski@intel.com,
mchehab@kernel.org, jani.nikula@intel.com
Subject: [igt-dev] [i-g-t 2/5] lib/igt_fb: Add support for allocating buffers for XE
Date: Mon, 20 Mar 2023 15:30:14 +0530 [thread overview]
Message-ID: <20230320100017.2913328-3-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230320100017.2913328-1-bhanuprakash.modem@intel.com>
Add support to create a buffer object to the XE driver.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
lib/igt_fb.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ba89e1f60..63f8923dc 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -49,6 +49,8 @@
#include "intel_batchbuffer.h"
#include "intel_chipset.h"
#include "intel_bufops.h"
+#include "xe/xe_ioctl.h"
+#include "xe/xe_query.h"
/**
* SECTION:igt_fb
@@ -434,7 +436,7 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
switch (modifier) {
case DRM_FORMAT_MOD_LINEAR :
- if (is_i915_device(fd))
+ if (is_intel_device(fd))
*width_ret = 64;
else
*width_ret = 1;
@@ -924,6 +926,9 @@ static uint64_t calc_fb_size(struct igt_fb *fb)
size += calc_plane_size(fb, plane);
}
+ if (is_xe_device(fb->fd))
+ size = ALIGN(size, xe_get_default_alignment(fb->fd));
+
return size;
}
@@ -1143,8 +1148,8 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
* them, so we need to make sure to use a device BO then.
*/
if (fb->modifier || fb->size || fb->strides[0] ||
- (is_i915_device(fd) && igt_format_is_yuv(fb->drm_format)) ||
- (is_i915_device(fd) && igt_format_is_fp16(fb->drm_format)) ||
+ (is_intel_device(fd) && igt_format_is_yuv(fb->drm_format)) ||
+ (is_intel_device(fd) && igt_format_is_fp16(fb->drm_format)) ||
(is_amdgpu_device(fd) && igt_format_is_yuv(fb->drm_format)) ||
is_nouveau_device(fd))
device_bo = true;
@@ -1168,6 +1173,11 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
fb->strides[0]);
/* If we can't use fences, we won't use ggtt detiling later. */
igt_assert(err == 0 || err == -EOPNOTSUPP);
+ } else if (is_xe_device(fd)) {
+ fb->gem_handle = xe_bo_create_flags(fd, 0, fb->size,
+ xe_has_vram(fd) ?
+ vram_memory(fd, 0) :
+ system_memory(fd));
} else if (is_vc4_device(fd)) {
fb->gem_handle = igt_vc4_create_bo(fd, fb->size);
--
2.40.0
next prev parent reply other threads:[~2023-03-20 10:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 10:00 [igt-dev] [i-g-t 0/5] Enable ADDFB tests for XE Bhanuprakash Modem
2023-03-20 10:00 ` [igt-dev] [i-g-t 1/5] lib/xe/xe_ioctl: Add a helper to map the buffer Bhanuprakash Modem
2023-03-20 14:28 ` Das, Nirmoy
2023-03-23 18:57 ` Zbigniew Kempczyński
2023-03-20 10:00 ` Bhanuprakash Modem [this message]
2023-03-23 19:01 ` [igt-dev] [i-g-t 2/5] lib/igt_fb: Add support for allocating buffers for XE Zbigniew Kempczyński
2023-03-20 10:00 ` [igt-dev] [i-g-t 3/5] tests/kms_addfb_basic: Add XE support Bhanuprakash Modem
2023-03-22 8:49 ` Kamil Konieczny
2023-03-23 19:04 ` Zbigniew Kempczyński
2023-03-31 13:51 ` Modem, Bhanuprakash
2023-03-20 10:00 ` [igt-dev] [i-g-t 4/5] tests/kms_force_connector_basic: " Bhanuprakash Modem
2023-03-23 19:06 ` Zbigniew Kempczyński
2023-03-31 13:53 ` Modem, Bhanuprakash
2023-03-20 10:00 ` [igt-dev] [i-g-t 5/5] xe-fast-feedback: Add basic kms tests to XE BAT Bhanuprakash Modem
2023-03-20 13:43 ` [igt-dev] ✗ Fi.CI.BAT: failure for Enable ADDFB tests for XE Patchwork
2023-03-20 14:40 ` [igt-dev] ✓ Fi.CI.BAT: success for Enable ADDFB tests for XE (rev2) Patchwork
2023-03-20 17:29 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=20230320100017.2913328-3-bhanuprakash.modem@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=mchehab@kernel.org \
--cc=zbigniew.kempczynski@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