Get started
Prerequisites
Vega apps can consume this package through the Vega SDK. For instructions on how to install the Vega SDK, see Vega SDK Setup.Setup
The Vega Graphics Turbo Module is provided by thekepler-graphics npm package. Add the following library dependency to the dependencies section of your package.json file.
Permissions
The display API consists of both get methods and set methods. Apps that use the set methods viaDisplayManager class require the security privilege com.amazon.graphics.privilege.display.manager it their app’s manifest.toml file under [needs] section as shown below.
com.amazon.graphics.privilege.display.manager allows the following set of operations:
- Changing current screen resolution and refresh rate to one of the supported values.
- Changing other display properties like color depth, color format, HDR mode, and ALLM.
Usage
The following is a list of supported use cases:- Listening to display hotplug events.
- Querying supported screen resolutions (width x height) and refresh rates of the display.
- Querying supported HDR types/Transfer Functions, maximum HDCP level, ccreen density (DPI) of the display.
- Querying currently active screen resolution, refresh rate, color depth, color rormat, HDR mode, Low Latency Mode (ALLM) for the display.
- Listening to change events for the display properties.
Import the required components
To use the Vega Graphics API, import the required components from@amazon-devices/kepler-graphics.
Import he interfaces and types should the kepler-graphics package
in a source code file as shown below:
Check display status
To check if a display is connected to the device, use the following method.Display hotplug events
Get callback events when display panels connect or disconnect. TheIDisplayControllerListener.onAddDisplay() and
IDisplayControllerListener.onRemoveDisplay() callback methods provide those events as shown below.
Get the current screen resolution and refresh rate
TheDisplay.getCurrentConfig() method returns the currently active configuration as an IDisplayConfig object. The members of the IDisplayConfig object provide the screen resolution (width x height), screen density, supported refresh rates, and more.
Check HDR support
The following example code shows how to check whether the display and the device suport HDR.Display.getAllSupportedConfigs() might list other HDR types. You can only use those HDR types when the current active configuration changes to that particular display configuration through DisplayManager.requestConfigChange() method.
Query other display properties
Listen for change events
The following code example shows apps can useIDisplayListener callback interface to listen for changes to the following:
- Display properties like screen resolution
- Refresh rate, color depth/space
- HDCP level
- HDR mode
- Low Latency Mode
FAQs
Why is a display supported HDR type not listed in the IDisplayConfig.supportedHdrType array?
Why is a display supported HDR type not listed in the IDisplayConfig.supportedHdrType array?
IDisplayConfig.supportedHdrType does not contain it.How to unsubscribe for the listener callbacks?
How to unsubscribe for the listener callbacks?
Display.addDisplayListener() and DisplayController.addListener() return a ISubscription object.
You use the object to unsubscribe the listener by calling the unsubscribe() method. See the following code example.Why does supportedHdrType return multiple duplicated values like
Why does supportedHdrType return multiple duplicated values like
HdrType.NONE.Modules
- index
- turbo-modules/AmazonGraphicsTurboModule
- turbo-modules/AmazonGraphicsTurboModule
- turbo-modules/Display
- turbo-modules/Display
- turbo-modules/DisplayController
- turbo-modules/DisplayController
- turbo-modules/DisplayManager
- turbo-modules/DisplayManager
- types
- types
- types/GraphicsTypes
- types/GraphicsTypes

