Screen usage flag types

Updated: April 19, 2023

Types of usage flags

Synopsis:

#include <screen/screen.h>
enum {
    SCREEN_USAGE_DISPLAY = (1 << 0),
    SCREEN_USAGE_READ = (1 << 1),
    SCREEN_USAGE_WRITE = (1 << 2),
    SCREEN_USAGE_NATIVE = (1 << 3),
    SCREEN_USAGE_OPENGL_ES1 = (1 << 4),
    SCREEN_USAGE_OPENGL_ES2 = (1 << 5),
    SCREEN_USAGE_OPENGL_ES3 = (1 << 11),
    SCREEN_USAGE_OPENVG = (1 << 6),
    SCREEN_USAGE_VIDEO = (1 << 7),
    SCREEN_USAGE_CAPTURE = (1 << 8),
    SCREEN_USAGE_ROTATION = (1 << 9),
    SCREEN_USAGE_OVERLAY = (1 << 10),
    SCREEN_USAGE_COMPRESSION = (1 << 12),
    SCREEN_USAGE_PHYSICAL = (1 << 13),
    SCREEN_USAGE_VULKAN = (1 << 14)
};

Data:

SCREEN_USAGE_DISPLAY
Internal use only; do not use.
SCREEN_USAGE_READ
Flag to indicate that the CPU can read from the buffer(s) associated with the API object.
SCREEN_USAGE_WRITE
Flag to indicate that the CPU can write to the buffer(s) associated with the API object.
SCREEN_USAGE_NATIVE
Flag to indicate that buffer(s) associated with the API object can be used for native API operations.

If using blits (screen_blit()) or fills (screen_fill()), this flag must be set on the buffer.

SCREEN_USAGE_OPENGL_ES1
Flag to indicate that OpenGL ES 1.X is used for rendering the buffer associated with the API object.
SCREEN_USAGE_OPENGL_ES2
Flag to indicate that OpenGL ES 2.X is used for rendering the buffer associated with the API object.
SCREEN_USAGE_OPENGL_ES3
Flag to indicate that OpenGL ES 3.X is used for rendering the buffer associated with the API object.
SCREEN_USAGE_OPENVG
Flag to indicate that OpenVG is used for rendering the buffer associated with the API object.
SCREEN_USAGE_VIDEO
Flag to indicate that the buffer can be written to by a video decoder.
SCREEN_USAGE_CAPTURE
Flag to indicate that the buffer can be written to by capture devices (such as cameras, analog-to-digital-converters, ...), and read by a hardware video encoder.
SCREEN_USAGE_ROTATION
Flag to indicate that the buffer can be reconfigured from landscape to portrait orientation without reallocation.
SCREEN_USAGE_OVERLAY
Flag to suggest the use of a display overlay.

Screen won't use display overlays unless your application assigns a pipeline. The SCREEN_USAGE_OVERLAY flag suggests that Screen tries to post your buffer onto a pipeline that doesn't have a framebuffer. If unable to, Screen will use composition instead. Changing SCREEN_USAGE_OVERLAY may affect pipeline assignment. Set this flag when you are targeting a non-composited pipeline.

SCREEN_USAGE_COMPRESSION
Flag to indicate that a buffer is compressed.
SCREEN_USAGE_PHYSICAL
Flag to indicate that the buffer should be physically contiguous and the physical address should be provided.

This flag is used only as a suggestion to Screen. Query the buffer's SCREEN_PROPERTY_PHYSICALLY_CONTIGUOUS property to confirm whether the buffer is actually contiguous. This flag is associated with the preprocessor definition SCREEN_USAGE_PHYSICAL.

SCREEN_USAGE_VULKAN
Flag to indicate that Vulkan is used for rendering the buffer associated with the API object.

Library:

libscreen

Description:

Usage flags are used when allocating buffers; they indicate to Screen how the application intends to use the buffers. Depending on the usage, different constraints such as width, height, stride granularity or special alignment must be observed. The usage is also valuable in determining the amount of caching that can be set on a particular buffer.