Description of the graphics adapter
#include <graphics/display.h>
typedef struct disp_adapter {
…
} disp_adapter_t;
This structure describes the graphics adapter.
There's one instance of this structure for each device.
|
The disp_adapter_t structure includes some members that
aren't described here; don't use or change any undocumented members. |
Each driver module has its own context block — these are the members
whose name ends with _ctx.
Your driver can use these context blocks to store any data it requires.
The structures pointed to by the modefuncs and memfuncs
structures contain the entry points of the memory manager and modeswitcher
modules.
Through these, it's possible for one module to call functions within another.
Since all entry points have access to the disp_adapter_t
structure,
each module's entry point is always able to find its own private data
structures.
The members of disp_adapter_t include:
- int size
- Size of this structure.
- void *gd_ctx
- Context block for graphics (2D) drivers.
- void *ms_ctx
- Context block for the modeswitch function group.
- void *mm_ctx
- Context block for the memory manager function group.
- void *vcap_ctx
- Context block for the video capture function group.
- void * (*callback)(...)
- Callback function; see below.
- void *callback_handle
- Callback handle to pass to the callback; see below.
- int bus_type
- Identifies the type of bus interface that connects the device to the rest
of the system:
- DISP_BUS_TYPE_UNKNOWN — the driver can't determine
the type of bus to which the device is connected, or the bus type isn't
one of the following.
- DISP_BUS_TYPE_PCI — the device is connected to a
PCI bus.
- DISP_BUS_TYPE_AGP — the device is connected to an
AGP bus.
- DISP_BUS_TYPE_ISA — device is connected to an ISA
bus.
- DISP_BUS_TYPE_VL — device is connected to a
VESA local bus.
- uintptr_t bus.pci.base[6]
- An array of up to six physical base addresses that correspond to the
device's (PCI) aperture bases.
This value is defined only if the bus_type is
DISP_BUS_TYPE_PCI or DISP_BUS_TYPE_AGP.
- uintptr_t bus.pci.apsize[6]
- An array of up to six aperture sizes that correspond to the device's
(PCI) aperture bases.
This value is defined only if the bus_type is
DISP_BUS_TYPE_PCI or DISP_BUS_TYPE_AGP.
- unsigned short bus.pci.pci_vendor_id
- The PCI Vendor Identification number of the device that the driver
interfaces with.
This value is defined only if the bus_type is
DISP_BUS_TYPE_PCI or DISP_BUS_TYPE_AGP.
- unsigned short bus.pci.pci_device_id
- The PCI Device Identification number of the device that the driver
interfaces with.
This value is defined only if the bus_type is
DISP_BUS_TYPE_PCI or DISP_BUS_TYPE_AGP.
- short bus.pci.pci_index
- The PCI Index of the device that the driver interfaces with.
Together, the three fields pci_vendor_id,
pci_device_id, and pci_index uniquely identify a
hardware device in the system.
This value is defined only if the bus_type is
DISP_BUS_TYPE_PCI or DISP_BUS_TYPE_AGP.
- struct pci_dev_info *bus.pci.pci_devinfo
- A pointer to a structure containing extra PCI device information.
For more details, see
pci_attach_device()
in the QNX Neutrino Library Reference.
This value is defined only if the bus_type is
DISP_BUS_TYPE_PCI or DISP_BUS_TYPE_AGP,
and is present only under QNX Neutrino.
- unsigned caps
- Capabilities; a bitmap of the following values:
- DISP_CAP_MULTI_MONITOR_SAFE — the card can work
with other VGA cards in the same system
- DISP_CAP_2D_ACCEL — the device provides
2D driver acceleration
- DISP_CAP_3D_ACCEL — the device provides
3D driver acceleration
- DISP_CAP_NO_IO_PRIVITY — 2D/3D entry points can be called without I/O privileges
- DISP_CAP_DYNAMIC_MODESWITCH - display modeswitches can occur without damaging any surfaces or disturbing the layer state
- void* shmem
- A pointer to a shared memory area which is used to store the driver's state data that must be consistent among processes. The size of the shared memory area is determined by the contents of the global symbol devg_shmem_size. Data which must be accessed both in the context of the io-display server, and in the context of any rendering client processes, may be stored by the driver in this shared memory area.
- int adapter_ram
- The amount of video RAM on the card, in bytes.
- struct vbios_context *vbios
- The handle set by
vbios_register()
that you need to pass to the other vbios_* functions.
For more information, see the Libraries chapter.
Sometimes it is necessary for the driver to call back into the graphics
framework. There is a callback function located in the disp_adapter_t
structure, along with a handle that should be passed to the callback.
The prototype of the callback is as follows:
void * (*callback)(void *handle, unsigned cmd, void *data);
The arguments are:
- handle
- Specify the callback_handle from the disp_adapter_t
- cmd
- May be one of:
- DISP_CALLBACK_LOCK
DISP_CALLBACK_UNLOCK
- Used to unlock/relock the device from
within the wait_vsync() entry point.
arg should be specified as NULL.
- DISP_CALLBACK_WAIT_IDLE
- Some drivers may use an interrupt mechanism to wait for rendering to complete, rather than polling. However, drivers should only attach interrupt handlers from within the address space of the display server. Use this callback from within your rendering entry points to cause the miscellaneous wait_idle() entry point to be called from within the address space of the display manager.
arg should be specified as NULL.
- DISP_CALLBACK_ALLOC_SURFACE
- Typically, all the data structures used to track graphics memory are located within the address space of the display manager. However, you may sometimes need to dynamically allocate or free memory when rendering. This callback can be used to allocate memory from within one of your rendering entry points. For the
arg parameter, pass a pointer to a
disp_surface_t. The width, height, pixel_format and flags members of the
disp_surface_t structure will then be
passed as the width, height, format and
flags arguments, respectively, of the
driver alloc_surface entry point.
If successful, a pointer to a disp_surface_t
structure describing the allocated memory
is returned.
- DISP_CALLBACK_FREE_SURFACE
- Frees a surface that was allocated via the DISP_CALLBACK_ALLOC_SURFACE mechanism.
arg points to a structure of type
disp_surface_t, which was previously
returned by the allocation callback.
- arg
- Value passed depends on the cmd argument; see above.
Neutrino
disp_memfuncs_t,
disp_modefuncs_t