OpenWF Display Configuration Developers Guide
OpenWF Display Configuration Developers Guide
QNX, QNX CAR, Momentics, Neutrino, and Aviage are trademarks of BlackBerry
Limited, which are registered and/or used in certain jurisdictions, and used
under license by QNX Software Systems Limited. All other trademarks belong
to their respective owners.
Table of Contents
About OpenWF Display Configuration ..........................................................................................5
Typographical conventions .................................................................................................6
Technical support .............................................................................................................8
wfdcfg_port_get_extension() .............................................................................................53
wfdcfg_power_mode ........................................................................................................54
wfdcfg_timing ................................................................................................................55
About OpenWF Display Configuration
If you are integrating a new display, you must configure and provide the parameters
of your display based on its specifications via the OpenWF Display Configuration API
(Wfdcfg Library).
This table may help you find what you need in this guide:
How to get the source code Getting the source code (p. 15)
How to build the Wfdcfg library Building the Wfdcfg library (p. 27)
How to configure your display Configuring Screen for your display (p.
27)
Typographical conventions
Throughout this manual, we use certain typographical conventions to distinguish
technical terms. In general, the conventions we use conform to those found in IEEE
POSIX publications.
Reference Example
Commands make
Constants NULL
Parameters parm1
You'll find the Other... menu item under Perspective Show View.
Cautions tell you about commands or procedures that may have unwanted
or undesirable side effects.
Technical support
Technical assistance is available for all supported products.
To obtain technical support for any QNX product, visit the Support area on our website
(www.qnx.com). You'll find a wide range of support options, including community
forums.
If you are integrating a new display, you must configure and provide the parameters
of your display based on its specifications via the OpenWF Display Configuration API
(Wfdcfg Library).
This table may help you find what you need in this guide:
How to get the source code Getting the source code (p. 15)
How to build the Wfdcfg library Building the Wfdcfg library (p. 27)
How to configure your display Configuring Screen for your display (p.
27)
This guide is intended to describe how to integrate a new display by setting the
appropripate parameters based on your display specifications.
or
• QNX Software Development Platform 6.5.0 with Service Pack 1 and a recent,
compatible Screen package
The Wfdcfg library provides the modes and attributes of your display hardware to your
display driver and Screen.
Wfdcfg Library
Your display driver (WFD driver) is the primary user of the Wfdcfg library, but the
composition manager component in Screen also uses the modes and attributes from
the Wfdcfg library.
The composition manager accesses the OpenWFD modes and attributes from the
Wfdcfg library through the WFD driver. Based on this information, the composition
manager tells the WFD driver which OpenWFD mode to use.
For the most part, it'll be your WFD driver that interfaces with the Wfdcfg library.
Examples of what your driver can do through the Wfdcfg library are:
What your WFD driver can control or provide through the Wfdcfg library is dependent
on your specific display hardware.
Screen
Composition Manager
OpenWFD modes?
Display
hardware
Some WFD drivers also probe the display hardware for extended display identification
data (EDID). This information is consolidated and provided to the composition manager.
The files from the compressed Wfdcfg archive are extracted onto your host.
The source code for the Wfdcfg library is provided as a compressed archive (.tgz file
format). This compressed archive usually contains a single .tar archive.
src-lib-wfdcfg-platform-build_date-branch-build_number.file_format
file_format
• tgz for the compressed archive
• tar archive
Extracting files
You can extract the files from the Wfdcfg archive to a directory of your choice. The
archive is self-contained and can be installed anywhere. The directory where you
extract the Wfdcfg archive will be referred to as wfdcfg_working_dir.
1. Go to your wfdcfg_working_dir.
cd wfdcfg_working_dir
2. Extract the files from the Wfdcfg archive using the tar command.
For more information on the tar command, refer to the Utilities Reference.
If you are on a Windows development host, and you are not using the tar
utility, ensure that you are using a compatible file archiver that properly
handles symbolic links.
You can manually copy the appropriate files if you find an issue with your
symbolic links. For a list of symbolic links in the archive, you can use a
command similar to this:
After you've extracted the files from the wfdcfg archive, the resulting directory structure
looks similar to this:
wfdcfg_working_dir
src
BUILD.txt
Makefile
qconf-override.mk
stage-sh
Makefile lib
Makefile wfdcfg
wfdqnx
wfdcfg.h
You'll update the files wfdcfg.h and wfdcfg.c to add extensions that are specific
for your display hardware. Refer to Updating Wfdcfg source (adding extensions) (p.
23) for more information on how to modify the Wfdcfg library.
BUILD.txt provides you with some simple directions on how to build your source.
stage-sh is a helper script that creates a stage area from where you can build your
source. Refer to Building the Wfdcfg library (p. 27) for information on how to build
the Wfdcfg library.
The timing parameters are related to the horizontal and vertical blanking intervals.
These intervals refer to a part of the process of displaying images on a computer
monitor or television screen via raster scanning.
The horizontal blanking interval occurs once per line of image information and is
composed of: a horizontal sync pulse, a front porch, and a back porch.
The vertical blanking interval is the time betweeen the end of an active image and the
start of the next; it is composed of: a vertical sync pulse, a front porch, and a back
porch.
Timing parameters
You'll define the timing parameters based on your display hardware using the wfd
cfg_timing structure in Wfdcfg. You'll need the following timing parameters to be
set:
pixel_clock_kHz
The frequency (in kHz) that pixels are transmitted at. The clock remains
active throughout the entire horizontal and vertical blanking intervals, even
when pixels are not being transmitted.
hpixels
The width (in pixels) of the display. Together with vlines, hpixels
indicates the resolution of the display.
vlines
The height (in lines) of the display. Together with hpixels, vlines
indicates the resolution of the display.
hsw
The width of the horizontal synchronization pulse. This width refers to the
amount of time that the horizontal sync pulse is active. The horizontal sync
pulse is transmitted at the beginning of each video scanline. Its purpose is
to keep start of the horizontal video scanline in the display in sync with the
video source that created it. That is, when the scanline reaches the right
side of your display, the horizontal sync pulses indicates that it is time to
return and start the next scanline at the left side of the display again. The
width of this horizontal synchronization pulse is measured in pixels.
vsw
The vertical synchronization pulse width. This width refers to the amount of
time that the vertical sync pulse is active. The vertical sync pulse is
transmitted at the beginning of each field and frame. Its purpose is to ensure
that the display scan starts at the top of the picture at the right time. That
is, when the last scanline on the bottom of the display has been reached,
the display must return and start the next scanline back at the top of the
screen for the next vertical cycle. The width of this vertical synchronization
pulse is measured in lines.
hfp
The horizontal front porch is the amount of time between the end of the
horizontal active time and the start of the horizontal synchronization pulse.
This time allows for the image to settle and to prevent the image from
interfering with sync extraction. The horizontal front porch is measured in
pixels.
vfp
The vertical front porch is the amount of time between the end of the vertical
active time and the start of the vertical synchronization pulse. The vertical
front porch is measured in lines.
hbp
The horizontal back porch is the amount of time between the end of the
horizontal sync pulse and the start of the next horizontal active time. The
horizontal back porch is measured in pixels.
vbp
The vertical back porch is the amount of time between the end of the vertical
sync pulse and the start of the next vertical active time. The vertical back
porch is measured in lines.
flags
The timing parameters that Wfdcfg requires are available in, or can be derived from,
the product specfication of your display hardware. Below is a table of typical timings
based on display resolutions and refresh rates:
Display pix hpix vlines hsw vsw hfp vfp hbp vbp
el_clock_kHz els
You'll need to configure these timing parameters, based on your product specification,
in your Wfdcfg source (wfdcfg.c) within a mode structure. The mode may also
include extensions, but the timing is the most important part. It's possible that in the
following circumstances, you may have multiple entries in your mode array:
For example,
struct mode {
const struct wfdcfg_timing timing;
const struct wfdcfg_keyval *ext_list;
};
// 1024x768 @ 60 Hz (CVT)
.timing = {
.pixel_clock_kHz = 63500,
.hpixels = 1024, .hfp= 48, .hsw=104, .hbp=152, // 1328 total
.vlines = 768, .vfp= 3, .vsw= 4, .vbp= 23, // 798 total
.flags = WFDCFG_INVERT_VSYNC,
},
.ext_list = NULL,
},
{
// 1280x1024 @ 60 Hz (CVT)
.timing = {
.pixel_clock_kHz = 109000,
.hpixels = 1280, .hfp= 88, .hsw=128, .hbp=216, // 1712 total
.vlines = 1024, .vfp= 3, .vsw= 7, .vbp= 29, // 1063 total
.flags = WFDCFG_INVERT_VSYNC,
},
.ext_list = NULL,
},
{
// 1080p @ 60 Hz (1920x1080)
.timing = {
.pixel_clock_kHz = 148500,
.hpixels = 1920, .hfp= 88, .hsw= 44, .hbp=148, // 2200 total
.vlines = 1080, .vfp= 4, .vsw= 5, .vbp= 36, // 1125 total
.flags = 0,
},
.ext_list = NULL,
},
{
// 720p @ 60 Hz (1280x720)
.timing = {
.pixel_clock_kHz = 74250,
.hpixels = 1280, .hfp=110, .hsw= 40, .hbp=220, // 1650 total
.vlines = 720, .vfp= 5, .vsw= 5, .vbp= 20, // 750 total
.flags = 0,
},
.ext_list = NULL,
},
{
// marks end of list
.timing = {.pixel_clock_kHz = 0},
},
};
You may want to update your Wfdcfg source if your display supports specific options
that you want to control.
For most part, other than the timing parameters, there's no need to update the Wfdcfg
source. However, some displays on some platforms may support specific options that
require extensions on the structures or implementation of callbacks. Not all display
drivers support the use of callback functions.
struct wfdcfg_keyval {
const char *key; /**< Identifier of extension */
long i; /**< Data associated to extension */
void *p; /**< Data associated to extension */
};
Usually, when there are extensions that are platform-specific, these extensions are
declared in a separate header file that is not wfdcfg.h. Conventionally, the header
file is named wfdcfg_platform.h where platform refers to the platform of your
target hardware.
Declaring extensions
If your display can support additional configuration or settings, then you'll declare
these extensions as constants in the source header file. Extensions can be added for:
• devices (wfdcfg_device)
• ports(wfdcfg_port)
• modes (wfdcfg_timing)
• mode lists (wfdcfg_mode_list)
Callback functions
/**
* Port initialisation. If this port extension exists, the WFD driver
* will call the given function when the port is created.
* .p (of is a pointer to a function of type wfdcfg_ext_fn_port_init_t
* (which returns EOK on success or another errno code on failure)
* .i must be zero
*/
#define WFDCFG_EXT_FN_PORT_INIT "port_init"
typedef int (wfdcfg_ext_fn_port_init_t)(struct wfdcfg_port*);
Attributes
/**
* The HSP clock frequency in kHz. This is a device extension.
* .p must be NULL
* .i gives the clock speed in kHz.
*/
#define WFDCFG_EXT_HSP_CLOCK_KHZ "hsp_clock_kHz"
/**
* Specifies the output format. This is a port extension.
* .p must be NULL
* .i is a value from enum imx5x_output_formats (default: RGB888)
*/
#define WFDCFG_EXT_OUTPUT_FORMAT "output_format"
enum imx5x_output_formats {
/* 24 bits (use for 18-bit SPWG too) */
WFDCFG_OUTPUT_FORMAT_RGB888 = 24,
/* 18 bits (LVDS) */
WFDCFG_OUTPUT_FORMAT_RGB666_SPWG18 = 19,
Defining extensions
Definitions of the extensions are usually added to the source file wfdcfg.c. However,
you can define them where you see fit, as long as you maintain binary compatibility.
It's generally expected that there are separate lists for the different types of extensions.
That is, you'll have one list for each of device, port, mode, and mode list extensions.
static int
port_init(struct wfdcfg_port *port)
{
(void)port;
return EOK;
}
After extracting the files from the Wfdcfg archive and modifying your source, you're
ready to rebuild the Wfdcfg library.
Remember that the directory where you extracted the Wfdcfg archive is referred to as
wfdcfg_working_dir.
1. From the command line on your development host, go to the directory where you
unzipped your Wfdcfg archive.
cd wfdcfg_working_dir
make clean
Your stage directory should now be populated with the library that you've just built.
A stage area is a directory location that mimics the local installation path(s) that you
would find under the QNX_TARGET variable of your development host. The stage area
is built up based on the content from the tree when make hinstall (headers) or
make install (binaries) is performed.
The stage area directory path is selected by setting the INSTALL_ROOT_nto makefile
variable to the base path where your headers and libraries are to be installed. You also
need to set the USE_INSTALL_ROOT macro. This macro tells the makefiles to search
the INSTALL_ROOT_nto directory tree when the compiler and linker are seaching
for headers and libraries. It is cumbersome to set these values each time you perform
an installation, so the build environment facilitates the setting of these variables
through the use of a single override makefile that is specified using the
QCONF_OVERRIDE environment variable.
You can use the stage-sh script that is included in the Wfdcfg archive to create a
stage area for you.
1. From the command line, go to your the directory where you unzipped your Wfdcfg
archive.
cd wfdcfg_working_dir
2. Run the provided script to create a stage area for building your source.
stage-sh
3. From within the shell created by stage-sh, ensure your environment is clean.
make clean
4. From within the shell created by stage-sh, use the make command to build.
The stage directory that was created by running the stage-sh script should now
be populated with the library that you've just built.
After you've completed updating and building your Wfdcfg library, you are ready to
rebuild your QNX IFS and transfer it to your target.
bsp_working_dir
hardware
boards
target
build
Figure 3: buildfile
/usr/lib/graphics/platform/libwfdcfg-sample.so=graphics/platform/libwfdcfg-sample.so
• $GRAPHICS_ROOT
• Your default library search path
make clean
make
For more information on building your QNX IFS, refer to Building Embedded Systems,
or to the BSP User Guide. The BSP User Guide that's specific to your target is available
from from our website, www.qnx.com.
From Building Embedded Systems, follow the instructions on how to transfer your
QNX IFS to your target.
In your configuration file (graphics.conf), on your target, you need to specify the
Wfdcfg library (or libraries) and any parameters related to your display device. In the
wfd device section, ensure that you have the appropriate libraries specified for your
display. For example,
You need to configure one wfd device section for each display you are using.
For more information on configuring Screen, refer to the Screen Developer's Guide.
Restarting Screen
1. On your target, from the command line, stop screen by using the following
command:
slay screen
You can verify that the screen process is no longer running by using the following
command:
pidin ar
2. If not already set, ensure that your GRAPHICS_ROOT and LD_LIBRARY_PATH are
set to correct paths. For more information on setting these environment variables,
refer to the Screen Developer's Guide.
3. Restart screen.
screen
4. Verify that there were no warnings generated from your new configuration by using
the following command:
sloginfo
5. Use any of the available sample Screen applications to verify that your display has
been correctly integrated for use with your target. For example:
sw-vsync
For more information on applying your Screen, configuration, refer to the Screen
Developer's Guide.
The Wfdcfg library provides the modes and attributes of your display hardware to your
display driver and to Screen. Your display driver (WFD driver) is the primary user of
the Wfdcfg library, but the composition manager component in Screen also uses the
modes and attributes from the Wfdcfg library.
Definitions in wfdcfg.h
Preprocessor macro definitions for the wfdcfg.h header file in the library.
Definitions:
A port extension that describes the physical size (in millimetres) of the display port.
Members of wfdcfg_keyval structure used for this extension are used as follows:
A port extension function that's called to set the power mode on a port.
Members of wfdcfg_keyval structure used for this extension are used as follows:
Library:
libwfdcfg
WFDCFG_FNPTR(FN, TYP)
Validate the type of a function pointer at compile time.
Synopsis:
#include <wfdqnx/wfdcfg.h>
WFDCFG_FNPTR(FN,TYP)
Arguments:
FN
TYP
Library:
libwfdcfg
Description:
This macro is used to validate that whether the specified function pointer (FN) is the
same type as the specified function type (TYP).
Returns:
The function pointer FN, if it is compatible with the function type specified; 0
otherwise.
wfdcfg_device
Opaque data type representing an OpenWF device
Synopsis:
struct wfdcfg_device;
Library:
libwfdcfg
Description:
This device is an abstraction of a display controller that supports one or more ports.
The device may be associated with device-extensions.
wfdcfg_device_create()
Create a wfdcfg device.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
device
deviceid
opts
Library:
libwfdcfg
Description:
This function creates one device. You must create at least one device. Failure to create
a device results in the OpenWF display driver reporting an error.
Returns:
wfdcfg_device_destroy()
Destroy a wfdcfg device.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
device
Library:
libwfdcfg
Description:
Returns:
Nothing.
wfdcfg_device_get_extension()
Retrieve an extension identified by a key (string) from a device.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
device
key
Library:
libwfdcfg
Description:
The extension is valid between the time you create and destroy the device.
Returns:
Pointer to wfdcfg_keyval if the extension was found; NULL if the extension was not
found. It's considered acceptable for a device to have no extensions.
wfdcfg_ext_fn_set_power_mode_t
A port extension function that's called to set the power mode on a port.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
port
power_mode
The power mode (of type wfdcfg_power_mode) that the display port is to be
set to
Library:
libwfdcfg
Description:
Returns:
wfdcfg_flags
Flags used in the flags field of wfdcfg_timing structure.
Synopsis:
#include <wfdqnx/wfdcfg.h>
enum wfdcfg_flags{
WFDCFG_INVERT_HSYNC =_b(0)
WFDCFG_INVERT_VSYNC =_b(1)
WFDCFG_INVERT_DATA_EN =_b(2)
WFDCFG_INVERT_CLOCK =_b(3)
WFDCFG_INVERT_DATA =_b(4)
WFDCFG_INVERT_HV_SYNC_RF =_b(5)
WFDCFG_INTERLACE =_b(8)
WFDCFG_DOUBLESCAN =_b(9)
WFDCFG_DOUBLECLOCK =_b(10)
WFDCFG_PREFERRED =_b(31)
};
Data:
WFDCFG_INVERT_HSYNC
WFDCFG_INVERT_VSYNC
WFDCFG_INVERT_DATA_EN
WFDCFG_INVERT_CLOCK
WFDCFG_INVERT_DATA
Invert data.
WFDCFG_INVERT_HV_SYNC_RF
Drive HSYNC and VSYNC on the opposite edge of the pixel clock.
WFDCFG_INTERLACE
Use interlacing.
WFDCFG_DOUBLESCAN
WFDCFG_DOUBLECLOCK
WFDCFG_PREFERRED
Library:
libwfdcfg
Description:
wfdcfg_keyval
Array(s) of this structure are used to allow for extensions.
Synopsis:
struct wfdcfg_keyval {
const char * key ;
long i ;
void * p ;
};
Data:
Identifier of extension.
long i
void * p
Library:
libwfdcfg
Description:
Several Wfdcfg library functions take this structure as an optional argument; certain
drivers pass data to the Wfdcfg library using this interface.
The i and p members of this structure depend on the key (when part of an array,
an element with key==NULL marks the end of that array). Unused i and/or p fields
should be set to 0 or NULL.
wfdcfg_mode_get_extension()
Retrieve an extension from the specified mode.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
mode
key
Library:
libwfdcfg
Description:
Returns:
Pointer to wfdcfg_keyval if the extension was found; NULL if the extension was not
found. It's considered acceptable for a list to have no extensions.
wfdcfg_mode_list
Opaque data type representing a list of video modes
Synopsis:
struct wfdcfg_mode_list;
Library:
libwfdcfg
Description:
A mode is a set of attributes and extensions that can be set on a display port.
wfdcfg_mode_list_create()
Create a list of video modes associated with specified port.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
list
port
opts
Library:
libwfdcfg
Description:
Returns:
0 if port was successfully created; *list is set to an opaque pointer. A code from
errno.h if device failed to be created; *list remains unchanged. Possible error codes
include:
wfdcfg_mode_list_destroy()
Destroy a list of video modes.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
list
Library:
libwfdcfg
Description:
Returns:
Nothing.
wfdcfg_mode_list_get_next()
Retrieve a mode (timing) from the specified list of video modes.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
list
prev_timing
A handle to the mode (timing) in the list that precedes the one to be retrieved
Library:
libwfdcfg
Description:
Timing is mandatory component of a mode. The mode may also include extensions.
If prev_timing is NULL, this function returns the first mode (timing) in the specified
list. Otherwise, this function returns the next mode (timing) in the list after
prev_timing.
Returns:
A pointer to the mode (wfdcfg_timing) in the list that follows the argument
prev_timing; a return value of NULL indicates that the end of the list has been
reached.
wfdcfg_port
Opaque data type representing an OpenWF display port
Synopsis:
struct wfdcfg_port;
Library:
libwfdcfg
Description:
This port is usually associated with an ID and a list of modes that include timing and
optional associated mode-extensions.
wfdcfg_port_create()
Create a wfdcfg port.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
port
device
portid
opts
Library:
libwfdcfg
Description:
There must be at least one port created. Otherwise, the OpenWF display driver will
report an error.
Returns:
0 if port was successfully created; *port is set to an opaque pointer. A code from
errno.h if device failed to be created; *port remains unchanged. Possible error codes
include:
wfdcfg_port_destroy()
Destroy a wfdcfg port.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
port
Library:
libwfdcfg
Description:
Returns:
Nothing.
wfdcfg_port_get_extension()
Retrieve an extension identified by a key (string) from a port.
Synopsis:
#include <wfdqnx/wfdcfg.h>
Arguments:
port
key
Library:
libwfdcfg
Description:
The extension is valid between the time you create and destroy the port.
Returns:
Pointer to wfdcfg_keyval if the extension was found; NULL if the extension was not
found. It's considered acceptable for a port to have no extensions.
wfdcfg_power_mode
Power modes for display.
Synopsis:
#include <wfdqnx/wfdcfg.h>
enum wfdcfg_power_mode{
WFDCFG_POWER_MODE_OFF = 0x7680
WFDCFG_POWER_MODE_SUSPEND = 0x7681
WFDCFG_POWER_MODE_LIMITED_USE = 0x7682
WFDCFG_POWER_MODE_ON = 0x7683
};
Data:
WFDCFG_POWER_MODE_OFF
WFDCFG_POWER_MODE_SUSPEND
WFDCFG_POWER_MODE_LIMITED_USE
WFDCFG_POWER_MODE_ON
Fully operational.
Library:
libwfdcfg
Description:
Some power modes may not be possible for your specific display hardware. Recovery
time to WFDCFG_POWER_MODE_ON decreases from WFDCFG_POWER_MODE_OFF to
WFDCFG_POWER_MODE_SUSPEND to WFDCFG_POWER_MODE_LIMITED_USE and the
power consumption increases.
wfdcfg_timing
Structure that describes the video timing parameters for the display driver settings.
Synopsis:
struct wfdcfg_timing {
_Uint32t pixel_clock_kHz ;
_Uint32t hpixels ;
_Uint32t vlines ;
_Uint16t hsw ;
_Uint16t vsw ;
_Uint16t hfp ;
_Uint16t vfp ;
_Uint16t hbp ;
_Uint16t vbp ;
_Uint32t flags ;
};
Data:
_Uint32t pixel_clock_kHz
_Uint32t hpixels
_Uint32t vlines
_Uint16t hsw
_Uint16t vsw
_Uint16t hfp
_Uint16t vfp
_Uint16t hbp
_Uint16t vbp
_Uint32t flags
Library:
libwfdcfg