Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: Maarten Lankhorst <dev@lankhorst.se>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Jani Nikula <jani.nikula@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 2/2] drm/xe/display: Make panic support work on vram.
Date: Sat, 18 Oct 2025 00:18:19 +0200	[thread overview]
Message-ID: <ade5c380-2f43-4c3e-b63e-75d6f384ba6a@redhat.com> (raw)
In-Reply-To: <5e285430-fd5e-4cd1-82b1-2b84b4eb3808@lankhorst.se>

On 17/10/2025 17:35, Maarten Lankhorst wrote:
> Hey,
> 
> Thanks for resubmitting, wnat me to push it?

Yes, please.

-- 

Jocelyn>
> Best regards,
> ~Maarten Lankhorst
> 
> Den 2025-10-16 kl. 09:52, skrev Jocelyn Falempe:
>> From: Maarten Lankhorst <dev@lankhorst.se>
>>
>> Add a special path for VRAM using xe_res iterators to ensure a panic
>> screen is shown on VRAM as well.
>>
>> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
>> Acked-by: Jocelyn Falempe <jfalempe@redhat.com>
>> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
>> ---
>>   drivers/gpu/drm/xe/display/xe_panic.c | 50 +++++++++++++++++++--------
>>   1 file changed, 36 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/display/xe_panic.c b/drivers/gpu/drm/xe/display/xe_panic.c
>> index f32b23338331..df663286092a 100644
>> --- a/drivers/gpu/drm/xe/display/xe_panic.c
>> +++ b/drivers/gpu/drm/xe/display/xe_panic.c
>> @@ -8,20 +8,23 @@
>>   #include "intel_fb.h"
>>   #include "intel_panic.h"
>>   #include "xe_bo.h"
>> +#include "xe_res_cursor.h"
>>   
>>   struct intel_panic {
>> -	struct page **pages;
>> +	struct xe_res_cursor res;
>> +	struct iosys_map vmap;
>> +
>>   	int page;
>> -	void *vaddr;
>>   };
>>   
>>   static void xe_panic_kunmap(struct intel_panic *panic)
>>   {
>> -	if (panic->vaddr) {
>> -		drm_clflush_virt_range(panic->vaddr, PAGE_SIZE);
>> -		kunmap_local(panic->vaddr);
>> -		panic->vaddr = NULL;
>> +	if (!panic->vmap.is_iomem && iosys_map_is_set(&panic->vmap)) {
>> +		drm_clflush_virt_range(panic->vmap.vaddr, PAGE_SIZE);
>> +		kunmap_local(panic->vmap.vaddr);
>>   	}
>> +	iosys_map_clear(&panic->vmap);
>> +	panic->page = -1;
>>   }
>>   
>>   /*
>> @@ -46,15 +49,29 @@ static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int
>>   	new_page = offset >> PAGE_SHIFT;
>>   	offset = offset % PAGE_SIZE;
>>   	if (new_page != panic->page) {
>> -		xe_panic_kunmap(panic);
>> +		if (xe_bo_is_vram(bo)) {
>> +			/* Display is always mapped on root tile */
>> +			struct xe_vram_region *vram = xe_bo_device(bo)->mem.vram;
>> +
>> +			if (panic->page < 0 || new_page < panic->page) {
>> +				xe_res_first(bo->ttm.resource, new_page * PAGE_SIZE,
>> +					     bo->ttm.base.size - new_page * PAGE_SIZE, &panic->res);
>> +			} else {
>> +				xe_res_next(&panic->res, PAGE_SIZE * (new_page - panic->page));
>> +			}
>> +			iosys_map_set_vaddr_iomem(&panic->vmap,
>> +						  vram->mapping + panic->res.start);
>> +		} else {
>> +			xe_panic_kunmap(panic);
>> +			iosys_map_set_vaddr(&panic->vmap,
>> +					    ttm_bo_kmap_try_from_panic(&bo->ttm,
>> +								       new_page));
>> +		}
>>   		panic->page = new_page;
>> -		panic->vaddr = ttm_bo_kmap_try_from_panic(&bo->ttm,
>> -							  panic->page);
>> -	}
>> -	if (panic->vaddr) {
>> -		u32 *pix = panic->vaddr + offset;
>> -		*pix = color;
>>   	}
>> +
>> +	if (iosys_map_is_set(&panic->vmap))
>> +		iosys_map_wr(&panic->vmap, offset, u32, color);
>>   }
>>   
>>   struct intel_panic *intel_panic_alloc(void)
>> @@ -68,6 +85,12 @@ struct intel_panic *intel_panic_alloc(void)
>>   
>>   int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
>>   {
>> +	struct intel_framebuffer *fb = (struct intel_framebuffer *)sb->private;
>> +	struct xe_bo *bo = gem_to_xe_bo(intel_fb_bo(&fb->base));
>> +
>> +	if (xe_bo_is_vram(bo) && !xe_bo_is_visible_vram(bo))
>> +		return -ENODEV;
>> +
>>   	panic->page = -1;
>>   	sb->set_pixel = xe_panic_page_set_pixel;
>>   	return 0;
>> @@ -76,5 +99,4 @@ int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
>>   void intel_panic_finish(struct intel_panic *panic)
>>   {
>>   	xe_panic_kunmap(panic);
>> -	panic->page = -1;
>>   }
> 


  reply	other threads:[~2025-10-17 22:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16  7:52 [PATCH v3 0/2] drm/xe/display: Make panic support work on vram Jocelyn Falempe
2025-10-16  7:52 ` [PATCH v3 1/2] drm/xe: Extract xe_bo_is_visible_vram Jocelyn Falempe
2025-10-16  7:52 ` [PATCH v3 2/2] drm/xe/display: Make panic support work on vram Jocelyn Falempe
2025-10-17 15:35   ` Maarten Lankhorst
2025-10-17 22:18     ` Jocelyn Falempe [this message]
2025-10-21 11:51       ` Maarten Lankhorst
2025-10-16  8:04 ` ✓ CI.KUnit: success for drm/xe/display: Make panic support work on vram. (rev3) Patchwork
2025-10-16  8:48 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-17  2:45 ` ✗ Xe.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=ade5c380-2f43-4c3e-b63e-75d6f384ba6a@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=maarten.lankhorst@linux.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