1fd0d4712Sshatty #if !defined(_VIDEO_OVERLAY_H_) 2fd0d4712Sshatty #define _VIDEO_OVERLAY_H_ 3fd0d4712Sshatty 4fd0d4712Sshatty /* 5fd0d4712Sshatty Copyright Be Incorporated. 6fd0d4712Sshatty This file will eventually be merged into Accelerant.h once the API is finalized. 7fd0d4712Sshatty */ 8fd0d4712Sshatty 9fd0d4712Sshatty #include <Accelerant.h> 10fd0d4712Sshatty #include <GraphicsDefs.h> 11fd0d4712Sshatty 12fd0d4712Sshatty #if defined(__cplusplus) 13fd0d4712Sshatty extern "C" { 14fd0d4712Sshatty #endif 15fd0d4712Sshatty 16fd0d4712Sshatty enum { 17*f92b1f2eSJérôme Duval B_SUPPORTS_OVERLAYS = 1U << 31 // part of display_mode.flags 18fd0d4712Sshatty }; 19fd0d4712Sshatty 20fd0d4712Sshatty enum { 21fd0d4712Sshatty B_OVERLAY_COUNT = 0x08000000, 22fd0d4712Sshatty B_OVERLAY_SUPPORTED_SPACES, 23fd0d4712Sshatty B_OVERLAY_SUPPORTED_FEATURES, 24fd0d4712Sshatty B_ALLOCATE_OVERLAY_BUFFER, 25fd0d4712Sshatty B_RELEASE_OVERLAY_BUFFER, 26fd0d4712Sshatty B_GET_OVERLAY_CONSTRAINTS, 27fd0d4712Sshatty B_ALLOCATE_OVERLAY, 28fd0d4712Sshatty B_RELEASE_OVERLAY, 29fd0d4712Sshatty B_CONFIGURE_OVERLAY 30fd0d4712Sshatty }; 31fd0d4712Sshatty 32fd0d4712Sshatty typedef struct { 33fd0d4712Sshatty uint32 space; /* color_space of buffer */ 34fd0d4712Sshatty uint16 width; /* width in pixels */ 35fd0d4712Sshatty uint16 height; /* height in lines */ 36fd0d4712Sshatty uint32 bytes_per_row; /* number of bytes in one line */ 37fd0d4712Sshatty void *buffer; /* pointer to first byte of overlay buffer in virtual memory */ 38fd0d4712Sshatty void *buffer_dma; /* pointer to first byte of overlay buffer in physical memory for DMA */ 39fd0d4712Sshatty } overlay_buffer; 40fd0d4712Sshatty 41fd0d4712Sshatty typedef struct { 42fd0d4712Sshatty uint16 h_start; 43fd0d4712Sshatty uint16 v_start; 44fd0d4712Sshatty uint16 width; 45fd0d4712Sshatty uint16 height; 46fd0d4712Sshatty } overlay_view; 47fd0d4712Sshatty 48fd0d4712Sshatty enum { 49fd0d4712Sshatty B_OVERLAY_COLOR_KEY = 1 << 0, 50fd0d4712Sshatty B_OVERLAY_CHROMA_KEY = 1 << 1, 51fd0d4712Sshatty B_OVERLAY_HORIZONTAL_FILTERING = 1 << 2, 52fd0d4712Sshatty B_OVERLAY_VERTICAL_FILTERING = 1 << 3, 53fd0d4712Sshatty B_OVERLAY_HORIZONTAL_MIRRORING = 1 << 4, 54fd0d4712Sshatty B_OVERLAY_KEYING_USES_ALPHA = 1 << 5 55fd0d4712Sshatty }; 56fd0d4712Sshatty 57fd0d4712Sshatty typedef struct { 58fd0d4712Sshatty uint8 value; /* if DAC color component of graphic pixel & mask == value, */ 59fd0d4712Sshatty uint8 mask; /* then show overlay pixel, else show graphic pixel */ 60fd0d4712Sshatty } overlay_key_color; 61fd0d4712Sshatty 62fd0d4712Sshatty typedef struct { 63fd0d4712Sshatty int16 h_start; /* Top left un-clipped corner of the window in the virtual display */ 64fd0d4712Sshatty int16 v_start; /* Note that these are _signed_ values */ 65fd0d4712Sshatty uint16 width; /* un-clipped width of the overlay window */ 66fd0d4712Sshatty uint16 height; /* un-clipped height of the overlay window */ 67fd0d4712Sshatty 68fd0d4712Sshatty uint16 offset_left; /* that portion of the overlay_window which is actually displayed */ 69fd0d4712Sshatty uint16 offset_top; /* ie, the first line displayed is v_start + offset_top */ 70fd0d4712Sshatty uint16 offset_right; /* and the first pixel displayed is h_start + offset_left */ 71fd0d4712Sshatty uint16 offset_bottom; 72fd0d4712Sshatty 73fd0d4712Sshatty overlay_key_color red; /* when using color keying, all components must match */ 74fd0d4712Sshatty overlay_key_color green; 75fd0d4712Sshatty overlay_key_color blue; 76fd0d4712Sshatty overlay_key_color alpha; 77fd0d4712Sshatty uint32 flags; /* which features should be enabled. See enum above. */ 78fd0d4712Sshatty } overlay_window; 79fd0d4712Sshatty 80fd0d4712Sshatty typedef struct { 81fd0d4712Sshatty uint16 min; 82fd0d4712Sshatty uint16 max; 83fd0d4712Sshatty } overlay_uint16_minmax; 84fd0d4712Sshatty 85fd0d4712Sshatty typedef struct { 86fd0d4712Sshatty float min; 87fd0d4712Sshatty float max; 88fd0d4712Sshatty } overlay_float_minmax; 89fd0d4712Sshatty 90fd0d4712Sshatty typedef struct { 91fd0d4712Sshatty uint16 h_alignment; /* alignments: a 1 bit set in every bit which must be zero */ 92fd0d4712Sshatty uint16 v_alignment; 93fd0d4712Sshatty uint16 width_alignment; 94fd0d4712Sshatty uint16 height_alignment; 95fd0d4712Sshatty overlay_uint16_minmax width; /* min and max sizes in each axis */ 96fd0d4712Sshatty overlay_uint16_minmax height; 97fd0d4712Sshatty } overlay_limits; 98fd0d4712Sshatty 99fd0d4712Sshatty typedef struct { 100fd0d4712Sshatty overlay_limits view; 101fd0d4712Sshatty overlay_limits window; 102fd0d4712Sshatty overlay_float_minmax h_scale; 103fd0d4712Sshatty overlay_float_minmax v_scale; 104fd0d4712Sshatty } overlay_constraints; 105fd0d4712Sshatty 106fd0d4712Sshatty typedef void * overlay_token; 107fd0d4712Sshatty 108fd0d4712Sshatty typedef uint32 (*overlay_count)(const display_mode *dm); 109fd0d4712Sshatty typedef const uint32 *(*overlay_supported_spaces)(const display_mode *dm); 110fd0d4712Sshatty typedef uint32 (*overlay_supported_features)(uint32 a_color_space); 111fd0d4712Sshatty typedef const overlay_buffer *(*allocate_overlay_buffer)(color_space cs, uint16 width, uint16 height); 112fd0d4712Sshatty typedef status_t (*release_overlay_buffer)(const overlay_buffer *ob); 113fd0d4712Sshatty typedef status_t (*get_overlay_constraints)(const display_mode *dm, const overlay_buffer *ob, overlay_constraints *oc); 114fd0d4712Sshatty typedef overlay_token (*allocate_overlay)(void); 115fd0d4712Sshatty typedef status_t (*release_overlay)(overlay_token ot); 116fd0d4712Sshatty typedef status_t (*configure_overlay)(overlay_token ot, const overlay_buffer *ob, const overlay_window *ow, const overlay_view *ov); 117fd0d4712Sshatty 118fd0d4712Sshatty #if defined(__cplusplus) 119fd0d4712Sshatty } 120fd0d4712Sshatty #endif 121fd0d4712Sshatty 122fd0d4712Sshatty #endif 123