Information for a display mode
#include <mode.h>
typedef struct disp_mode_info {
short size;
disp_mode_t mode;
int xres, yres;
unsigned pixel_format;
unsigned flags;
unsigned crtc_start_gran;
unsigned caps;
union {
struct {
short refresh [DISP_MODE_NUM_REFRESH];
} fixed;
struct {
int min_vfreq, max_vfreq;
int min_hfreq, max_hfreq;
int min_pixel_clock;
int max_pixel_clock;
uint8_t h_granularity;
uint8_t v_granularity;
uint8_t sync_polarity;
} generic;
} u;
int num_colors;
unsigned crtc_pitch_gran;
} disp_mode_info_t;
The disp_mode_info_t structure holds information about a
display mode.
Your driver fills in this structure when the graphics framework calls the
get_modeinfo
function defined in the
disp_modefuncs_t
structure.
The members of disp_mode_info_t include:
- size
- The size of this structure.
- mode
- The unique mode ID; see the
get_modelist
function defined in the
disp_modefuncs_t
structure.
- xres, yres
- The display dimensions, in pixels.
- pixel_format
- The frame buffer's pixel format.
For more information, see
"Pixel formats"
in the Writing a Graphics Driver chapter.
- flags
- Flags that specify various attributes of this mode,
selected from the following:
- DISP_MODE_TVOUT -- this mode drives a TV, and not
a monitor.
- DISP_MODE_TVOUT_OR_MONITOR -- this mode can drive
a TV or a monitor, but not both simultaneously.
- DISP_MODE_TVOUT_WITH_MONITOR -- this mode can drive
a TV and a monitor simultaneously.
- DISP_MODE_TVOUT_OVERSCAN -- the overscan goes
beyond the edge of the TV (i.e. there are no borders at the edges).
- DISP_MODE_TVOUT_NTSC -- this mode generates NTSC
format video signal.
- DISP_MODE_TVOUT_PAL -- this mode generates PAL
format video signal.
- DISP_MODE_TVOUT_SECAM -- this mode generates SECAM
format video signal.
- DISP_MODE_GENERIC -- this mode is a generic mode.
That is, the mode has a given pixel_format but can handle any
resolution or refresh rate, within certain constraints.
If this flag is set, the members of the u.generic
structure are defined.
Otherwise, the members of the u.fixed structure are defined.
Note that there's a macro, DISP_TVOUT_STANDARD() that
returns just the type of output (PAL, NTSC, SECAM).
- crtc_start_gran
- The granularity of the frame buffer base address.
Values passed in the offset parameter to the
set_display_offset()
function in the disp_modefuncs_t structure are multiples of
this value.
- caps
- The list of available features:
- DISP_MCAP_SET_DISPLAY_OFFSET -- the display
controller can point to different areas of the video RAM.
This indicates that its offset into video RAM isn't hard-coded, meaning
that it can perform double-buffering operations.
- DISP_MCAP_DPMS_SUPPORTED -- the display supports
DPMS (if this bit set), else no support.
- DISP_MCAP_VIRTUAL_PANNING -- the display supports
virtual resolutions that are larger than the physical display, and
supports "panning" of the physical viewport into the
virtual display.
- u.fixed.refresh
- An array of possible refresh rates (in Hz) for this mode.
The size of this array is given by DISP_MODE_NUM_REFRESH
(i.e. it's the maximum number of refresh rates that can be supported for
a given mode).
- u.generic.min_vfreq, u.generic.max_vfreq
- The monitor vertical frequency limits, in Hz.
- u.generic.min_hfreq, u.generic.max_hfreq
- The monitor horizontal frequency limits, in kHz.
- u.generic.min_pixel_clock, u.generic.max_pixel_clock
- The pixel clock limits, in kHz.
- u.generic.h_granularity
- The horizontal granularity; X resolution must be a multiple of this.
- u.generic.v_granularity
- The vertical granularity; Y resolution must be a multiple of this.
- num_colors
- Defined only if the display format is palette-based.
It specifies the maximum palette index that the display can handle.
For example, the example 16-color VGA driver sets this to 16.
Photon
disp_modefuncs_t