Home | History | Annotate | Download | only in libc2dcolorconvert
      1 /* Copyright (c) 2012 - 2013, The Linux Foundation. All rights reserved.
      2  *
      3  * redistribution and use in source and binary forms, with or without
      4  * modification, are permitted provided that the following conditions are
      5  * met:
      6  *     * redistributions of source code must retain the above copyright
      7  *       notice, this list of conditions and the following disclaimer.
      8  *     * redistributions in binary form must reproduce the above
      9  *       copyright notice, this list of conditions and the following
     10  *       disclaimer in the documentation and/or other materials provided
     11  *       with the distribution.
     12  *     * neither the name of The Linux Foundation nor the names of its
     13  *       contributors may be used to endorse or promote products derived
     14  *       from this software without specific prior written permission.
     15  *
     16  * this software is provided "as is" and any express or implied
     17  * warranties, including, but not limited to, the implied warranties of
     18  * merchantability, fitness for a particular purpose and non-infringement
     19  * are disclaimed.  in no event shall the copyright owner or contributors
     20  * be liable for any direct, indirect, incidental, special, exemplary, or
     21  * consequential damages (including, but not limited to, procurement of
     22  * substitute goods or services; loss of use, data, or profits; or
     23  * business interruption) however caused and on any theory of liability,
     24  * whether in contract, strict liability, or tort (including negligence
     25  * or otherwise) arising in any way out of the use of this software, even
     26  * if advised of the possibility of such damage.
     27  *
     28  */
     29 
     30 #ifndef C2D_ColorConverter_H_
     31 #define C2D_ColorConverter_H_
     32 
     33 #include <c2d2.h>
     34 #include <ColorConverter.h>
     35 #include <sys/types.h>
     36 
     37 typedef C2D_STATUS (*LINK_c2dCreateSurface)( uint32 *surface_id,
     38         uint32 surface_bits,
     39         C2D_SURFACE_TYPE surface_type,
     40         void *surface_definition );
     41 
     42 typedef C2D_STATUS (*LINK_c2dUpdateSurface)( uint32 surface_id,
     43         uint32 surface_bits,
     44         C2D_SURFACE_TYPE surface_type,
     45         void *surface_definition );
     46 
     47 typedef C2D_STATUS (*LINK_c2dReadSurface)( uint32 surface_id,
     48         C2D_SURFACE_TYPE surface_type,
     49         void *surface_definition,
     50         int32 x, int32 y );
     51 
     52 typedef C2D_STATUS (*LINK_c2dDraw)( uint32 target_id,
     53         uint32 target_config, C2D_RECT *target_scissor,
     54         uint32 target_mask_id, uint32 target_color_key,
     55         C2D_OBJECT *objects_list, uint32 num_objects );
     56 
     57 typedef C2D_STATUS (*LINK_c2dFlush)( uint32 target_id, c2d_ts_handle *timestamp);
     58 
     59 typedef C2D_STATUS (*LINK_c2dFinish)( uint32 target_id);
     60 
     61 typedef C2D_STATUS (*LINK_c2dWaitTimestamp)( c2d_ts_handle timestamp );
     62 
     63 typedef C2D_STATUS (*LINK_c2dDestroySurface)( uint32 surface_id );
     64 
     65 typedef C2D_STATUS (*LINK_c2dMapAddr)( int mem_fd, void * hostptr, uint32 len, uint32 offset, uint32 flags, void ** gpuaddr);
     66 
     67 typedef C2D_STATUS (*LINK_c2dUnMapAddr)(void * gpuaddr);
     68 
     69 namespace android {
     70 
     71 /*TODO: THIS NEEDS TO ENABLED FOR JB PLUS*/
     72 enum ColorConvertFormat {
     73     RGB565 = 1,
     74     YCbCr420Tile,
     75     YCbCr420SP,
     76     YCbCr420P,
     77     YCrCb420P,
     78     RGBA8888,
     79     NV12_2K,
     80     NV12_128m,
     81 };
     82 
     83 typedef struct {
     84   int32_t width;
     85   int32_t height;
     86   int32_t stride;
     87   int32_t sliceHeight;
     88   int32_t lumaAlign;
     89   int32_t sizeAlign;
     90   int32_t size;
     91 } C2DBuffReq;
     92 
     93 typedef enum {
     94   C2D_INPUT = 0,
     95   C2D_OUTPUT,
     96 } C2D_PORT;
     97 
     98 class C2DColorConverterBase {
     99 
    100 public:
    101     virtual ~C2DColorConverterBase(){};
    102     virtual int convertC2D(int srcFd, void *srcBase, void * srcData, int dstFd, void *dstBase, void * dstData) = 0;
    103     virtual int32_t getBuffReq(int32_t port, C2DBuffReq *req) = 0;
    104     virtual int32_t dumpOutput(char * filename, char mode) = 0;
    105 };
    106 
    107 typedef C2DColorConverterBase* createC2DColorConverter_t(size_t srcWidth, size_t srcHeight, size_t dstWidth, size_t dstHeight, ColorConvertFormat srcFormat, ColorConvertFormat dstFormat, int32_t flags, size_t srcStride);
    108 typedef void destroyC2DColorConverter_t(C2DColorConverterBase*);
    109 
    110 }
    111 
    112 #endif  // C2D_ColorConverter_H_
    113