* [PATCH] drm/i915: consider HAS_FLAT_CCS() in needs_ccs_pages
@ 2022-09-05 10:53 Matthew Auld
2022-09-05 11:03 ` Das, Nirmoy
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Auld @ 2022-09-05 10:53 UTC (permalink / raw)
To: intel-gfx; +Cc: dri-devel, Nirmoy Das
Just move the HAS_FLAT_CCS() check into needs_ccs_pages. This also then
fixes i915_ttm_memcpy_allowed() which was incorrectly reporting true on
DG1, even though it doesn't have small-BAR or flat-CCS.
References: https://gitlab.freedesktop.org/drm/intel/-/issues/6605
Fixes: efeb3caf4341 ("drm/i915/ttm: disallow CPU fallback mode for ccs pages")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
---
drivers/gpu/drm/i915/gem/i915_gem_object.c | 3 +++
drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 389e9f157ca5..85482a04d158 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -723,6 +723,9 @@ bool i915_gem_object_needs_ccs_pages(struct drm_i915_gem_object *obj)
bool lmem_placement = false;
int i;
+ if (!HAS_FLAT_CCS(to_i915(obj->base.dev)))
+ return false;
+
for (i = 0; i < obj->mm.n_placements; i++) {
/* Compression is not allowed for the objects with smem placement */
if (obj->mm.placements[i]->type == INTEL_MEMORY_SYSTEM)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index bc9c432edffe..f64a3deb12fc 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -297,7 +297,7 @@ static struct ttm_tt *i915_ttm_tt_create(struct ttm_buffer_object *bo,
i915_tt->is_shmem = true;
}
- if (HAS_FLAT_CCS(i915) && i915_gem_object_needs_ccs_pages(obj))
+ if (i915_gem_object_needs_ccs_pages(obj))
ccs_pages = DIV_ROUND_UP(DIV_ROUND_UP(bo->base.size,
NUM_BYTES_PER_CCS_BYTE),
PAGE_SIZE);
--
2.37.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/i915: consider HAS_FLAT_CCS() in needs_ccs_pages
2022-09-05 10:53 [PATCH] drm/i915: consider HAS_FLAT_CCS() in needs_ccs_pages Matthew Auld
@ 2022-09-05 11:03 ` Das, Nirmoy
0 siblings, 0 replies; 2+ messages in thread
From: Das, Nirmoy @ 2022-09-05 11:03 UTC (permalink / raw)
To: Matthew Auld, intel-gfx; +Cc: dri-devel
LGTM Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
On 9/5/2022 12:53 PM, Matthew Auld wrote:
> Just move the HAS_FLAT_CCS() check into needs_ccs_pages. This also then
> fixes i915_ttm_memcpy_allowed() which was incorrectly reporting true on
> DG1, even though it doesn't have small-BAR or flat-CCS.
>
> References: https://gitlab.freedesktop.org/drm/intel/-/issues/6605
> Fixes: efeb3caf4341 ("drm/i915/ttm: disallow CPU fallback mode for ccs pages")
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Nirmoy Das <nirmoy.das@intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_object.c | 3 +++
> drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index 389e9f157ca5..85482a04d158 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -723,6 +723,9 @@ bool i915_gem_object_needs_ccs_pages(struct drm_i915_gem_object *obj)
> bool lmem_placement = false;
> int i;
>
> + if (!HAS_FLAT_CCS(to_i915(obj->base.dev)))
> + return false;
> +
> for (i = 0; i < obj->mm.n_placements; i++) {
> /* Compression is not allowed for the objects with smem placement */
> if (obj->mm.placements[i]->type == INTEL_MEMORY_SYSTEM)
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> index bc9c432edffe..f64a3deb12fc 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> @@ -297,7 +297,7 @@ static struct ttm_tt *i915_ttm_tt_create(struct ttm_buffer_object *bo,
> i915_tt->is_shmem = true;
> }
>
> - if (HAS_FLAT_CCS(i915) && i915_gem_object_needs_ccs_pages(obj))
> + if (i915_gem_object_needs_ccs_pages(obj))
> ccs_pages = DIV_ROUND_UP(DIV_ROUND_UP(bo->base.size,
> NUM_BYTES_PER_CCS_BYTE),
> PAGE_SIZE);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-05 11:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 10:53 [PATCH] drm/i915: consider HAS_FLAT_CCS() in needs_ccs_pages Matthew Auld
2022-09-05 11:03 ` Das, Nirmoy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).