summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2024-05-15 14:19:41 +0200
committerZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2024-05-16 06:14:58 +0200
commit46211eeb76b330bc4994b2213eb57991e4c991bd (patch)
treee5a09e98914122749a07b12b0760c7cdd89e3955 /lib
parent02dbc3f8f4f3e02dd09a5af505900ff933b9adf0 (diff)
lib/intel_bufops: Store devid on buffer ops creation
As I need devid to diverge intel-buf init code lets store it in bufops structure. This field is commonly used so add function which returns it. Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Link: https://lore.kernel.org/r/20240515121949.245280-2-zbigniew.kempczynski@intel.com Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/intel_bufops.c20
-rw-r--r--lib/intel_bufops.h1
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 51fdf50ad..43d6dd5b4 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -114,6 +114,7 @@ struct buf_ops {
int gen_start;
int gen_end;
unsigned int intel_gen;
+ uint32_t devid;
uint32_t supported_tiles;
uint32_t supported_hw_tiles;
uint32_t swizzle_x;
@@ -1499,12 +1500,11 @@ static bool probe_hw_tiling(struct buf_ops *bops, uint32_t tiling,
{
uint64_t size = 256 * 256;
uint32_t handle, buf_tiling, buf_swizzle, phys_swizzle;
- uint32_t devid, stride;
+ uint32_t stride;
int ret;
bool is_set = false;
- devid = intel_get_drm_devid(bops->fd);
- stride = get_stride(devid, tiling);
+ stride = get_stride(bops->devid, tiling);
handle = gem_create(bops->fd, size);
/* Single shot, if no fences are available we fail immediately */
@@ -1616,6 +1616,7 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency)
bops->fd = fd;
bops->intel_gen = generation;
+ bops->devid = devid;
bops->driver = is_i915_device(fd) ? INTEL_DRIVER_I915 :
is_xe_device(fd) ? INTEL_DRIVER_XE : 0;
igt_assert(bops->driver);
@@ -1786,6 +1787,19 @@ int buf_ops_get_fd(struct buf_ops *bops)
}
/**
+ * buf_ops_get_devid
+ * @bops: pointer to buf_ops
+ *
+ * Returns: device id
+ */
+uint32_t buf_ops_get_devid(struct buf_ops *bops)
+{
+ igt_assert(bops);
+
+ return bops->devid;
+}
+
+/**
* buf_ops_get_driver
* @bops: pointer to buf_ops
*
diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index b959a8cc8..84e71d41a 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -118,6 +118,7 @@ struct buf_ops *buf_ops_create(int fd);
struct buf_ops *buf_ops_create_with_selftest(int fd);
void buf_ops_destroy(struct buf_ops *bops);
int buf_ops_get_fd(struct buf_ops *bops);
+uint32_t buf_ops_get_devid(struct buf_ops *bops);
enum intel_driver buf_ops_get_driver(struct buf_ops *bops);
bool buf_ops_set_software_tiling(struct buf_ops *bops,