"Fixes" for page flipping under PRIME on AMD & nouveau

Michel Dänzer michel at daenzer.net
Thu Aug 18 02:23:16 UTC 2016


On 18/08/16 01:12 AM, Mario Kleiner wrote:
> 
> Intel as display gpu + nouveau for render offload worked nicely
> on intel-ddx with page flipping, proper timing, dmabuf fence sync
> and all.

How about with AMD instead of nouveau in this case?


> Turns out that prime + page flipping currently doesn't work
> on nouveau and amd. The first offload rendered images from
> the imported dmabufs show up properly, but then the display
> is stuck alternating between the first two or three rendered
> frames.
> 
> The problem is that during the pageflip ioctl we pin the
> dmabuf into VRAM in preparation for scanout, then unpin it
> when we are done with it at next flip, but the buffer stays
> in the VRAM memory domain.

Sounds like you found a bug here: BOs which are being shared between
different GPUs should always be pinned to GTT, moving them to VRAM (and
consequently the page flip) should fail.

The latest versions of DCE support scanning out from GTT, so that might
be a good solution at least for Carrizo and newer APUs, not sure it
makes sense for dGPUs though.


> AMD, as tested with dual Radeon HD-5770 seems to be fast as prime
> importer/display gpu, but very slow as prime exporter/render offload,
> e.g., taking 16 msecs to get a 1920x1080 framebuffer into RAM. Seems
> that Mesa's blitImage function is the slow bit here. On r600 it seems
> to draw a textured triangle strip to detile the gpu renderbuffer and
> copy it into GTT. As drawing a textured fullscreen quad is normally
> much faster, something special seems to be going on there wrt. DMA?

Maybe the rasterization as two triangles results in bad PCIe bandwidth
utilization. Using the asynchronous DMA engine for these transfers would
probably be ideal, but having the 3D engine rasterize a single rectangle
(either using the rectangle primitive or a large triangle with scissor)
might already help.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer



More information about the dri-devel mailing list