From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: intel-xe@lists.freedesktop.org,
"Matthew Auld" <matthew.auld@intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Juha-Pekka Heikkilä" <juha-pekka.heikkila@intel.com>
Subject: Re: [PATCH v2 1/3] drm/xe: Align all 64k VRAM buffers physically when multiple of 64k.
Date: Thu, 22 Aug 2024 14:31:40 +0200 [thread overview]
Message-ID: <1906edf6-f5d3-471c-8cba-12ef84e7a5ff@linux.intel.com> (raw)
In-Reply-To: <20240822121412.sciljgl3oomkxv4t@zkempczy-mobl2>
Hey,
Den 2024-08-22 kl. 14:14, skrev Zbigniew Kempczyński:
> On Wed, Aug 21, 2024 at 10:56:35PM +0200, Maarten Lankhorst wrote:
>> For CCS formats on affected platforms, CCS can be used freely, but
>> display engine requires a multiple of 64k physical pages. No other
>> changes are needed.
>>
>> At the BO creation time we don't know if the BO will be used for CCS
>> or not. If the scanout flag is set, and the BO is a multiple of 64k,
>> we take the safe route and force the physical alignment of 64k pages.
>>
>> If the BO is not a multiple of 64k, or the scanout flag was not set
>> at BO creation, we reject it for usage as CCS in display. The physical
>> pages are likely not aligned correctly, and this will cause corruption
>> when used as FB.
>>
>> This is a slightly different approach from my previous patch. Instead
>> of requiring a scanout flag at FB creation, we now make all buffers of
>> the right size physically aligned correctly, so no change from userspace
>> is needed.
>>
>> It will be interesting to see if it affects performance in any way,
>> could potentially even improve things with 64k PTE's.
>>
>> Inspired by Zbigniews patch.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Co-developed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
>> Cc: Matthew Auld <matthew.auld@intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Juha-Pekka Heikkilä <juha-pekka.heikkila@intel.com>
>> ---
>> drivers/gpu/drm/xe/display/intel_fb_bo.c | 6 ++++++
>> drivers/gpu/drm/xe/xe_bo.c | 10 ++++++++++
>> drivers/gpu/drm/xe/xe_device_types.h | 1 +
>> drivers/gpu/drm/xe/xe_vm.c | 3 ++-
>> 4 files changed, 19 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/display/intel_fb_bo.c b/drivers/gpu/drm/xe/display/intel_fb_bo.c
>> index f835492f73fb4..407367719abe2 100644
>> --- a/drivers/gpu/drm/xe/display/intel_fb_bo.c
>> +++ b/drivers/gpu/drm/xe/display/intel_fb_bo.c
>> @@ -7,6 +7,7 @@
>> #include <drm/ttm/ttm_bo.h>
>>
>> #include "intel_display_types.h"
>> +#include "intel_fb.h"
>> #include "intel_fb_bo.h"
>> #include "xe_bo.h"
>>
>> @@ -28,6 +29,11 @@ int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
>> struct xe_device *xe = to_xe_device(bo->ttm.base.dev);
>> int ret;
>>
>> + if (XE_IOCTL_DBG(xe, intel_fb_is_ccs_modifier(mode_cmd->modifier[0]) &&
>> + (xe->info.vram_flags & XE_VRAM_FLAGS_DISPLAY_NEED64K_CCS) &&
>> + !(bo->flags & XE_BO_FLAG_NEEDS_64K)))
>> + return -EINVAL;
>> +
>> xe_bo_get(bo);
>>
>> ret = ttm_bo_reserve(&bo->ttm, true, false, NULL);
>> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
>> index 6ed0e19552159..3a753f4644cb6 100644
>> --- a/drivers/gpu/drm/xe/xe_bo.c
>> +++ b/drivers/gpu/drm/xe/xe_bo.c
>> @@ -2017,6 +2017,16 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,
>> if (args->flags & DRM_XE_GEM_CREATE_FLAG_SCANOUT)
>> bo_flags |= XE_BO_FLAG_SCANOUT;
>
> I wonder, may you fail early here if buffer comes with SCANOUT flag but
> is not aligned to 64K when vram_flags has DISPLAY_NEED64K_CCS set and
> not wait to framebuffer init?
>
I decided to allow this case. Because only a single format is affected (4-tiled CCS), it makes sense to allow scanout for all buffers and only fail on fb init.
Cheers,
~Maarten
next prev parent reply other threads:[~2024-08-22 12:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 20:56 [PATCH v2 0/3] drm/xe: Alternative CCS fix Maarten Lankhorst
2024-08-21 20:56 ` [PATCH v2 1/3] drm/xe: Align all 64k VRAM buffers physically when multiple of 64k Maarten Lankhorst
2024-08-22 12:12 ` Zbigniew Kempczyński
2024-08-22 13:57 ` Juha-Pekka Heikkila
2024-08-22 12:14 ` Zbigniew Kempczyński
2024-08-22 12:31 ` Maarten Lankhorst [this message]
2024-08-22 12:48 ` Thomas Hellström
2024-08-21 20:56 ` [PATCH v2 2/3] drm/xe: Use 64K pages for scanout buffers for Battlemage Maarten Lankhorst
2024-08-21 20:56 ` [PATCH v2 3/3] drm/i915/display: Allowing looking up invalid modifiers to make xe happy Maarten Lankhorst
2024-08-21 20:59 ` [PATCH v2.1] " Maarten Lankhorst
2024-08-21 21:05 ` ✓ CI.Patch_applied: success for drm/xe: Alternative CCS fix. (rev3) Patchwork
2024-08-21 21:05 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-21 21:06 ` ✓ CI.KUnit: success " Patchwork
2024-08-21 21:18 ` ✓ CI.Build: " Patchwork
2024-08-21 21:21 ` ✓ CI.Hooks: " Patchwork
2024-08-21 21:22 ` ✗ CI.checksparse: warning " Patchwork
2024-08-21 21:44 ` ✓ CI.BAT: success " Patchwork
2024-08-22 6:15 ` ✗ CI.FULL: 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=1906edf6-f5d3-471c-8cba-12ef84e7a5ff@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=juha-pekka.heikkila@intel.com \
--cc=matthew.auld@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
--cc=zbigniew.kempczynski@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