| 1 | /* |
| 2 | Copyright (c) 2012, Broadcom Europe Ltd |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | * Redistributions of source code must retain the above copyright |
| 8 | notice, this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of the copyright holder nor the |
| 13 | names of its contributors may be used to endorse or promote products |
| 14 | derived from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #ifndef VC_VCHI_BUFMAN_DEFS_H |
| 29 | #define VC_VCHI_BUFMAN_DEFS_H |
| 30 | |
| 31 | #ifdef __SYMBIAN32__ |
| 32 | typedef uint32_t DISPMANX_RESOURCE_HANDLE_T; |
| 33 | namespace BufManX { |
| 34 | #else |
| 35 | #include "interface/vmcs_host/vc_dispmanx.h" |
| 36 | #endif |
| 37 | |
| 38 | typedef enum { |
| 39 | // Insert extra frame types here |
| 40 | FRAME_HOST_IMAGE_BASE = 0x20000, // Base for host format images |
| 41 | FRAME_HOST_IMAGE_EFormatYuv420P, |
| 42 | FRAME_HOST_IMAGE_EFormatYuv422P, |
| 43 | FRAME_HOST_IMAGE_EFormatYuv422LE, |
| 44 | FRAME_HOST_IMAGE_EFormatRgb565, |
| 45 | FRAME_HOST_IMAGE_EFormatRgb888, |
| 46 | FRAME_HOST_IMAGE_EFormatRgbU32, |
| 47 | FRAME_HOST_IMAGE_EFormatRgbA32, |
| 48 | FRAME_HOST_IMAGE_EFormatRgbA32LE, |
| 49 | FRAME_HOST_IMAGE_EFormatRgbU32LE, |
| 50 | |
| 51 | FRAME_FORCE_FIELD_WIDTH = 0xFFFFFFFF |
| 52 | } buf_frame_type_t; |
| 53 | |
| 54 | typedef enum { |
| 55 | //host to videocore |
| 56 | VC_BUFMAN_CONVERT_UNUSED = 0, |
| 57 | VC_BUFMAN_PULL_FRAME, |
| 58 | VC_BUFMAN_PUSH_FRAME, |
| 59 | VC_BUFMAN_MESSAGE_RESPONSE, |
| 60 | VC_BUFMAN_SYNC, |
| 61 | VC_BUFMAN_ALLOC_BUF, |
| 62 | VC_BUFMAN_FREE_BUF, |
| 63 | VC_BUFMAN_PULL_MULTI, |
| 64 | VC_BUFMAN_PUSH_MULTI, |
| 65 | VC_BUFMAN_PUSH_MULTI_STREAM, |
| 66 | //vc to host |
| 67 | VC_BUFMAN_FRAME_SENT_CALLBACK, |
| 68 | VC_BUFMAN_FORCE_WIDTH = 0x7fffffff, |
| 69 | } buf_command_t; |
| 70 | |
| 71 | /* A header used for all messages sent and received by bufman. |
| 72 | */ |
| 73 | typedef struct { |
| 74 | buf_command_t command; |
| 75 | } BUF_MSG_HDR_T; |
| 76 | |
| 77 | /* General remotely call this bufman operation commands */ |
| 78 | typedef struct { |
| 79 | uint32_t resource_handle; |
| 80 | buf_frame_type_t type; |
| 81 | int32_t size, width, height, pitch; |
| 82 | VC_RECT_T src_rect; // in 16.16 units |
| 83 | VC_RECT_T dest_rect; // in 32.0 units |
| 84 | } BUF_MSG_REMOTE_FUNCTION_FRAME_T; |
| 85 | |
| 86 | typedef struct { |
| 87 | int32_t status; |
| 88 | int32_t total_stripes; |
| 89 | // normal stipe height and size |
| 90 | int32_t stripe_height, stripe_size; |
| 91 | // last stripe size (if height not a mulitple of stripe height, last stripe nay be smaller) |
| 92 | int32_t last_stripe_height, last_stripe_size; |
| 93 | } BUF_MSG_RESPONSE_T; |
| 94 | |
| 95 | typedef struct |
| 96 | { |
| 97 | uint32_t stream; |
| 98 | uint32_t num_of_buffers; |
| 99 | buf_frame_type_t type; |
| 100 | uint32_t width; |
| 101 | uint32_t height; |
| 102 | } BUF_MSG_ALLOC_BUF_FRAME_T; |
| 103 | |
| 104 | typedef struct |
| 105 | { |
| 106 | uint32_t stream; |
| 107 | uint32_t num_of_buffers; |
| 108 | } BUF_MSG_FREE_BUF_FRAME_T; |
| 109 | |
| 110 | typedef struct { |
| 111 | BUF_MSG_HDR_T hdr; |
| 112 | union { |
| 113 | BUF_MSG_REMOTE_FUNCTION_FRAME_T frame; |
| 114 | BUF_MSG_RESPONSE_T message_response; |
| 115 | BUF_MSG_ALLOC_BUF_FRAME_T alloc_buf_frame; |
| 116 | BUF_MSG_FREE_BUF_FRAME_T free_buf_frame; |
| 117 | } u; |
| 118 | } BUF_MSG_T; |
| 119 | |
| 120 | enum { |
| 121 | //host to videocore |
| 122 | VC_BUFMAN_ERROR_NONE = 0, |
| 123 | VC_BUFMAN_ERROR_BAD_GENERALLY = -1, |
| 124 | VC_BUFMAN_ERROR_BAD_RESOURCE = -2, |
| 125 | VC_BUFMAN_ERROR_BAD_TRANSFORM = -3, |
| 126 | VC_BUFMAN_ERROR_BAD_RESIZE = -4, |
| 127 | VC_BUFMAN_ERROR_BAD_HOST_FORMAT = -5, |
| 128 | VC_BUFMAN_ERROR_BAD_VC_FORMAT = -6, |
| 129 | VC_BUFMAN_ERROR_BAD_SIZE = -7, |
| 130 | }; |
| 131 | |
| 132 | #ifdef __SYMBIAN32__ |
| 133 | } // namespace BufManX |
| 134 | #endif |
| 135 | |
| 136 | #endif /* VC_VCHI_BUFMAN_DEFS_H */ |
| 137 | |