From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: juhapekka.heikkila@gmail.com,
Matthew Auld <matthew.auld@intel.com>,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/5] drm/xe/xe2: Limit ccs framebuffers to tile4 only
Date: Wed, 31 Jan 2024 11:26:46 +0100 [thread overview]
Message-ID: <d022db40-0ced-4488-8b99-2581ecad4bca@linux.intel.com> (raw)
In-Reply-To: <4cf6939e-f4b5-4515-ba1a-f6d6b505e903@gmail.com>
Hey,
On 2024-01-30 20:16, Juha-Pekka Heikkila wrote:
> On 29.1.2024 14.02, Matthew Auld wrote:
>> On 26/01/2024 21:08, Juha-Pekka Heikkila wrote:
>>> Display engine support ccs only with tile4, prevent other modifiers
>>> from using compressed memory. Store pin time pat index to xe_bo.
>>>
>>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>>> ---
>>> drivers/gpu/drm/xe/display/xe_fb_pin.c | 19 +++++++++++++++++++
>>> 1 file changed, 19 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..b2930a226f54 100644
>>> --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
>>> +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
>>> @@ -10,9 +10,18 @@
>>> #include "intel_fb_pin.h"
>>> #include "xe_ggtt.h"
>>> #include "xe_gt.h"
>>> +#include "xe_pat.h"
>>> #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);
>>> +
>>> + return xe_pat_index_has_compression(xe, bo->pat_index);
>>> +}
>>> +
>>> 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 +358,22 @@ 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) {
>>> + if (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;
>>> + }
>>> + bo->pat_index_scanout = bo->pat_index;
>>> + }
>>
>> I think this needs to be moved into __xe_pin_fb_vma() after acquiring
>> the object lock. Also not sure what prevents vm_bind appearing after
>> we drop the lock? Do we need to prevent modifications until the end of
>> _xe_unpin_fb_vma()?
>
> I did now put in __xe_unpin_fb_vma()
> ..
> vma->bo->has_sealed_pat_index = false;
> ..
>
> as well as moved this above block to correct place.
I'm pretty sure this will fail if the BO is pinned more than once
simultaneously. Should probably be a refcount protected by bo lock instead.
Is the harm from allowing this only having a garbled display?
If so, we might as well allow it, and avoid complicating the bind code
even more.
Cheers,
~Maarten
next prev parent reply other threads:[~2024-01-31 10:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 21:08 [PATCH 0/5] Enable ccs compressed framebuffers on Xe2 Juha-Pekka Heikkila
2024-01-26 21:08 ` [PATCH 1/5] drm/xe/pat: annotate pat index table with compression information Juha-Pekka Heikkila
2024-01-26 21:08 ` [PATCH 2/5] drm/xe: add bind time pat index to xe_bo structure Juha-Pekka Heikkila
2024-01-26 21:08 ` [PATCH 3/5] drm/xe: store bind time pat index to xe_bo Juha-Pekka Heikkila
2024-01-29 11:33 ` Matthew Auld
2024-01-30 19:16 ` Juha-Pekka Heikkila
2024-01-31 9:10 ` Dan Carpenter
2024-01-26 21:08 ` [PATCH 4/5] drm/xe/xe2: Limit ccs framebuffers to tile4 only Juha-Pekka Heikkila
2024-01-29 12:02 ` Matthew Auld
2024-01-30 19:16 ` Juha-Pekka Heikkila
2024-01-31 10:26 ` Maarten Lankhorst [this message]
2024-01-26 21:08 ` [PATCH 5/5] drm/i915/display: On Xe2 always enable decompression with tile4 Juha-Pekka Heikkila
2024-01-26 21:34 ` ✓ CI.Patch_applied: success for Enable ccs compressed framebuffers on Xe2 (rev3) Patchwork
2024-01-26 21:34 ` ✓ CI.checkpatch: " Patchwork
2024-01-26 21:35 ` ✗ CI.KUnit: failure " Patchwork
2024-01-29 8:47 ` ✓ CI.Patch_applied: success for Enable ccs compressed framebuffers on Xe2 (rev4) Patchwork
2024-01-29 8:47 ` ✓ CI.checkpatch: " Patchwork
2024-01-29 8:47 ` ✗ CI.KUnit: 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=d022db40-0ced-4488-8b99-2581ecad4bca@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=juhapekka.heikkila@gmail.com \
--cc=matthew.auld@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