OpenWFD Usage Guidelines
- The macro
WFD_WFDEXT_PROTOTYPES
must be defined before including thewfd.h
andwfdext.h
headers. - To clear the contents on a
WFDPipeline
(performing a null flip),wfdBindSourceToPipeline
must be called with0
as the argument forWFDSource
before callingwfdDeviceCommit
on theWFDPipeline
. This is demonstrated in theopenwfd_nvsci_sample
application present in the SDK. - During the deinitialization of OpenWFD applications, you must follow these steps:
- Perform a null flip on all
WFDPorts
andWFDPipelines
that were previously bound to aWFDSource
.- If nonblocking commits are being used and
WFD_PIPELINE_POSTFENCE_SCANOUT_BEGIN_NVX
is set toWFD_TRUE
, the post-flip fence of the null flip commit should be waited on. - If nonblocking commits are being used and
WFD_PIPELINE_POSTFENCE_SCANOUT_BEGIN_NVX
is set toWFD_FALSE
, the post-flip fence of thewfdDeviceCommit
call before the null flip commit should be waited on.
- If nonblocking commits are being used and
- Destroy all
WFDSource
objects by invokingwfdDestroySource
on them only after all null flip commits are complete. BlockingwfdDeviceCommit
calls ensures that the null flip is complete when thewfdDeviceCommit
call returns. For nonblockingwfdDeviceCommit
calls, synchronization must be handled by the OpenWFD client as described previously. - Destroy all
WFDPipeline
andWFDPort
objects by usingwfdDestroyPipeline
andwfdDestroyPort
, respectively, before finally destroying theWFDDevice
object usingwfdDestroyDevice
.
- Perform a null flip on all
- For committing to multiple
WFDPipeline
handles bound to the sameWFDPort
, it is recommended to callwfdDeviceCommit
* withWFDCommitType
set toWFD_COMMIT_ENTIRE_PORT
. - When you use
WFD_COMMIT_ENTIRE_PORT
in awfdDeviceCommit
call, all theWFDPipeline
objects part of the commit must either have a surface bound(normal flip) or have no surfaces bound (null flip). A mix of normal and a null flip in oneWFD_COMMIT_ENTIRE_PORT
wfdDeviceCommit
call is not allowed due to a limitation on the NvDisplay resource manager. To ensure that any errors are caught, the OpenWFD APIwfdGetError
must be invoked after calls to the following OpenWFD APIs that take in aWFDDevice
handle as one of the inputs and return void:- wfdDeviceCommit
- wfdDeviceCommitWithNvSciSyncFenceNVX
- wfdDestroyPort
- wfdSetPortMode
- wfdGetPortAttrib{iv/fv}
- wfdSetPortAttrib{i/v/iv/fv}
- wfdBindPipelineToPort
- wfdDestroyPipeline
- wfdDestroySource
- wfdBindSourceToPipeline
- wfdGetPipelineAttrib{iv/fv}
- wfdSetPipelineAttrib{i/v/iv/fv}
-
When flipping to display, you should use a minimum of two
WFDSource
handles (double buffering) to prevent tearing or corruption.For more details, see section 8.1 in the OpenWF Display Specification.
-
The following prerequisites must be fulfilled for use cases to suspend to RAM (SC7 mode):
- Before entering suspend-to-RAM (SC7) mode, it is recommended to perform a null flip to display.
- To exit SC7 mode, a
modeset
must be performed before flipping to display.
- On Linux platforms, the following restriction applies when you invoke
wfdDeviceCommit
orwfdDeviceCommitWithNvSciSyncFenceNVX
:- A main
WFDPipeline
of aWFDPort
refers to the WFD pipeline that is represented by the first WFD pipeline ID returned bywfdEnumeratePipelines
. An overlayWFDPipeline
refers to the WFD pipelines represented by the remaining WFD pipeline IDs enumerated bywfdEnumeratePipelines
. On Linux, calling thewfdDeviceCommit
orwfdDeviceCommitWithNvSciSyncFenceNVX
API involving the overlay WFD pipelines is supported only if the mainWFDPipeline
already has aWFDSource
bound. Similarly, null flip commit on main WFD pipelines is only supported when all overlay WFD pipelines are also bound to null surfaces.
- A main
- To minimize flip latency, you should set
WFD_PIPELINE_POSTFENCE_SCANOUT_BEGIN_NVX
toWFD_FALSE
.