All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	"Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	"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 v6 2/2] drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed.
Date: Mon, 26 Aug 2024 21:42:54 +0200	[thread overview]
Message-ID: <361abc93-0246-4f21-b235-4e0699682ef3@linux.intel.com> (raw)
In-Reply-To: <ZszXzIwntGCQobwy@DUT025-TGLU.fm.intel.com>

Hey,

Den 2024-08-26 kl. 21:30, skrev Matthew Brost:
> On Mon, Aug 26, 2024 at 07:01:16PM +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.
>>
>> The scanout flag and size being a multiple of 64k are used together
>> to enforce 64k physical placement.
>>
>> VM_BIND is completely unaffected, mappings to a VM can still be aligned
>> to 4k, just like for normal buffers.
>>
>> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.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 |  9 +++++++++
>>  drivers/gpu/drm/xe/xe_bo.c               |  7 +++++++
>>  drivers/gpu/drm/xe/xe_vm.c               | 11 ++++++++++-
>>  3 files changed, 26 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..63ce97cc4cfef 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,14 @@ int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
>>  	struct xe_device *xe = to_xe_device(bo->ttm.base.dev);
>>  	int ret;
>>  
>> +	/*
>> +	 * Some modifiers require physical alignment of 64KiB VRAM pages;
>> +	 * require that the BO in those cases is created correctly.
>> +	 */
>> +	if (XE_IOCTL_DBG(xe, intel_fb_needs_64k_phys(mode_cmd->modifier[0]) &&
>> +			     !(bo->flags & XE_BO_FLAG_NEEDS_64K)))
>> +		return -EINVAL;
> 
> I don't think this is correct use of this macro as XE_BO_FLAG_NEEDS_64K
> is an internal flag we set and typically this macro is used to santize
> user input. An assert here or WARN would make more sense.
Ideally we'd use 'is bo created as scanout', but that flag can be set by fb_init too, so if the BO was used for normal 4-tiled before, then as CCS it would pass when it wouldn't be valid.

I could change it to bo_created_with_scanout_flag_on_64k_platform inline, but I doubt that's more readable. :)

Cheers,
~Maarten

  reply	other threads:[~2024-08-26 19:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 17:01 [PATCH v6 0/2] drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed Maarten Lankhorst
2024-08-26 17:01 ` [PATCH v6 1/2] drm/i915/display: Plane capability for 64k phys alignment Maarten Lankhorst
2024-08-27 16:26   ` Rodrigo Vivi
2024-08-27 18:59     ` Rodrigo Vivi
2024-08-26 17:01 ` [PATCH v6 2/2] drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed Maarten Lankhorst
2024-08-26 19:30   ` Matthew Brost
2024-08-26 19:42     ` Maarten Lankhorst [this message]
2024-08-27  3:11       ` Matthew Brost
2024-08-27  6:43         ` Maarten Lankhorst
2024-08-27 16:00           ` Matthew Brost
2024-08-27 16:23   ` Rodrigo Vivi
2024-08-26 18:57 ` ✓ CI.Patch_applied: success for drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed. (rev3) Patchwork
2024-08-26 18:58 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-26 19:00 ` ✓ CI.KUnit: success " Patchwork
2024-08-26 19:14 ` ✓ CI.Build: " Patchwork
2024-08-26 19:16 ` ✓ CI.Hooks: " Patchwork
2024-08-26 19:18 ` ✗ CI.checksparse: warning " Patchwork
2024-08-26 19:39 ` ✗ Fi.CI.CHECKPATCH: warning for drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed. (rev2) Patchwork
2024-08-26 19:39 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-08-26 19:43 ` ✓ CI.BAT: success for drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed. (rev3) Patchwork
2024-08-26 19:46 ` ✓ Fi.CI.BAT: success for drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed. (rev2) Patchwork
2024-08-27  1:44 ` ✗ CI.FULL: failure for drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed. (rev3) Patchwork
2024-08-27 15:29 ` ✓ Fi.CI.IGT: success for drm/xe: Align all VRAM scanout buffers to 64k physical pages when needed. (rev2) 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=361abc93-0246-4f21-b235-4e0699682ef3@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=juha-pekka.heikkila@intel.com \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.