From: Matthew Auld <matthew.auld@intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/xe/xe2: Limit ccs framebuffers to tile4 only
Date: Fri, 19 Jan 2024 15:22:58 +0000 [thread overview]
Message-ID: <5dae781f-83a3-454f-ad6a-e32774b0b2b2@intel.com> (raw)
In-Reply-To: <20240118152745.162960-4-juhapekka.heikkila@gmail.com>
On 18/01/2024 15:27, Juha-Pekka Heikkila wrote:
> Display engine support ccs only with tile4, prevent other modifiers
> from using compressed memory.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
> drivers/gpu/drm/xe/display/xe_fb_pin.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> index 722c84a56607..579badb8c69e 100644
> --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
> +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> @@ -13,6 +13,16 @@
>
> #include <drm/ttm/ttm_bo.h>
>
> +static bool is_compressed(const struct drm_framebuffer *fb)
> +{
> + struct xe_bo *bo = intel_fb_obj(fb);
> + struct xe_device *xe = to_xe_device(to_intel_framebuffer(fb)->base.dev);
> + struct xe_ggtt *ggtt = xe_device_get_root_tile(xe)->mem.ggtt;
> + u16 pat_index_compressed = tile_to_xe(ggtt->tile)->pat.idx[XE_CACHE_WT];
Why just this index? There seems to be various indexes that turn on
compression. How about annotating the pat index table and then have a
helper like xe_pat_index_has_compression(xe, pat_index)?
@@ -104,7 +104,8 @@ static const struct xe_pat_table_entry
xelpg_pat_table[] = {
REG_FIELD_PREP(XE2_L3_POLICY, l3_policy) | \
REG_FIELD_PREP(XE2_L4_POLICY, l4_policy) | \
REG_FIELD_PREP(XE2_COH_MODE, __coh_mode), \
- .coh_mode = __coh_mode ? XE_COH_AT_LEAST_1WAY :
XE_COH_NONE \
+ .coh_mode = __coh_mode ? XE_COH_AT_LEAST_1WAY :
XE_COH_NONE, \
+ .compressed = comp_en \
}
static const struct xe_pat_table_entry xe2_pat_table[] = {
@@ -148,6 +149,12 @@ u16 xe_pat_index_get_coh_mode(struct xe_device *xe,
u16 pat_index)
return xe->pat.table[pat_index].coh_mode;
}
+bool xe_pat_index_has_compression(struct xe_device *xe, u16 pat_index)
+{
+ WARN_ON(pat_index >= xe->pat.n_entries);
+ return xe->pat.table[pat_index].compressed;
+}
+
static void program_pat(struct xe_gt *gt, const struct
xe_pat_table_entry table[],
int n_entries)
{
diff --git a/drivers/gpu/drm/xe/xe_pat.h b/drivers/gpu/drm/xe/xe_pat.h
index fa0dfbe525cd..37666ba1aec4 100644
--- a/drivers/gpu/drm/xe/xe_pat.h
+++ b/drivers/gpu/drm/xe/xe_pat.h
@@ -29,6 +29,7 @@ struct xe_pat_table_entry {
#define XE_COH_NONE 1
#define XE_COH_AT_LEAST_1WAY 2
u16 coh_mode;
+ bool compressed;
};
/**
@@ -58,4 +59,6 @@ void xe_pat_dump(struct xe_gt *gt, struct drm_printer *p);
*/
u16 xe_pat_index_get_coh_mode(struct xe_device *xe, u16 pat_index);
+bool xe_pat_index_has_compression(struct xe_device *xe, u16 pat_index);
> +
> + return (bo->pat_index == pat_index_compressed);
> +}
> +
> static void
> write_dpt_rotated(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs, u32 bo_ofs,
> u32 width, u32 height, u32 src_stride, u32 dst_stride)
> @@ -349,12 +359,19 @@ void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags)
> int intel_plane_pin_fb(struct intel_plane_state *plane_state)
> {
> struct drm_framebuffer *fb = plane_state->hw.fb;
> + struct xe_device *xe = to_xe_device(to_intel_framebuffer(fb)->base.dev);
> struct xe_bo *bo = intel_fb_obj(fb);
> struct i915_vma *vma;
>
> /* We reject creating !SCANOUT fb's, so this is weird.. */
> drm_WARN_ON(bo->ttm.base.dev, !(bo->flags & XE_BO_SCANOUT_BIT));
>
> + if (GRAPHICS_VER(xe) >= 20 && fb->modifier != I915_FORMAT_MOD_4_TILED &&
> + is_compressed(fb)) {
> + drm_warn(&xe->drm, "Cannot create ccs framebuffer with other than tile4 mofifier\n");
> + return -EINVAL;
> + }
> +
> vma = __xe_pin_fb_vma(to_intel_framebuffer(fb), &plane_state->view.gtt);
> if (IS_ERR(vma))
> return PTR_ERR(vma);
next prev parent reply other threads:[~2024-01-19 15:23 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 15:27 [PATCH 0/4] Enable ccs compressed framebuffers on Xe2 Juha-Pekka Heikkila
2024-01-18 15:27 ` [PATCH 1/4] drm/xe: add bind time pat index to xe_bo structure Juha-Pekka Heikkila
2024-01-18 15:27 ` [PATCH 2/4] drm/xe: store bind time pat index to xe_bo Juha-Pekka Heikkila
2024-01-19 15:45 ` Matthew Auld
2024-01-22 18:26 ` Juha-Pekka Heikkila
2024-01-23 12:59 ` Matthew Auld
2024-01-23 8:05 ` Ville Syrjälä
2024-01-23 9:17 ` Matthew Auld
2024-01-18 15:27 ` [PATCH 3/4] drm/xe/xe2: Limit ccs framebuffers to tile4 only Juha-Pekka Heikkila
2024-01-19 11:48 ` Jani Nikula
2024-01-19 12:08 ` Juha-Pekka Heikkila
2024-01-19 15:22 ` Matthew Auld [this message]
2024-01-22 18:27 ` Juha-Pekka Heikkila
2024-01-18 15:27 ` [PATCH 4/4] drm/i915/display: On Xe2 always enable decompression with tile4 Juha-Pekka Heikkila
2024-01-19 12:15 ` Kahola, Mika
2024-01-18 15:48 ` ✓ CI.Patch_applied: success for Enable ccs compressed framebuffers on Xe2 Patchwork
2024-01-18 15:48 ` ✓ CI.checkpatch: " Patchwork
2024-01-18 15:49 ` ✓ CI.KUnit: " Patchwork
2024-01-18 15:56 ` ✓ CI.Build: " Patchwork
2024-01-18 15:57 ` ✓ CI.Hooks: " Patchwork
2024-01-18 15:58 ` ✗ CI.checksparse: warning " Patchwork
2024-01-18 16:22 ` ✗ CI.BAT: failure " Patchwork
2024-01-18 16:51 ` ✓ CI.Patch_applied: success for Enable ccs compressed framebuffers on Xe2 (rev2) Patchwork
2024-01-18 16:51 ` ✓ CI.checkpatch: " Patchwork
2024-01-18 16:52 ` ✓ CI.KUnit: " Patchwork
2024-01-18 16:59 ` ✓ CI.Build: " Patchwork
2024-01-18 17:00 ` ✓ CI.Hooks: " Patchwork
2024-01-18 17:01 ` ✗ CI.checksparse: warning " Patchwork
2024-01-18 17:25 ` ✓ CI.BAT: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-01-30 19:36 [PATCH 0/4] Enable ccs compressed framebuffers on Xe2 Juha-Pekka Heikkila
2024-01-30 19:36 ` [PATCH 3/4] drm/xe/xe2: Limit ccs framebuffers to tile4 only Juha-Pekka Heikkila
2024-01-31 11:40 ` Ville Syrjälä
2024-01-31 12:09 ` Ville Syrjälä
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=5dae781f-83a3-454f-ad6a-e32774b0b2b2@intel.com \
--to=matthew.auld@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=juhapekka.heikkila@gmail.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