Information for a display mode
#include <graphics/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;
uint8_t reserved;
} generic;
} u;
int num_colors;
unsigned crtc_pitch_gran;
unsigned max_virtual_width;
unsigned max_virtual_height;
unsigned reserved[2];
} 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_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.
- crtc_start_gran
- Not used.
- caps
- The list of available features. None are currently defined; set to 0.
- 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.
- crtc_pitch_gran
- Not used.
- max_virtual_width
- The maximum width of the virtual display, in pixels.
- max_virtual_height
- The maximum height of the virtual display, in pixels.
Neutrino
disp_modefuncs_t