R Rob Clark #
Message details and related content
On Fri, Aug 9, 2013 at 12:15 PM, Tom Cooksey [off-list ref] wrote:
Hi Daniel, Rob. Thank you both for your reviews - greatly appreciated!quoted
quoted
quoted
Known issues: * It still includes code to use KDS, which is not going upstream.review's on <http://lists.freedesktop.org/archives/dri-devel/2013- July/042462.html> can't hurt although you might consider submitting a reduced functionality driver w/ KDS bits removed in the mean time.. then when the fence stuff is merged it is just an incremental patch rather than a whole driver ;-)Yeah, I think the KDS bits and comments need to go first before merginge.Right, as I expected really. Though as I said we'll probably wait for fences to land and switch over to that before asking for it to be merged. A pl111 KMS driver with neither KDS nor implicit fences is useless to us. Having said that, if someone else would have a use for a fence/KDS-less pl111 KMS driver, please let me know!
well, it would make it easier to review the patches adding fence
support if it was on top of basic KMS support. So there still is some
benefit to a fence-less pl111, even if it is just for purposes of git
history and patch review ;-)
quoted
quoted
quoted
+/* + * Number of flips allowed in flight at any one time. Any more + * flips requested beyond this value will cause the caller to + * block until earlier flips have completed. + * + * For performance reasons, this must be greater than the number + * of buffers used in the rendering pipeline. Note that the + * rendering pipeline can contain different types of buffer, e.g.: + * - 2 final framebuffers + * - >2 geometry buffers for GPU use-cases + * - >2 vertex buffers for GPU use-cases + * + * For example, a system using 5 geometry buffers could have 5 + * flips in flight, and so NR_FLIPS_IN_FLIGHT_THRESHOLD must be + * 5 or greater. + * + * Whilst there may be more intermediate buffers (such as + * vertex/geometry) than final framebuffers, KDS is used to + * ensure that GPU rendering waits for the next off-screen + * buffer, so it doesn't overwrite an on-screen buffer and + * produce tearing. + */ +fwiw, this is at least different from how other drivers do triple (or > double) buffering. In other drivers (intel, omap, and msm/freedreno, that I know of, maybe others too) the xorg driver dri2 bits implement the double buffering (ie. send flip event back to client immediately and queue up the flip and call page-flip after the pageflip event back from kernel. I'm not saying not to do it this way, I guess I'd like to hear what other folks think. I kinda prefer doing this in userspace as it keeps the kernel bits simpler (plus it would then work properly on exynosdrm or other kms drivers).Yeah, if this is just a sw queue then I don't think it makes sense to have it in the kernel. Afaik the current pageflip interface drm exposes allows one oustanding flip only, and you _must_ wait for
well, this is really only an issue if you are so loaded that you don't get a chance to schedule for ~16ms.. which is pretty long time. If you are triple buffering, it should not end up in the critical path (since the gpu already has the 3rd buffer to start on the next frame). And, well, if you do it all in the kernel you probably need to toss things over to a workqueue anyways.
If we were to move to a user-space queue, I think we have something like this: DRI2SwapBuffers - drm_mode_page_flip to buffer B DRI2SwapBuffers - queue page flip to buffer A in DDX ... v_sync! (at this point buffer B is scanned out) - release buffer A's KDS resource/signal buffer A's fence - queued GPU job to render next frame to buffer A scheduled on HW - Send page flip event to X ... GPU interrupt! (at this point buffer A is ready to be scanned out) - Release buffer A's KDS resource/signal buffer A's fence - but nothing is waiting on it.... ... X gets scheduled, runs page flip handler - drm_mode_page_flip to buffer A - buffer A's address written to scanout register, takes effect on next v_sync. So here, X must get scheduled again after processing the second DRI2SwapBuffers in order to have the next frame displayed. This increases the likely-hood that we're not able to write the address of buffer A to the display HW's scan-out buffer in time to catch the next v_sync, especially on a loaded system. Anyway, I think that's our rational for keeping the queue in kernel space, but I don't see there's much value in queuing more than 2 page flips in kernel space.quoted
Ofc if your hardware as a hw-based flip queue (maybe even with frame targets) that's a different matter, but currently we don't have a drm interface to expose this. I'd say for merging the basic driver first we should go with the existing simple pageflip semantics.
fwiw, it should fail, not when you create the (at least for most drivers) but when you try to attach it to a plane or crtc. If we had primary plane's in drm core, we could do a bit better error checking in the core and bail out on fb creation for a format that no crtc/plane could scanout. BR, -R
Thanks again!! Cheers, Tom