13d0407baSopenharmony_ci/*
23d0407baSopenharmony_ci * Copyright (C) 2016 Rockchip Electronics Co., Ltd.
33d0407baSopenharmony_ci * Authors:
43d0407baSopenharmony_ci *    Zhiqin Wei <wzq@rock-chips.com>
53d0407baSopenharmony_ci *
63d0407baSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
73d0407baSopenharmony_ci * you may not use this file except in compliance with the License.
83d0407baSopenharmony_ci * You may obtain a copy of the License at
93d0407baSopenharmony_ci *
103d0407baSopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
113d0407baSopenharmony_ci *
123d0407baSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
133d0407baSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
143d0407baSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
153d0407baSopenharmony_ci * See the License for the specific language governing permissions and
163d0407baSopenharmony_ci * limitations under the License.
173d0407baSopenharmony_ci */
183d0407baSopenharmony_ci#ifndef _rockchip_rga_c_h_
193d0407baSopenharmony_ci#define _rockchip_rga_c_h_
203d0407baSopenharmony_ci
213d0407baSopenharmony_ci#include <stdint.h>
223d0407baSopenharmony_ci#include <sys/types.h>
233d0407baSopenharmony_ci#include <stdlib.h>
243d0407baSopenharmony_ci#include <stdio.h>
253d0407baSopenharmony_ci#include <string.h>
263d0407baSopenharmony_ci#include <errno.h>
273d0407baSopenharmony_ci#include <time.h>
283d0407baSopenharmony_ci#include <unistd.h>
293d0407baSopenharmony_ci
303d0407baSopenharmony_ci#include <sys/mman.h>
313d0407baSopenharmony_ci
323d0407baSopenharmony_ci#include "drmrga.h"
333d0407baSopenharmony_ci#include "rga.h"
343d0407baSopenharmony_ci
353d0407baSopenharmony_ci#ifdef __cplusplus
363d0407baSopenharmony_ciextern "C" {
373d0407baSopenharmony_ci#endif
383d0407baSopenharmony_ci
393d0407baSopenharmony_ci/*
403d0407baSopenharmony_ci * Compatible with the old version of C interface.The new
413d0407baSopenharmony_ci * version of the C interface no longer requires users to
423d0407baSopenharmony_ci * initialize rga, so RgaInit and RgaDeInit are just for
433d0407baSopenharmony_ci * compatibility with the old C interface, so please do
443d0407baSopenharmony_ci * not use ctx, because it is usually a NULL.
453d0407baSopenharmony_ci */
463d0407baSopenharmony_ci#define RgaInit(ctx) ( { \
473d0407baSopenharmony_ci    int ret = 0; \
483d0407baSopenharmony_ci    ret = c_RkRgaInit(); \
493d0407baSopenharmony_ci    c_RkRgaGetContext(ctx); \
503d0407baSopenharmony_ci    ret; \
513d0407baSopenharmony_ci})
523d0407baSopenharmony_ci#define RgaDeInit(ctx) do { \
533d0407baSopenharmony_ci    (void)(ctx);        /* unused */ \
543d0407baSopenharmony_ci    c_RkRgaDeInit(); \
553d0407baSopenharmony_ci} while (0)
563d0407baSopenharmony_ci#define RgaBlit(...) c_RkRgaBlit(__VA_ARGS__)
573d0407baSopenharmony_ci#define RgaCollorFill(...) c_RkRgaColorFill(__VA_ARGS__)
583d0407baSopenharmony_ci#define RgaFlush() c_RkRgaFlush()
593d0407baSopenharmony_ci
603d0407baSopenharmony_ciint  c_RkRgaInit(void);
613d0407baSopenharmony_civoid c_RkRgaDeInit(void);
623d0407baSopenharmony_civoid c_RkRgaGetContext(void **ctx);
633d0407baSopenharmony_ciint  c_RkRgaBlit(rga_info_t *src, rga_info_t *dst, rga_info_t *src1);
643d0407baSopenharmony_ciint  c_RkRgaColorFill(rga_info_t *dst);
653d0407baSopenharmony_ciint  c_RkRgaFlush(void);
663d0407baSopenharmony_ci
673d0407baSopenharmony_ciint c_RkRgaGetAllocBuffer(bo_t *bo_info, int width, int height, int bpp);
683d0407baSopenharmony_ciint c_RkRgaGetAllocBufferCache(bo_t *bo_info, int width, int height, int bpp);
693d0407baSopenharmony_ciint c_RkRgaGetMmap(bo_t *bo_info);
703d0407baSopenharmony_ciint c_RkRgaUnmap(bo_t *bo_info);
713d0407baSopenharmony_ciint c_RkRgaFree(bo_t *bo_info);
723d0407baSopenharmony_ciint c_RkRgaGetBufferFd(bo_t *bo_info, int *fd);
733d0407baSopenharmony_ci
743d0407baSopenharmony_ci#ifdef __cplusplus
753d0407baSopenharmony_ci}
763d0407baSopenharmony_ci#endif
773d0407baSopenharmony_ci
783d0407baSopenharmony_ci#endif /* #ifndef _rockchip_rga_c_h_ */
79