1 /*
   2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 #ifndef __WRAPPED_BCM__
  26 #define __WRAPPED_BCM__
  27 
  28 #ifndef WRAPPEDAPI
  29 #define WRAPPEDAPI extern
  30 #endif
  31 
  32 #ifdef USE_DISPMAN
  33 
  34 #ifndef BCM_HOST_H
  35 #include <bcm_host.h>
  36 #endif
  37 
  38 #if !defined(_VC_DISPMANX_H_)
  39 /* for Debian 6.0 libraries */
  40 typedef enum {
  41    VC_IMAGE_ARGB8888 = 43,  /* 32bpp with 8bit alpha at MS byte, with R, G, B (LS byte) */
  42 } VC_IMAGE_TYPE_T;
  43 #endif
  44 
  45 #define vc_dispmanx_display_close(display) (*wr_vc_dispmanx_display_close)(display)
  46 
  47 #define vc_dispmanx_display_open(device) (*wr_vc_dispmanx_display_open)(device)
  48 
  49 #define vc_dispmanx_element_add(update, display, layer, dest_rect, src, src_rect, protection, alpha, clamp, transform) (*wr_vc_dispmanx_element_add)(update, display, layer, dest_rect, src, src_rect, protection, alpha, clamp, transform)
  50 
  51 #define vc_dispmanx_update_start(priority) (*wr_vc_dispmanx_update_start)(priority)
  52 
  53 #define vc_dispmanx_update_submit_sync(update) (*wr_vc_dispmanx_update_submit_sync)(update)
  54 
  55 #define vc_dispmanx_resource_read_data(handle, p_rect, dst_address, dst_pitch) (*wr_vc_dispmanx_resource_read_data) (handle, p_rect, dst_address, dst_pitch)
  56 
  57 #define vc_dispmanx_resource_write_data(res, src_type, src_pitch, src_address, rect) (*wr_vc_dispmanx_resource_write_data)(res, src_type,src_pitch, src_address, rect)
  58 
  59 #define vc_dispmanx_element_remove(update, element) (*wr_vc_dispmanx_element_remove) (update, element)
  60 
  61 #define vc_dispmanx_element_change_attributes(update, element, change_flags, layer, opacity, dest_rect, src_rect, mask, transform) (*wr_vc_dispmanx_element_change_attributes) (update, element, change_flags, layer, opacity, dest_rect, src_rect, mask, transform)
  62 
  63 #define vc_dispmanx_resource_create(type, width, height, native_image_handle) (*wr_vc_dispmanx_resource_create) (type, width, height, native_image_handle)
  64 
  65 #define vc_dispmanx_resource_delete(res) (*wr_vc_dispmanx_resource_delete)(res )
  66 
  67 #define vc_dispmanx_snapshot(display, snapshot_resource, transform) (*wr_vc_dispmanx_snapshot) (display, snapshot_resource, transform )
  68 
  69 #define vc_dispmanx_element_change_source(update, element, src) (*wr_vc_dispmanx_element_change_source) (update, element, src )
  70 
  71 /* wrapped method declarations */
  72 
  73 WRAPPEDAPI int (*wr_vc_dispmanx_display_close)(DISPMANX_DISPLAY_HANDLE_T display);
  74 
  75 WRAPPEDAPI DISPMANX_DISPLAY_HANDLE_T (*wr_vc_dispmanx_display_open)
  76                                       (uint32_t device);
  77 
  78 WRAPPEDAPI DISPMANX_ELEMENT_HANDLE_T (*wr_vc_dispmanx_element_add)
  79                                       (DISPMANX_UPDATE_HANDLE_T update,
  80                                        DISPMANX_DISPLAY_HANDLE_T display,
  81                                        int32_t layer, const VC_RECT_T *dest_rect,
  82                                        DISPMANX_RESOURCE_HANDLE_T src,
  83                                        const VC_RECT_T *src_rect,
  84                                        DISPMANX_PROTECTION_T protection,
  85                                        VC_DISPMANX_ALPHA_T *alpha,
  86                                        DISPMANX_CLAMP_T *clamp,
  87                                        DISPMANX_TRANSFORM_T transform);
  88 
  89 WRAPPEDAPI DISPMANX_UPDATE_HANDLE_T (*wr_vc_dispmanx_update_start)
  90                                      (int32_t priority);
  91 
  92 WRAPPEDAPI int (*wr_vc_dispmanx_update_submit_sync)
  93                 (DISPMANX_UPDATE_HANDLE_T update);
  94 
  95 WRAPPEDAPI int (*wr_vc_dispmanx_resource_read_data)
  96                 (DISPMANX_RESOURCE_HANDLE_T handle,
  97                  const VC_RECT_T *p_rect, void *dst_address, uint32_t dst_pitch);
  98 
  99 WRAPPEDAPI int (*wr_vc_dispmanx_resource_write_data)
 100                 (DISPMANX_RESOURCE_HANDLE_T res, VC_IMAGE_TYPE_T src_type,
 101                  int src_pitch, void *src_address, const VC_RECT_T *rect);
 102 
 103 WRAPPEDAPI int (*wr_vc_dispmanx_element_remove)
 104                 (DISPMANX_UPDATE_HANDLE_T update,
 105                  DISPMANX_ELEMENT_HANDLE_T element);
 106 
 107 WRAPPEDAPI int (*wr_vc_dispmanx_element_change_attributes)
 108                 (DISPMANX_UPDATE_HANDLE_T update,
 109                  DISPMANX_ELEMENT_HANDLE_T element, uint32_t change_flags,
 110                  int32_t layer, uint8_t opacity, const VC_RECT_T *dest_rect,
 111                  const VC_RECT_T *src_rect, DISPMANX_RESOURCE_HANDLE_T mask,
 112                  VC_IMAGE_TRANSFORM_T transform);
 113 
 114 WRAPPEDAPI DISPMANX_RESOURCE_HANDLE_T (*wr_vc_dispmanx_resource_create)
 115                                        (VC_IMAGE_TYPE_T type, uint32_t width,
 116                                         uint32_t height,
 117                                         uint32_t *native_image_handle);
 118 
 119 WRAPPEDAPI int (*wr_vc_dispmanx_resource_delete)
 120                 (DISPMANX_RESOURCE_HANDLE_T res);
 121 
 122 WRAPPEDAPI int (*wr_vc_dispmanx_snapshot) (DISPMANX_DISPLAY_HANDLE_T display,
 123                 DISPMANX_RESOURCE_HANDLE_T snapshot_resource,
 124                 VC_IMAGE_TRANSFORM_T transform);
 125 
 126 WRAPPEDAPI int (*wr_vc_dispmanx_element_change_source)
 127                 (DISPMANX_UPDATE_HANDLE_T update,
 128                  DISPMANX_ELEMENT_HANDLE_T element,
 129                  DISPMANX_RESOURCE_HANDLE_T src);
 130 
 131 WRAPPEDAPI int (*wr_vc_dispmanx_display_get_info)(DISPMANX_DISPLAY_HANDLE_T display, DISPMANX_MODEINFO_T *pinfo);
 132 
 133 #endif // __WRAPPED_BCM__
 134 #endif // USE_DISPMAN