Query capabilities of a given layer
#include <graphics/display.h>
typedef struct {
int size;
unsigned pixel_format;
unsigned caps;
unsigned alpha_valid_flags;
unsigned alpha_combinations;
unsigned chromakey_caps;
int src_max_height;
int src_max_width;
int src_max_viewport_height;
int src_max_viewport_width;
int dst_max_height;
int dst_max_width;
int dst_min_height;
int dst_min_width;
int max_scaleup_x;
int max_scaleup_y;
int max_scaledown_x;
int max_scaledown_y;
uint64_t order_mask;
uint32_t output_mask;
} disp_layer_query_t *info;
The disp_layer_query_t structure defines the graphics
driver's capabilities.
The graphics framework passes this structure to the layer query entry point.
The members of disp_layer_query_t include:
- size
- The sizeof disp_surface_info_t structure.
- format
- The pixel format; see
“Pixel formats for layers” in
the Writing a Graphics Driver chapter.
- caps
- The flags that describe the capabilities of a layer for a given format:
- DISP_LAYER_CAP_FILTER — the layer can apply a filtering technique
to the image as it's being displayed in order to produce a smoother image. Filtering techniques may be used to reduce artifacts when scaling images.
- DISP_LAYER_CAP_SCALE_REPLICATE — a simple pixel
replication scaling technique is available for a source image
that's scaled before it's displayed in the destination viewport.
- DISP_LAYER_CAP_PAN_SOURCE — the source viewpoint can
be moved within the source image for this layer. If this flag isn't set, the
viewport can be located only at the top left corner of the image.
- DISP_LAYER_CAP_PAN_DEST — the destination viewpoint can be moved within the display area for this layer. If this flag isn't set, the
viewport can be located only at the top left corner of the image.
- DISP_LAYER_CAP_EDGE_CLAMP — if the image being displayed isn't large enough to fill the destination viewport, the unfilled right and bottom
portions of the viewport can be filled. The last pixel that was displayed can
be replicated to the edge of the viewport.
- DISP_LAYER_CAP_EDGE_WRAP — if the image being displayed
isn't large enough to fill the destination viewport, the unfilled right and bottom
portions of the viewport can be filled. The right and bottom portions can be
wrapped around to the top left portions of the image.
- DISP_LAYER_CAP_DISABLE — you can disable this layer and make it invisible.
This layer can also be enabled.
- DISP_LAYER_CAP_SET_BRIGHTNESS — you can adjust the
intensity of the displayed image.
- DISP_LAYER_CAP_SET_CONTRAST — you can adjust the
contrast of the displayed image.
- DISP_LAYER_CAP_SET_SATURATION — you can adjust the
color saturation of the displayed image.
- DISP_LAYER_CAP_SET_HUE — you can adjust the
hue of the displayed image.
- DISP_LAYER_CAP_ALPHA_WITH_CHROMA — chroma-keying and alpha-blending
operations can be used simultaneously when you combine this layer with other
layers.
- DISP_LAYER_CAP_BLEND_WITH_FRONT —
By default, when combining layers (whether using chroma-keying or
alpha-blending) the layer whose attributes are being set is considered
to be the “source” of the operation, whereas any image data coming from
behind that layer is considered to be the “destination”. However, if
DISP_LAYER_CAP_BLEND_WITH_FRONT is set, the opposite is the case:
the layer whose attributes are being set is considered to be the
“destination”, whereas image data in front of that layer is considered
to be the “source”.
- DISP_LAYER_CAP_MAIN_DISPLAY — according to the mode-switcher, this layer is the “main” layer. Mode-switcher calls such as set_display_offset()
that don't target a specific layer affect this layer. Typically, a driver for a “main” layer only reports that a single pixel format is available. This
format is the same as the format that was selected when set_mode()
was called.
- alpha_valid_flags
- These are the flags that may be specified in the alpha_mode
parameter to layer_set _blending().
- alpha_combinations
- alpha_combinations are used to define some capabilities of the alpha-blending hardware
for this layer. Defined values are:
- DISP_ALPHA_BLEND_CAP_SPP_WITH_GLOBAL — source per-pixel
alpha blending can be used in conjunction with a global alpha multiplier.
- DISP_ALPHA_BLEND_CAP_GLOBAL_WITH_DPP — destination per-pixel
blending can be used in conjunction with a global alpha multiplier.
- DISP_ALPHA_BLEND_CAP_SPP_WITH_DPP — source per-pixel
alpha blending can be used in conjunction with destination per-pixel
alpha blending.
- chromakey_caps
- These flags define some capabilities of the chroma-key hardware for this
layer. Defined values are:
- DISP_LAYER_CHROMAKEY_CAP_SRC_SINGLE — chroma-keying
based on an exact match between the source-pixel value and a single key color is supported.
- DISP_LAYER_CHROMAKEY_CAP_DST_SINGLE — chroma-keying
based on an exact match between the destination-pixel value and a
single key color is supported.
- DISP_LAYER_CHROMAKEY_CAP_SHOWTHROUGH — a layer can
be configured so that when a chroma-key comparison is made, and the colors
match, the pixel displayed comes from the behind the layer. When
the colors don't match, the pixel that appears comes from the layer displayed.
- DISP_LAYER_CHROMAKEY_CAP_BLOCK — a layer can
be configured so that when a chroma-key comparison is made, and the colors
match, the pixel displayed comes from the layer displayed. When
the colors don't match, the pixel that appears comes from behind the layer.
- src_max_height
- The maximum height of the source image that can be displayed. The surface to
be displayed may be taller than this value. When this is the case, it isn't
possible to display part of the image at the bottom of the surface.
- src_max_width
- The maximum width of the source image that can be displayed. The surface to be
displayed may be wider than this value. When this is the case, it isn't
possible to display part of the image at the right of the surface.
- src_max_viewport_height
- Maximum height of the viewport into the source image. The layer isn't
capable of fetching an image area for a display that's taller than this value.
- src_max_viewport_width
- Maximum width of the viewport into the source image. The layer isn't
capable of fetching an image area for a display that's wider than this value.
- dst_max_height
- Maximum height of the destination viewport on the display.
- dst_max_width
- Maximum width of the destination viewport on the display.
- dst_min_height
- Minimum height of the destination viewport on the display.
- dst_min_width
- Minimum width of the destination viewport on the display.
- max_scaleup_x
- Maximum scaling factor for image upscaling in the horizontal
direction. A value of 1 means upscaling can't be performed. A value < 1 is invalid. A value > 1 means that
the destination viewport width can be up to max_scaleup_x
times the source viewport width.
- max_scaleup_y
- Maximum scaling factor for image upscaling in the vertical
direction. A value of 1 means upscaling can't be performed. A value
< 1 is invalid. A value > 1 means that
the destination viewport height can be up to max_scaleup_y
times the source viewport height.
- max_scaledown_x
- Maximum scaling factor for image downscaling in the horizontal
direction. A value of 1 means downscaling can't be performed. A value
< 1 is invalid. A value > 1 means that
the source viewport width can be up to max_scaledown_x
times the destination viewport width.
- max_scaledown_y
- Maximum scaling factor for image downscaling in the vertical
direction. A value of 1 means downscaling can't be performed. A value
< 1 is invalid. A value > 1 means that
the source viewport height can be up to max_scaledown_x
times the destination viewport height.
- order_mask
- If you think of the hardware as having n slots and n layers which can occupy these slots, for a given layer this bit mask represents the slots which the layer may occupy. For example, these two layers can only occupy one slot, and can't be re-ordered:
- Layer 0: 01b — can only occupy slot 1
- Layer 1: 10b — can only occupy slot 2
- output_mask
- On a display with multiple outputs, this bitmask specifies which
outputs this layer may be displayed on. Each bit in the layer mask represents an output for the display.
Neutrino