public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t 1/6] lib/intel_bufops: Add bufops reference and relaxate stride requirement
Date: Tue, 12 May 2020 10:23:57 +0200	[thread overview]
Message-ID: <20200512082402.26792-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20200512082402.26792-1-zbigniew.kempczynski@intel.com>

Add bufops reference to intel_buf to allow acquire drm fd against which
buffer was created.

Relax stride limitation for intel_buf for non-tiled buffers.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/intel_bufops.c | 20 +++++++++++++++++++-
 lib/intel_bufops.h |  3 +++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 804b2a0a..cdf6b114 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -686,6 +686,8 @@ static void __intel_buf_init(struct buf_ops *bops,
 
 	memset(buf, 0, sizeof(*buf));
 
+	buf->bops = bops;
+
 	if (compression) {
 		int aux_width, aux_height;
 
@@ -721,7 +723,10 @@ static void __intel_buf_init(struct buf_ops *bops,
 		size = buf->aux.offset + aux_width * aux_height;
 
 	} else {
-		buf->stride = ALIGN(width * (bpp / 8), 128);
+		if (buf->tiling)
+			buf->stride = ALIGN(width * (bpp / 8), 128);
+		else
+			buf->stride = width * (bpp / 8);
 		buf->size = buf->stride * height;
 		buf->tiling = tiling;
 		buf->bpp = bpp;
@@ -1038,6 +1043,19 @@ void buf_ops_destroy(struct buf_ops *bops)
 	free(bops);
 }
 
+/**
+ * buf_ops_getfd
+ * @bops: pointer to buf_ops
+ *
+ * Returns: drm fd
+ */
+int buf_ops_getfd(struct buf_ops *bops)
+{
+	igt_assert(bops);
+
+	return bops->fd;
+}
+
 /**
  * buf_ops_set_software_tiling
  * @bops: pointer to buf_ops
diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index f3d6aed8..cd7b74bd 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -2,10 +2,12 @@
 #define __INTEL_BUFOPS_H__
 
 #include <stdint.h>
+#include "igt_aux.h"
 
 struct buf_ops;
 
 struct intel_buf {
+	struct buf_ops *bops;
 	uint32_t handle;
 	uint32_t stride;
 	uint32_t tiling;
@@ -58,6 +60,7 @@ intel_buf_aux_height(int gen, const struct intel_buf *buf)
 
 struct buf_ops *buf_ops_create(int fd);
 void buf_ops_destroy(struct buf_ops *bops);
+int buf_ops_getfd(struct buf_ops *bops);
 
 bool buf_ops_set_software_tiling(struct buf_ops *bops,
 				 uint32_t tiling,
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-05-12  8:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12  8:23 [igt-dev] [PATCH i-g-t 0/6] Make gpgpu fill tests libdrm independent Zbigniew Kempczyński
2020-05-12  8:23 ` Zbigniew Kempczyński [this message]
2020-05-12  9:29   ` [igt-dev] [PATCH i-g-t 1/6] lib/intel_bufops: Add bufops reference and relaxate stride requirement Chris Wilson
2020-05-12  8:23 ` [igt-dev] [PATCH i-g-t 2/6] lib/intel_batchbuffer: Introduce intel_bb Zbigniew Kempczyński
2020-05-12  9:39   ` Chris Wilson
2020-05-12  8:23 ` [igt-dev] [PATCH i-g-t 3/6] lib/intel_batchbuffer: Introduce temporary igt_fillfunc_v2_t Zbigniew Kempczyński
2020-05-12  8:24 ` [igt-dev] [PATCH i-g-t 4/6] lib/gpu_cmds: Add gpgpu pipeline functions based on intel_bb Zbigniew Kempczyński
2020-05-12  8:24 ` [igt-dev] [PATCH i-g-t 5/6] lib/gpgpu_fill: libdrm-free gpgpu pipeline creation for gen7 Zbigniew Kempczyński
2020-05-12  8:24 ` [igt-dev] [PATCH i-g-t 6/6] tests/gem_gpgpu_fill: Add gen7 version without libdrm dependency Zbigniew Kempczyński
2020-05-12  8:59 ` [igt-dev] ✓ Fi.CI.BAT: success for Make gpgpu fill tests libdrm independent Patchwork
2020-05-12 10:43 ` [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=20200512082402.26792-2-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /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