/*************************************************************************** * Copyright (c) 2003-2006, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: $ * $brcm_Revision: $ * $brcm_Date: $ * * Module Description: * * Revision History: * * $brcm_Log: $ * ***************************************************************************/ #ifndef BSETTOP_GRAPHICS_H__ #define BSETTOP_GRAPHICS_H__ #include "bsettop_types.h" /* Summary: For non-palettized surfaces, this is a ARGB8888 pixel. When used, it will be converted into the desired pixel for a surface. For palettized surfaces, this is the palette index plus possible alpha value. Description: For palette indexes, values should be packed into the least significant bits of bgraphics_pixel. For instance, a8_palette8 uses byte[0] for the palette8 index, byte[1] for alpha8 value and ignores byte[2] and byte[3]. palette2 uses bits 0 and 1 of byte[0] and ignores the rest. */ typedef uint32_t bgraphics_pixel; /* Summary: Pixel format of a surface. 75xx Note, to utilize dual HD,SD output the SD plane has no color space converter and only supports 16bpp or palette4 format. For the HD and SD display to share the same graphics plane one of these two formats must be used for for the HD OSD also. */ typedef enum bgraphics_pixel_format { bgraphics_pixel_format_r5_g6_b5, /* 16-bit, no per-pixel alpha */ bgraphics_pixel_format_a1_r5_g5_b5, /* 16-bit */ bgraphics_pixel_format_r5_g5_b5_a1, /* 16-bit */ bgraphics_pixel_format_a4_r4_g4_b4, /* 16-bit */ bgraphics_pixel_format_r4_g4_b4_a4, /* 16-bit */ bgraphics_pixel_format_a8_r8_g8_b8, /* 32-bit */ bgraphics_pixel_format_palette8, /* 8-bit Palette index */ bgraphics_pixel_format_a8_palette8, /* A8 and 8-bit Palette index */ bgraphics_pixel_format_a0, /* 0-bit surface (constant color, constant alpha) */ bgraphics_pixel_format_a8, /* 8-bit alpha-only surface (constant color) */ bgraphics_pixel_format_y08_cb8_y18_cr8, /* 32-bit Y0_8 Cb_8 Y1_8 Cr_8 */ bgraphics_pixel_format_cr8_y18_cb8_y08, /* 32-bit Cr_8 Y1_8 Cb_8 Y0_8 */ bgraphics_pixel_format_video_tunnel, /* 0-bit tunnel to video. Use to allow video to show through graphics without chromakey and without per-pixel alpha. */ bgraphics_pixel_format_palette2, /* 2-bit palette index */ bgraphics_pixel_format_palette4 /* 4-bit palette index */ } bgraphics_pixel_format; /* Summary: A palette of colors to be used with palettized surfaces. */ typedef struct bgraphics_palette { const bgraphics_pixel *palette; /* [size_is(length)] */ unsigned length; } bgraphics_palette; /* Summary: Universal settings for a graphics engine. */ typedef struct bgraphics_settings{ bgraphics_pixel_format format; /* OSD graphics format*/ } bgraphics_settings; /* Summary: Graphics engine handle returned by bgraphics_open. */ typedef struct bgraphics *bgraphics_t; typedef enum bgraphics_id { eGRAPHICS_HD = 0x01, eGRAPHICS_SD = 0x02, eGRAPHICS_BOTH = (eGRAPHICS_HD|eGRAPHICS_SD), } bgraphics_id; #ifdef __cplusplus extern "C" { #endif /** Summary: Open and enable a graphic output. Surfaces will be created to support output in the currently configured graphics format (see bgraphics_set). */ bgraphics_t bgraphics_open( bobject_t id, /* not used */ bdisplay_t display /* display on which the graphics are displayed */ ); /* Summary: Close and release resources. */ void bgraphics_close( bgraphics_t graphics /* handle returned by bgraphics_open */ ); /** Summary: Get current graphics settings. **/ void bgraphics_get( bgraphics_settings *settings /* [out] */ ); /** Summary: Set graphics settings. **/ bresult bgraphics_set( const bgraphics_settings *settings ); /** Summary: Block until vsync. **/ bresult bgraphics_sync( bgraphics_t g, /* handle returned by bgraphics_open */ bool overlay /* overlay is popped or not */ ); /** * Summary: * update HD or SD or both frame buffer **/ bresult bgraphics_sync_partial( bgraphics_t g, /* handle returned by bgraphics_open */ bgraphics_id id, bool overlay /* overlay is popped or not */ ); /* Summary: Get the graphics framebuffer parameters */ bresult bgraphics_get_framebuffer( bgraphics_t graphics, /* handle returned by bgraphics_open */ void **buffer, /* [out] address of framebuffer memory */ unsigned int **palette, /* [out] address of palette */ int *width, /* [out] width of the OSD surface */ int *height, /* [out] height of the OSD surface */ int *pitch /* [out] pitch of the OSD surface */ ); /* Summary: Reload the graphics palette */ bresult bgraphics_load_palette( bgraphics_t g /* handle returned by bgraphics_open */ ); bresult bgraphics_get_osd_params(bgraphics_t graphics, bsettop_surf_t *p_osd_surf, void **osd_buffer, bsettop_surf_t *p_overlay_surf, void **overlay_mem); bresult bsurface_create_surface(uint32_t width, uint32_t height, bgraphics_pixel_format format, uint8_t **mem, uint32_t *pitch, bsettop_surf_t *p_settop_surf); bresult bsurface_fill(bsettop_surf_t surface, bsettop_rect *rect, bgraphics_pixel pixel); bresult bsurface_blit_surface(bsettop_surf_t src_surf, bsettop_rect *src_r, bsettop_surf_t dst_surf, bsettop_rect *dst_r, bsettop_surf_t out_surf, bsettop_rect *out_r); #ifdef __cplusplus } #endif #endif /* BSETTOP_GRAPHICS_H__ */