blob: a4aa69c53f4feccb1c002ae51c07ba9b5b5e3317 [file] [log] [blame]
codeworkx62f02ba2012-05-20 12:00:36 +02001/*
2 * Copyright@ Samsung Electronics Co. LTD
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef __HDMI_HAL_V4L2_UTILS_H__
18#define __HDMI_HAL_V4L2_UTILS_H__
19
20//#define LOG_NDEBUG 0
21//#define LOG_TAG "libhdmi"
22#if defined(BOARD_USE_V4L2)
23#include "SecBuffer.h"
24#endif
25#include "fimd_api.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31namespace android {
32
33void display_menu(void);
34
35int tvout_open(const char *fp_name);
36#if defined(BOARD_USE_V4L2)
37int tvout_std_v4l2_init(int fd, unsigned int preset_id);
38int tvout_std_v4l2_querycap(int fd, char *node);
39int tvout_std_v4l2_enum_dv_presets(int fd);
40int tvout_std_v4l2_s_dv_preset(int fd, struct v4l2_dv_preset *preset);
41int tvout_std_v4l2_enum_output(int fd, struct v4l2_output *output);
42int tvout_std_v4l2_s_output(int fd, int index);
43int tvout_std_v4l2_g_output(int fd, int *index);
44int tvout_std_v4l2_s_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, int w, int h, int colorformat, int num_planes);
45int tvout_std_v4l2_s_crop(int fd, enum v4l2_buf_type type, enum v4l2_field field, int x, int y, int w, int h);
46int tvout_std_v4l2_s_ctrl(int fd, int id, int value);
47int tvout_std_v4l2_reqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int num_bufs);
48int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int buf_index, unsigned int num_planes, SecBuffer *secBuf);
49int tvout_std_v4l2_qbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int buf_index, int num_planes, SecBuffer *secBuf);
50int tvout_std_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int *buf_index, int num_planes);
51int tvout_std_v4l2_streamon(int fd, enum v4l2_buf_type type);
52int tvout_std_v4l2_streamoff(int fd, enum v4l2_buf_type type);
53#else
54int tvout_init(v4l2_std_id std_id);
55int tvout_deinit();
56int tvout_v4l2_querycap(int fp);
57int tvout_v4l2_g_std(int fp, v4l2_std_id *std_id);
58int tvout_v4l2_s_std(int fp, v4l2_std_id std_id);
59int tvout_v4l2_enum_std(int fp, struct v4l2_standard *std, v4l2_std_id std_id);
60int tvout_v4l2_enum_output(int fp, struct v4l2_output *output);
61int tvout_v4l2_s_output(int fp, int index);
62int tvout_v4l2_g_output(int fp, int *index);
63int tvout_v4l2_enum_fmt(int fp, struct v4l2_fmtdesc *desc);
64int tvout_v4l2_g_fmt(int fp, int buf_type, void* ptr);
65int tvout_v4l2_s_fmt(int fp, int buf_type, void *ptr);
66int tvout_v4l2_g_fbuf(int fp, struct v4l2_framebuffer *frame);
67int tvout_v4l2_s_fbuf(int fp, struct v4l2_framebuffer *frame);
68int tvout_v4l2_s_baseaddr(int fp, void *base_addr);
69int tvout_v4l2_g_crop(int fp, unsigned int type, struct v4l2_rect *rect);
70int tvout_v4l2_s_crop(int fp, unsigned int type, struct v4l2_rect *rect);
71int tvout_v4l2_start_overlay(int fp);
72int tvout_v4l2_stop_overlay(int fp);
73#endif
74
75int hdmi_init_layer(int layer);
76int hdmi_deinit_layer(int layer);
77#if defined(BOARD_USE_V4L2)
78int hdmi_set_v_param(int fd, int layer,
79 int srcColorFormat,
80 int src_w, int src_h,
81 SecBuffer * dstBuffer,
82 int dst_x, int dst_y, int dst_w, int dst_h);
83int hdmi_set_g_param(int fd, int layer,
84 int srcColorFormat,
85 int src_w, int src_h,
86 SecBuffer * dstBuffer,
87 int dst_x, int dst_y, int dst_w, int dst_h);
88int hdmi_set_g_scaling(int layer,
89 int srcColorFormat,
90 int src_w, int src_h,
91 unsigned int src_address, SecBuffer * dstBuffer,
92 int dst_x, int dst_y, int dst_w, int dst_h,
93 int rotVal, unsigned int hwc_layer);
94#else
95int hdmi_set_v_param(int layer,
96 int src_w, int src_h, int colorFormat,
97 unsigned int src_y_address, unsigned int src_c_address,
98 int dst_w, int dst_h);
99int hdmi_gl_set_param(int layer,
100 int srcColorFormat,
101 int src_w, int src_h,
102 unsigned int src_y_address, unsigned int src_c_address,
103 int dst_x, int dst_y, int dst_w, int dst_h,
104 int rotVal);
105#endif
106void hdmi_cal_rect(int src_w, int src_h, int dst_w, int dst_h, struct v4l2_rect *dst_rect);
107#if defined(BOARD_USE_V4L2)
108int hdmi_get_src_plane(int srcColorFormat, unsigned int *num_of_plane);
109#endif
110int hdmi_cable_status();
111int hdmi_outputmode_2_v4l2_output_type(int output_mode);
112int hdmi_v4l2_output_type_2_outputmode(int v4l2_output_type);
113int composite_std_2_v4l2_std_id(int std);
114
115int hdmi_check_output_mode(int v4l2_output_type);
116#if defined(BOARD_USE_V4L2)
117int hdmi_check_resolution(unsigned int preset_id);
118int hdmi_resolution_2_preset_id(unsigned int resolution, int * w, int * h, unsigned int *preset_id);
119#else
120int hdmi_check_resolution(v4l2_std_id std_id);
121int hdmi_resolution_2_std_id(unsigned int resolution, int *w, int *h, v4l2_std_id *std_id);
122#endif
123int hdmi_enable_hdcp(unsigned int hdcp_en);
124int hdmi_check_audio(void);
125
126#ifdef __cplusplus
127}
128#endif
129
130} //namespace android
131
132#endif //__HDMI_HAL_V4L2_UTILS_H__