From: Matthew Auld <matthew.auld@intel.com>
To: Ramalingam C <ramalingam.c@intel.com>,
intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>
Cc: Hellstrom Thomas <thomas.hellstrom@intel.com>
Subject: Re: [Intel-gfx] [PATCH v2 2/4] drm/i915/gt: optimize the ccs_sz calculation per chunk
Date: Wed, 27 Apr 2022 20:24:38 +0100 [thread overview]
Message-ID: <845ad9dc-4570-56de-31a9-a9898884c2b2@intel.com> (raw)
In-Reply-To: <20220425162430.28844-3-ramalingam.c@intel.com>
On 25/04/2022 17:24, Ramalingam C wrote:
> Calculate the ccs_sz that needs to be emitted based on the src
> and dst pages emitted per chunk. And handle the return value of emit_pte
> for the ccs pages.
>
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_migrate.c | 36 +++++++++----------------
> 1 file changed, 12 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
> index 29d761da02c4..463a6a14b5f9 100644
> --- a/drivers/gpu/drm/i915/gt/intel_migrate.c
> +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
> @@ -647,17 +647,9 @@ static int scatter_list_length(struct scatterlist *sg)
>
> static void
> calculate_chunk_sz(struct drm_i915_private *i915, bool src_is_lmem,
> - int *src_sz, int *ccs_sz, u32 bytes_to_cpy,
> - u32 ccs_bytes_to_cpy)
> + int *src_sz, u32 bytes_to_cpy, u32 ccs_bytes_to_cpy)
> {
> if (ccs_bytes_to_cpy) {
> - /*
> - * We can only copy the ccs data corresponding to
> - * the CHUNK_SZ of lmem which is
> - * GET_CCS_BYTES(i915, CHUNK_SZ))
> - */
> - *ccs_sz = min_t(int, ccs_bytes_to_cpy, GET_CCS_BYTES(i915, CHUNK_SZ));
> -
> if (!src_is_lmem)
> /*
> * When CHUNK_SZ is passed all the pages upto CHUNK_SZ
> @@ -713,10 +705,10 @@ intel_context_migrate_copy(struct intel_context *ce,
> struct drm_i915_private *i915 = ce->engine->i915;
> u32 ccs_bytes_to_cpy = 0, bytes_to_cpy;
> enum i915_cache_level ccs_cache_level;
> - int src_sz, dst_sz, ccs_sz;
> u32 src_offset, dst_offset;
> u8 src_access, dst_access;
> struct i915_request *rq;
> + int src_sz, dst_sz;
> bool ccs_is_src;
> int err;
>
> @@ -770,7 +762,7 @@ intel_context_migrate_copy(struct intel_context *ce,
> }
>
> do {
> - int len;
> + int len, ccs_sz;
This could be moved into the reduced scope below.
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>
> rq = i915_request_create(ce);
> if (IS_ERR(rq)) {
> @@ -797,7 +789,7 @@ intel_context_migrate_copy(struct intel_context *ce,
> if (err)
> goto out_rq;
>
> - calculate_chunk_sz(i915, src_is_lmem, &src_sz, &ccs_sz,
> + calculate_chunk_sz(i915, src_is_lmem, &src_sz,
> bytes_to_cpy, ccs_bytes_to_cpy);
>
> len = emit_pte(rq, &it_src, src_cache_level, src_is_lmem,
> @@ -835,33 +827,29 @@ intel_context_migrate_copy(struct intel_context *ce,
> if (err)
> goto out_rq;
>
> + ccs_sz = GET_CCS_BYTES(i915, len);
> err = emit_pte(rq, &it_ccs, ccs_cache_level, false,
> ccs_is_src ? src_offset : dst_offset,
> ccs_sz);
> + if (err < 0)
> + goto out_rq;
> + if (err < ccs_sz) {
> + err = -EINVAL;
> + goto out_rq;
> + }
>
> err = rq->engine->emit_flush(rq, EMIT_INVALIDATE);
> if (err)
> goto out_rq;
>
> - /*
> - * Using max of src_sz and dst_sz, as we need to
> - * pass the lmem size corresponding to the ccs
> - * blocks we need to handle.
> - */
> - ccs_sz = max_t(int, ccs_is_src ? ccs_sz : src_sz,
> - ccs_is_src ? dst_sz : ccs_sz);
> -
> err = emit_copy_ccs(rq, dst_offset, dst_access,
> - src_offset, src_access, ccs_sz);
> + src_offset, src_access, len);
> if (err)
> goto out_rq;
>
> err = rq->engine->emit_flush(rq, EMIT_INVALIDATE);
> if (err)
> goto out_rq;
> -
> - /* Converting back to ccs bytes */
> - ccs_sz = GET_CCS_BYTES(rq->engine->i915, ccs_sz);
> ccs_bytes_to_cpy -= ccs_sz;
> }
>
next prev parent reply other threads:[~2022-04-27 19:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 16:24 [Intel-gfx] [PATCH v2 0/4] Flat-CCS eviction enhancements Ramalingam C
2022-04-25 16:24 ` [Intel-gfx] [PATCH v2 1/4] drm/i915/gt: GEM_BUG_ON unexpected NULL at scatterlist walking Ramalingam C
2022-04-27 19:27 ` Matthew Auld
2022-04-25 16:24 ` [Intel-gfx] [PATCH v2 2/4] drm/i915/gt: optimize the ccs_sz calculation per chunk Ramalingam C
2022-04-27 19:24 ` Matthew Auld [this message]
2022-04-25 16:24 ` [Intel-gfx] [PATCH v2 3/4] drm/i915/gt: Document the eviction of the Flat-CCS objects Ramalingam C
2022-04-27 16:29 ` Matthew Auld
2022-04-25 16:24 ` [Intel-gfx] [PATCH v2 4/4] uapi/drm/i915: Document memory residency and Flat-CCS capability of obj Ramalingam C
2022-04-27 17:09 ` Matthew Auld
2022-04-25 17:29 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Flat-CCS eviction enhancements (rev3) Patchwork
2022-04-25 18:02 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=845ad9dc-4570-56de-31a9-a9898884c2b2@intel.com \
--to=matthew.auld@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ramalingam.c@intel.com \
--cc=thomas.hellstrom@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