/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 *
 * $Author$
 * $Date$
 * $RCSfile: vdp_mw.c,v $
 * $Revision$
 *
 *---------------------------------------------------------------------------*/

/** @file vdp_mt53fb_mw.c
 *  Brief of file vdp_mt53fb_mw.c.
 *  Details of file vdp_photo_mw.c (optional).
 */


//-----------------------------------------------------------------------------
// Include files
//-----------------------------------------------------------------------------
#ifdef CC_DFB_SUPPORT_VDP_LAYER

typedef struct _mt53fb_vdp_init
{
    unsigned int width;
    unsigned int height;
}mt53fb_vdp_init;

typedef struct mt53fb_vdp_flip
{
    unsigned char ucFbgId;
	unsigned int  ui4_pitch;
   union {
    unsigned char *pu1SrcYAddr;
	unsigned int src_y_compat_value;
	unsigned long long u8pu1SrcYAddrPadding;
	};
	union {
    unsigned char *pu1SrcCAddr;
	unsigned int src_c_compat_value;
	unsigned long long u8pu1SrcCAddrPadding;
	};
    unsigned char fgIs3DMode;
    unsigned int u4CropBottomOffset;
    unsigned int u4CropTopOffset;
    unsigned int u4CropLeftOffset;
    unsigned int u4CropRightOffset;          
}mt53fb_vdp_flip;

typedef struct mt53fb_vdp_set
{
    unsigned char ucEnable;
}mt53fb_vdp_set;

#define MT53FB_VDP_ROTATE_90 0 
#define MT53FB_VDP_ROTATE_270 1
#define MT53FB_VDP_ROTATE_180 2

typedef struct mt53fb_vdp_rotate
{
    union {
    unsigned long u4Src;
		unsigned int src_compat_value;
		unsigned long long u8SrcPadding;
		};
	  union {
    unsigned long u4Dst;
		unsigned int dst_compat_value;
		unsigned long long u8u4DstPadding;
		};
    unsigned int eSrcCm;
    unsigned int eDstCm;       
    unsigned int u4SrcPitch;
    unsigned int u4DstPitch;    
    unsigned int u4SrcX;
    unsigned int u4SrcY;
    unsigned int u4Width;    
    unsigned int u4Height;        
    unsigned int u4DstX;       
    unsigned int u4DstY;
    unsigned int u4RotateOp;
    unsigned int u4SrcCbCrOffset;    
    unsigned int u4DstCbCrOffset;        
}mt53fb_vdp_rotate; 

typedef struct _mt53fb_vdp_crop_rect
{
    unsigned int                ui4_layer;
	unsigned int                ui4_3d_mode;
    unsigned int                crop_left_offset;       /* pixel width */
    unsigned int                crop_right_offset;      /* pixel height */    
    unsigned int                crop_top_offset;        /* pixel width */
    unsigned int                crop_bottom_offset;     /* pixel height */                                                                                                                      
}mt53fb_vdp_crop_rect;

typedef struct _mt53fb_vdp_stretch_blit
{
    unsigned int src1_buffer_Y_addr;
    unsigned int src1_buffer_C_addr;
    unsigned int src1_buffer_Y_width;
    unsigned int src1_buffer_Y_height;       
    unsigned int src1_buffer_Y_pitch;
    unsigned int src2_buffer_Y_addr;    
    unsigned int src2_buffer_C_addr;
    unsigned int dest_buffer_Y_addr;
    unsigned int dest_buffer_C_addr;    
    unsigned int dest_buffer_Y_width;        
    unsigned int dest_buffer_Y_height;       
    unsigned int dest_buffer_Y_pitch;  
	unsigned int composition_level;
}mt53fb_vdp_stretch_blit;

typedef struct _mt53fb_imagebuffer
{
    unsigned int u4Size;
	unsigned int u4padding;
	union {
    unsigned long u4VirtAddr;
	unsigned int vir_compat_value;
	unsigned long long u8VirtAddr;
	};
	union {
	unsigned long u4PhyAddr;
	unsigned int phy_compat_value;
	unsigned long long u8PhyAddr;
	};
}mt53fb_imagebuffer;


extern UINT32 VDP_SetInput(UCHAR ucVdpId, UCHAR ucEsId, UCHAR ucPort);

extern INT32 _VdpPhotoSetCommand(DRV_COMP_ID_T* prCompId, DRV_SET_TYPE_T rSetType,
                            const VOID* pvSetInfo, SIZE_T zSetInfoLen);

#endif


