Guest User

Untitled

a guest
Jul 9th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 114.78 KB | None | 0 0
  1. From 228fb06d5558bb009bd714fafec76264ddb23fef Mon Sep 17 00:00:00 2001
  2. From: xc-racer99 <xc-racer2@live.ca>
  3. Date: Thu, 7 Jul 2016 18:26:41 -0700
  4. Subject: [PATCH 1/3] Revert "exynos3: hwc: add hdmi support"
  5.  
  6. This reverts commit 1386f44a87281ecfb0309fc7b6ba00209cd7c05f.
  7. ---
  8. exynos3/s5pc110/include/hardware/hdmi.h | 58 -----------------------------
  9. exynos3/s5pc110/libhwcomposer/Android.mk | 6 +--
  10. exynos3/s5pc110/libhwcomposer/SecHWC.cpp | 57 +---------------------------
  11. exynos3/s5pc110/libhwcomposer/SecHWCUtils.h | 6 ---
  12. 4 files changed, 3 insertions(+), 124 deletions(-)
  13. delete mode 100644 exynos3/s5pc110/include/hardware/hdmi.h
  14.  
  15. diff --git a/exynos3/s5pc110/include/hardware/hdmi.h b/exynos3/s5pc110/include/hardware/hdmi.h
  16. deleted file mode 100644
  17. index c8e3209..0000000
  18. --- a/exynos3/s5pc110/include/hardware/hdmi.h
  19. +++ /dev/null
  20. @@ -1,58 +0,0 @@
  21. -/*
  22. - * Copyright (C) 2012 The Android Open Source Project
  23. - *
  24. - * Licensed under the Apache License, Version 2.0 (the "License");
  25. - * you may not use this file except in compliance with the License.
  26. - * You may obtain a copy of the License at
  27. - *
  28. - * http://www.apache.org/licenses/LICENSE-2.0
  29. - *
  30. - * Unless required by applicable law or agreed to in writing, software
  31. - * distributed under the License is distributed on an "AS IS" BASIS,
  32. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  33. - * See the License for the specific language governing permissions and
  34. - * limitations under the License.
  35. - */
  36. -
  37. -#ifndef ANDROID_HDMI_INTERFACE_H
  38. -#define ANDROID_HDMI_INTERFACE_H
  39. -
  40. -#include <stdint.h>
  41. -#include <sys/cdefs.h>
  42. -#include <sys/types.h>
  43. -
  44. -#include <hardware/hardware.h>
  45. -
  46. -__BEGIN_DECLS
  47. -
  48. -/**
  49. - * The id of this module
  50. - */
  51. -#define HDMI_HARDWARE_MODULE_ID "hdmi"
  52. -
  53. -enum {
  54. - HDMI_MODE_NONE = 0,
  55. - HDMI_MODE_UI,
  56. - HDMI_MODE_VIDEO,
  57. -};
  58. -
  59. -struct hdmi_device_t {
  60. - struct hw_device_t common;
  61. -
  62. - int (*connect)(struct hdmi_device_t* dev);
  63. -
  64. - int (*disconnect)(struct hdmi_device_t* dev);
  65. -
  66. - int (*clear) (struct hdmi_device_t* dev, int hdmiLayer);
  67. -
  68. - int (*blit)(struct hdmi_device_t* dev, int srcW, int srcH, int srcColorFormat,
  69. - uint32_t srcYAddr, uint32_t srcCbAddr, uint32_t srcCrAddr,
  70. - int dstX, int dstY,
  71. - int layer,
  72. - int num_of_hwc_layer);
  73. -};
  74. -
  75. -
  76. -__END_DECLS
  77. -
  78. -#endif // ANDROID_HDMI_INTERFACE_H
  79. diff --git a/exynos3/s5pc110/libhwcomposer/Android.mk b/exynos3/s5pc110/libhwcomposer/Android.mk
  80. index 2330f5b..5785d4d 100644
  81. --- a/exynos3/s5pc110/libhwcomposer/Android.mk
  82. +++ b/exynos3/s5pc110/libhwcomposer/Android.mk
  83. @@ -20,11 +20,7 @@ include $(CLEAR_VARS)
  84. LOCAL_PRELINK_MODULE := false
  85. LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
  86. LOCAL_SHARED_LIBRARIES := liblog libcutils libEGL libGLESv1_CM libhardware libhardware_legacy
  87. -
  88. -LOCAL_CFLAGS := -DLOG_TAG=\"hwcomposer\"
  89. -ifeq ($(BOARD_USES_HDMI),true)
  90. - LOCAL_CFLAGS += -DBOARD_USES_HDMI
  91. -endif
  92. +LOCAL_CFLAGS += -DLOG_TAG=\"hwcomposer\"
  93.  
  94. LOCAL_C_INCLUDES := \
  95. $(LOCAL_PATH)/../include
  96. diff --git a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  97. index 88a8e8c..38b5b2d 100644
  98. --- a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  99. +++ b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  100. @@ -81,9 +81,9 @@ static int set_src_dst_info(hwc_layer_1_t *cur,
  101. src_img->w = prev_handle->iWidth;
  102. src_img->h = prev_handle->iHeight;
  103. src_img->format = prev_handle->iFormat;
  104. - src_img->base = 0;
  105. + src_img->base = NULL;
  106. src_img->offset = 0;
  107. - src_img->mem_id = 0;
  108. + src_img->mem_id =0;
  109.  
  110. src_img->mem_type = HWC_PHYS_MEM_TYPE;
  111. src_img->w = (src_img->w + 15) & (~15);
  112. @@ -434,42 +434,6 @@ static int hwc_set(hwc_composer_device_1_t *dev,
  113. }
  114. }
  115.  
  116. -#if defined(BOARD_USES_HDMI)
  117. - hdmi_device_t* hdmi = ctx->hdmi;
  118. - if (ctx->num_of_hwc_layer == 1 && hdmi) {
  119. - if ((src_img.format == HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED)||
  120. - (src_img.format == HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP)) {
  121. - ADDRS * addr = (ADDRS *)(src_img.base);
  122. - hdmi->blit(hdmi,
  123. - src_img.w,
  124. - src_img.h,
  125. - src_img.format,
  126. - (unsigned int)addr->addr_y,
  127. - (unsigned int)addr->addr_cbcr,
  128. - (unsigned int)addr->addr_cbcr,
  129. - 0, 0,
  130. - HDMI_MODE_VIDEO,
  131. - ctx->num_of_hwc_layer);
  132. - } else if ((src_img.format == HAL_PIXEL_FORMAT_YCbCr_420_SP) ||
  133. - (src_img.format == HAL_PIXEL_FORMAT_YCrCb_420_SP) ||
  134. - (src_img.format == HAL_PIXEL_FORMAT_YCbCr_420_P) ||
  135. - (src_img.format == HAL_PIXEL_FORMAT_YV12)) {
  136. - hdmi->blit(hdmi,
  137. - src_img.w,
  138. - src_img.h,
  139. - src_img.format,
  140. - (unsigned int)ctx->fimc.params.src.buf_addr_phy_rgb_y,
  141. - (unsigned int)ctx->fimc.params.src.buf_addr_phy_cb,
  142. - (unsigned int)ctx->fimc.params.src.buf_addr_phy_cr,
  143. - 0, 0,
  144. - HDMI_MODE_VIDEO,
  145. - ctx->num_of_hwc_layer);
  146. - } else {
  147. - ALOGE("%s: Unsupported format = %d for hdmi", __func__, src_img.format);
  148. - }
  149. - }
  150. -#endif
  151. -
  152. return 0;
  153. }
  154.  
  155. @@ -666,9 +630,6 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
  156. int status = 0;
  157. int err;
  158. struct hwc_win_info_t *win;
  159. -#if defined(BOARD_USES_HDMI)
  160. - struct hw_module_t *hdmi_module;
  161. -#endif
  162.  
  163. if(hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
  164. (const hw_module_t**)&gpsGrallocModule))
  165. @@ -701,20 +662,6 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
  166.  
  167. *device = &dev->device.common;
  168.  
  169. -#if defined(BOARD_USES_HDMI)
  170. - dev->hdmi = NULL;
  171. - if(hw_get_module(HDMI_HARDWARE_MODULE_ID,
  172. - (const hw_module_t**)&hdmi_module)) {
  173. - ALOGE("%s:: HDMI device not present", __func__);
  174. - } else {
  175. - int ret = module->methods->open(hdmi_module, "hdmi-composer",
  176. - (hw_device_t **)&dev->hdmi);
  177. - if(ret < 0) {
  178. - ALOGE("%s:: Failed to open hdmi device : %s", __func__, strerror(ret));
  179. - }
  180. - }
  181. -#endif
  182. -
  183. /* initializing */
  184. memset(&(dev->fimc), 0, sizeof(s5p_fimc_t));
  185. dev->fimc.dev_fd = -1;
  186. diff --git a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  187. index 81a0723..18aa727 100644
  188. --- a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  189. +++ b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  190. @@ -37,9 +37,6 @@
  191. #include <hardware/gralloc.h>
  192. #include <hardware/hardware.h>
  193. #include <hardware/hwcomposer.h>
  194. -#if defined(BOARD_USES_HDMI)
  195. -#include "hardware/hdmi.h"
  196. -#endif
  197.  
  198. #include "s5p_fimc.h"
  199. #include "sec_lcd.h"
  200. @@ -128,9 +125,6 @@ struct hwc_context_t {
  201. unsigned int num_of_fb_layer;
  202. unsigned int num_of_hwc_layer;
  203. unsigned int num_of_fb_layer_prev;
  204. -#if defined(BOARD_USES_HDMI)
  205. - hdmi_device_t* hdmi;
  206. -#endif
  207. };
  208.  
  209. int window_open(struct hwc_win_info_t *win, int id);
  210. --
  211. 2.1.4
  212.  
  213.  
  214. From ab1d0160c4a83d88319101134f71ce22b3281e7c Mon Sep 17 00:00:00 2001
  215. From: xc-racer99 <xc-racer2@live.ca>
  216. Date: Thu, 7 Jul 2016 18:25:45 -0700
  217. Subject: [PATCH 2/3] Revert "exynos3: libhdmi: initial commit"
  218.  
  219. This reverts commit c9288149a35eef64908085d9799f2ba908bfabd2.
  220. ---
  221. exynos3/s5pc110/include/s5p_tvout.h | 189 -------
  222. exynos3/s5pc110/include/sec_lcd.h | 18 +-
  223. exynos3/s5pc110/include/sec_utils.h | 2 -
  224. exynos3/s5pc110/libhdmi/Android.mk | 38 --
  225. exynos3/s5pc110/libhdmi/SecHDMI.cpp | 846 --------------------------------
  226. exynos3/s5pc110/libhdmi/SecHDMI.h | 113 -----
  227. exynos3/s5pc110/libhdmi/fimc.c | 722 ---------------------------
  228. exynos3/s5pc110/libhdmi/fimc.h | 76 ---
  229. exynos3/s5pc110/libhdmi/fimd.c | 231 ---------
  230. exynos3/s5pc110/libhdmi/fimd.h | 54 --
  231. exynos3/s5pc110/libhdmi/hal_module.cpp | 222 ---------
  232. exynos3/s5pc110/libhdmi/test/Android.mk | 61 ---
  233. exynos3/s5pc110/libhdmi/test/test.h | 48 --
  234. exynos3/s5pc110/libhdmi/test/test1.cpp | 116 -----
  235. exynos3/s5pc110/libhdmi/test/test2.cpp | 97 ----
  236. 15 files changed, 2 insertions(+), 2831 deletions(-)
  237. delete mode 100644 exynos3/s5pc110/include/s5p_tvout.h
  238. delete mode 100644 exynos3/s5pc110/libhdmi/Android.mk
  239. delete mode 100644 exynos3/s5pc110/libhdmi/SecHDMI.cpp
  240. delete mode 100644 exynos3/s5pc110/libhdmi/SecHDMI.h
  241. delete mode 100644 exynos3/s5pc110/libhdmi/fimc.c
  242. delete mode 100644 exynos3/s5pc110/libhdmi/fimc.h
  243. delete mode 100644 exynos3/s5pc110/libhdmi/fimd.c
  244. delete mode 100644 exynos3/s5pc110/libhdmi/fimd.h
  245. delete mode 100644 exynos3/s5pc110/libhdmi/hal_module.cpp
  246. delete mode 100644 exynos3/s5pc110/libhdmi/test/Android.mk
  247. delete mode 100644 exynos3/s5pc110/libhdmi/test/test.h
  248. delete mode 100644 exynos3/s5pc110/libhdmi/test/test1.cpp
  249. delete mode 100644 exynos3/s5pc110/libhdmi/test/test2.cpp
  250.  
  251. diff --git a/exynos3/s5pc110/include/s5p_tvout.h b/exynos3/s5pc110/include/s5p_tvout.h
  252. deleted file mode 100644
  253. index 85b8dad..0000000
  254. --- a/exynos3/s5pc110/include/s5p_tvout.h
  255. +++ /dev/null
  256. @@ -1,189 +0,0 @@
  257. -/*
  258. - * Copyright@ Samsung Electronics Co. LTD
  259. - *
  260. - * Licensed under the Apache License, Version 2.0 (the "License");
  261. - * you may not use this file except in compliance with the License.
  262. - * You may obtain a copy of the License at
  263. - *
  264. - * http://www.apache.org/licenses/LICENSE-2.0
  265. - *
  266. - * Unless required by applicable law or agreed to in writing, software
  267. - * distributed under the License is distributed on an "AS IS" BASIS,
  268. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  269. - * See the License for the specific language governing permissions and
  270. - * limitations under the License.
  271. - */
  272. -
  273. -#ifndef __S5P_TVOUT_H__
  274. -#define __S5P_TVOUT_H__
  275. -
  276. -#include <linux/fb.h>
  277. -#include <linux/videodev2.h>
  278. -
  279. -#ifdef __cplusplus
  280. -extern "C" {
  281. -#endif
  282. -
  283. -/*******************************************
  284. - * Define
  285. - *******************************************/
  286. -/* TVOUT control */
  287. -
  288. -#define TVOUT_DEV "/dev/video14"
  289. -#define TVOUT_DEV_V "/dev/video21"
  290. -#define TVOUT_DEV_V2 "/dev/video22"
  291. -
  292. -/* ------------- Output -----------------*/
  293. -/* type */
  294. -#define V4L2_OUTPUT_TYPE_MSDMA 4
  295. -#define V4L2_OUTPUT_TYPE_COMPOSITE 5
  296. -#define V4L2_OUTPUT_TYPE_SVIDEO 6
  297. -#define V4L2_OUTPUT_TYPE_YPBPR_INERLACED 7
  298. -#define V4L2_OUTPUT_TYPE_YPBPR_PROGRESSIVE 8
  299. -#define V4L2_OUTPUT_TYPE_RGB_PROGRESSIVE 9
  300. -#define V4L2_OUTPUT_TYPE_DIGITAL 10
  301. -#define V4L2_OUTPUT_TYPE_HDMI V4L2_OUTPUT_TYPE_DIGITAL
  302. -#define V4L2_OUTPUT_TYPE_HDMI_RGB 11
  303. -#define V4L2_OUTPUT_TYPE_DVI 12
  304. -
  305. -/* ------------- STD -------------------*/
  306. -#define V4L2_STD_PAL_BDGHI\
  307. - (V4L2_STD_PAL_B|V4L2_STD_PAL_D|V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_PAL_I)
  308. -
  309. -#define V4L2_STD_480P_60_16_9 ((v4l2_std_id)0x04000000)
  310. -#define V4L2_STD_480P_60_4_3 ((v4l2_std_id)0x05000000)
  311. -#define V4L2_STD_576P_50_16_9 ((v4l2_std_id)0x06000000)
  312. -#define V4L2_STD_576P_50_4_3 ((v4l2_std_id)0x07000000)
  313. -#define V4L2_STD_720P_60 ((v4l2_std_id)0x08000000)
  314. -#define V4L2_STD_720P_50 ((v4l2_std_id)0x09000000)
  315. -#define V4L2_STD_1080P_60 ((v4l2_std_id)0x0a000000)
  316. -#define V4L2_STD_1080P_50 ((v4l2_std_id)0x0b000000)
  317. -#define V4L2_STD_1080I_60 ((v4l2_std_id)0x0c000000)
  318. -#define V4L2_STD_1080I_50 ((v4l2_std_id)0x0d000000)
  319. -#define V4L2_STD_480P_59 ((v4l2_std_id)0x0e000000)
  320. -#define V4L2_STD_720P_59 ((v4l2_std_id)0x0f000000)
  321. -#define V4L2_STD_1080I_59 ((v4l2_std_id)0x10000000)
  322. -#define V4L2_STD_1080P_59 ((v4l2_std_id)0x11000000)
  323. -#define V4L2_STD_1080P_30 ((v4l2_std_id)0x12000000)
  324. -#define V4L2_STD_TVOUT_720P_60_SBS_HALF ((v4l2_std_id)0x13000000)
  325. -#define V4L2_STD_TVOUT_720P_59_SBS_HALF ((v4l2_std_id)0x14000000)
  326. -#define V4L2_STD_TVOUT_720P_50_TB ((v4l2_std_id)0x15000000)
  327. -#define V4L2_STD_TVOUT_1080P_24_TB ((v4l2_std_id)0x16000000)
  328. -#define V4L2_STD_TVOUT_1080P_23_TB ((v4l2_std_id)0x17000000)
  329. -
  330. -/* ------------- Input ------------------*/
  331. -/* type */
  332. -#define V4L2_INPUT_TYPE_MSDMA 3
  333. -#define V4L2_INPUT_TYPE_FIFO 4
  334. -
  335. -/* TVOUT video */
  336. -#define PFX_NODE_FB "/dev/graphics/fb"
  337. -
  338. -/*******************************************
  339. - * structures
  340. - *******************************************/
  341. -
  342. -/* TVOUT */
  343. -struct v4l2_vid_overlay_src {
  344. - void *base_y;
  345. - void *base_c;
  346. - struct v4l2_pix_format pix_fmt;
  347. -};
  348. -
  349. -struct v4l2_window_s5p_tvout {
  350. - __u32 capability;
  351. - __u32 flags;
  352. - __u32 priority;
  353. - struct v4l2_window win;
  354. -};
  355. -
  356. -struct v4l2_pix_format_s5p_tvout {
  357. - void *base_y;
  358. - void *base_c;
  359. - __u32 src_img_endian;
  360. - struct v4l2_pix_format pix_fmt;
  361. -};
  362. -
  363. -struct vid_overlay_param {
  364. - struct v4l2_vid_overlay_src src;
  365. - struct v4l2_rect src_crop;
  366. - struct v4l2_framebuffer dst;
  367. - struct v4l2_window dst_win;
  368. -};
  369. -
  370. -struct tvout_param {
  371. - struct v4l2_pix_format_s5p_tvout tvout_src;
  372. - struct v4l2_window_s5p_tvout tvout_rect;
  373. - struct v4l2_rect tvout_dst;
  374. -};
  375. -
  376. -struct overlay_param {
  377. - struct v4l2_framebuffer overlay_frame;
  378. - struct v4l2_window_s5p_tvout overlay_rect;
  379. - struct v4l2_rect overlay_dst;
  380. -};
  381. -
  382. -/* FB */
  383. -struct s5ptvfb_user_window {
  384. - int x;
  385. - int y;
  386. -};
  387. -
  388. -struct s5ptvfb_user_plane_alpha {
  389. - int channel;
  390. - unsigned char alpha;
  391. -};
  392. -
  393. -struct s5ptvfb_user_chroma {
  394. - int enabled;
  395. - unsigned char red;
  396. - unsigned char green;
  397. - unsigned char blue;
  398. -};
  399. -
  400. -enum s5ptvfb_ver_scaling_t {
  401. - VERTICAL_X1,
  402. - VERTICAL_X2,
  403. -};
  404. -
  405. -enum s5ptvfb_hor_scaling_t {
  406. - HORIZONTAL_X1,
  407. - HORIZONTAL_X2,
  408. -};
  409. -
  410. -struct s5ptvfb_user_scaling {
  411. - enum s5ptvfb_ver_scaling_t ver;
  412. - enum s5ptvfb_hor_scaling_t hor;
  413. -};
  414. -
  415. -/*******************************************
  416. - * custom ioctls
  417. - *******************************************/
  418. -
  419. -#define VIDIOC_S_BASEADDR _IOR('V', 83, int)
  420. -
  421. -#define VIDIOC_HDCP_ENABLE _IOWR('V', 100, unsigned int)
  422. -#define VIDIOC_HDCP_STATUS _IOR('V', 101, unsigned int)
  423. -#define VIDIOC_HDCP_PROT_STATUS _IOR('V', 102, unsigned int)
  424. -
  425. -#define VIDIOC_INIT_AUDIO _IOR('V', 103, unsigned int)
  426. -#define VIDIOC_AV_MUTE _IOR('V', 104, unsigned int)
  427. -#define VIDIOC_G_AVMUTE _IOR('V', 105, unsigned int)
  428. -#define HPD_GET_STATE _IOR('H', 100, unsigned int)
  429. -
  430. -#define S5PTVFB_WIN_POSITION _IOW('F', 213, struct s5ptvfb_user_window)
  431. -#define S5PTVFB_WIN_SET_PLANE_ALPHA _IOW('F', 214, struct s5ptvfb_user_plane_alpha)
  432. -#define S5PTVFB_WIN_SET_CHROMA _IOW('F', 215, struct s5ptvfb_user_chroma)
  433. -
  434. -#define S5PTVFB_SET_VSYNC_INT _IOW('F', 216, unsigned int)
  435. -#define S5PTVFB_WAITFORVSYNC _IO('F', 32)
  436. -#define S5PTVFB_WIN_SET_ADDR _IOW('F', 219, unsigned int)
  437. -#define S5PTVFB_SET_WIN_ON _IOW('F', 220, unsigned int)
  438. -#define S5PTVFB_SET_WIN_OFF _IOW('F', 221, unsigned int)
  439. -#define S5PTVFB_SCALING _IOW('F', 222, struct s5ptvfb_user_scaling)
  440. -
  441. -#ifdef __cplusplus
  442. -}
  443. -#endif
  444. -
  445. -#endif /* __S5P_TVOUT_H__ */
  446. diff --git a/exynos3/s5pc110/include/sec_lcd.h b/exynos3/s5pc110/include/sec_lcd.h
  447. index f104d2d..82ef42f 100755
  448. --- a/exynos3/s5pc110/include/sec_lcd.h
  449. +++ b/exynos3/s5pc110/include/sec_lcd.h
  450. @@ -26,18 +26,6 @@ struct secfb_user_window {
  451. int y;
  452. };
  453.  
  454. -struct s3cfb_next_info {
  455. - unsigned int phy_start_addr;
  456. - unsigned int xres; /* visible resolution*/
  457. - unsigned int yres;
  458. - unsigned int xres_virtual; /* virtual resolution*/
  459. - unsigned int yres_virtual;
  460. - unsigned int xoffset; /* offset from virtual to visible */
  461. - unsigned int yoffset; /* resolution */
  462. - unsigned int lcd_offset_x;
  463. - unsigned int lcd_offset_y;
  464. -};
  465. -
  466. /*
  467. * C U S T O M I O C T L S
  468. *
  469. @@ -46,15 +34,13 @@ struct s3cfb_next_info {
  470. #define FBIO_WAITFORVSYNC _IO ('F', 32)
  471. #define SECFB_WIN_POSITION _IOW ('F', 203, struct secfb_user_window)
  472. #define S3CFB_SET_VSYNC_INT _IOW ('F', 206, uint32_t)
  473. -#define S3CFB_GET_CURR_FB_INFO _IOR ('F', 305, struct s3cfb_next_info)
  474. #define S3CFB_WAIT_FOR_VSYNC _IOR ('F', 311, uint64_t)
  475.  
  476. -#define DEFAULT_LCD_WIDTH (600)
  477. -#define DEFAULT_LCD_HEIGHT (1024)
  478. +#define DEFAULT_LCD_WIDTH (480)
  479. +#define DEFAULT_LCD_HEIGHT (800)
  480. #define DEFAULT_LCD_BPP (32)
  481.  
  482. /***************** LCD frame buffer *****************/
  483. -#define S3CFB_SIZE 5
  484. #define FB0_NAME "/dev/fb0"
  485. #define FB1_NAME "/dev/fb1"
  486. #define FB2_NAME "/dev/fb2"
  487. diff --git a/exynos3/s5pc110/include/sec_utils.h b/exynos3/s5pc110/include/sec_utils.h
  488. index 9404f61..0056ca2 100644
  489. --- a/exynos3/s5pc110/include/sec_utils.h
  490. +++ b/exynos3/s5pc110/include/sec_utils.h
  491. @@ -22,8 +22,6 @@
  492. //---------------------------------------------------------//
  493.  
  494. #include <hardware/hardware.h>
  495. -#include <utils/Log.h>
  496. -
  497. #include "sec_format.h"
  498.  
  499. #ifdef __cplusplus
  500. diff --git a/exynos3/s5pc110/libhdmi/Android.mk b/exynos3/s5pc110/libhdmi/Android.mk
  501. deleted file mode 100644
  502. index 9bfa180..0000000
  503. --- a/exynos3/s5pc110/libhdmi/Android.mk
  504. +++ /dev/null
  505. @@ -1,38 +0,0 @@
  506. -# Copyright (C) 2008 The Android Open Source Project
  507. -#
  508. -# Licensed under the Apache License, Version 2.0 (the "License");
  509. -# you may not use this file except in compliance with the License.
  510. -# You may obtain a copy of the License at
  511. -#
  512. -# http://www.apache.org/licenses/LICENSE-2.0
  513. -#
  514. -# Unless required by applicable law or agreed to in writing, software
  515. -# distributed under the License is distributed on an "AS IS" BASIS,
  516. -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  517. -# See the License for the specific language governing permissions and
  518. -# limitations under the License.
  519. -
  520. -LOCAL_PATH:= $(call my-dir)
  521. -include $(CLEAR_VARS)
  522. -
  523. -LOCAL_CFLAGS := -fno-short-enums
  524. -LOCAL_CFLAGS += -DLOG_TAG=\"hdmi.$(TARGET_BOARD_PLATFORM)\"
  525. -
  526. -LOCAL_C_INCLUDES := \
  527. - $(LOCAL_PATH)/../include
  528. -
  529. -LOCAL_SRC_FILES := \
  530. - fimc.c \
  531. - fimd.c \
  532. - SecHDMI.cpp \
  533. - hal_module.cpp
  534. -
  535. -LOCAL_MODULE := hdmi.$(TARGET_BOARD_PLATFORM)
  536. -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
  537. -LOCAL_MODULE_TAGS := optional
  538. -
  539. -LOCAL_SHARED_LIBRARIES := liblog libutils
  540. -
  541. -include $(BUILD_SHARED_LIBRARY)
  542. -
  543. -include $(call all-makefiles-under,$(LOCAL_PATH))
  544. diff --git a/exynos3/s5pc110/libhdmi/SecHDMI.cpp b/exynos3/s5pc110/libhdmi/SecHDMI.cpp
  545. deleted file mode 100644
  546. index eeacb4d..0000000
  547. --- a/exynos3/s5pc110/libhdmi/SecHDMI.cpp
  548. +++ /dev/null
  549. @@ -1,846 +0,0 @@
  550. -/*
  551. - * Copyright 2011, Havlena Petr <havlenapetr@gmail.com>
  552. - *
  553. - * Licensed under the Apache License, Version 2.0 (the "License");
  554. - * you may not use this file except in compliance with the License.
  555. - * You may obtain a copy of the License at
  556. - *
  557. - * http://www.apache.org/licenses/LICENSE-2.0
  558. - *
  559. - * Unless required by applicable law or agreed to in writing, software
  560. - * distributed under the License is distributed on an "AS IS" BASIS,
  561. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  562. - * See the License for the specific language governing permissions and
  563. - * limitations under the License.
  564. - */
  565. -
  566. -#define LOG_NDEBUG 0
  567. -#include <utils/Log.h>
  568. -
  569. -#include <string.h>
  570. -#include <stdlib.h>
  571. -#include <sys/poll.h>
  572. -
  573. -#include <sec_lcd.h>
  574. -
  575. -#include "SecHDMI.h"
  576. -#include "fimd.h"
  577. -
  578. -using namespace android;
  579. -
  580. -#define RETURN_IF(return_value) \
  581. - if (return_value < 0) { \
  582. - ALOGE("%s::%d fail. errno: %s", \
  583. - __func__, __LINE__, strerror(errno)); \
  584. - return -1; \
  585. - }
  586. -
  587. -#define ALOG_IF(return_value) \
  588. - if (return_value < 0) { \
  589. - ALOGE("%s::%d fail. errno: %s", \
  590. - __func__, __LINE__, strerror(errno)); \
  591. - }
  592. -
  593. -#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
  594. -#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
  595. -#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
  596. -
  597. -struct s5p_tv_standart_internal {
  598. - int index;
  599. - unsigned long value;
  600. -} s5p_tv_standards[] = {
  601. - {
  602. - S5P_TV_STD_NTSC_M,
  603. - V4L2_STD_NTSC_M,
  604. - }, {
  605. - S5P_TV_STD_PAL_BDGHI,
  606. - V4L2_STD_PAL_BDGHI,
  607. - }, {
  608. - S5P_TV_STD_PAL_M,
  609. - V4L2_STD_PAL_M,
  610. - }, {
  611. - S5P_TV_STD_PAL_N,
  612. - V4L2_STD_PAL_N,
  613. - }, {
  614. - S5P_TV_STD_PAL_Nc,
  615. - V4L2_STD_PAL_Nc,
  616. - }, {
  617. - S5P_TV_STD_PAL_60,
  618. - V4L2_STD_PAL_60,
  619. - }, {
  620. - S5P_TV_STD_NTSC_443,
  621. - V4L2_STD_NTSC_443,
  622. - }, {
  623. - S5P_TV_STD_480P_60_16_9,
  624. - V4L2_STD_480P_60_16_9,
  625. - }, {
  626. - S5P_TV_STD_480P_60_4_3,
  627. - V4L2_STD_480P_60_4_3,
  628. - }, {
  629. - S5P_TV_STD_576P_50_16_9,
  630. - V4L2_STD_576P_50_16_9,
  631. - }, {
  632. - S5P_TV_STD_576P_50_4_3,
  633. - V4L2_STD_576P_50_4_3,
  634. - }, {
  635. - S5P_TV_STD_720P_60,
  636. - V4L2_STD_720P_60,
  637. - }, {
  638. - S5P_TV_STD_720P_50,
  639. - V4L2_STD_720P_50,
  640. - },
  641. -};
  642. -
  643. -static inline int calcFrameSize(int format, int width, int height)
  644. -{
  645. - int size = 0;
  646. -
  647. - switch (format) {
  648. - case V4L2_PIX_FMT_YUV420:
  649. - case V4L2_PIX_FMT_NV12:
  650. - case V4L2_PIX_FMT_NV21:
  651. - size = (width * height * 3 / 2);
  652. - break;
  653. -
  654. - case V4L2_PIX_FMT_NV12T:
  655. - size = ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)) +
  656. - ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2));
  657. - break;
  658. -
  659. - case V4L2_PIX_FMT_YUV422P:
  660. - case V4L2_PIX_FMT_YUYV:
  661. - case V4L2_PIX_FMT_UYVY:
  662. - size = (width * height * 2);
  663. - break;
  664. -
  665. - default :
  666. - ALOGE("ERR(%s):Invalid V4L2 pixel format(%d)\n", __func__, format);
  667. - case V4L2_PIX_FMT_RGB565:
  668. - size = (width * height * 2);
  669. - break;
  670. - }
  671. - return size;
  672. -}
  673. -
  674. -static int get_pixel_depth(unsigned int fmt)
  675. -{
  676. - int depth = 0;
  677. -
  678. - switch (fmt) {
  679. - case V4L2_PIX_FMT_NV12:
  680. - depth = 12;
  681. - break;
  682. - case V4L2_PIX_FMT_NV12T:
  683. - depth = 12;
  684. - break;
  685. - case V4L2_PIX_FMT_NV21:
  686. - depth = 12;
  687. - break;
  688. - case V4L2_PIX_FMT_YUV420:
  689. - depth = 12;
  690. - break;
  691. -
  692. - case V4L2_PIX_FMT_RGB565:
  693. - case V4L2_PIX_FMT_YUYV:
  694. - case V4L2_PIX_FMT_YVYU:
  695. - case V4L2_PIX_FMT_UYVY:
  696. - case V4L2_PIX_FMT_VYUY:
  697. - case V4L2_PIX_FMT_NV16:
  698. - case V4L2_PIX_FMT_NV61:
  699. - case V4L2_PIX_FMT_YUV422P:
  700. - depth = 16;
  701. - break;
  702. -
  703. - case V4L2_PIX_FMT_RGB32:
  704. - depth = 32;
  705. - break;
  706. - }
  707. -
  708. - return depth;
  709. -}
  710. -
  711. -// ======================================================================
  712. -// Video ioctls
  713. -
  714. -static int tv20_v4l2_querycap(int fp)
  715. -{
  716. - struct v4l2_capability cap;
  717. -
  718. - int ret = ioctl(fp, VIDIOC_QUERYCAP, &cap);
  719. - if (ret < 0) {
  720. - ALOGE("ERR(%s):VIDIOC_QUERYCAP failed", __func__);
  721. - return -1;
  722. - }
  723. -
  724. - if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
  725. - ALOGE("ERR(%s):no output devices\n", __func__);
  726. - return -1;
  727. - }
  728. - ALOGV("Name of cap driver is %s", cap.driver);
  729. -
  730. - return ret;
  731. -}
  732. -
  733. -static const __u8* tv20_v4l2_enum_output(int fp, int index)
  734. -{
  735. - static struct v4l2_output output;
  736. -
  737. - output.index = index;
  738. - if (ioctl(fp, VIDIOC_ENUMOUTPUT, &output) != 0) {
  739. - ALOGE("ERR(%s):No matching index found", __func__);
  740. - return NULL;
  741. - }
  742. - ALOGV("Name of output channel[%d] is %s", output.index, output.name);
  743. -
  744. - return output.name;
  745. -}
  746. -
  747. -static const __u8* tv20_v4l2_enum_standarts(int fp, int index)
  748. -{
  749. - static struct v4l2_standard standart;
  750. -
  751. - standart.index = index;
  752. - if (ioctl(fp, VIDIOC_ENUMSTD, &standart) != 0) {
  753. - ALOGE("ERR(%s):No matching index found\n", __func__);
  754. - return NULL;
  755. - }
  756. - ALOGV("Name of output standart[%d] is %s\n", standart.index, standart.name);
  757. -
  758. - return standart.name;
  759. -}
  760. -
  761. -static int tv20_v4l2_s_output(int fp, int index)
  762. -{
  763. - struct v4l2_output output;
  764. - int ret;
  765. -
  766. - output.index = index;
  767. -
  768. - ret = ioctl(fp, VIDIOC_S_OUTPUT, &output);
  769. - if (ret < 0) {
  770. - ALOGE("ERR(%s):VIDIOC_S_OUPUT failed\n", __func__);
  771. - return ret;
  772. - }
  773. - return ret;
  774. -}
  775. -
  776. -static int tv20_v4l2_s_std(int fp, unsigned long id)
  777. -{
  778. - v4l2_std_id std;
  779. - int ret;
  780. -
  781. - std = id;
  782. -
  783. - ret = ioctl(fp, VIDIOC_S_STD, &std);
  784. - if (ret < 0) {
  785. - ALOGE("ERR(%s):VIDIOC_S_OUPUT failed\n", __func__);
  786. - return ret;
  787. - }
  788. - return ret;
  789. -}
  790. -
  791. -static int tv20_v4l2_enum_fmt(int fp, unsigned int fmt)
  792. -{
  793. - struct v4l2_fmtdesc fmtdesc;
  794. - int found = 0;
  795. -
  796. - fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  797. - fmtdesc.index = 0;
  798. -
  799. - while (ioctl(fp, VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
  800. - if (fmtdesc.pixelformat == fmt) {
  801. - ALOGV("passed fmt = %#x found pixel format[%d]: %s\n", fmt, fmtdesc.index, fmtdesc.description);
  802. - found = 1;
  803. - break;
  804. - }
  805. -
  806. - fmtdesc.index++;
  807. - }
  808. -
  809. - if (!found) {
  810. - ALOGE("unsupported pixel format\n");
  811. - return -1;
  812. - }
  813. -
  814. - return 0;
  815. -}
  816. -
  817. -static int tv20_v4l2_s_fmt(int fp, int width, int height,
  818. - unsigned int fmt, unsigned int yAddr, unsigned int cAddr)
  819. -{
  820. - struct v4l2_format v4l2_fmt;
  821. - struct v4l2_pix_format_s5p_tvout pixfmt;
  822. - int ret;
  823. -
  824. - v4l2_fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  825. -#if 0
  826. - ret = ioctl(fp, VIDIOC_G_FMT, &v4l2_fmt);
  827. - if (ret < 0) {
  828. - ALOGE("ERR(%s):VIDIOC_G_FMT failed", __func__);
  829. - return -1;
  830. - }
  831. -#endif
  832. -
  833. - memset(&pixfmt, 0, sizeof(pixfmt));
  834. - pixfmt.pix_fmt.width = width;
  835. - pixfmt.pix_fmt.height = height;
  836. - pixfmt.pix_fmt.pixelformat = fmt;
  837. - pixfmt.pix_fmt.sizeimage = (width * height * get_pixel_depth(fmt)) / 8;
  838. - pixfmt.pix_fmt.field = V4L2_FIELD_NONE;
  839. -
  840. - // here we must set addresses of our memory for video out
  841. - pixfmt.base_y = (void *)yAddr;
  842. - pixfmt.base_c = (void* )cAddr;
  843. -
  844. - v4l2_fmt.fmt.pix = pixfmt.pix_fmt;
  845. - memcpy(v4l2_fmt.fmt.raw_data, &pixfmt,
  846. - sizeof(struct v4l2_pix_format_s5p_tvout));
  847. -
  848. - /* Set up for capture */
  849. - ret = ioctl(fp, VIDIOC_S_FMT, &v4l2_fmt);
  850. - if (ret < 0) {
  851. - ALOGE("ERR(%s):VIDIOC_S_FMT failed\n", __func__);
  852. - return -1;
  853. - }
  854. - return 0;
  855. -}
  856. -
  857. -static int tv20_v4l2_streamon(int fp)
  858. -{
  859. - enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  860. - int ret;
  861. -
  862. - ret = ioctl(fp, VIDIOC_STREAMON, &type);
  863. - if (ret < 0) {
  864. - ALOGE("ERR(%s):VIDIOC_STREAMON failed\n", __func__);
  865. - return ret;
  866. - }
  867. -
  868. - return ret;
  869. -}
  870. -
  871. -static int tv20_v4l2_streamoff(int fp)
  872. -{
  873. - enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  874. - int ret;
  875. -
  876. - ALOGV("%s :", __func__);
  877. - ret = ioctl(fp, VIDIOC_STREAMOFF, &type);
  878. - if (ret < 0) {
  879. - ALOGE("ERR(%s):VIDIOC_STREAMOFF failed\n", __func__);
  880. - return ret;
  881. - }
  882. -
  883. - return ret;
  884. -}
  885. -
  886. -static int tv20_v4l2_g_parm(int fp, struct v4l2_streamparm *streamparm)
  887. -{
  888. - int ret;
  889. -
  890. - streamparm->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  891. -
  892. - ret = ioctl(fp, VIDIOC_G_PARM, streamparm);
  893. - if (ret < 0) {
  894. - ALOGE("ERR(%s):VIDIOC_G_PARM failed\n", __func__);
  895. - return -1;
  896. - }
  897. -
  898. - ALOGV("%s : timeperframe: numerator %d, denominator %d\n", __func__,
  899. - streamparm->parm.capture.timeperframe.numerator,
  900. - streamparm->parm.capture.timeperframe.denominator);
  901. -
  902. - return 0;
  903. -}
  904. -
  905. -static int tv20_v4l2_s_parm(int fp, struct v4l2_streamparm *streamparm)
  906. -{
  907. - int ret;
  908. -
  909. - streamparm->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  910. -
  911. - ret = ioctl(fp, VIDIOC_S_PARM, streamparm);
  912. - if (ret < 0) {
  913. - ALOGE("ERR(%s):VIDIOC_S_PARM failed\n", __func__);
  914. - return ret;
  915. - }
  916. - return 0;
  917. -}
  918. -
  919. -static int tv20_v4l2_s_crop(int fp, int offset_x, int offset_y, int width, int height)
  920. -{
  921. - struct v4l2_crop crop;
  922. -
  923. - crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  924. - crop.c.left = offset_x;
  925. - crop.c.top = offset_y;
  926. - crop.c.width = width;
  927. - crop.c.height = height;
  928. -
  929. - int ret = ioctl(fp, VIDIOC_S_CROP, &crop);
  930. - if (ret < 0) {
  931. - ALOGE("ERR(%s):VIDIOC_S_PARM failed\n", __func__);
  932. - return ret;
  933. - }
  934. - return 0;
  935. -}
  936. -
  937. -static int tv20_v4l2_start_overlay(int fp)
  938. -{
  939. - int ret, start = 1;
  940. -
  941. - ret = ioctl(fp, VIDIOC_OVERLAY, &start);
  942. - if (ret < 0) {
  943. - ALOGE("ERR(%s): VIDIOC_OVERLAY start failed\n", __func__);
  944. - return ret;
  945. - }
  946. -
  947. - return ret;
  948. -}
  949. -
  950. -static int tv20_v4l2_stop_overlay(int fp)
  951. -{
  952. - int ret, stop = 0;
  953. -
  954. - ret = ioctl(fp, VIDIOC_OVERLAY, &stop);
  955. - if (ret < 0) {
  956. - ALOGE("ERR(%s): VIDIOC_OVERLAY stop failed\n", __func__);
  957. - return ret;
  958. - }
  959. -
  960. - return ret;
  961. -}
  962. -
  963. -static int tv20_v4l2_s_baseaddr(int fp, void *base_addr)
  964. -{
  965. - int ret;
  966. -
  967. - ret = ioctl(fp, S5PTVFB_WIN_SET_ADDR, base_addr);
  968. - if (ret < 0) {
  969. - ALOGE("ERR(%s): VIDIOC_S_BASEADDR failed %d", __func__, ret);
  970. - return ret;
  971. - }
  972. -
  973. - return 0;
  974. -}
  975. -
  976. -static int tv20_v4l2_s_position(int fp, int x, int y)
  977. -{
  978. - int ret;
  979. - struct s5ptvfb_user_window window;
  980. -
  981. - memset(&window, 0, sizeof(struct s5ptvfb_user_window));
  982. - window.x = x;
  983. - window.y = y;
  984. -
  985. - ret = ioctl(fp, S5PTVFB_WIN_POSITION, &window);
  986. - if (ret < 0) {
  987. - ALOGE("ERR(%s): VIDIOC_S_WIN_POSITION failed %d", __func__, ret);
  988. - return ret;
  989. - }
  990. -
  991. - return 0;
  992. -}
  993. -
  994. -// ======================================================================
  995. -// Audio ioctls
  996. -
  997. -static int tv20_v4l2_audio_enable(int fp)
  998. -{
  999. - return ioctl(fp, VIDIOC_INIT_AUDIO, 1);
  1000. -}
  1001. -
  1002. -static int tv20_v4l2_audio_disable(int fp)
  1003. -{
  1004. - return ioctl(fp, VIDIOC_INIT_AUDIO, 0);
  1005. -}
  1006. -
  1007. -static int tv20_v4l2_audio_mute(int fp)
  1008. -{
  1009. - return ioctl(fp, VIDIOC_AV_MUTE, 1);
  1010. -}
  1011. -
  1012. -static int tv20_v4l2_audio_unmute(int fp)
  1013. -{
  1014. - return ioctl(fp, VIDIOC_AV_MUTE, 0);
  1015. -}
  1016. -
  1017. -static int tv20_v4l2_audio_get_mute_state(int fp)
  1018. -{
  1019. - return ioctl(fp, VIDIOC_G_AVMUTE, 0);
  1020. -}
  1021. -
  1022. -// ======================================================================
  1023. -// Class which comunicate with kernel driver
  1024. -
  1025. -SecHDMI::SecHDMI()
  1026. - : mTvOutFd(-1),
  1027. - mTvOutVFd(-1),
  1028. - mLcdFd(-1),
  1029. - mHdcpEnabled(0),
  1030. - mFlagConnected(false)
  1031. -{
  1032. - ALOGV("%s", __func__);
  1033. -
  1034. - memset(&mParams, 0, sizeof(struct v4l2_streamparm));
  1035. - memset(&mFlagLayerEnable, 0, sizeof(bool) * S5P_TV_LAYER_MAX);
  1036. -
  1037. - int ret = ioctl(mTvOutFd, VIDIOC_HDCP_ENABLE, &mHdcpEnabled);
  1038. - ALOG_IF(ret);
  1039. -}
  1040. -
  1041. -SecHDMI::~SecHDMI()
  1042. -{
  1043. - destroy();
  1044. -}
  1045. -
  1046. -/* static */
  1047. -int SecHDMI::getCableStatus()
  1048. -{
  1049. - int fd = 0;
  1050. - char value[8] = {0};
  1051. -
  1052. - ALOGV("%s", __func__);
  1053. -
  1054. - fd = open("/sys/class/switch/h2w/state", O_RDWR);
  1055. - if(fd < 0) {
  1056. - goto close;
  1057. - }
  1058. -
  1059. - if(read(fd, &value, 8) <= 0) {
  1060. - goto close;
  1061. - }
  1062. -
  1063. -close:
  1064. - close(fd);
  1065. - return strtol(value, NULL, 10);
  1066. -}
  1067. -
  1068. -const __u8* SecHDMI::getName(int index)
  1069. -{
  1070. - ALOGV("%s", __func__);
  1071. - return tv20_v4l2_enum_output(mTvOutFd, index);
  1072. -}
  1073. -
  1074. -int SecHDMI::destroy()
  1075. -{
  1076. - ALOGV("%s", __func__);
  1077. -
  1078. - if(mFlagConnected) {
  1079. - disconnect();
  1080. - }
  1081. - if(mTvOutFd > 0) {
  1082. - close(mTvOutFd);
  1083. - mTvOutFd = -1;
  1084. - }
  1085. - if(mFimc.dev_fd > 0) {
  1086. - fimc_close(&mFimc);
  1087. - mFimc.dev_fd = -1;
  1088. - }
  1089. - if (mLcdFd > 0) {
  1090. - fb_close(mLcdFd);
  1091. - mLcdFd = -1;
  1092. - }
  1093. -
  1094. - return 0;
  1095. -}
  1096. -
  1097. -int SecHDMI::startLayer(s5p_tv_layer layer)
  1098. -{
  1099. - int ret;
  1100. -
  1101. - if (mFlagLayerEnable[layer]) {
  1102. - return 0;
  1103. - }
  1104. -
  1105. - switch (layer) {
  1106. - case S5P_TV_LAYER_VIDEO:
  1107. - if(mTvOutVFd < 0) {
  1108. - mTvOutVFd = open(TVOUT_DEV_V, O_RDWR);
  1109. - RETURN_IF(mTvOutVFd);
  1110. - }
  1111. - ret = tv20_v4l2_start_overlay(mTvOutVFd);
  1112. - RETURN_IF(ret);
  1113. - break;
  1114. - case S5P_TV_LAYER_GRAPHIC_0 :
  1115. - ret = ioctl(0/*fp_tvout_g0*/, FBIOBLANK, (void *)FB_BLANK_UNBLANK);
  1116. - RETURN_IF(ret);
  1117. - break;
  1118. - case S5P_TV_LAYER_GRAPHIC_1 :
  1119. - ret = ioctl(0/*fp_tvout_g1*/, FBIOBLANK, (void *)FB_BLANK_UNBLANK);
  1120. - RETURN_IF(ret);
  1121. - break;
  1122. - default :
  1123. - RETURN_IF(-1);
  1124. - }
  1125. -
  1126. - mFlagLayerEnable[layer] = true;
  1127. -
  1128. - return 0;
  1129. -}
  1130. -
  1131. -int SecHDMI::stopLayer(s5p_tv_layer layer)
  1132. -{
  1133. - int ret;
  1134. -
  1135. - if (!mFlagLayerEnable[layer]) {
  1136. - return 0;
  1137. - }
  1138. -
  1139. - switch (layer) {
  1140. - case S5P_TV_LAYER_VIDEO:
  1141. - ret = tv20_v4l2_stop_overlay(mTvOutVFd);
  1142. - RETURN_IF(ret);
  1143. - close(mTvOutVFd);
  1144. - mTvOutVFd = -1;
  1145. - break;
  1146. - case S5P_TV_LAYER_GRAPHIC_0 :
  1147. - ret = ioctl(0/*fp_tvout_g0*/, FBIOBLANK, (void *)FB_BLANK_POWERDOWN);
  1148. - RETURN_IF(ret);
  1149. - break;
  1150. - case S5P_TV_LAYER_GRAPHIC_1 :
  1151. - ret = ioctl(0/*fp_tvout_g1*/, FBIOBLANK, (void *)FB_BLANK_POWERDOWN);
  1152. - RETURN_IF(ret);
  1153. - break;
  1154. - default :
  1155. - RETURN_IF(-1);
  1156. - }
  1157. -
  1158. - mFlagLayerEnable[layer] = false;
  1159. -
  1160. - return 0;
  1161. -}
  1162. -
  1163. -int SecHDMI::create(int width, int height)
  1164. -{
  1165. - int ret, y_size;
  1166. - unsigned int addr;
  1167. -
  1168. - ALOGV("%s", __func__);
  1169. -
  1170. - mTvOutFd = open(TVOUT_DEV, O_RDWR);
  1171. - RETURN_IF(mTvOutFd);
  1172. -
  1173. - memset(&mFimc, 0, sizeof(s5p_fimc_t));
  1174. - mFimc.dev_fd = -1;
  1175. - ret = fimc_open(&mFimc, "/dev/video2");
  1176. - RETURN_IF(ret);
  1177. -
  1178. - ALOGV("query capabilities");
  1179. - ret = tv20_v4l2_querycap(mTvOutFd);
  1180. - RETURN_IF(ret);
  1181. -
  1182. - struct s5p_tv_standart_internal std =
  1183. - s5p_tv_standards[(int) S5P_TV_STD_PAL_BDGHI];
  1184. -
  1185. - ALOGV("searching for standart: %i", std.index);
  1186. - if(!tv20_v4l2_enum_standarts(mTvOutFd, std.index))
  1187. - return -1;
  1188. -
  1189. - ret = tv20_v4l2_s_std(mTvOutFd, std.value);
  1190. - RETURN_IF(ret);
  1191. -
  1192. - ALOGV("searching for output: %i", S5P_TV_OUTPUT_TYPE_COMPOSITE);
  1193. - if (!tv20_v4l2_enum_output(mTvOutFd, S5P_TV_OUTPUT_TYPE_COMPOSITE))
  1194. - return -1;
  1195. -
  1196. - ret = tv20_v4l2_s_output(mTvOutFd, S5P_TV_OUTPUT_TYPE_COMPOSITE);
  1197. - RETURN_IF(ret);
  1198. -
  1199. - struct v4l2_window_s5p_tvout* p =
  1200. - (struct v4l2_window_s5p_tvout*)&mParams.parm.raw_data;
  1201. - p->win.w.top = 0;
  1202. - p->win.w.left = 0;
  1203. - p->win.w.width = width;
  1204. - p->win.w.height = height;
  1205. -
  1206. - ALOGV("searching for format: %i", V4L2_PIX_FMT_NV12);
  1207. - ret = tv20_v4l2_enum_fmt(mTvOutFd, V4L2_PIX_FMT_NV12);
  1208. - RETURN_IF(ret);
  1209. -
  1210. - addr = (unsigned int) mFimc.out_buf.phys_addr;
  1211. - y_size = ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height));
  1212. - ret = tv20_v4l2_s_fmt(mTvOutFd, width, height, V4L2_PIX_FMT_NV12,
  1213. - (unsigned int) addr,
  1214. - (unsigned int) addr + y_size);
  1215. - RETURN_IF(ret);
  1216. -
  1217. - return 0;
  1218. -}
  1219. -
  1220. -int SecHDMI::connect()
  1221. -{
  1222. - int ret;
  1223. -
  1224. - ALOGV("%s", __func__);
  1225. -
  1226. - RETURN_IF(mTvOutFd);
  1227. -
  1228. - if(mFlagConnected) {
  1229. - return 0;
  1230. - }
  1231. -
  1232. -#if 0
  1233. - ret = getCableStatus() <= 0 ? -1 : 0;
  1234. - RETURN_IF(ret);
  1235. -#endif
  1236. -
  1237. - ret = tv20_v4l2_s_parm(mTvOutFd, &mParams);
  1238. - RETURN_IF(ret);
  1239. -
  1240. - ret = tv20_v4l2_streamon(mTvOutFd);
  1241. - RETURN_IF(ret);
  1242. -
  1243. -#if 0
  1244. - ret = startLayer(S5P_TV_LAYER_VIDEO);
  1245. - RETURN_IF(ret);
  1246. -#endif
  1247. -
  1248. - mFlagConnected = true;
  1249. -
  1250. - return 0;
  1251. -}
  1252. -
  1253. -int SecHDMI::disconnect()
  1254. -{
  1255. - int ret;
  1256. -
  1257. - ALOGV("%s", __func__);
  1258. -
  1259. - RETURN_IF(mTvOutFd);
  1260. -
  1261. - if(!mFlagConnected) {
  1262. - return 0;
  1263. - }
  1264. -
  1265. - ret = tv20_v4l2_streamoff(mTvOutFd);
  1266. - RETURN_IF(ret);
  1267. -
  1268. -#if 0
  1269. - ret = stopLayer(S5P_TV_LAYER_VIDEO);
  1270. - RETURN_IF(ret);
  1271. -#endif
  1272. -
  1273. - mFlagConnected = false;
  1274. -
  1275. - return 0;
  1276. -}
  1277. -
  1278. -int SecHDMI::flush(int srcW, int srcH, int srcColorFormat,
  1279. - unsigned int srcYAddr, unsigned int srcCbAddr, unsigned int srcCrAddr,
  1280. - int dstX, int dstY,
  1281. - int layer,
  1282. - int num_of_hwc_layer)
  1283. -{
  1284. - int ret;
  1285. -
  1286. -#if 0
  1287. - usleep(1000 * 10);
  1288. -#else
  1289. - sec_img src_img;
  1290. - sec_img dst_img;
  1291. - sec_rect src_rect;
  1292. - sec_rect dst_rect;
  1293. - unsigned int phyAddr[3/*MAX_NUM_PLANES*/];
  1294. -
  1295. - if(!srcYAddr) {
  1296. - struct s3cfb_next_info fb_info;
  1297. -
  1298. - if (mLcdFd < 0) {
  1299. - mLcdFd = fb_open(0);
  1300. - }
  1301. -
  1302. - RETURN_IF(mLcdFd);
  1303. -
  1304. - ret = ioctl(mLcdFd, S3CFB_GET_CURR_FB_INFO, &fb_info);
  1305. - RETURN_IF(ret);
  1306. -
  1307. - srcYAddr = fb_info.phy_start_addr;
  1308. - srcCbAddr = srcYAddr;
  1309. - }
  1310. -
  1311. - memset(&src_img, 0, sizeof(src_img));
  1312. - memset(&dst_img, 0, sizeof(src_img));
  1313. - memset(&src_rect, 0, sizeof(src_rect));
  1314. - memset(&dst_rect, 0, sizeof(src_rect));
  1315. - memset(&phyAddr, 0, sizeof(int) * sizeof(phyAddr));
  1316. -
  1317. - phyAddr[0] = srcYAddr;
  1318. - phyAddr[1] = srcCbAddr;
  1319. - phyAddr[2] = srcCrAddr;
  1320. -
  1321. - src_img.w = srcW;
  1322. - src_img.h = srcH;
  1323. - src_img.format = HAL_PIXEL_FORMAT_YCbCr_420_SP/*srcColorFormat*/;
  1324. - src_img.base = 0;
  1325. - src_img.offset = 0;
  1326. - src_img.mem_id = 0;
  1327. - src_img.mem_type = FIMC_MEM_TYPE_PHYS;
  1328. - src_img.w = (src_img.w + 15) & (~15);
  1329. - src_img.h = (src_img.h + 1) & (~1) ;
  1330. -
  1331. - src_rect.x = 0;
  1332. - src_rect.y = 0;
  1333. - src_rect.w = src_img.w;
  1334. - src_rect.h = src_img.h;
  1335. -
  1336. - struct v4l2_window_s5p_tvout* p =
  1337. - (struct v4l2_window_s5p_tvout*)&mParams.parm.raw_data;
  1338. - if (!p) {
  1339. - return -1;
  1340. - }
  1341. -
  1342. - dst_img.w = p->win.w.width;
  1343. - dst_img.h = p->win.w.height;
  1344. - dst_img.format = HAL_PIXEL_FORMAT_YCbCr_420_SP;
  1345. - dst_img.base = (unsigned int) mFimc.out_buf.phys_addr;
  1346. - dst_img.offset = 0;
  1347. - dst_img.mem_id = 0;
  1348. - dst_img.mem_type = FIMC_MEM_TYPE_PHYS;
  1349. -
  1350. - dst_rect.x = p->win.w.top;
  1351. - dst_rect.y = p->win.w.left;
  1352. - dst_rect.w = dst_img.w;
  1353. - dst_rect.h = dst_img.h;
  1354. -
  1355. - ALOGV("%s::sr_x %d sr_y %d sr_w %d sr_h %d dr_x %d dr_y %d dr_w %d dr_h %d ",
  1356. - __func__, src_rect.x, src_rect.y, src_rect.w, src_rect.h,
  1357. - dst_rect.x, dst_rect.y, dst_rect.w, dst_rect.h);
  1358. -
  1359. - ret = fimc_flush(&mFimc, &src_img, &src_rect, &dst_img, &dst_rect,
  1360. - phyAddr, 0);
  1361. - RETURN_IF(ret);
  1362. -
  1363. -/*
  1364. - struct fb_var_screeninfo var;
  1365. - var.xres = srcW;
  1366. - var.yres = srcH;
  1367. - var.xres_virtual = var.xres;
  1368. - var.yres_virtual = var.yres;
  1369. - var.xoffset = 0;
  1370. - var.yoffset = 0;
  1371. - var.width = srcW;
  1372. - var.height = srcH;
  1373. - var.activate = FB_ACTIVATE_FORCE;
  1374. - if (srcColorFormat == HAL_PIXEL_FORMAT_RGB_565) {
  1375. - var.bits_per_pixel = 16;
  1376. - var.transp.length = 0;
  1377. - }
  1378. - else {
  1379. - var.bits_per_pixel = 32;
  1380. - var.transp.length = 8;
  1381. - }
  1382. -
  1383. - ret = tv20_v4l2_s_baseaddr(mTvOutFd, (void *)srcYAddr);
  1384. - RETURN_IF(ret);
  1385. -
  1386. - ret = fb_put_vscreeninfo(mLcdFd, &var);
  1387. - RETURN_IF(ret);
  1388. -
  1389. - ret = tv20_v4l2_s_position(mTvOutFd, dstX, dstY);
  1390. - RETURN_IF(ret);
  1391. -*/
  1392. -#endif
  1393. -
  1394. - return 0;
  1395. -}
  1396. diff --git a/exynos3/s5pc110/libhdmi/SecHDMI.h b/exynos3/s5pc110/libhdmi/SecHDMI.h
  1397. deleted file mode 100644
  1398. index c2f6f9b..0000000
  1399. --- a/exynos3/s5pc110/libhdmi/SecHDMI.h
  1400. +++ /dev/null
  1401. @@ -1,113 +0,0 @@
  1402. -/*
  1403. - * Copyright 2011, Havlena Petr <havlenapetr@gmail.com>
  1404. - *
  1405. - * Licensed under the Apache License, Version 2.0 (the "License");
  1406. - * you may not use this file except in compliance with the License.
  1407. - * You may obtain a copy of the License at
  1408. - *
  1409. - * http://www.apache.org/licenses/LICENSE-2.0
  1410. - *
  1411. - * Unless required by applicable law or agreed to in writing, software
  1412. - * distributed under the License is distributed on an "AS IS" BASIS,
  1413. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1414. - * See the License for the specific language governing permissions and
  1415. - * limitations under the License.
  1416. - */
  1417. -
  1418. -#ifndef ANDROID_HARDWARE_SEC_TV_H
  1419. -#define ANDROID_HARDWARE_SEC_TV_H
  1420. -
  1421. -#include <stdio.h>
  1422. -#include <string.h>
  1423. -#include <stdlib.h>
  1424. -
  1425. -#include <fcntl.h>
  1426. -#include <unistd.h>
  1427. -#include <errno.h>
  1428. -#include <signal.h>
  1429. -#include <sys/mman.h>
  1430. -#include <sys/time.h>
  1431. -#include <sys/ioctl.h>
  1432. -#include <sys/poll.h>
  1433. -#include <sys/stat.h>
  1434. -
  1435. -#include <linux/videodev2.h>
  1436. -#include <s5p_tvout.h>
  1437. -
  1438. -#include "fimc.h"
  1439. -
  1440. -namespace android {
  1441. -
  1442. -enum s5p_tv_standart {
  1443. - S5P_TV_STD_NTSC_M = 0,
  1444. - S5P_TV_STD_PAL_BDGHI,
  1445. - S5P_TV_STD_PAL_M,
  1446. - S5P_TV_STD_PAL_N,
  1447. - S5P_TV_STD_PAL_Nc,
  1448. - S5P_TV_STD_PAL_60,
  1449. - S5P_TV_STD_NTSC_443,
  1450. - S5P_TV_STD_480P_60_16_9,
  1451. - S5P_TV_STD_480P_60_4_3,
  1452. - S5P_TV_STD_576P_50_16_9,
  1453. - S5P_TV_STD_576P_50_4_3,
  1454. - S5P_TV_STD_720P_60,
  1455. - S5P_TV_STD_720P_50
  1456. -};
  1457. -
  1458. -// must match with s5p_tv_outputs in s5p_tv_v4l.c
  1459. -enum s5p_tv_output {
  1460. - S5P_TV_OUTPUT_TYPE_COMPOSITE = 0,
  1461. - S5P_TV_OUTPUT_TYPE_SVIDEO,
  1462. - S5P_TV_OUTPUT_TYPE_YPBPR_INERLACED,
  1463. - S5P_TV_OUTPUT_TYPE_YPBPR_PROGRESSIVE,
  1464. - S5P_TV_OUTPUT_TYPE_RGB_PROGRESSIVE,
  1465. - S5P_TV_OUTPUT_TYPE_HDMI,
  1466. -};
  1467. -
  1468. -class SecHDMI {
  1469. -public:
  1470. - SecHDMI();
  1471. - ~SecHDMI();
  1472. -
  1473. - static int getCableStatus();
  1474. -
  1475. - int create(int width, int height);
  1476. - int destroy();
  1477. -
  1478. - int connect();
  1479. - int disconnect();
  1480. -
  1481. - int flush(int srcW, int srcH, int srcColorFormat,
  1482. - unsigned int srcYAddr, unsigned int srcCbAddr, unsigned int srcCrAddr,
  1483. - int dstX, int dstY,
  1484. - int layer,
  1485. - int num_of_hwc_layer);
  1486. -
  1487. - const __u8* getName(int index);
  1488. -
  1489. -private:
  1490. - enum s5p_tv_layer {
  1491. - S5P_TV_LAYER_BASE = 0,
  1492. - S5P_TV_LAYER_VIDEO,
  1493. - S5P_TV_LAYER_GRAPHIC_0,
  1494. - S5P_TV_LAYER_GRAPHIC_1,
  1495. - S5P_TV_LAYER_MAX,
  1496. - };
  1497. -
  1498. - int mTvOutFd;
  1499. - int mTvOutVFd;
  1500. - int mLcdFd;
  1501. - unsigned int mHdcpEnabled;
  1502. - bool mFlagConnected;
  1503. - bool mFlagLayerEnable[S5P_TV_LAYER_MAX];
  1504. -
  1505. - s5p_fimc_t mFimc;
  1506. - v4l2_streamparm mParams;
  1507. -
  1508. - int startLayer(s5p_tv_layer layer);
  1509. - int stopLayer(s5p_tv_layer layer);
  1510. -};
  1511. -
  1512. -}; // namespace android
  1513. -
  1514. -#endif // ANDROID_HARDWARE_SEC_TV_H
  1515. diff --git a/exynos3/s5pc110/libhdmi/fimc.c b/exynos3/s5pc110/libhdmi/fimc.c
  1516. deleted file mode 100644
  1517. index e229eb7..0000000
  1518. --- a/exynos3/s5pc110/libhdmi/fimc.c
  1519. +++ /dev/null
  1520. @@ -1,722 +0,0 @@
  1521. -/*
  1522. - * Copyright (C) 2010 The Android Open Source Project
  1523. - *
  1524. - * Licensed under the Apache License, Version 2.0 (the "License");
  1525. - * you may not use this file except in compliance with the License.
  1526. - * You may obtain a copy of the License at
  1527. - *
  1528. - * http://www.apache.org/licenses/LICENSE-2.0
  1529. - *
  1530. - * Unless required by applicable law or agreed to in writing, software
  1531. - * distributed under the License is distributed on an "AS IS" BASIS,
  1532. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1533. - * See the License for the specific language governing permissions and
  1534. - * limitations under the License.
  1535. - */
  1536. -
  1537. -#include <fcntl.h>
  1538. -#include <errno.h>
  1539. -#include <stdlib.h>
  1540. -#include <sys/ioctl.h>
  1541. -#include <linux/videodev.h>
  1542. -
  1543. -#include <hardware/hwcomposer.h>
  1544. -
  1545. -#include <cutils/log.h>
  1546. -
  1547. -#include "fimc.h"
  1548. -
  1549. -typedef struct sec_img sec_img;
  1550. -typedef struct sec_rect sec_rect;
  1551. -
  1552. -int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src)
  1553. -{
  1554. - struct v4l2_format fmt;
  1555. - struct v4l2_cropcap cropcap;
  1556. - struct v4l2_crop crop;
  1557. - struct v4l2_requestbuffers req;
  1558. -
  1559. - /*
  1560. - * To set size & format for source image (DMA-INPUT)
  1561. - */
  1562. - fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  1563. - fmt.fmt.pix.width = src->full_width;
  1564. - fmt.fmt.pix.height = src->full_height;
  1565. - fmt.fmt.pix.pixelformat = src->color_space;
  1566. - fmt.fmt.pix.field = V4L2_FIELD_NONE;
  1567. -
  1568. - if (ioctl (fd, VIDIOC_S_FMT, &fmt) < 0) {
  1569. - ALOGE("VIDIOC_S_FMT failed : errno=%d (%s) : fd=%d", errno,
  1570. - strerror(errno), fd);
  1571. - return -1;
  1572. - }
  1573. -
  1574. - /*
  1575. - * crop input size
  1576. - */
  1577. - crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  1578. - if (0x50 == hw_ver) {
  1579. - crop.c.left = src->start_x;
  1580. - crop.c.top = src->start_y;
  1581. - } else {
  1582. - crop.c.left = 0;
  1583. - crop.c.top = 0;
  1584. - }
  1585. - crop.c.width = src->width;
  1586. - crop.c.height = src->height;
  1587. - if (ioctl(fd, VIDIOC_S_CROP, &crop) < 0) {
  1588. - ALOGE("Error in video VIDIOC_S_CROP (%d, %d, %d, %d)",
  1589. - crop.c.left, crop.c.top, crop.c.width, crop.c.height);
  1590. - return -1;
  1591. - }
  1592. -
  1593. - /*
  1594. - * input buffer type
  1595. - */
  1596. - req.count = 1;
  1597. - req.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  1598. - req.memory = V4L2_MEMORY_USERPTR;
  1599. -
  1600. - if (ioctl (fd, VIDIOC_REQBUFS, &req) < 0) {
  1601. - ALOGE("Error in VIDIOC_REQBUFS");
  1602. - return -1;
  1603. - }
  1604. -
  1605. - return 0;
  1606. -}
  1607. -
  1608. -int fimc_v4l2_set_dst(int fd,
  1609. - s5p_fimc_img_info *dst,
  1610. - int rotation,
  1611. - int flag_h_flip,
  1612. - int flag_v_flip,
  1613. - unsigned int addr)
  1614. -{
  1615. - struct v4l2_format fmt;
  1616. - struct v4l2_control vc;
  1617. - struct v4l2_framebuffer fbuf;
  1618. -
  1619. - /*
  1620. - * set rotation configuration
  1621. - */
  1622. - vc.id = V4L2_CID_HFLIP;
  1623. - vc.value = flag_h_flip;
  1624. - if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
  1625. - ALOGE("Error in video VIDIOC_S_CTRL - flag_h_flip (%d)", flag_h_flip);
  1626. - return -1;
  1627. - }
  1628. -
  1629. - vc.id = V4L2_CID_VFLIP;
  1630. - vc.value = flag_v_flip;
  1631. - if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
  1632. - ALOGE("Error in video VIDIOC_S_CTRL - flag_v_flip (%d)", flag_v_flip);
  1633. - return -1;
  1634. - }
  1635. -
  1636. - vc.id = V4L2_CID_ROTATION;
  1637. - vc.value = rotation;
  1638. - if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
  1639. - ALOGE("Error in video VIDIOC_S_CTRL - rotation (%d)", rotation);
  1640. - return -1;
  1641. - }
  1642. -
  1643. - /*
  1644. - * set size, format & address for destination image (DMA-OUTPUT)
  1645. - */
  1646. - if (ioctl (fd, VIDIOC_G_FBUF, &fbuf) < 0) {
  1647. - ALOGE("Error in video VIDIOC_G_FBUF");
  1648. - return -1;
  1649. - }
  1650. -
  1651. - fbuf.base = (void *)addr;
  1652. - fbuf.fmt.width = dst->full_width;
  1653. - fbuf.fmt.height = dst->full_height;
  1654. - fbuf.fmt.pixelformat = dst->color_space;
  1655. - if (ioctl (fd, VIDIOC_S_FBUF, &fbuf) < 0) {
  1656. - ALOGE("Error in video VIDIOC_S_FBUF 0x%x %d %d %d",
  1657. - (void *)addr, dst->full_width, dst->full_height,
  1658. - dst->color_space);
  1659. - return -1;
  1660. - }
  1661. -
  1662. - /*
  1663. - * set destination window
  1664. - */
  1665. - fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
  1666. - fmt.fmt.win.w.left = dst->start_x;
  1667. - fmt.fmt.win.w.top = dst->start_y;
  1668. - fmt.fmt.win.w.width = dst->width;
  1669. - fmt.fmt.win.w.height = dst->height;
  1670. - if (ioctl(fd, VIDIOC_S_FMT, &fmt) < 0) {
  1671. - ALOGE("Error in video VIDIOC_S_FMT %d %d %d %d",
  1672. - dst->start_x, dst->start_y, dst->width, dst->height);
  1673. - return -1;
  1674. - }
  1675. -
  1676. - return 0;
  1677. -}
  1678. -
  1679. -static int fimc_v4l2_stream_on(int fd, enum v4l2_buf_type type)
  1680. -{
  1681. - if (ioctl (fd, VIDIOC_STREAMON, &type) < 0) {
  1682. - ALOGE("Error in VIDIOC_STREAMON");
  1683. - return -1;
  1684. - }
  1685. -
  1686. - return 0;
  1687. -}
  1688. -
  1689. -static int fimc_v4l2_queue(int fd, struct fimc_buf *fimc_buf)
  1690. -{
  1691. - struct v4l2_buffer buf;
  1692. -
  1693. - buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  1694. - buf.memory = V4L2_MEMORY_USERPTR;
  1695. - buf.m.userptr = (unsigned long)fimc_buf;
  1696. - buf.length = 0;
  1697. - buf.index = 0;
  1698. -
  1699. - if (ioctl (fd, VIDIOC_QBUF, &buf) < 0) {
  1700. - ALOGE("Error in VIDIOC_QBUF");
  1701. - return -1;
  1702. - }
  1703. -
  1704. - return 0;
  1705. -}
  1706. -
  1707. -static int fimc_v4l2_dequeue(int fd)
  1708. -{
  1709. - struct v4l2_buffer buf;
  1710. -
  1711. - buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  1712. - buf.memory = V4L2_MEMORY_USERPTR;
  1713. -
  1714. - if (ioctl (fd, VIDIOC_DQBUF, &buf) < 0) {
  1715. - ALOGE("Error in VIDIOC_DQBUF");
  1716. - return -1;
  1717. - }
  1718. -
  1719. - return buf.index;
  1720. -}
  1721. -
  1722. -static int fimc_v4l2_stream_off(int fd)
  1723. -{
  1724. - enum v4l2_buf_type type;
  1725. - type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  1726. -
  1727. - if (ioctl (fd, VIDIOC_STREAMOFF, &type) < 0) {
  1728. - ALOGE("Error in VIDIOC_STREAMOFF");
  1729. - return -1;
  1730. - }
  1731. -
  1732. - return 0;
  1733. -}
  1734. -
  1735. -static int fimc_v4l2_clr_buf(int fd)
  1736. -{
  1737. - struct v4l2_requestbuffers req;
  1738. -
  1739. - req.count = 0;
  1740. - req.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  1741. - req.memory = V4L2_MEMORY_USERPTR;
  1742. -
  1743. - if (ioctl (fd, VIDIOC_REQBUFS, &req) < 0) {
  1744. - ALOGE("Error in VIDIOC_REQBUFS");
  1745. - }
  1746. -
  1747. - return 0;
  1748. -}
  1749. -
  1750. -static int fimc_handle_oneshot(int fd, struct fimc_buf *fimc_buf)
  1751. -{
  1752. - int ret =0;
  1753. -
  1754. - if (fimc_v4l2_stream_on(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT) < 0) {
  1755. - ALOGE("Fail : v4l2_stream_on()");
  1756. - return -1;
  1757. - }
  1758. -
  1759. - if (fimc_v4l2_queue(fd, fimc_buf) < 0) {
  1760. - ALOGE("Fail : v4l2_queue()");
  1761. - ret = -1;
  1762. - goto stream_off;
  1763. - }
  1764. -
  1765. - if (fimc_v4l2_dequeue(fd) < 0) {
  1766. - ALOGE("Fail : v4l2_dequeue()");
  1767. - ret = -1;
  1768. - goto stream_off;
  1769. - }
  1770. -
  1771. -stream_off:
  1772. - if (fimc_v4l2_stream_off(fd) < 0) {
  1773. - ALOGE("Fail : v4l2_stream_off()");
  1774. - return -1;
  1775. - }
  1776. -
  1777. - if (fimc_v4l2_clr_buf(fd) < 0) {
  1778. - ALOGE("Fail : v4l2_clr_buf()");
  1779. - return -1;
  1780. - }
  1781. -
  1782. - return ret;
  1783. -}
  1784. -
  1785. -static int get_src_phys_addr(s5p_fimc_t *fimc,
  1786. - sec_img *src_img,
  1787. - unsigned int *phyAddr)
  1788. -{
  1789. - if(src_img->mem_type == FIMC_MEM_TYPE_PHYS) {
  1790. - switch(src_img->format) {
  1791. - case HAL_PIXEL_FORMAT_YCbCr_420_SP:
  1792. - fimc->params.src.buf_addr_phy_rgb_y = phyAddr[0];
  1793. - fimc->params.src.buf_addr_phy_cb = phyAddr[1];
  1794. - break;
  1795. - default:
  1796. - ALOGE("%s format error (format=0x%x)", __func__,
  1797. - src_img->format);
  1798. - return -1;
  1799. - }
  1800. - } else {
  1801. - ALOGE("%s mem_type error (mem_type=%d)", __func__, src_img->mem_type);
  1802. - return -1;
  1803. - }
  1804. -
  1805. - return 0;
  1806. -}
  1807. -
  1808. -static int get_dst_phys_addr(s5p_fimc_t *fimc,
  1809. - sec_img *dst_img)
  1810. -{
  1811. - unsigned int dst_phys_addr = 0;
  1812. -
  1813. - if (FIMC_MEM_TYPE_PHYS == dst_img->mem_type && 0 != dst_img->base)
  1814. - dst_phys_addr = dst_img->base;
  1815. - else {
  1816. - ALOGE("%s::get_dst_phys_addr fail ", __func__);
  1817. - dst_phys_addr = 0;
  1818. - }
  1819. - return dst_phys_addr;
  1820. -}
  1821. -
  1822. -static inline int rotateValueHAL2PP(unsigned char transform,
  1823. - int *flag_h_flip,
  1824. - int *flag_v_flip)
  1825. -{
  1826. - int rotate_result = 0;
  1827. - int rotate_flag = transform & 0x7;
  1828. -
  1829. - switch (rotate_flag) {
  1830. - case HAL_TRANSFORM_ROT_90:
  1831. - rotate_result = 90;
  1832. - break;
  1833. - case HAL_TRANSFORM_ROT_180:
  1834. - rotate_result = 180;
  1835. - break;
  1836. - case HAL_TRANSFORM_ROT_270:
  1837. - rotate_result = 270;
  1838. - break;
  1839. - }
  1840. -
  1841. - switch (rotate_flag) {
  1842. - case HAL_TRANSFORM_FLIP_H:
  1843. - *flag_h_flip = 1;
  1844. - *flag_v_flip = 0;
  1845. - break;
  1846. - case HAL_TRANSFORM_FLIP_V:
  1847. - *flag_h_flip = 0;
  1848. - *flag_v_flip = 1;
  1849. - break;
  1850. - default:
  1851. - *flag_h_flip = 0;
  1852. - *flag_v_flip = 0;
  1853. - break;
  1854. - }
  1855. -
  1856. - return rotate_result;
  1857. -}
  1858. -
  1859. -static inline int multipleOfN(int number, int N)
  1860. -{
  1861. - int result = number;
  1862. - switch (N) {
  1863. - case 1:
  1864. - case 2:
  1865. - case 4:
  1866. - case 8:
  1867. - case 16:
  1868. - case 32:
  1869. - case 64:
  1870. - case 128:
  1871. - case 256:
  1872. - result = (number - (number & (N-1)));
  1873. - break;
  1874. - default:
  1875. - result = number - (number % N);
  1876. - break;
  1877. - }
  1878. - return result;
  1879. -}
  1880. -
  1881. -static inline int widthOfPP(unsigned int ver,
  1882. - int pp_color_format,
  1883. - int number)
  1884. -{
  1885. - if (0x50 == ver) {
  1886. - switch(pp_color_format) {
  1887. - /* 422 1/2/3 plane */
  1888. - case V4L2_PIX_FMT_YUYV:
  1889. - case V4L2_PIX_FMT_UYVY:
  1890. - case V4L2_PIX_FMT_NV61:
  1891. - case V4L2_PIX_FMT_NV16:
  1892. - case V4L2_PIX_FMT_YUV422P:
  1893. -
  1894. - /* 420 2/3 plane */
  1895. - case V4L2_PIX_FMT_NV21:
  1896. - case V4L2_PIX_FMT_NV12:
  1897. - case V4L2_PIX_FMT_NV12T:
  1898. - case V4L2_PIX_FMT_YUV420:
  1899. - return multipleOfN(number, 2);
  1900. -
  1901. - default :
  1902. - return number;
  1903. - }
  1904. - } else {
  1905. - switch(pp_color_format) {
  1906. - case V4L2_PIX_FMT_RGB565:
  1907. - return multipleOfN(number, 8);
  1908. -
  1909. - case V4L2_PIX_FMT_RGB32:
  1910. - return multipleOfN(number, 4);
  1911. -
  1912. - case V4L2_PIX_FMT_YUYV:
  1913. - case V4L2_PIX_FMT_UYVY:
  1914. - return multipleOfN(number, 4);
  1915. -
  1916. - case V4L2_PIX_FMT_NV61:
  1917. - case V4L2_PIX_FMT_NV16:
  1918. - return multipleOfN(number, 8);
  1919. -
  1920. - case V4L2_PIX_FMT_YUV422P:
  1921. - return multipleOfN(number, 16);
  1922. -
  1923. - case V4L2_PIX_FMT_NV21:
  1924. - case V4L2_PIX_FMT_NV12:
  1925. - case V4L2_PIX_FMT_NV12T:
  1926. - return multipleOfN(number, 8);
  1927. -
  1928. - case V4L2_PIX_FMT_YUV420:
  1929. - return multipleOfN(number, 16);
  1930. -
  1931. - default :
  1932. - return number;
  1933. - }
  1934. - }
  1935. - return number;
  1936. -}
  1937. -
  1938. -static inline int heightOfPP(int pp_color_format,
  1939. - int number)
  1940. -{
  1941. - switch(pp_color_format) {
  1942. - case V4L2_PIX_FMT_NV21:
  1943. - case V4L2_PIX_FMT_NV12:
  1944. - case V4L2_PIX_FMT_NV12T:
  1945. - case V4L2_PIX_FMT_YUV420:
  1946. - return multipleOfN(number, 2);
  1947. -
  1948. - default :
  1949. - return number;
  1950. - }
  1951. - return number;
  1952. -}
  1953. -
  1954. -static int fimc_core(s5p_fimc_t *fimc,
  1955. - sec_img *src_img,
  1956. - sec_rect *src_rect,
  1957. - uint32_t src_color_space,
  1958. - unsigned int dst_phys_addr,
  1959. - sec_img *dst_img,
  1960. - sec_rect *dst_rect,
  1961. - uint32_t dst_color_space,
  1962. - int transform)
  1963. -{
  1964. - s5p_fimc_params_t * params = &(fimc->params);
  1965. -
  1966. - unsigned int frame_size = 0;
  1967. - struct fimc_buf fimc_src_buf;
  1968. -
  1969. - int src_bpp, src_planes;
  1970. - int flag_h_flip = 0;
  1971. - int flag_v_flip = 0;
  1972. - int rotate_value = rotateValueHAL2PP(transform, &flag_h_flip, &flag_v_flip);
  1973. -
  1974. - /* set post processor configuration */
  1975. - params->src.full_width = src_img->w;
  1976. - params->src.full_height = src_img->h;
  1977. - params->src.start_x = src_rect->x;
  1978. - params->src.start_y = src_rect->y;
  1979. - params->src.width = widthOfPP(fimc->hw_ver, src_color_space, src_rect->w);
  1980. - params->src.height = heightOfPP(src_color_space, src_rect->h);
  1981. - params->src.color_space = src_color_space;
  1982. -
  1983. -
  1984. - /* check minimum */
  1985. - if (src_rect->w < 16 || src_rect->h < 8) {
  1986. - ALOGE("%s src size is not supported by fimc : f_w=%d f_h=%d x=%d y=%d \
  1987. - w=%d h=%d (ow=%d oh=%d) format=0x%x", __func__,
  1988. - params->src.full_width, params->src.full_height,
  1989. - params->src.start_x, params->src.start_y, params->src.width,
  1990. - params->src.height, src_rect->w, src_rect->h,
  1991. - params->src.color_space);
  1992. - return -1;
  1993. - }
  1994. -
  1995. - switch (rotate_value) {
  1996. - case 0:
  1997. - params->dst.full_width = dst_img->w;
  1998. - params->dst.full_height = dst_img->h;
  1999. -
  2000. - params->dst.start_x = dst_rect->x;
  2001. - params->dst.start_y = dst_rect->y;
  2002. -
  2003. - params->dst.width =
  2004. - widthOfPP(fimc->hw_ver, dst_color_space, dst_rect->w);
  2005. - params->dst.height = heightOfPP(dst_color_space, dst_rect->h);
  2006. - break;
  2007. - case 90:
  2008. - params->dst.full_width = dst_img->h;
  2009. - params->dst.full_height = dst_img->w;
  2010. -
  2011. - params->dst.start_x = dst_rect->y;
  2012. - params->dst.start_y = dst_img->w - (dst_rect->x + dst_rect->w);
  2013. -
  2014. - params->dst.width =
  2015. - widthOfPP(fimc->hw_ver, dst_color_space, dst_rect->h);
  2016. - params->dst.height =
  2017. - widthOfPP(fimc->hw_ver, dst_color_space, dst_rect->w);
  2018. -
  2019. - if (0x50 > fimc->hw_ver)
  2020. - params->dst.start_y += (dst_rect->w - params->dst.height);
  2021. - break;
  2022. - case 180:
  2023. - params->dst.full_width = dst_img->w;
  2024. - params->dst.full_height = dst_img->h;
  2025. -
  2026. - params->dst.start_x = dst_img->w - (dst_rect->x + dst_rect->w);
  2027. - params->dst.start_y = dst_img->h - (dst_rect->y + dst_rect->h);
  2028. -
  2029. - params->dst.width =
  2030. - widthOfPP(fimc->hw_ver, dst_color_space, dst_rect->w);
  2031. - params->dst.height = heightOfPP(dst_color_space, dst_rect->h);
  2032. - break;
  2033. - case 270:
  2034. - params->dst.full_width = dst_img->h;
  2035. - params->dst.full_height = dst_img->w;
  2036. -
  2037. - params->dst.start_x = dst_img->h - (dst_rect->y + dst_rect->h);
  2038. - params->dst.start_y = dst_rect->x;
  2039. -
  2040. - params->dst.width =
  2041. - widthOfPP(fimc->hw_ver, dst_color_space, dst_rect->h);
  2042. - params->dst.height =
  2043. - widthOfPP(fimc->hw_ver, dst_color_space, dst_rect->w);
  2044. -
  2045. - if (0x50 > fimc->hw_ver)
  2046. - params->dst.start_y += (dst_rect->w - params->dst.height);
  2047. - break;
  2048. - }
  2049. -
  2050. - params->dst.color_space = dst_color_space;
  2051. -
  2052. - /* check minimum */
  2053. - if (dst_rect->w < 8 || dst_rect->h < 4) {
  2054. - ALOGE("%s dst size is not supported by fimc : \
  2055. - f_w=%d f_h=%d x=%d y=%d w=%d h=%d (ow=%d oh=%d) format=0x%x",
  2056. - __func__, params->dst.full_width, params->dst.full_height,
  2057. - params->dst.start_x, params->dst.start_y, params->dst.width,
  2058. - params->dst.height, dst_rect->w, dst_rect->h,
  2059. - params->dst.color_space);
  2060. - return -1;
  2061. - }
  2062. -
  2063. - /* check scaling limit
  2064. - * the scaling limie must not be more than MAX_RESIZING_RATIO_LIMIT
  2065. - */
  2066. - if (((src_rect->w > dst_rect->w) &&
  2067. - ((src_rect->w / dst_rect->w) > MAX_RESIZING_RATIO_LIMIT)) ||
  2068. - ((dst_rect->w > src_rect->w) &&
  2069. - ((dst_rect->w / src_rect->w) > MAX_RESIZING_RATIO_LIMIT))) {
  2070. - ALOGE("%s over scaling limit : src.w=%d dst.w=%d (limit=%d)",
  2071. - __func__, src_rect->w, dst_rect->w, MAX_RESIZING_RATIO_LIMIT);
  2072. - return -1;
  2073. - }
  2074. -
  2075. -
  2076. - /* set configuration related to destination (DMA-OUT)
  2077. - * - set input format & size
  2078. - * - crop input size
  2079. - * - set input buffer
  2080. - * - set buffer type (V4L2_MEMORY_USERPTR)
  2081. - */
  2082. - if (fimc_v4l2_set_dst(fimc->dev_fd,
  2083. - &params->dst,
  2084. - rotate_value,
  2085. - flag_h_flip,
  2086. - flag_v_flip,
  2087. - dst_phys_addr) < 0) {
  2088. - return -1;
  2089. - }
  2090. -
  2091. - /* set configuration related to source (DMA-INPUT)
  2092. - * - set input format & size
  2093. - * - crop input size
  2094. - * - set input buffer
  2095. - * - set buffer type (V4L2_MEMORY_USERPTR)
  2096. - */
  2097. - if (fimc_v4l2_set_src(fimc->dev_fd, fimc->hw_ver, &params->src) < 0)
  2098. - return -1;
  2099. -
  2100. - /* set input dma address (Y/RGB, Cb, Cr) */
  2101. - switch (src_img->format) {
  2102. - case HAL_PIXEL_FORMAT_YCbCr_420_SP:
  2103. - /* for video display zero copy case */
  2104. - fimc_src_buf.base[0] = params->src.buf_addr_phy_rgb_y;
  2105. - fimc_src_buf.base[1] = params->src.buf_addr_phy_cb;
  2106. - break;
  2107. -
  2108. - default:
  2109. - /* set source image */
  2110. - fimc_src_buf.base[0] = params->src.buf_addr_phy_rgb_y;
  2111. - break;
  2112. - }
  2113. -
  2114. - if (fimc_handle_oneshot(fimc->dev_fd, &fimc_src_buf) < 0) {
  2115. - fimc_v4l2_clr_buf(fimc->dev_fd);
  2116. - return -1;
  2117. - }
  2118. -
  2119. - return 0;
  2120. -}
  2121. -
  2122. -static
  2123. -void* fimc_get_reserved_mem_addr(s5p_fimc_t *fimc)
  2124. -{
  2125. - int ret;
  2126. - struct v4l2_control vc;
  2127. -
  2128. - vc.id = V4L2_CID_RESERVED_MEM_BASE_ADDR;
  2129. - vc.value = 0;
  2130. -
  2131. - ret = ioctl(fimc->dev_fd, VIDIOC_G_CTRL, &vc);
  2132. - if (ret < 0) {
  2133. - ALOGE("Err(%s) in video VIDIOC_G_CTRL (%d)",ret);
  2134. - return NULL;
  2135. - }
  2136. -
  2137. - return vc.value;
  2138. -}
  2139. -
  2140. -int fimc_open(s5p_fimc_t *fimc, const char* dev)
  2141. -{
  2142. - struct v4l2_capability cap;
  2143. - struct v4l2_format fmt;
  2144. - struct v4l2_control vc;
  2145. -
  2146. - /* open device file */
  2147. - if(fimc->dev_fd < 0) {
  2148. - fimc->dev_fd = open(dev, O_RDWR);
  2149. - if (fimc->dev_fd < 0) {
  2150. - ALOGE("%s::Post processor open error (%d)", __func__, errno);
  2151. - goto err;
  2152. - }
  2153. - }
  2154. -
  2155. - /* check capability */
  2156. - if (ioctl(fimc->dev_fd, VIDIOC_QUERYCAP, &cap) < 0) {
  2157. - ALOGE("VIDIOC_QUERYCAP failed");
  2158. - goto err;
  2159. - }
  2160. -
  2161. - if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
  2162. - ALOGE("%d has no streaming support", fimc->dev_fd);
  2163. - goto err;
  2164. - }
  2165. -
  2166. - if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
  2167. - ALOGE("%d is no video output", fimc->dev_fd);
  2168. - goto err;
  2169. - }
  2170. -
  2171. - /*
  2172. - * malloc fimc_outinfo structure
  2173. - */
  2174. - fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  2175. - if (ioctl(fimc->dev_fd, VIDIOC_G_FMT, &fmt) < 0) {
  2176. - ALOGE("%s::Error in video VIDIOC_G_FMT", __func__);
  2177. - goto err;
  2178. - }
  2179. -
  2180. - fimc->out_buf.phys_addr = fimc_get_reserved_mem_addr(fimc);
  2181. -
  2182. - vc.id = V4L2_CID_FIMC_VERSION;
  2183. - vc.value = 0;
  2184. -
  2185. - if (ioctl(fimc->dev_fd, VIDIOC_G_CTRL, &vc) < 0) {
  2186. - ALOGE("%s::Error in video VIDIOC_G_CTRL", __func__);
  2187. - goto err;
  2188. - }
  2189. - fimc->hw_ver = vc.value;
  2190. -
  2191. - return 0;
  2192. -
  2193. -err:
  2194. - if (0 <= fimc->dev_fd)
  2195. - close(fimc->dev_fd);
  2196. - fimc->dev_fd = -1;
  2197. -
  2198. - return -1;
  2199. -}
  2200. -
  2201. -void fimc_close(s5p_fimc_t *fimc)
  2202. -{
  2203. - /* close */
  2204. - if (0 <= fimc->dev_fd)
  2205. - close(fimc->dev_fd);
  2206. - fimc->dev_fd = -1;
  2207. -}
  2208. -
  2209. -int fimc_flush(s5p_fimc_t *fimc,
  2210. - struct sec_img *src_img,
  2211. - struct sec_rect *src_rect,
  2212. - struct sec_img *dst_img,
  2213. - struct sec_rect *dst_rect,
  2214. - unsigned int *phyAddr,
  2215. - uint32_t transform)
  2216. -{
  2217. - unsigned int dst_phys_addr = 0;
  2218. - int32_t src_color_space;
  2219. - int32_t dst_color_space;
  2220. -
  2221. - /* 1 : source address and size */
  2222. -
  2223. - if(0 > get_src_phys_addr(fimc, src_img, phyAddr))
  2224. - return -1;
  2225. -
  2226. - /* 2 : destination address and size */
  2227. - if(0 == (dst_phys_addr = get_dst_phys_addr(fimc, dst_img)))
  2228. - return -2;
  2229. -
  2230. - /* check whether fimc supports the src format */
  2231. - if (0 > (src_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(src_img->format)))
  2232. - return -3;
  2233. -
  2234. - if (0 > (dst_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(dst_img->format)))
  2235. - return -4;
  2236. -
  2237. - if(fimc_core(fimc, src_img, src_rect, (uint32_t)src_color_space,
  2238. - dst_phys_addr, dst_img, dst_rect, (uint32_t)dst_color_space, transform) < 0)
  2239. - return -5;
  2240. -
  2241. - return 0;
  2242. -}
  2243. diff --git a/exynos3/s5pc110/libhdmi/fimc.h b/exynos3/s5pc110/libhdmi/fimc.h
  2244. deleted file mode 100644
  2245. index dfd0525..0000000
  2246. --- a/exynos3/s5pc110/libhdmi/fimc.h
  2247. +++ /dev/null
  2248. @@ -1,76 +0,0 @@
  2249. -/*
  2250. - * Copyright (C) 2010 The Android Open Source Project
  2251. - *
  2252. - * Licensed under the Apache License, Version 2.0 (the "License");
  2253. - * you may not use this file except in compliance with the License.
  2254. - * You may obtain a copy of the License at
  2255. - *
  2256. - * http://www.apache.org/licenses/LICENSE-2.0
  2257. - *
  2258. - * Unless required by applicable law or agreed to in writing, software
  2259. - * distributed under the License is distributed on an "AS IS" BASIS,
  2260. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2261. - * See the License for the specific language governing permissions and
  2262. - * limitations under the License.
  2263. - */
  2264. -
  2265. -#ifndef _FIMC_LIB_
  2266. -#define _FIMC_LIB_
  2267. -
  2268. -#include "s5p_fimc.h"
  2269. -#include "sec_utils.h"
  2270. -
  2271. -#define MAX_RESIZING_RATIO_LIMIT (63)
  2272. -
  2273. -enum {
  2274. - FIMC_MEM_TYPE_UNKNOWN = 0,
  2275. - FIMC_MEM_TYPE_PHYS,
  2276. - FIMC_MEM_TYPE_VIRT,
  2277. -};
  2278. -
  2279. -#ifdef __cplusplus
  2280. -extern "C" {
  2281. -#endif
  2282. -
  2283. -struct sec_rect {
  2284. - uint32_t x;
  2285. - uint32_t y;
  2286. - uint32_t w;
  2287. - uint32_t h;
  2288. -};
  2289. -
  2290. -struct sec_img {
  2291. - uint32_t w;
  2292. - uint32_t h;
  2293. - uint32_t format;
  2294. - uint32_t base;
  2295. - uint32_t offset;
  2296. - int mem_id;
  2297. - int mem_type;
  2298. -};
  2299. -
  2300. -inline int SEC_MIN(int x, int y) {
  2301. - return ((x < y) ? x : y);
  2302. -}
  2303. -
  2304. -inline int SEC_MAX(int x, int y) {
  2305. - return ((x > y) ? x : y);
  2306. -}
  2307. -
  2308. -int fimc_open(s5p_fimc_t *fimc, const char* dev);
  2309. -
  2310. -void fimc_close(s5p_fimc_t *fimc);
  2311. -
  2312. -int fimc_flush(s5p_fimc_t *fimc,
  2313. - struct sec_img *src_img,
  2314. - struct sec_rect *src_rect,
  2315. - struct sec_img *dst_img,
  2316. - struct sec_rect *dst_rect,
  2317. - unsigned int *phyAddr,
  2318. - uint32_t transform);
  2319. -
  2320. -#ifdef __cplusplus
  2321. -}
  2322. -#endif
  2323. -
  2324. -#endif // end of _FIMC_LIB_
  2325. diff --git a/exynos3/s5pc110/libhdmi/fimd.c b/exynos3/s5pc110/libhdmi/fimd.c
  2326. deleted file mode 100644
  2327. index 0486597..0000000
  2328. --- a/exynos3/s5pc110/libhdmi/fimd.c
  2329. +++ /dev/null
  2330. @@ -1,231 +0,0 @@
  2331. -/*
  2332. -* Copyright@ Samsung Electronics Co. LTD
  2333. -*
  2334. -* Licensed under the Apache License, Version 2.0 (the "License");
  2335. -* you may not use this file except in compliance with the License.
  2336. -* You may obtain a copy of the License at
  2337. -*
  2338. -* http://www.apache.org/licenses/LICENSE-2.0
  2339. -*
  2340. -* Unless required by applicable law or agreed to in writing, software
  2341. -* distributed under the License is distributed on an "AS IS" BASIS,
  2342. -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2343. -* See the License for the specific language governing permissions and
  2344. -* limitations under the License.
  2345. -*/
  2346. -
  2347. -#include <stdio.h>
  2348. -#include <string.h>
  2349. -#include <stdlib.h>
  2350. -#include <errno.h>
  2351. -#include <sys/types.h>
  2352. -#include <sys/stat.h>
  2353. -#include <sys/ioctl.h>
  2354. -#include <sys/mman.h>
  2355. -#include <sys/time.h>
  2356. -#include <linux/vt.h>
  2357. -#include <fcntl.h>
  2358. -#include <unistd.h>
  2359. -#include <poll.h>
  2360. -#include <signal.h>
  2361. -#include <cutils/log.h>
  2362. -
  2363. -#include "fimd.h"
  2364. -
  2365. -int fb_open(int win)
  2366. -{
  2367. - char node[20];
  2368. - int fp = -1;
  2369. -
  2370. - sprintf(node, "%s%d", PFX_NODE_FB, win);
  2371. -
  2372. - fp = open(node, O_RDWR);
  2373. - if (fp < 0)
  2374. - ALOGE("%s: fb[%d] open failed", __func__, win);
  2375. -
  2376. - return fp;
  2377. -}
  2378. -
  2379. -int fb_close(int fp)
  2380. -{
  2381. - if (fp)
  2382. - close(fp);
  2383. - else
  2384. - ALOGE("%s: fb is not allocated %d", __func__, fp);
  2385. -
  2386. - return 0;
  2387. -}
  2388. -
  2389. -int fb_get_fscreeninfo(int fp, struct fb_fix_screeninfo *fix)
  2390. -{
  2391. - int ret = -1;
  2392. -
  2393. - ret = ioctl(fp, FBIOGET_FSCREENINFO, fix);
  2394. - if (ret)
  2395. - ALOGE("%s: FBIOGET_FSCREENINFO failed", __func__);
  2396. -
  2397. - return ret;
  2398. -}
  2399. -
  2400. -int fb_get_vscreeninfo(int fp, struct fb_var_screeninfo *var)
  2401. -{
  2402. - int ret = -1;
  2403. -
  2404. - ret = ioctl(fp, FBIOGET_VSCREENINFO, var);
  2405. - if (ret)
  2406. - ALOGE("%s:: FBIOGET_VSCREENINFO failed", __func__);
  2407. -
  2408. - return ret;
  2409. -}
  2410. -
  2411. -int fb_put_vscreeninfo(int fp, struct fb_var_screeninfo *var)
  2412. -{
  2413. - int ret = -1;
  2414. -
  2415. - ret = ioctl(fp, FBIOPUT_VSCREENINFO, var);
  2416. - if (ret)
  2417. - ALOGE("%s:: FBIOPUT_VSCREENINFO failed", __func__);
  2418. -
  2419. - return ret;
  2420. -}
  2421. -
  2422. -char* fb_mmap(int fp, __u32 size)
  2423. -{
  2424. - char *buffer;
  2425. -
  2426. - buffer = (char *)mmap(0, size, PROT_READ | PROT_WRITE,
  2427. - MAP_SHARED, fp, 0);
  2428. - if (!buffer) {
  2429. - ALOGE("%s:: mmap failed", __func__);
  2430. - return NULL;
  2431. - }
  2432. -
  2433. - return buffer;
  2434. -}
  2435. -
  2436. -int fb_ioctl(int fp, __u32 cmd, void *arg)
  2437. -{
  2438. - int ret = -1;
  2439. -
  2440. - ret = ioctl(fp, cmd, arg);
  2441. - if (ret < 0)
  2442. - ALOGE("%s:: ioctl (%d) failed", __func__, cmd);
  2443. -
  2444. - return ret;
  2445. -}
  2446. -
  2447. -int fb_on(int fp)
  2448. -{
  2449. - int ret = -1;
  2450. -
  2451. - ret = ioctl(fp, FBIOBLANK, FB_BLANK_UNBLANK);
  2452. - if (ret)
  2453. - ALOGE("%s:: FBIOBLANK failed", __func__);
  2454. -
  2455. - return ret;
  2456. -}
  2457. -
  2458. -int fb_off(int fp)
  2459. -{
  2460. - int ret = -1;
  2461. -
  2462. - ret = ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN);
  2463. - if (ret)
  2464. - ALOGE("%s:: FBIOBLANK failed", __func__);
  2465. -
  2466. - return ret;
  2467. -}
  2468. -
  2469. -int fb_off_all()
  2470. -{
  2471. - int fp, i;
  2472. -
  2473. - for (i = 0; i < TOTAL_FB_NUM; i++) {
  2474. - fp = fb_open(i);
  2475. - if (fp < 0)
  2476. - return -1;
  2477. -
  2478. - if (ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN) < 0)
  2479. - ALOGE("%s:: FBIOBLANK failed", __func__);
  2480. -
  2481. - fb_off(fp);
  2482. - fb_close(fp);
  2483. - }
  2484. -
  2485. - return 0;
  2486. -}
  2487. -
  2488. -char* fb_init_display(int fp, int width, int height, int left_x, int top_y, int bpp)
  2489. -{
  2490. - struct fb_var_screeninfo var;
  2491. - struct s5ptvfb_user_window window;
  2492. - int fb_size;
  2493. - char *fb = NULL;
  2494. -
  2495. - var.xres = width;
  2496. - var.yres = height;
  2497. - var.bits_per_pixel = bpp;
  2498. - window.x = left_x;
  2499. - window.y = top_y;
  2500. -
  2501. - var.xres_virtual = var.xres;
  2502. - var.yres_virtual = var.yres;
  2503. - var.xoffset = 0;
  2504. - var.yoffset = 0;
  2505. - var.width = 0;
  2506. - var.height = 0;
  2507. - var.transp.length = 0;
  2508. - var.activate = FB_ACTIVATE_FORCE;
  2509. - fb_size = var.xres_virtual * var.yres_virtual * bpp / 8;
  2510. -
  2511. - /* FBIOPUT_VSCREENINFO should be first */
  2512. - fb_put_vscreeninfo(fp, &var);
  2513. - fb_ioctl(fp, S5PTVFB_WIN_POSITION, &window);
  2514. -
  2515. - /* draw image */
  2516. - fb = fb_mmap(fb_size, fp);
  2517. - memset(fb, 0x0, fb_size);
  2518. -
  2519. - return fb;
  2520. -}
  2521. -
  2522. -#if 0
  2523. -
  2524. -static int get_bytes_per_pixel(int bits_per_pixel)
  2525. -{
  2526. - return (bits_per_pixel == 24 || bits_per_pixel == 25 ||
  2527. - bits_per_pixel == 28) ? 4 : bits_per_pixel / 8;
  2528. -}
  2529. -
  2530. -int simple_draw(char *dest, const char *src, int img_width,
  2531. - struct fb_var_screeninfo *var)
  2532. -{
  2533. - int bytes_per_pixel = get_bytes_per_pixel(var->bits_per_pixel);
  2534. - unsigned int y;
  2535. -
  2536. - for (y = 0; y < var->yres; y++)
  2537. - memcpy(dest + y * var->xres * bytes_per_pixel,
  2538. - src + y * img_width * bytes_per_pixel,
  2539. - var->xres * bytes_per_pixel);
  2540. -
  2541. - return 0;
  2542. -}
  2543. -
  2544. -int draw(char *dest, const char *src, int img_width,
  2545. - struct fb_var_screeninfo *var)
  2546. -{
  2547. - int bytes_per_pixel = get_bytes_per_pixel(var->bits_per_pixel);
  2548. - unsigned int y;
  2549. -
  2550. - if (var->bits_per_pixel == 16) {
  2551. - memcpy(dest, src, var->xres * var->yres * 2);
  2552. - } else {
  2553. - for (y = 0; y < var->yres; y++)
  2554. - memcpy(dest + y * var->xres * bytes_per_pixel,
  2555. - src + y * img_width * bytes_per_pixel,
  2556. - var->xres * bytes_per_pixel);
  2557. - }
  2558. -
  2559. - return 0;
  2560. -}
  2561. -#endif
  2562. diff --git a/exynos3/s5pc110/libhdmi/fimd.h b/exynos3/s5pc110/libhdmi/fimd.h
  2563. deleted file mode 100644
  2564. index bb2f36c..0000000
  2565. --- a/exynos3/s5pc110/libhdmi/fimd.h
  2566. +++ /dev/null
  2567. @@ -1,54 +0,0 @@
  2568. -/*
  2569. - * Copyright@ Samsung Electronics Co. LTD
  2570. - *
  2571. - * Licensed under the Apache License, Version 2.0 (the "License");
  2572. - * you may not use this file except in compliance with the License.
  2573. - * You may obtain a copy of the License at
  2574. - *
  2575. - * http://www.apache.org/licenses/LICENSE-2.0
  2576. - *
  2577. - * Unless required by applicable law or agreed to in writing, software
  2578. - * distributed under the License is distributed on an "AS IS" BASIS,
  2579. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2580. - * See the License for the specific language governing permissions and
  2581. - * limitations under the License.
  2582. - */
  2583. -
  2584. -#ifndef __FIMD_H__
  2585. -#define __FIMD_H__
  2586. -
  2587. -#include <linux/fb.h>
  2588. -
  2589. -#include <s5p_tvout.h>
  2590. -
  2591. -#define TOTAL_FB_NUM 5
  2592. -
  2593. -#ifdef __cplusplus
  2594. -extern "C" {
  2595. -#endif
  2596. -
  2597. -int fb_open(int win);
  2598. -int fb_close(int fp);
  2599. -int fb_on(int fp);
  2600. -int fb_off(int fp);
  2601. -int fb_off_all(void);
  2602. -char* fb_init_display(int fp, int width, int height,
  2603. - int left_x, int top_y, int bpp);
  2604. -int fb_ioctl(int fp, __u32 cmd, void *arg);
  2605. -char* fb_mmap(int fp, __u32 size);
  2606. -int fb_get_fscreeninfo(int fp, struct fb_fix_screeninfo *fix);
  2607. -int fb_get_vscreeninfo(int fp, struct fb_var_screeninfo *var);
  2608. -int fb_put_vscreeninfo(int fp, struct fb_var_screeninfo *var);
  2609. -
  2610. -#if 0
  2611. -int simple_draw(char *dest, const char *src,
  2612. - int img_width, struct fb_var_screeninfo *var);
  2613. -int draw(char *dest, const char *src,\
  2614. - int img_width, struct fb_var_screeninfo *var);
  2615. -#endif
  2616. -
  2617. -#ifdef __cplusplus
  2618. -}
  2619. -#endif
  2620. -
  2621. -#endif /* __FIMD_H__ */
  2622. diff --git a/exynos3/s5pc110/libhdmi/hal_module.cpp b/exynos3/s5pc110/libhdmi/hal_module.cpp
  2623. deleted file mode 100644
  2624. index 767e6b5..0000000
  2625. --- a/exynos3/s5pc110/libhdmi/hal_module.cpp
  2626. +++ /dev/null
  2627. @@ -1,222 +0,0 @@
  2628. -/*
  2629. - * Copyright 2011, Havlena Petr <havlenapetr@gmail.com>
  2630. - *
  2631. - * Licensed under the Apache License, Version 2.0 (the "License");
  2632. - * you may not use this file except in compliance with the License.
  2633. - * You may obtain a copy of the License at
  2634. - *
  2635. - * http://www.apache.org/licenses/LICENSE-2.0
  2636. - *
  2637. - * Unless required by applicable law or agreed to in writing, software
  2638. - * distributed under the License is distributed on an "AS IS" BASIS,
  2639. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2640. - * See the License for the specific language governing permissions and
  2641. - * limitations under the License.
  2642. - */
  2643. -
  2644. -#define LOG_NDEBUG 0
  2645. -#include <cutils/log.h>
  2646. -
  2647. -#include <stdint.h>
  2648. -#include <string.h>
  2649. -#include <errno.h>
  2650. -#include <fcntl.h>
  2651. -#include <sys/types.h>
  2652. -#include <linux/fb.h>
  2653. -
  2654. -#include "hardware/hdmi.h"
  2655. -
  2656. -#include "SecHDMI.h"
  2657. -
  2658. -using namespace android;
  2659. -
  2660. -#define RETURN_EINVAL_IF(hw) \
  2661. - if(!hw) { \
  2662. - ALOGE("%s: %i - Can't obtain hw driver!", __func__, __LINE__); \
  2663. - return -EINVAL; \
  2664. - }
  2665. -
  2666. -struct sec_hdmi_device_t {
  2667. - hdmi_device_t base;
  2668. - /* Sec specific "private" data can go here (base.priv) */
  2669. - SecHDMI* hw;
  2670. - int lcd_width;
  2671. - int lcd_height;
  2672. -};
  2673. -
  2674. -static SecHDMI* sec_obtain_hw(struct hdmi_device_t* device)
  2675. -{
  2676. - if(!device) {
  2677. - ALOGE("Can't obtain hdmi base device!");
  2678. - return NULL;
  2679. - }
  2680. -
  2681. - struct sec_hdmi_device_t* dev =
  2682. - (struct sec_hdmi_device_t *) device;
  2683. - if(!dev) {
  2684. - ALOGE("Can't obtain SEC hdmi device!");
  2685. - return NULL;
  2686. - }
  2687. -
  2688. - return dev->hw;
  2689. -}
  2690. -
  2691. -static int hdmi_connect(struct hdmi_device_t* dev)
  2692. -{
  2693. - ALOGV("connect is called");
  2694. -
  2695. - SecHDMI* hw = sec_obtain_hw(dev);
  2696. - RETURN_EINVAL_IF(hw);
  2697. -
  2698. - return hw->connect();
  2699. -}
  2700. -
  2701. -static int hdmi_disconnect(struct hdmi_device_t* dev)
  2702. -{
  2703. - ALOGV("disconnect is called");
  2704. -
  2705. - SecHDMI* hw = sec_obtain_hw(dev);
  2706. - RETURN_EINVAL_IF(hw);
  2707. -
  2708. - return hw->disconnect();
  2709. -}
  2710. -
  2711. -static int hdmi_clear(struct hdmi_device_t* dev, int hdmiLayer)
  2712. -{
  2713. - ALOGV("clear is called");
  2714. -
  2715. - SecHDMI* hw = sec_obtain_hw(dev);
  2716. - RETURN_EINVAL_IF(hw);
  2717. -
  2718. - return 0/*hw->clear(hdmiLayer) ? 0 : -1*/;
  2719. -}
  2720. -
  2721. -static int hdmi_blit(struct hdmi_device_t* dev, int srcW, int srcH, int srcColorFormat,
  2722. - uint32_t srcYAddr, uint32_t srcCbAddr, uint32_t srcCrAddr,
  2723. - int dstX, int dstY,
  2724. - int layer,
  2725. - int num_of_hwc_layer)
  2726. -{
  2727. - ALOGV("blit is called");
  2728. -
  2729. - SecHDMI* hw = sec_obtain_hw(dev);
  2730. - RETURN_EINVAL_IF(hw);
  2731. -
  2732. - return hw->flush(srcW, srcH, srcColorFormat, srcYAddr, srcCbAddr, srcCrAddr,
  2733. - dstX, dstY, layer, num_of_hwc_layer);
  2734. -}
  2735. -
  2736. -static int hdmi_close(struct hdmi_device_t *dev)
  2737. -{
  2738. - ALOGV("close is called");
  2739. -
  2740. - if (!dev) {
  2741. - return 0;
  2742. - }
  2743. -
  2744. - SecHDMI* hw = sec_obtain_hw(dev);
  2745. - if(hw) {
  2746. - hw->destroy();
  2747. - delete hw;
  2748. - }
  2749. -
  2750. - free(dev);
  2751. -
  2752. - return 0;
  2753. -}
  2754. -
  2755. -static int hdmi_get_lcd_size(int* width, int* height)
  2756. -{
  2757. - char const * const device_template[] = {
  2758. - "/dev/graphics/fb%u",
  2759. - "/dev/fb%u",
  2760. - 0 };
  2761. -
  2762. - int fd = -1;
  2763. - char name[64];
  2764. -
  2765. - for(int i = 0; fd < 0 && device_template[i]; i++) {
  2766. - snprintf(name, 64, device_template[i], 0);
  2767. - fd = open(name, O_RDWR, 0);
  2768. - }
  2769. -
  2770. - if (fd < 0) {
  2771. - return -1;
  2772. - }
  2773. -
  2774. - struct fb_var_screeninfo info;
  2775. - if (ioctl(fd, FBIOGET_VSCREENINFO, &info) < 0) {
  2776. - close(fd);
  2777. - return -2;
  2778. - }
  2779. -
  2780. - *width = info.xres;
  2781. - *height = info.yres;
  2782. -
  2783. - close(fd);
  2784. - return 0;
  2785. -}
  2786. -
  2787. -static int hdmi_open(const struct hw_module_t *module, char const *name,
  2788. - struct hw_device_t **device)
  2789. -{
  2790. - int lcdWidth, lcdHeight;
  2791. -
  2792. - ALOGV("open: open with %s", name);
  2793. -
  2794. - if (strcmp("hdmi-test", name) &&
  2795. - strcmp("hdmi-service", name) &&
  2796. - strcmp("hdmi-composer", name)) {
  2797. - return -EINVAL;
  2798. - }
  2799. -
  2800. - if(hdmi_get_lcd_size(&lcdWidth, &lcdHeight) < 0) {
  2801. - return -EINVAL;
  2802. - }
  2803. -
  2804. - struct sec_hdmi_device_t *hdmi_dev =
  2805. - (struct sec_hdmi_device_t *) malloc(sizeof(struct sec_hdmi_device_t));
  2806. - if(!hdmi_dev) {
  2807. - return -ENOMEM;
  2808. - }
  2809. - memset(hdmi_dev, 0, sizeof(*hdmi_dev));
  2810. -
  2811. - hdmi_dev->base.common.tag = HARDWARE_DEVICE_TAG;
  2812. - hdmi_dev->base.common.version = 0;
  2813. - hdmi_dev->base.common.module = (struct hw_module_t *)module;
  2814. - hdmi_dev->base.common.close = (int (*)(struct hw_device_t *))hdmi_close;
  2815. - hdmi_dev->base.connect = hdmi_connect;
  2816. - hdmi_dev->base.disconnect = hdmi_disconnect;
  2817. - hdmi_dev->base.clear = hdmi_clear;
  2818. - hdmi_dev->base.blit = hdmi_blit;
  2819. - hdmi_dev->lcd_width = lcdWidth;
  2820. - hdmi_dev->lcd_height = lcdHeight;
  2821. -
  2822. - *device = &hdmi_dev->base.common;
  2823. -
  2824. - hdmi_dev->hw = new SecHDMI();
  2825. - if(hdmi_dev->hw->create(lcdWidth, lcdHeight) < 0) {
  2826. - hdmi_close((hdmi_device_t *)hdmi_dev);
  2827. - return -EINVAL;
  2828. - }
  2829. -
  2830. - ALOGI("initzialized for lcd size: %dx%d", lcdWidth, lcdHeight);
  2831. -
  2832. - return 0;
  2833. -}
  2834. -
  2835. -static struct hw_module_methods_t hal_module_methods = {
  2836. - open: hdmi_open,
  2837. -};
  2838. -
  2839. -extern "C" {
  2840. - struct hw_module_t HAL_MODULE_INFO_SYM = {
  2841. - tag: HARDWARE_MODULE_TAG,
  2842. - version_major: 1,
  2843. - version_minor: 0,
  2844. - id: HDMI_HARDWARE_MODULE_ID,
  2845. - name: "Samsung S5PC11X hdmi module",
  2846. - author: "Havlena Petr <havlenapetr@gmail.com>",
  2847. - methods: &hal_module_methods,
  2848. - };
  2849. -}
  2850. diff --git a/exynos3/s5pc110/libhdmi/test/Android.mk b/exynos3/s5pc110/libhdmi/test/Android.mk
  2851. deleted file mode 100644
  2852. index bcdb787..0000000
  2853. --- a/exynos3/s5pc110/libhdmi/test/Android.mk
  2854. +++ /dev/null
  2855. @@ -1,61 +0,0 @@
  2856. -# Copyright (C) 2008 The Android Open Source Project
  2857. -#
  2858. -# Licensed under the Apache License, Version 2.0 (the "License");
  2859. -# you may not use this file except in compliance with the License.
  2860. -# You may obtain a copy of the License at
  2861. -#
  2862. -# http://www.apache.org/licenses/LICENSE-2.0
  2863. -#
  2864. -# Unless required by applicable law or agreed to in writing, software
  2865. -# distributed under the License is distributed on an "AS IS" BASIS,
  2866. -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2867. -# See the License for the specific language governing permissions and
  2868. -# limitations under the License.
  2869. -
  2870. -LOCAL_PATH:= $(call my-dir)
  2871. -
  2872. -# --------------------------------------------- #
  2873. -# test1 binary
  2874. -# --------------------------------------------- #
  2875. -
  2876. -include $(CLEAR_VARS)
  2877. -
  2878. -LOCAL_CFLAGS := -fno-short-enums
  2879. -LOCAL_CFLAGS += -DLOG_TAG=\"test1-hdmi\" -DLOG_TYPE=1
  2880. -
  2881. -LOCAL_C_INCLUDES := \
  2882. - $(LOCAL_PATH)/../../include
  2883. -
  2884. -LOCAL_SRC_FILES := \
  2885. - test1.cpp
  2886. -
  2887. -LOCAL_MODULE := test1-hdmi
  2888. -LOCAL_MODULE_TAGS := optional
  2889. -
  2890. -LOCAL_SHARED_LIBRARIES := liblog libutils libhardware
  2891. -
  2892. -include $(BUILD_EXECUTABLE)
  2893. -
  2894. -# --------------------------------------------- #
  2895. -# test2 binary
  2896. -# --------------------------------------------- #
  2897. -
  2898. -include $(CLEAR_VARS)
  2899. -
  2900. -LOCAL_CFLAGS := -fno-short-enums
  2901. -LOCAL_CFLAGS += -DLOG_TAG=\"test2-hdmi\" -DLOG_TYPE=1
  2902. -
  2903. -LOCAL_C_INCLUDES := \
  2904. - $(LOCAL_PATH)/../ \
  2905. - $(LOCAL_PATH)/../../include
  2906. -
  2907. -LOCAL_SRC_FILES := \
  2908. - ../fimc.c \
  2909. - test2.cpp
  2910. -
  2911. -LOCAL_MODULE := test2-hdmi
  2912. -LOCAL_MODULE_TAGS := optional
  2913. -
  2914. -LOCAL_SHARED_LIBRARIES := liblog libutils
  2915. -
  2916. -include $(BUILD_EXECUTABLE)
  2917. diff --git a/exynos3/s5pc110/libhdmi/test/test.h b/exynos3/s5pc110/libhdmi/test/test.h
  2918. deleted file mode 100644
  2919. index 58c934d..0000000
  2920. --- a/exynos3/s5pc110/libhdmi/test/test.h
  2921. +++ /dev/null
  2922. @@ -1,48 +0,0 @@
  2923. -/*
  2924. - * Copyright (C) 2012 Havlena Petr, <havlenapetr@gmail.com>
  2925. - *
  2926. - * Licensed under the Apache License, Version 2.0 (the "License");
  2927. - * you may not use this file except in compliance with the License.
  2928. - * You may obtain a copy of the License at
  2929. - *
  2930. - * http://www.apache.org/licenses/LICENSE-2.0
  2931. - *
  2932. - * Unless required by applicable law or agreed to in writing, software
  2933. - * distributed under the License is distributed on an "AS IS" BASIS,
  2934. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2935. - * See the License for the specific language governing permissions and
  2936. - * limitations under the License.
  2937. - */
  2938. -
  2939. -#ifndef _HDMI_TEST_H_
  2940. -#define _HDMI_TEST_H_
  2941. -
  2942. -#if LOG_TYPE == 1
  2943. -#include <stdio.h>
  2944. -
  2945. -#define LOGI(fmt, ...) \
  2946. - do { \
  2947. - printf(LOG_TAG"/I: "fmt"\n", __VA_ARGS__); \
  2948. - } while (0)
  2949. -
  2950. -#define LOGE(fmt, ...) \
  2951. - do { \
  2952. - printf(LOG_TAG"/E: "fmt"\n", __VA_ARGS__); \
  2953. - } while (0)
  2954. -
  2955. -#elif LOG_TYPE == 2
  2956. -#include <utils/Log.h>
  2957. -
  2958. -#define LOGI(fmt, ...) \
  2959. - do { \
  2960. - ALOGI(fmt, __VA_ARGS__); \
  2961. - } while (0)
  2962. -
  2963. -#define LOGE(fmt, ...) \
  2964. - do { \
  2965. - ALOGE(fmt, __VA_ARGS__); \
  2966. - } while (0)
  2967. -
  2968. -#endif
  2969. -
  2970. -#endif // end of _HDMI_TEST_H_
  2971. diff --git a/exynos3/s5pc110/libhdmi/test/test1.cpp b/exynos3/s5pc110/libhdmi/test/test1.cpp
  2972. deleted file mode 100644
  2973. index 3e8c911..0000000
  2974. --- a/exynos3/s5pc110/libhdmi/test/test1.cpp
  2975. +++ /dev/null
  2976. @@ -1,116 +0,0 @@
  2977. -/*
  2978. - * Copyright (C) 2012 Havlena Petr, <havlenapetr@gmail.com>
  2979. - *
  2980. - * Licensed under the Apache License, Version 2.0 (the "License");
  2981. - * you may not use this file except in compliance with the License.
  2982. - * You may obtain a copy of the License at
  2983. - *
  2984. - * http://www.apache.org/licenses/LICENSE-2.0
  2985. - *
  2986. - * Unless required by applicable law or agreed to in writing, software
  2987. - * distributed under the License is distributed on an "AS IS" BASIS,
  2988. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2989. - * See the License for the specific language governing permissions and
  2990. - * limitations under the License.
  2991. - */
  2992. -
  2993. -#include "hardware/hdmi.h"
  2994. -
  2995. -#include <stdint.h>
  2996. -#include <string.h>
  2997. -#include <errno.h>
  2998. -#include <fcntl.h>
  2999. -#include <sys/types.h>
  3000. -#include <linux/videodev2.h>
  3001. -
  3002. -#include "sec_lcd.h"
  3003. -
  3004. -#include "test.h"
  3005. -
  3006. -static void dump_fbs(int count) {
  3007. - char name[64];
  3008. - char const * const fb_template = {
  3009. - "/dev/graphics/fb%u"};
  3010. -
  3011. - for(int i = 0; i < count; i++) {
  3012. - snprintf(name, 64, fb_template, i);
  3013. - int fd = open(name, O_RDWR, 0);
  3014. - if(fd < 0) {
  3015. - LOGE("%s:: Can't open %s", __func__, name);
  3016. - continue;
  3017. - }
  3018. -
  3019. - struct s3cfb_next_info fb_info;
  3020. - int ret = ioctl(fd, S3CFB_GET_CURR_FB_INFO, &fb_info);
  3021. - if (ret < 0) {
  3022. - LOGE("%s:: ioctl(S3CFB_GET_FB_PHY__ADDR) fail: %d for %s",
  3023. - __func__, ret, name);
  3024. - goto close;
  3025. - }
  3026. -
  3027. - LOGI("%s:: %s addr=0x%08x", __func__, name, fb_info.phy_start_addr);
  3028. -
  3029. -close:
  3030. - close(fd);
  3031. - }
  3032. -}
  3033. -
  3034. -int main(int argc, char** argv) {
  3035. - hw_module_t* module;
  3036. - hdmi_device_t* hdmi;
  3037. - int ret;
  3038. -
  3039. - ret = hw_get_module(HDMI_HARDWARE_MODULE_ID,
  3040. - (const hw_module_t**)&module);
  3041. - if(ret) {
  3042. - LOGE("%s:: Hdmi device not presented", __func__);
  3043. - goto fail;
  3044. - }
  3045. -
  3046. - ret = module->methods->open(module, "hdmi-test",
  3047. - (hw_device_t **)&hdmi);
  3048. - if(ret < 0) {
  3049. - LOGE("%s:: Can't open hdmi device", __func__);
  3050. - goto fail;
  3051. - }
  3052. -
  3053. - ret = hdmi->connect(hdmi);
  3054. - if(ret < 0) {
  3055. - LOGE("%s:: Can't connect hdmi device", __func__);
  3056. - goto close;
  3057. - }
  3058. -
  3059. -#if 1
  3060. - dump_fbs(5);
  3061. -#endif
  3062. -
  3063. - for(int i = 0; i < 5; i++) {
  3064. - LOGI("Blit cycle: %d", i);
  3065. - ret = hdmi->blit(hdmi,
  3066. - 600, /* default lcd width */
  3067. - 1024, /* default lcd height */
  3068. - HAL_PIXEL_FORMAT_BGRA_8888, /* our default pixel format */
  3069. - 0, 0, 0, /* use default frame buffer */
  3070. - 0, 0,
  3071. - HDMI_MODE_UI,
  3072. - 0);
  3073. - if(ret < 0) {
  3074. - LOGE("%s:: Can't blit to hdmi device", __func__);
  3075. - break;
  3076. - }
  3077. - }
  3078. -
  3079. -disconnect:
  3080. - if(hdmi->disconnect(hdmi) < 0) {
  3081. - LOGE("%s:: Can't disconnect hdmi device", __func__);
  3082. - }
  3083. -
  3084. -close:
  3085. - if(hdmi->common.close(&hdmi->common) < 0) {
  3086. - LOGE("%s:: Can't close hdmi device", __func__);
  3087. - }
  3088. -
  3089. -fail:
  3090. - LOGI("HDMI result: %d", ret);
  3091. - return ret;
  3092. -}
  3093. diff --git a/exynos3/s5pc110/libhdmi/test/test2.cpp b/exynos3/s5pc110/libhdmi/test/test2.cpp
  3094. deleted file mode 100644
  3095. index 9f841e1..0000000
  3096. --- a/exynos3/s5pc110/libhdmi/test/test2.cpp
  3097. +++ /dev/null
  3098. @@ -1,97 +0,0 @@
  3099. -/*
  3100. - * Copyright (C) 2012 Havlena Petr, <havlenapetr@gmail.com>
  3101. - *
  3102. - * Licensed under the Apache License, Version 2.0 (the "License");
  3103. - * you may not use this file except in compliance with the License.
  3104. - * You may obtain a copy of the License at
  3105. - *
  3106. - * http://www.apache.org/licenses/LICENSE-2.0
  3107. - *
  3108. - * Unless required by applicable law or agreed to in writing, software
  3109. - * distributed under the License is distributed on an "AS IS" BASIS,
  3110. - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  3111. - * See the License for the specific language governing permissions and
  3112. - * limitations under the License.
  3113. - */
  3114. -
  3115. -#include <stdint.h>
  3116. -#include <string.h>
  3117. -#include <errno.h>
  3118. -#include <fcntl.h>
  3119. -#include <sys/types.h>
  3120. -
  3121. -#include <fimc.h>
  3122. -
  3123. -#include "test.h"
  3124. -
  3125. -int main(int argc, char** argv) {
  3126. - int ret;
  3127. - s5p_fimc_t fimc;
  3128. - /* fimc src and dest objects */
  3129. - sec_img src_img;
  3130. - sec_img dst_img;
  3131. - sec_rect src_rect;
  3132. - sec_rect dst_rect;
  3133. - unsigned int phyAddr[3];
  3134. -
  3135. - memset(&fimc, 0, sizeof(s5p_fimc_t));
  3136. - fimc.dev_fd = -1;
  3137. - ret = fimc_open(&fimc, "/dev/video2");
  3138. - if(ret < 0) {
  3139. - LOGE("%s:: Can't open fimc dev[%d]", __func__, ret);
  3140. - return ret;
  3141. - }
  3142. -
  3143. - memset(&src_img, 0, sizeof(src_img));
  3144. - memset(&dst_img, 0, sizeof(src_img));
  3145. - memset(&src_rect, 0, sizeof(src_rect));
  3146. - memset(&dst_rect, 0, sizeof(src_rect));
  3147. - memset(&phyAddr, 0, sizeof(int) * sizeof(phyAddr));
  3148. -
  3149. - phyAddr[0] = 0/*srcYAddr*/;
  3150. - phyAddr[1] = 0/*srcCbAddr*/;
  3151. - phyAddr[2] = 0/*srcCrAddr*/;
  3152. -
  3153. - src_img.w = 600;
  3154. - src_img.h = 1024;
  3155. - src_img.format = HAL_PIXEL_FORMAT_YCbCr_420_SP;
  3156. - src_img.base = 0;
  3157. - src_img.offset = 0;
  3158. - src_img.mem_id = 0;
  3159. - src_img.mem_type = FIMC_MEM_TYPE_PHYS;
  3160. - src_img.w = (src_img.w + 15) & (~15);
  3161. - src_img.h = (src_img.h + 1) & (~1) ;
  3162. -
  3163. - src_rect.x = 0;
  3164. - src_rect.y = 0;
  3165. - src_rect.w = src_img.w;
  3166. - src_rect.h = src_img.h;
  3167. -
  3168. - dst_img.w = 600;
  3169. - dst_img.h = 1024;
  3170. - dst_img.format = HAL_PIXEL_FORMAT_YCbCr_420_SP;
  3171. - dst_img.base = (unsigned int) fimc.out_buf.phys_addr;
  3172. - dst_img.offset = 0;
  3173. - dst_img.mem_id = 0;
  3174. - dst_img.mem_type = FIMC_MEM_TYPE_PHYS;
  3175. -
  3176. - dst_rect.x = 0;
  3177. - dst_rect.y = 0;
  3178. - dst_rect.w = dst_img.w;
  3179. - dst_rect.h = dst_img.h;
  3180. -
  3181. - LOGI("%s::sr_x %d sr_y %d sr_w %d sr_h %d dr_x %d dr_y %d dr_w %d dr_h %d ",
  3182. - __func__, src_rect.x, src_rect.y, src_rect.w, src_rect.h,
  3183. - dst_rect.x, dst_rect.y, dst_rect.w, dst_rect.h);
  3184. -
  3185. - for(int i = 0; i < 5 && ret == 0; i++) {
  3186. - ret = fimc_flush(&fimc, &src_img, &src_rect, &dst_img, &dst_rect,
  3187. - phyAddr, 0);
  3188. - if(ret < 0) {
  3189. - LOGE("%s:: Can't flush to fimc dev[%d]", __func__, ret);
  3190. - }
  3191. - }
  3192. -
  3193. - fimc_close(&fimc);
  3194. - return ret;
  3195. -}
  3196. --
  3197. 2.1.4
  3198.  
  3199.  
  3200. From ccce14f9ec581be7102df81fa7479ea39ed5b1cc Mon Sep 17 00:00:00 2001
  3201. From: xc-racer99 <xc-racer2@live.ca>
  3202. Date: Sat, 9 Jul 2016 17:50:27 -0700
  3203. Subject: [PATCH 3/3] exynos3: hwcomposer: Make it more like DDK1.10
  3204.  
  3205. Althought we will likely never have DDK1.10, we might as well use an "official" hwcomposer.
  3206.  
  3207. This differs from the one introduced in https://android-review.googlesource.com/#/c/59341/ in that we keep the hal_public.h that we had (related to our prebuilt gralloc) and we use GRALLOC_USAGE_PHYS_CONTIG as opposed to HAL_PIXEL_FORMAT_C110_NV12.
  3208.  
  3209. Full diff is:
  3210.  
  3211. diff --git a/exynos3/s5pc110/include/hal_public.h b/exynos3/s5pc110/include/hal_public.h
  3212. index 60f33a9..18b01b4 100644
  3213. --- a/exynos3/s5pc110/include/hal_public.h
  3214. +++ b/exynos3/s5pc110/include/hal_public.h
  3215. @@ -70,7 +70,8 @@ typedef struct
  3216. */
  3217. int fd[MAX_SUB_ALLOCS];
  3218.  
  3219. -#define IMG_NATIVE_HANDLE_NUMINTS ((sizeof(unsigned long long) / sizeof(int)) + 5)
  3220. +#define IMG_NATIVE_HANDLE_NUMINTS \
  3221. + ((sizeof(unsigned long long) / sizeof(int)) + 5 + MAX_SUB_ALLOCS + 1)
  3222. /* A KERNEL unique identifier for any exported kernel meminfo. Each
  3223. * exported kernel meminfo will have a unique stamp, but note that in
  3224. * userspace, several meminfos across multiple processes could have
  3225. @@ -84,21 +85,26 @@ typedef struct
  3226. */
  3227. int usage;
  3228.  
  3229. - //int dummy;
  3230. /* In order to do efficient cache flushes we need the buffer dimensions
  3231. * and format. These are available on the ANativeWindowBuffer,
  3232. * but the platform doesn't pass them down to the graphics HAL.
  3233. - *
  3234. - * These fields are also used in the composition bypass. In this
  3235. - * capacity, these are the "real" values for the backing allocation.
  3236. */
  3237. int iWidth;
  3238. int iHeight;
  3239. int iFormat;
  3240. unsigned int uiBpp;
  3241. +
  3242. + /* The ion allocation path doesn't allow for the allocation size and
  3243. + * mapping flags to be communicated cross-process automatically.
  3244. + * Cache these here so we can map buffers in client processes.
  3245. + */
  3246. + unsigned int uiAllocSize[MAX_SUB_ALLOCS];
  3247. + unsigned int uiFlags;
  3248. }
  3249. __attribute__((aligned(sizeof(int)),packed)) IMG_native_handle_t;
  3250.  
  3251. +#if defined(SUPPORT_ANDROID_FRAMEBUFFER_HAL)
  3252. +
  3253. typedef struct
  3254. {
  3255. framebuffer_device_t base;
  3256. @@ -106,39 +112,13 @@ typedef struct
  3257. /* The HWC was loaded. post() is no longer responsible for presents */
  3258. int bBypassPost;
  3259.  
  3260. - /* Custom-blit components in lieu of overlay hardware */
  3261. - int (*Blit)(framebuffer_device_t *device, buffer_handle_t src,
  3262. - buffer_handle_t dest, int w, int h, int x, int y);
  3263. -
  3264. /* HWC path for present posts */
  3265. int (*Post2)(framebuffer_device_t *fb, buffer_handle_t *buffers,
  3266. int num_buffers, void *data, int data_length);
  3267. }
  3268. IMG_framebuffer_device_public_t;
  3269.  
  3270. -typedef struct IMG_gralloc_module_public_t
  3271. -{
  3272. - gralloc_module_t base;
  3273. -
  3274. - /* If the framebuffer has been opened, this will point to the
  3275. - * framebuffer device data required by the allocator, WSEGL
  3276. - * modules and composerhal.
  3277. - */
  3278. - IMG_framebuffer_device_public_t *psFrameBufferDevice;
  3279. -
  3280. - int (*GetPhyAddrs)(struct IMG_gralloc_module_public_t const* module,
  3281. - buffer_handle_t handle,
  3282. - unsigned int auiPhyAddr[MAX_SUB_ALLOCS]);
  3283. - /* Custom-blit components in lieu of overlay hardware */
  3284. - int (*Blit)(struct IMG_gralloc_module_public_t const *module,
  3285. - buffer_handle_t src,
  3286. - void *dest[MAX_SUB_ALLOCS], int format);
  3287. -
  3288. - int (*Blit2)(struct IMG_gralloc_module_public_t const *module,
  3289. - buffer_handle_t src, buffer_handle_t dest,
  3290. - int w, int h, int x, int y);
  3291. -}
  3292. -IMG_gralloc_module_public_t;
  3293. +#endif /* defined(SUPPORT_ANDROID_FRAMEBUFFER_HAL) */
  3294.  
  3295. typedef struct
  3296. {
  3297. @@ -146,6 +126,10 @@ typedef struct
  3298. }
  3299. IMG_write_lock_rect_t;
  3300.  
  3301. +typedef int (*IMG_buffer_format_compute_params_pfn)(
  3302. + unsigned int uiPlane, int *piWidth, int *piHeight,
  3303. + int *piStride, int *piVStride, unsigned long *pulPlaneOffset);
  3304. +
  3305. typedef struct IMG_buffer_format_public_t
  3306. {
  3307. /* Buffer formats are returned as a linked list */
  3308. @@ -163,9 +147,45 @@ typedef struct IMG_buffer_format_public_t
  3309. /* Bits (not bytes) per pixel */
  3310. unsigned int uiBpp;
  3311.  
  3312. - /* GPU output format (creates EGLConfig for format) */
  3313. - int bGPURenderable;
  3314. + /* Supported HW usage bits. If this is GRALLOC_USAGE_HW_MASK, all usages
  3315. + * are supported. Used for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED.
  3316. + */
  3317. + int iSupportedUsage;
  3318. +
  3319. + /* Utility function for adjusting YUV per-plane parameters */
  3320. + IMG_buffer_format_compute_params_pfn pfnComputeParams;
  3321. }
  3322. IMG_buffer_format_public_t;
  3323.  
  3324. +typedef struct IMG_gralloc_module_public_t
  3325. +{
  3326. + gralloc_module_t base;
  3327. +
  3328. +#if defined(SUPPORT_ANDROID_FRAMEBUFFER_HAL)
  3329. + /* If the framebuffer has been opened, this will point to the
  3330. + * framebuffer device data required by the allocator, WSEGL
  3331. + * modules and composerhal.
  3332. + */
  3333. + IMG_framebuffer_device_public_t *psFrameBufferDevice;
  3334. +#endif /* defined(SUPPORT_ANDROID_FRAMEBUFFER_HAL) */
  3335. +
  3336. + /* Obtain HAL's registered format list */
  3337. + const IMG_buffer_format_public_t *(*GetBufferFormats)(void);
  3338. +
  3339. + /* Custom-blit components in lieu of overlay hardware */
  3340. + int (*Blit)(struct IMG_gralloc_module_public_t const *module,
  3341. + buffer_handle_t src,
  3342. + void *dest[MAX_SUB_ALLOCS], int format);
  3343. +
  3344. + int (*Blit2)(struct IMG_gralloc_module_public_t const *module,
  3345. + buffer_handle_t src, buffer_handle_t dest,
  3346. + int w, int h, int x, int y);
  3347. +
  3348. + int (*Blit3)(struct IMG_gralloc_module_public_t const *module,
  3349. + unsigned long long ui64SrcStamp,
  3350. + unsigned long long ui64DestStamp,
  3351. + int eSrcRotation, int eDestRotation);
  3352. +}
  3353. +IMG_gralloc_module_public_t;
  3354. +
  3355. #endif /* HAL_PUBLIC_H */
  3356. diff --git a/exynos3/s5pc110/libhwcomposer/Android.mk b/exynos3/s5pc110/libhwcomposer/Android.mk
  3357. index 5785d4d..72c7b59 100644
  3358. --- a/exynos3/s5pc110/libhwcomposer/Android.mk
  3359. +++ b/exynos3/s5pc110/libhwcomposer/Android.mk
  3360. @@ -12,6 +12,8 @@
  3361. # See the License for the specific language governing permissions and
  3362. # limitations under the License.
  3363.  
  3364. +ifneq ($(filter crespo crespo4g,$(TARGET_DEVICE)),)
  3365. +
  3366. LOCAL_PATH:= $(call my-dir)
  3367. # HAL module implemenation, not prelinked and stored in
  3368. # hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.product.board>.so
  3369. @@ -27,14 +29,8 @@ LOCAL_C_INCLUDES := \
  3370.  
  3371. LOCAL_SRC_FILES := SecHWCUtils.cpp SecHWC.cpp
  3372.  
  3373. -ifeq ($(BOARD_CUSTOM_VSYNC_IOCTL),true)
  3374. - LOCAL_CFLAGS += -DVSYNC_IOCTL
  3375. -endif
  3376. -
  3377. -ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true)
  3378. - LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING
  3379. -endif
  3380. -
  3381. LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
  3382. LOCAL_MODULE_TAGS := optional
  3383. include $(BUILD_SHARED_LIBRARY)
  3384. +
  3385. +endif
  3386. diff --git a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  3387. index 7e86407..a2d8ff2 100644
  3388. --- a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  3389. +++ b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  3390. @@ -152,15 +152,16 @@ static int get_hwc_compos_decision(hwc_layer_1_t* cur)
  3391. ((cur->displayFrame.bottom - cur->displayFrame.top) < 4))
  3392. return compositionType;
  3393.  
  3394. - if((prev_handle->usage & GRALLOC_USAGE_PHYS_CONTIG) &&
  3395. + if((prev_handle->iFormat == HAL_PIXEL_FORMAT_C110_NV12) &&
  3396. + (prev_handle->usage & GRALLOC_USAGE_HW_COMPOSER) &&
  3397. (cur->blending == HWC_BLENDING_NONE))
  3398. compositionType = HWC_OVERLAY;
  3399. else
  3400. compositionType = HWC_FRAMEBUFFER;
  3401.  
  3402. - ALOGV("%s::compositionType %d bpp %d format %x usage %x",
  3403. + ALOGE("%s::compositionType %d bpp %d format %x usage %x",
  3404. __func__,compositionType, prev_handle->uiBpp, prev_handle->iFormat,
  3405. - prev_handle->usage & GRALLOC_USAGE_PHYS_CONTIG);
  3406. + prev_handle->usage & GRALLOC_USAGE_HW_COMPOSER);
  3407.  
  3408. return compositionType;
  3409. }
  3410. @@ -355,13 +356,12 @@ static int hwc_set(hwc_composer_device_1_t *dev,
  3411. cur = &displays[0]->hwLayers[win->layer_index];
  3412.  
  3413. if (cur->compositionType == HWC_OVERLAY) {
  3414. - ret = gpsGrallocModule->GetPhyAddrs(gpsGrallocModule,
  3415. - cur->handle, phyAddr);
  3416. - if (ret) {
  3417. - ALOGE("%s::GetPhyAddrs fail : ret=%d\n", __func__, ret);
  3418. - skipped_window_mask |= (1 << i);
  3419. - continue;
  3420. - }
  3421. + IMG_native_handle_t *native_handle =
  3422. + (IMG_native_handle_t *)cur->handle;
  3423. +
  3424. + /* pass through ion handles */
  3425. + phyAddr[0] = native_handle->fd[0];
  3426. + phyAddr[1] = native_handle->fd[1];
  3427.  
  3428. /* initialize the src & dist context for fimc */
  3429. set_src_dst_info (cur, win, &src_img, &dst_img, &src_rect,
  3430. @@ -452,17 +452,6 @@ static int hwc_query(hwc_composer_device_1_t* dev,
  3431. return 0;
  3432. }
  3433.  
  3434. -#ifdef VSYNC_IOCTL
  3435. -// Linux version of a manual reset event to control when
  3436. -// and when not to ask the video card for a VSYNC. This
  3437. -// stops the worker thread from asking for a VSYNC when
  3438. -// there is nothing useful to do with it and more closely
  3439. -// mimicks the original uevent mechanism
  3440. -int vsync_enable = 0;
  3441. -pthread_mutex_t vsync_mutex = PTHREAD_MUTEX_INITIALIZER;
  3442. -pthread_cond_t vsync_condition = PTHREAD_COND_INITIALIZER;
  3443. -#endif
  3444. -
  3445. static int hwc_eventControl(hwc_composer_device_1_t* dev,
  3446. int disp, int event, int enabled)
  3447. {
  3448. @@ -475,18 +464,6 @@ static int hwc_eventControl(hwc_composer_device_1_t* dev,
  3449. if (err < 0)
  3450. return -errno;
  3451.  
  3452. -#if VSYNC_IOCTL
  3453. - // Enable or disable the ability for the worker thread
  3454. - // to ask for VSYNC events from the video driver
  3455. - pthread_mutex_lock(&vsync_mutex);
  3456. - if(enabled) {
  3457. - vsync_enable = 1;
  3458. - pthread_cond_broadcast(&vsync_condition);
  3459. - }
  3460. - else vsync_enable = 0;
  3461. - pthread_mutex_unlock(&vsync_mutex);
  3462. -#endif
  3463. -
  3464. return 0;
  3465. }
  3466.  
  3467. @@ -518,48 +495,18 @@ void handle_vsync_uevent(hwc_context_t *ctx, const char *buff, int len)
  3468. static void *hwc_vsync_thread(void *data)
  3469. {
  3470. hwc_context_t *ctx = (hwc_context_t *)(data);
  3471. -#ifdef VSYNC_IOCTL
  3472. - uint64_t timestamp = 0;
  3473. -#else
  3474. char uevent_desc[4096];
  3475. memset(uevent_desc, 0, sizeof(uevent_desc));
  3476. -#endif
  3477.  
  3478. setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
  3479.  
  3480. -#ifndef VSYNC_IOCTL
  3481. uevent_init();
  3482. -#endif
  3483. -
  3484. while(true) {
  3485. -#ifdef VSYNC_IOCTL
  3486. - // Only continue if hwc_eventControl is enabled, otherwise
  3487. - // just sit here and wait until it is. This stops the code
  3488. - // from constantly looking for the VSYNC event with the screen
  3489. - // turned off.
  3490. - pthread_mutex_lock(&vsync_mutex);
  3491. - if(!vsync_enable) pthread_cond_wait(&vsync_condition, &vsync_mutex);
  3492. - pthread_mutex_unlock(&vsync_mutex);
  3493. -
  3494. - timestamp = 0; // Reset the timestamp value
  3495. -
  3496. - // S3CFB_WAIT_FOR_VSYNC is a custom IOCTL I added to wait for
  3497. - // the VSYNC interrupt, and then return the timestamp that was
  3498. - // originally being communicated via a uevent. The uevent was
  3499. - // spamming the UEventObserver and events/0 process with more
  3500. - // information than this device could really deal with every 18ms
  3501. - int res = ioctl(ctx->global_lcd_win.fd, S3CFB_WAIT_FOR_VSYNC, &timestamp);
  3502. - if(res > 0) {
  3503. - if(!ctx->procs || !ctx->procs->vsync) continue;
  3504. - ctx->procs->vsync(ctx->procs, 0, timestamp);
  3505. - }
  3506. -#else
  3507. int len = uevent_next_event(uevent_desc, sizeof(uevent_desc) - 2);
  3508.  
  3509. bool vsync = !strcmp(uevent_desc, "change@/devices/platform/s3cfb");
  3510. if(vsync)
  3511. handle_vsync_uevent(ctx, uevent_desc, len);
  3512. -#endif
  3513. }
  3514.  
  3515. return NULL;
  3516. @@ -598,18 +545,7 @@ static int hwc_device_close(struct hw_device_t *dev)
  3517.  
  3518. static int hwc_blank(struct hwc_composer_device_1* dev, int disp, int blank)
  3519. {
  3520. - struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
  3521. - if (blank) {
  3522. - // release our resources, the screen is turning off
  3523. - // in our case, there is nothing to do.
  3524. - ctx->num_of_fb_layer_prev = 0;
  3525. - return 0;
  3526. - }
  3527. - else {
  3528. - // No need to unblank, will unblank on set()
  3529. - return 0;
  3530. - }
  3531. -
  3532. + // FIXME: implement
  3533. return 0;
  3534. }
  3535.  
  3536. diff --git a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  3537. index f0db3b0..415c5db 100644
  3538. --- a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  3539. +++ b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  3540. @@ -32,7 +32,7 @@
  3541. #include <sys/ioctl.h>
  3542. #include <sys/mman.h>
  3543. #include "linux/fb.h"
  3544. -#include "videodev.h"
  3545. +#include <linux/videodev.h>
  3546.  
  3547. #include <hardware/gralloc.h>
  3548. #include <hardware/hardware.h>
  3549. @@ -43,16 +43,13 @@
  3550. #include "sec_format.h"
  3551. #include "sec_utils.h"
  3552.  
  3553. +#define SUPPORT_ANDROID_FRAMEBUFFER_HAL
  3554. #include "hal_public.h"
  3555.  
  3556. -#define GRALLOC_USAGE_PHYS_CONTIG GRALLOC_USAGE_PRIVATE_1
  3557. +#define HAL_PIXEL_FORMAT_C110_NV12 0x100
  3558.  
  3559. #define NUM_OF_WIN (1)
  3560. -#ifdef TARGET_DISABLE_TRIPLE_BUFFERING
  3561. -#define NUM_OF_WIN_BUF (2)
  3562. -#else
  3563. #define NUM_OF_WIN_BUF (3)
  3564. -#endif
  3565. #define NUM_OF_MEM_OBJ (1)
  3566. #define MAX_NUM_PLANES (3)
  3567. ---
  3568. exynos3/s5pc110/include/sec_lcd.h | 1 -
  3569. exynos3/s5pc110/libhwcomposer/SecHWC.cpp | 149 ++++++++++++++++++----------
  3570. exynos3/s5pc110/libhwcomposer/SecHWCUtils.h | 3 +-
  3571. 3 files changed, 99 insertions(+), 54 deletions(-)
  3572.  
  3573. diff --git a/exynos3/s5pc110/include/sec_lcd.h b/exynos3/s5pc110/include/sec_lcd.h
  3574. index 82ef42f..faa7748 100755
  3575. --- a/exynos3/s5pc110/include/sec_lcd.h
  3576. +++ b/exynos3/s5pc110/include/sec_lcd.h
  3577. @@ -31,7 +31,6 @@ struct secfb_user_window {
  3578. *
  3579. */
  3580.  
  3581. -#define FBIO_WAITFORVSYNC _IO ('F', 32)
  3582. #define SECFB_WIN_POSITION _IOW ('F', 203, struct secfb_user_window)
  3583. #define S3CFB_SET_VSYNC_INT _IOW ('F', 206, uint32_t)
  3584. #define S3CFB_WAIT_FOR_VSYNC _IOR ('F', 311, uint64_t)
  3585. diff --git a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  3586. index 38b5b2d..7e86407 100644
  3587. --- a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  3588. +++ b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
  3589. @@ -23,8 +23,6 @@
  3590. *
  3591. */
  3592.  
  3593. -#define HWC_REMOVE_DEPRECATED_VERSIONS 1
  3594. -
  3595. #include <sys/resource.h>
  3596. #include <cutils/log.h>
  3597. #include <cutils/atomic.h>
  3598. @@ -81,9 +79,9 @@ static int set_src_dst_info(hwc_layer_1_t *cur,
  3599. src_img->w = prev_handle->iWidth;
  3600. src_img->h = prev_handle->iHeight;
  3601. src_img->format = prev_handle->iFormat;
  3602. - src_img->base = NULL;
  3603. + src_img->base = 0;
  3604. src_img->offset = 0;
  3605. - src_img->mem_id =0;
  3606. + src_img->mem_id = 0;
  3607.  
  3608. src_img->mem_type = HWC_PHYS_MEM_TYPE;
  3609. src_img->w = (src_img->w + 15) & (~15);
  3610. @@ -216,8 +214,8 @@ static void reset_win_rect_info(hwc_win_info_t *win)
  3611. return;
  3612. }
  3613.  
  3614. -static int hwc_prepare(hwc_composer_device_1_t *dev,
  3615. - size_t numDisplays, hwc_display_contents_1_t** displays)
  3616. +static int hwc_prepare(hwc_composer_device_1_t *dev, size_t numDisplays,
  3617. + hwc_display_contents_1_t **displays)
  3618. {
  3619.  
  3620. struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
  3621. @@ -225,14 +223,8 @@ static int hwc_prepare(hwc_composer_device_1_t *dev,
  3622. int compositionType = 0;
  3623. int ret;
  3624.  
  3625. - // Compat
  3626. - hwc_display_contents_1_t* list = NULL;
  3627. - if (numDisplays > 0) {
  3628. - list = displays[0];
  3629. - }
  3630. -
  3631. //if geometry is not changed, there is no need to do any work here
  3632. - if( !list || (!(list->flags & HWC_GEOMETRY_CHANGED)))
  3633. + if(!(displays[0]->flags & HWC_GEOMETRY_CHANGED))
  3634. return 0;
  3635.  
  3636. //all the windows are free here....
  3637. @@ -242,10 +234,10 @@ static int hwc_prepare(hwc_composer_device_1_t *dev,
  3638. }
  3639. ctx->num_of_hwc_layer = 0;
  3640. ctx->num_of_fb_layer = 0;
  3641. - ALOGV("%s:: hwc_prepare list->numHwLayers %d", __func__, list->numHwLayers);
  3642. + ALOGV("%s:: hwc_prepare displays[0]->numHwLayers %d", __func__, displays[0]->numHwLayers);
  3643.  
  3644. - for (int i = 0; i < list->numHwLayers ; i++) {
  3645. - hwc_layer_1_t* cur = &list->hwLayers[i];
  3646. + for (int i = 0; i < displays[0]->numHwLayers ; i++) {
  3647. + hwc_layer_1_t* cur = &displays[0]->hwLayers[i];
  3648.  
  3649. if (overlay_win_cnt < NUM_OF_WIN) {
  3650. compositionType = get_hwc_compos_decision(cur);
  3651. @@ -272,9 +264,9 @@ static int hwc_prepare(hwc_composer_device_1_t *dev,
  3652. }
  3653. }
  3654.  
  3655. - if(list->numHwLayers != (ctx->num_of_fb_layer + ctx->num_of_hwc_layer))
  3656. + if(displays[0]->numHwLayers != (ctx->num_of_fb_layer + ctx->num_of_hwc_layer))
  3657. ALOGV("%s:: numHwLayers %d num_of_fb_layer %d num_of_hwc_layer %d ",
  3658. - __func__, list->numHwLayers, ctx->num_of_fb_layer,
  3659. + __func__, displays[0]->numHwLayers, ctx->num_of_fb_layer,
  3660. ctx->num_of_hwc_layer);
  3661.  
  3662. if (overlay_win_cnt < NUM_OF_WIN) {
  3663. @@ -288,7 +280,8 @@ static int hwc_prepare(hwc_composer_device_1_t *dev,
  3664. }
  3665.  
  3666. static int hwc_set(hwc_composer_device_1_t *dev,
  3667. - size_t numDisplays, hwc_display_contents_1_t** displays)
  3668. + size_t numDisplays,
  3669. + hwc_display_contents_1_t **displays)
  3670. {
  3671. struct hwc_context_t *ctx = (struct hwc_context_t *)dev;
  3672. unsigned int phyAddr[MAX_NUM_PLANES];
  3673. @@ -301,12 +294,7 @@ static int hwc_set(hwc_composer_device_1_t *dev,
  3674. struct sec_rect src_rect;
  3675. struct sec_rect dst_rect;
  3676.  
  3677. - // Only support one display
  3678. - hwc_display_t dpy = displays[0]->dpy;
  3679. - hwc_surface_t sur = displays[0]->sur;
  3680. - hwc_display_contents_1_t* list = displays[0];
  3681. -
  3682. - if (dpy == NULL && sur == NULL && list == NULL) {
  3683. + if (displays[0]->dpy == NULL && displays[0]->sur == NULL) {
  3684. // release our resources, the screen is turning off
  3685. // in our case, there is nothing to do.
  3686. ctx->num_of_fb_layer_prev = 0;
  3687. @@ -339,14 +327,14 @@ static int hwc_set(hwc_composer_device_1_t *dev,
  3688.  
  3689. ctx->num_of_fb_layer_prev = ctx->num_of_fb_layer;
  3690.  
  3691. - if (need_swap_buffers || !list) {
  3692. - EGLBoolean sucess = eglSwapBuffers((EGLDisplay)dpy, (EGLSurface)sur);
  3693. + if (need_swap_buffers || !displays[0]->numHwLayers) {
  3694. + EGLBoolean sucess = eglSwapBuffers((EGLDisplay)displays[0]->dpy, (EGLSurface)displays[0]->sur);
  3695. if (!sucess) {
  3696. return HWC_EGL_ERROR;
  3697. }
  3698. }
  3699.  
  3700. - if (!list) {
  3701. + if (!displays[0]->numHwLayers) {
  3702. /* turn off the all windows */
  3703. for (int i = 0; i < NUM_OF_WIN; i++) {
  3704. window_hide(&ctx->win[i]);
  3705. @@ -364,10 +352,9 @@ static int hwc_set(hwc_composer_device_1_t *dev,
  3706. for (uint32_t i = 0; i < ctx->num_of_hwc_layer; i++) {
  3707. win = &ctx->win[i];
  3708. if (win->status == HWC_WIN_RESERVED) {
  3709. - cur = &list->hwLayers[win->layer_index];
  3710. + cur = &displays[0]->hwLayers[win->layer_index];
  3711.  
  3712. if (cur->compositionType == HWC_OVERLAY) {
  3713. -
  3714. ret = gpsGrallocModule->GetPhyAddrs(gpsGrallocModule,
  3715. cur->handle, phyAddr);
  3716. if (ret) {
  3717. @@ -437,30 +424,14 @@ static int hwc_set(hwc_composer_device_1_t *dev,
  3718. return 0;
  3719. }
  3720.  
  3721. -static void hwc_registerProcs(struct hwc_composer_device_1* dev,
  3722. +static void hwc_registerProcs(hwc_composer_device_1_t* dev,
  3723. hwc_procs_t const* procs)
  3724. {
  3725. struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
  3726. ctx->procs = const_cast<hwc_procs_t *>(procs);
  3727. }
  3728.  
  3729. -static int hwc_blank(struct hwc_composer_device_1 *dev,
  3730. - int disp, int blank)
  3731. -{
  3732. - struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
  3733. - if (blank) {
  3734. - // release our resources, the screen is turning off
  3735. - // in our case, there is nothing to do.
  3736. - ctx->num_of_fb_layer_prev = 0;
  3737. - return 0;
  3738. - }
  3739. - else {
  3740. - // No need to unblank, will unblank on set()
  3741. - return 0;
  3742. - }
  3743. -}
  3744. -
  3745. -static int hwc_query(struct hwc_composer_device_1* dev,
  3746. +static int hwc_query(hwc_composer_device_1_t* dev,
  3747. int what, int* value)
  3748. {
  3749. struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
  3750. @@ -492,8 +463,8 @@ pthread_mutex_t vsync_mutex = PTHREAD_MUTEX_INITIALIZER;
  3751. pthread_cond_t vsync_condition = PTHREAD_COND_INITIALIZER;
  3752. #endif
  3753.  
  3754. -static int hwc_eventControl(struct hwc_composer_device_1* dev, int dpy,
  3755. - int event, int enabled)
  3756. +static int hwc_eventControl(hwc_composer_device_1_t* dev,
  3757. + int disp, int event, int enabled)
  3758. {
  3759. struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
  3760.  
  3761. @@ -559,6 +530,7 @@ static void *hwc_vsync_thread(void *data)
  3762. #ifndef VSYNC_IOCTL
  3763. uevent_init();
  3764. #endif
  3765. +
  3766. while(true) {
  3767. #ifdef VSYNC_IOCTL
  3768. // Only continue if hwc_eventControl is enabled, otherwise
  3769. @@ -624,6 +596,77 @@ static int hwc_device_close(struct hw_device_t *dev)
  3770. return ret;
  3771. }
  3772.  
  3773. +static int hwc_blank(struct hwc_composer_device_1* dev, int disp, int blank)
  3774. +{
  3775. + struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
  3776. + if (blank) {
  3777. + // release our resources, the screen is turning off
  3778. + // in our case, there is nothing to do.
  3779. + ctx->num_of_fb_layer_prev = 0;
  3780. + return 0;
  3781. + }
  3782. + else {
  3783. + // No need to unblank, will unblank on set()
  3784. + return 0;
  3785. + }
  3786. +
  3787. + return 0;
  3788. +}
  3789. +
  3790. +static int hwc_getDisplayConfigs(struct hwc_composer_device_1* dev, int disp,
  3791. + uint32_t* configs, size_t* numConfigs)
  3792. +{
  3793. + if(disp != HWC_DISPLAY_PRIMARY)
  3794. + return -EINVAL;
  3795. +
  3796. + if(numConfigs)
  3797. + *numConfigs = 1;
  3798. +
  3799. + if(configs)
  3800. + configs[0] = 0;
  3801. +
  3802. + return 0;
  3803. +}
  3804. +
  3805. +static int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
  3806. + uint32_t config, const uint32_t* attributes, int32_t* values)
  3807. +{
  3808. + if(disp != HWC_DISPLAY_PRIMARY)
  3809. + return -EINVAL;
  3810. +
  3811. + if(config != 0)
  3812. + return -EINVAL;
  3813. +
  3814. + while(*attributes != HWC_DISPLAY_NO_ATTRIBUTE)
  3815. + {
  3816. + switch(*attributes)
  3817. + {
  3818. + case HWC_DISPLAY_VSYNC_PERIOD:
  3819. + *values = 1000000000.0 / gpsGrallocModule->psFrameBufferDevice->base.fps;
  3820. + break;
  3821. + case HWC_DISPLAY_WIDTH:
  3822. + *values = gpsGrallocModule->psFrameBufferDevice->base.width;
  3823. + break;
  3824. + case HWC_DISPLAY_HEIGHT:
  3825. + *values = gpsGrallocModule->psFrameBufferDevice->base.height;
  3826. + break;
  3827. + case HWC_DISPLAY_DPI_X:
  3828. + *values = gpsGrallocModule->psFrameBufferDevice->base.xdpi;
  3829. + break;
  3830. + case HWC_DISPLAY_DPI_Y:
  3831. + *values = gpsGrallocModule->psFrameBufferDevice->base.ydpi;
  3832. + break;
  3833. + default:
  3834. + return -EINVAL;
  3835. + }
  3836. +
  3837. + attributes++;
  3838. + values++;
  3839. + }
  3840. +
  3841. + return 0;
  3842. +}
  3843. +
  3844. static int hwc_device_open(const struct hw_module_t* module, const char* name,
  3845. struct hw_device_t** device)
  3846. {
  3847. @@ -655,10 +698,12 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
  3848.  
  3849. dev->device.prepare = hwc_prepare;
  3850. dev->device.set = hwc_set;
  3851. + dev->device.registerProcs = hwc_registerProcs;
  3852. + dev->device.query = hwc_query;
  3853. dev->device.eventControl = hwc_eventControl;
  3854. dev->device.blank = hwc_blank;
  3855. - dev->device.query = hwc_query;
  3856. - dev->device.registerProcs = hwc_registerProcs;
  3857. + dev->device.getDisplayConfigs = hwc_getDisplayConfigs;
  3858. + dev->device.getDisplayAttributes = hwc_getDisplayAttributes;
  3859.  
  3860. *device = &dev->device.common;
  3861.  
  3862. diff --git a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  3863. index 18aa727..f0db3b0 100644
  3864. --- a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  3865. +++ b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
  3866. @@ -42,6 +42,7 @@
  3867. #include "sec_lcd.h"
  3868. #include "sec_format.h"
  3869. #include "sec_utils.h"
  3870. +
  3871. #include "hal_public.h"
  3872.  
  3873. #define GRALLOC_USAGE_PHYS_CONTIG GRALLOC_USAGE_PRIVATE_1
  3874. @@ -113,7 +114,7 @@ enum {
  3875. };
  3876.  
  3877. struct hwc_context_t {
  3878. - hwc_composer_device_1_t device;
  3879. + hwc_composer_device_1_t device;
  3880.  
  3881. /* our private state goes below here */
  3882. struct hwc_win_info_t win[NUM_OF_WIN];
  3883. --
  3884. 2.1.4
Add Comment
Please, Sign In to add comment