public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* Does display engine read contents from LLC of scanout buffer?
@ 2016-11-24 18:20 Weng, Chuanbo
  2016-11-24 19:07 ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Weng, Chuanbo @ 2016-11-24 18:20 UTC (permalink / raw)
  To: intel-gfx@lists.freedesktop.org


[-- Attachment #1.1: Type: text/plain, Size: 747 bytes --]

Hi all,
               I have a question of display (forgive me if it's too simple because I'm not familiar with display):

               My scenario is as below:
                              gbm_bo_create to create gbm_bo
                              Get its handle
                              drmModeAddFB to specify this bo as scanout buffer
                              do rendering to this bo by OpenCL(Beignet)
                              drmModePageFlip to do page flip

               Does display engine directly read contents from scanout buffer or read contents from LLC of this
scanout buffer?
               Environment:
                              SKL GT2, on console mode(no X).

Thanks,
Chuanbo Weng



[-- Attachment #1.2: Type: text/html, Size: 4456 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does display engine read contents from LLC of scanout buffer?
  2016-11-24 18:20 Does display engine read contents from LLC of scanout buffer? Weng, Chuanbo
@ 2016-11-24 19:07 ` Ville Syrjälä
  2016-12-07 11:30   ` Weng, Chuanbo
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2016-11-24 19:07 UTC (permalink / raw)
  To: Weng, Chuanbo; +Cc: intel-gfx@lists.freedesktop.org

On Thu, Nov 24, 2016 at 06:20:22PM +0000, Weng, Chuanbo wrote:
> Hi all,
>                I have a question of display (forgive me if it's too simple because I'm not familiar with display):
> 
>                My scenario is as below:
>                               gbm_bo_create to create gbm_bo
>                               Get its handle
>                               drmModeAddFB to specify this bo as scanout buffer
>                               do rendering to this bo by OpenCL(Beignet)
>                               drmModePageFlip to do page flip
> 
>                Does display engine directly read contents from scanout buffer or read contents from LLC of this
> scanout buffer?

The display engine sits between the LLC and main memory effectively, so
the answer is that it always reads directly from memory. When you make
a bo a scanout buffer the kernel will flush the caches and reconfigure
the PTEs to UC/WC so that subsequent rendering will hit memory directly.
And that also means you should never override potential scanout buffers
to WB via MOCS, and instead you should leave the choice up to the PTEs.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does display engine read contents from LLC of scanout buffer?
  2016-11-24 19:07 ` Ville Syrjälä
@ 2016-12-07 11:30   ` Weng, Chuanbo
  2016-12-07 14:09     ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Weng, Chuanbo @ 2016-12-07 11:30 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx@lists.freedesktop.org

Hi Ville,
	Thanks for your useful info.
	How about L3 cache? In my scenario, Beignet will use Read Write Data Port to write data (typed write) to bo.
So the cache path is L3 -> LLC -> memory. So only leave LLC cache ability the same as PTEs is not enough.
	In order to make data access efficient, I set L3 to WB. So is there a way to flush L3 cache to memory?

Thanks,
Chuanbo Weng

-----Original Message-----
From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com] 
Sent: Friday, November 25, 2016 3:07 AM
To: Weng, Chuanbo <chuanbo.weng@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] Does display engine read contents from LLC of scanout buffer?

On Thu, Nov 24, 2016 at 06:20:22PM +0000, Weng, Chuanbo wrote:
> Hi all,
>                I have a question of display (forgive me if it's too simple because I'm not familiar with display):
> 
>                My scenario is as below:
>                               gbm_bo_create to create gbm_bo
>                               Get its handle
>                               drmModeAddFB to specify this bo as scanout buffer
>                               do rendering to this bo by OpenCL(Beignet)
>                               drmModePageFlip to do page flip
> 
>                Does display engine directly read contents from scanout 
> buffer or read contents from LLC of this scanout buffer?

The display engine sits between the LLC and main memory effectively, so the answer is that it always reads directly from memory. When you make a bo a scanout buffer the kernel will flush the caches and reconfigure the PTEs to UC/WC so that subsequent rendering will hit memory directly.
And that also means you should never override potential scanout buffers to WB via MOCS, and instead you should leave the choice up to the PTEs.

--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does display engine read contents from LLC of scanout buffer?
  2016-12-07 11:30   ` Weng, Chuanbo
@ 2016-12-07 14:09     ` Ville Syrjälä
  2016-12-08  9:14       ` Weng, Chuanbo
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2016-12-07 14:09 UTC (permalink / raw)
  To: Weng, Chuanbo; +Cc: intel-gfx@lists.freedesktop.org

On Wed, Dec 07, 2016 at 11:30:37AM +0000, Weng, Chuanbo wrote:
> Hi Ville,
> 	Thanks for your useful info.
> 	How about L3 cache? In my scenario, Beignet will use Read Write Data Port to write data (typed write) to bo.
> So the cache path is L3 -> LLC -> memory. So only leave LLC cache ability the same as PTEs is not enough.
> 	In order to make data access efficient, I set L3 to WB. So is there a way to flush L3 cache to memory?

I don't recall. But actually caching in L3 is dangerous anyway since
IIRC L3 evictions can land in LLC despite the LLC cacheability being set
to UC/WT. Or at least there was a note stating that in bspec at some
point. So to be totally correct you should not use L3 either. Well, I
suppose you could use L3 as a RO cache, but sounds like you want to write
as well.

> 
> Thanks,
> Chuanbo Weng
> 
> -----Original Message-----
> From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com] 
> Sent: Friday, November 25, 2016 3:07 AM
> To: Weng, Chuanbo <chuanbo.weng@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] Does display engine read contents from LLC of scanout buffer?
> 
> On Thu, Nov 24, 2016 at 06:20:22PM +0000, Weng, Chuanbo wrote:
> > Hi all,
> >                I have a question of display (forgive me if it's too simple because I'm not familiar with display):
> > 
> >                My scenario is as below:
> >                               gbm_bo_create to create gbm_bo
> >                               Get its handle
> >                               drmModeAddFB to specify this bo as scanout buffer
> >                               do rendering to this bo by OpenCL(Beignet)
> >                               drmModePageFlip to do page flip
> > 
> >                Does display engine directly read contents from scanout 
> > buffer or read contents from LLC of this scanout buffer?
> 
> The display engine sits between the LLC and main memory effectively, so the answer is that it always reads directly from memory. When you make a bo a scanout buffer the kernel will flush the caches and reconfigure the PTEs to UC/WC so that subsequent rendering will hit memory directly.
> And that also means you should never override potential scanout buffers to WB via MOCS, and instead you should leave the choice up to the PTEs.
> 
> --
> Ville Syrjälä
> Intel OTC

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does display engine read contents from LLC of scanout buffer?
  2016-12-07 14:09     ` Ville Syrjälä
@ 2016-12-08  9:14       ` Weng, Chuanbo
  0 siblings, 0 replies; 5+ messages in thread
From: Weng, Chuanbo @ 2016-12-08  9:14 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx@lists.freedesktop.org

I'm interesting in how mesa set related cache ability.
Take kmscube(https://github.com/robclark/kmscube.git) as an example, mesa and drm do similar things:
	gbm_surface_create to create gbm_surface
	eglCreateWindowSurface to create EGLSurface
	eglMakeCurrent to bind context to EGLSurface
	do rendering using glsl
	eglSwapBuffers
	drmModePageFlip to do page flip

Because mesa use Render Cache Data Port to render to framebuffer, so the cache path is: Render Cache -> LLC -> Memory.
How can we control cache ability of render cache (MOCS can control L3 & LLC, but not render cache)?
Or just flush render cache before display by kernel or mesa?

Thanks,
Chuanbo Weng

-----Original Message-----
From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com] 
Sent: Wednesday, December 7, 2016 10:10 PM
To: Weng, Chuanbo <chuanbo.weng@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] Does display engine read contents from LLC of scanout buffer?

On Wed, Dec 07, 2016 at 11:30:37AM +0000, Weng, Chuanbo wrote:
> Hi Ville,
> 	Thanks for your useful info.
> 	How about L3 cache? In my scenario, Beignet will use Read Write Data Port to write data (typed write) to bo.
> So the cache path is L3 -> LLC -> memory. So only leave LLC cache ability the same as PTEs is not enough.
> 	In order to make data access efficient, I set L3 to WB. So is there a way to flush L3 cache to memory?

I don't recall. But actually caching in L3 is dangerous anyway since IIRC L3 evictions can land in LLC despite the LLC cacheability being set to UC/WT. Or at least there was a note stating that in bspec at some point. So to be totally correct you should not use L3 either. Well, I suppose you could use L3 as a RO cache, but sounds like you want to write as well.

> 
> Thanks,
> Chuanbo Weng
> 
> -----Original Message-----
> From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
> Sent: Friday, November 25, 2016 3:07 AM
> To: Weng, Chuanbo <chuanbo.weng@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] Does display engine read contents from LLC of scanout buffer?
> 
> On Thu, Nov 24, 2016 at 06:20:22PM +0000, Weng, Chuanbo wrote:
> > Hi all,
> >                I have a question of display (forgive me if it's too simple because I'm not familiar with display):
> > 
> >                My scenario is as below:
> >                               gbm_bo_create to create gbm_bo
> >                               Get its handle
> >                               drmModeAddFB to specify this bo as scanout buffer
> >                               do rendering to this bo by OpenCL(Beignet)
> >                               drmModePageFlip to do page flip
> > 
> >                Does display engine directly read contents from 
> > scanout buffer or read contents from LLC of this scanout buffer?
> 
> The display engine sits between the LLC and main memory effectively, so the answer is that it always reads directly from memory. When you make a bo a scanout buffer the kernel will flush the caches and reconfigure the PTEs to UC/WC so that subsequent rendering will hit memory directly.
> And that also means you should never override potential scanout buffers to WB via MOCS, and instead you should leave the choice up to the PTEs.
> 
> --
> Ville Syrjälä
> Intel OTC

--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-08  9:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 18:20 Does display engine read contents from LLC of scanout buffer? Weng, Chuanbo
2016-11-24 19:07 ` Ville Syrjälä
2016-12-07 11:30   ` Weng, Chuanbo
2016-12-07 14:09     ` Ville Syrjälä
2016-12-08  9:14       ` Weng, Chuanbo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox