From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org Subject: [Intel-gfx] [PATCH i-g-t 2/5] lib/intel_batchbuffer: Add CCS width/height functions for Intel igt_buf Date: Fri, 17 Jan 2020 17:15:42 +0000 [thread overview] Message-ID: <20200117171545.3212625-2-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20200117171545.3212625-1-chris@chris-wilson.co.uk> From: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> igt_buf has some fields which can be interpreted differently across vendors (ccs structure). Patch adds functions which are aware of meaning of this field. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> --- lib/intel_batchbuffer.c | 47 +++++++++++++++++++++++++++++++++++++++++ lib/intel_batchbuffer.h | 2 ++ 2 files changed, 49 insertions(+) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 3dc890242..ab907913b 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -43,6 +43,7 @@ #include "ioctl_wrappers.h" #include "media_spin.h" #include "gpgpu_fill.h" +#include "igt_aux.h" #include <i915_drm.h> @@ -529,6 +530,52 @@ unsigned igt_buf_height(const struct igt_buf *buf) return buf->surface[0].size/buf->surface[0].stride; } +/** + * igt_buf_intel_ccs_width: + * @buf: the Intel i-g-t buffer object + * @gen: device generation + * + * Computes the width of ccs buffer when considered as Intel surface data. + * + * Returns: + * The width of the ccs buffer data. + */ +unsigned int igt_buf_intel_ccs_width(int gen, const struct igt_buf *buf) +{ + /* + * GEN12+: The CCS unit size is 64 bytes mapping 4 main surface + * tiles. Thus the width of the CCS unit is 4*32=128 pixels on the + * main surface. + */ + if (gen >= 12) + return DIV_ROUND_UP(igt_buf_width(buf), 128) * 64; + + return DIV_ROUND_UP(igt_buf_width(buf), 1024) * 128; +} + +/** + * igt_buf_intel_ccs_height: + * @buf: the i-g-t buffer object + * @gen: device generation + * + * Computes the height of ccs buffer when considered as Intel surface data. + * + * Returns: + * The height of the ccs buffer data. + */ +unsigned int igt_buf_intel_ccs_height(int gen, const struct igt_buf *buf) +{ + /* + * GEN12+: The CCS unit size is 64 bytes mapping 4 main surface + * tiles. Thus the height of the CCS unit is 32 pixel rows on the main + * surface. + */ + if (gen >= 12) + return DIV_ROUND_UP(igt_buf_height(buf), 32); + + return DIV_ROUND_UP(igt_buf_height(buf), 512) * 32; +} + /* * pitches are in bytes if the surfaces are linear, number of dwords * otherwise diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h index fd7ef03f3..85eb3ffd7 100644 --- a/lib/intel_batchbuffer.h +++ b/lib/intel_batchbuffer.h @@ -262,6 +262,8 @@ static inline bool igt_buf_compressed(const struct igt_buf *buf) unsigned igt_buf_width(const struct igt_buf *buf); unsigned igt_buf_height(const struct igt_buf *buf); +unsigned int igt_buf_intel_ccs_width(int gen, const struct igt_buf *buf); +unsigned int igt_buf_intel_ccs_height(int gen, const struct igt_buf *buf); void igt_blitter_fast_copy(struct intel_batchbuffer *batch, const struct igt_buf *src, unsigned src_delta, -- 2.25.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org Subject: [igt-dev] [PATCH i-g-t 2/5] lib/intel_batchbuffer: Add CCS width/height functions for Intel igt_buf Date: Fri, 17 Jan 2020 17:15:42 +0000 [thread overview] Message-ID: <20200117171545.3212625-2-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20200117171545.3212625-1-chris@chris-wilson.co.uk> From: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> igt_buf has some fields which can be interpreted differently across vendors (ccs structure). Patch adds functions which are aware of meaning of this field. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> --- lib/intel_batchbuffer.c | 47 +++++++++++++++++++++++++++++++++++++++++ lib/intel_batchbuffer.h | 2 ++ 2 files changed, 49 insertions(+) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 3dc890242..ab907913b 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -43,6 +43,7 @@ #include "ioctl_wrappers.h" #include "media_spin.h" #include "gpgpu_fill.h" +#include "igt_aux.h" #include <i915_drm.h> @@ -529,6 +530,52 @@ unsigned igt_buf_height(const struct igt_buf *buf) return buf->surface[0].size/buf->surface[0].stride; } +/** + * igt_buf_intel_ccs_width: + * @buf: the Intel i-g-t buffer object + * @gen: device generation + * + * Computes the width of ccs buffer when considered as Intel surface data. + * + * Returns: + * The width of the ccs buffer data. + */ +unsigned int igt_buf_intel_ccs_width(int gen, const struct igt_buf *buf) +{ + /* + * GEN12+: The CCS unit size is 64 bytes mapping 4 main surface + * tiles. Thus the width of the CCS unit is 4*32=128 pixels on the + * main surface. + */ + if (gen >= 12) + return DIV_ROUND_UP(igt_buf_width(buf), 128) * 64; + + return DIV_ROUND_UP(igt_buf_width(buf), 1024) * 128; +} + +/** + * igt_buf_intel_ccs_height: + * @buf: the i-g-t buffer object + * @gen: device generation + * + * Computes the height of ccs buffer when considered as Intel surface data. + * + * Returns: + * The height of the ccs buffer data. + */ +unsigned int igt_buf_intel_ccs_height(int gen, const struct igt_buf *buf) +{ + /* + * GEN12+: The CCS unit size is 64 bytes mapping 4 main surface + * tiles. Thus the height of the CCS unit is 32 pixel rows on the main + * surface. + */ + if (gen >= 12) + return DIV_ROUND_UP(igt_buf_height(buf), 32); + + return DIV_ROUND_UP(igt_buf_height(buf), 512) * 32; +} + /* * pitches are in bytes if the surfaces are linear, number of dwords * otherwise diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h index fd7ef03f3..85eb3ffd7 100644 --- a/lib/intel_batchbuffer.h +++ b/lib/intel_batchbuffer.h @@ -262,6 +262,8 @@ static inline bool igt_buf_compressed(const struct igt_buf *buf) unsigned igt_buf_width(const struct igt_buf *buf); unsigned igt_buf_height(const struct igt_buf *buf); +unsigned int igt_buf_intel_ccs_width(int gen, const struct igt_buf *buf); +unsigned int igt_buf_intel_ccs_height(int gen, const struct igt_buf *buf); void igt_blitter_fast_copy(struct intel_batchbuffer *batch, const struct igt_buf *src, unsigned src_delta, -- 2.25.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-01-17 17:16 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-17 17:15 [Intel-gfx] [PATCH i-g-t 1/5] lib/intel_bufops: Introduce buffer operations Chris Wilson 2020-01-17 17:15 ` [igt-dev] " Chris Wilson 2020-01-17 17:15 ` Chris Wilson [this message] 2020-01-17 17:15 ` [igt-dev] [PATCH i-g-t 2/5] lib/intel_batchbuffer: Add CCS width/height functions for Intel igt_buf Chris Wilson 2020-01-17 17:15 ` [Intel-gfx] [PATCH i-g-t 3/5] lib/rendercopy_bufmgr: Add rendercopy buffer manager Chris Wilson 2020-01-17 17:15 ` [igt-dev] " Chris Wilson 2020-01-17 17:15 ` [Intel-gfx] [PATCH i-g-t 4/5] i915/gem_render_copy.c: Simplify code by switch to rendercopy bufmgr Chris Wilson 2020-01-17 17:15 ` [igt-dev] " Chris Wilson 2020-01-17 17:15 ` [Intel-gfx] [PATCH i-g-t 5/5] HAX: run gem_render_copy tests in BAT Chris Wilson 2020-01-17 17:15 ` [igt-dev] " Chris Wilson 2020-01-17 17:57 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/5] lib/intel_bufops: Introduce buffer operations Patchwork 2020-01-20 15:23 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork 2020-01-17 18:19 [Intel-gfx] [PATCH i-g-t 1/5] " Chris Wilson 2020-01-17 18:19 ` [Intel-gfx] [PATCH i-g-t 2/5] lib/intel_batchbuffer: Add CCS width/height functions for Intel igt_buf Chris Wilson
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=20200117171545.3212625-2-chris@chris-wilson.co.uk \ --to=chris@chris-wilson.co.uk \ --cc=igt-dev@lists.freedesktop.org \ --cc=intel-gfx@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.