Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: Matthew Auld <matthew.auld@intel.com>,
	intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/xe: store bind time pat index to xe_bo
Date: Tue, 30 Jan 2024 21:16:10 +0200	[thread overview]
Message-ID: <1c8cce00-8f43-4a19-97a7-760f0525a197@gmail.com> (raw)
In-Reply-To: <87f6ed0b-0fe2-4cbb-ae77-bdcfdd687ccc@intel.com>

On 29.1.2024 13.33, Matthew Auld wrote:
> On 26/01/2024 21:08, Juha-Pekka Heikkila wrote:
>> Store pat index from xe_vma to xe_bo and check if bo was pinned
>> as framebuffer and verify pat index is not changing for pinned
>> framebuffers.
>>
>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>> ---
>>   drivers/gpu/drm/xe/xe_pt.c | 23 +++++++++++++++++++----
>>   1 file changed, 19 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
>> index de1030a47588..0a5d7c7543b1 100644
>> --- a/drivers/gpu/drm/xe/xe_pt.c
>> +++ b/drivers/gpu/drm/xe/xe_pt.c
>> @@ -1208,10 +1208,11 @@ __xe_pt_bind_vma(struct xe_tile *tile, struct 
>> xe_vma *vma, struct xe_exec_queue
>>       struct dma_fence *fence;
>>       struct invalidation_fence *ifence = NULL;
>>       struct xe_range_fence *rfence;
>> +    struct xe_bo *bo = xe_vma_bo(vma);
>>       int err;
>>       bind_pt_update.locked = false;
>> -    xe_bo_assert_held(xe_vma_bo(vma));
>> +    xe_bo_assert_held(bo);
>>       xe_vm_assert_held(vm);
>>       vm_dbg(&xe_vma_vm(vma)->xe->drm,
>> @@ -1252,8 +1253,22 @@ __xe_pt_bind_vma(struct xe_tile *tile, struct 
>> xe_vma *vma, struct xe_exec_queue
>>           return ERR_PTR(-ENOMEM);
>>       }
>> +    /*
>> +     * BO which has XE_BO_SCANOUT_BIT set and was pinned as framebuffer
>> +     * before with different PAT index cannot be bound with different 
>> PAT
>> +     * index. This is to prevent switching CCS on/off from framebuffers
>> +     * on the fly.
>> +     */
>> +    if (bo) {
>> +        if (bo->flags & XE_BO_SCANOUT_BIT && bo->pat_index_scanout &&
> 
> Note that pat_index = 0 is usually a valid index...
> 
>> +            bo->pat_index_scanout != vma->pat_index)
>> +            return ERR_PTR(-EINVAL);
>> +
>> +        bo->pat_index = vma->pat_index;
>> +    }
> 
> ...what about something like:
> 
> if (bo.has_sealed_pat_index && bo.sealed_pat_index != vma->pat_index)
>      return ERR_PTR();
> else if (SCANOUT) {
>      bo.has_sealed_pat_index = true;
>      bo.sealed_pat_index = vma->pat_index;
> }
> 
> Also, this and the previous patch should probably be squashed together? 
> Other question is if we should only apply this on xe2?

Hi Matthew, thanks for the comments. I went ahead with making 
has_sealed_pat_index and it did make things much more clean. It's good 
idea, thanks. I'll soon send new version. Here I didn't go limit this to 
xe2 as the limit is coming from framebuffer code, if there come other 
use for this pat index sealing it doesn't need to be about xe2 on this part.

> 
>> +
>>       fence = xe_migrate_update_pgtables(tile->migrate,
>> -                       vm, xe_vma_bo(vma), q,
>> +                       vm, bo, q,
>>                          entries, num_entries,
>>                          syncs, num_syncs,
>>                          &bind_pt_update.base);
>> @@ -1287,8 +1302,8 @@ __xe_pt_bind_vma(struct xe_tile *tile, struct 
>> xe_vma *vma, struct xe_exec_queue
>>                      DMA_RESV_USAGE_KERNEL :
>>                      DMA_RESV_USAGE_BOOKKEEP);
>> -        if (!xe_vma_has_no_bo(vma) && !xe_vma_bo(vma)->vm)
>> -            dma_resv_add_fence(xe_vma_bo(vma)->ttm.base.resv, fence,
>> +        if (!xe_vma_has_no_bo(vma) && !bo->vm)
>> +            dma_resv_add_fence(bo->ttm.base.resv, fence,
>>                          DMA_RESV_USAGE_BOOKKEEP);
>>           xe_pt_commit_bind(vma, entries, num_entries, rebind,
>>                     bind_pt_update.locked ? &deferred : NULL);


  reply	other threads:[~2024-01-30 19:17 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 [this message]
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
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=1c8cce00-8f43-4a19-97a7-760f0525a197@gmail.com \
    --to=juhapekka.heikkila@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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