make base directory to remove exactly the same code 46/250246/1
authordyamy-lee <dyamy.lee@samsung.com>
Wed, 25 Nov 2020 05:15:42 +0000 (14:15 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Tue, 22 Dec 2020 09:01:21 +0000 (18:01 +0900)
Change-Id: I9459356a1be251a2afe1eed226a209b1d8ee6378

61 files changed:
base/fbinfo.h [new file with mode: 0644]
base/fota_png.c [new file with mode: 0644]
base/fota_png.h [new file with mode: 0644]
base/gui_general.h [new file with mode: 0644]
base/gui_log.h [new file with mode: 0644]
base/gui_util.c [new file with mode: 0644]
base/gui_util.h [new file with mode: 0644]
base/tdm-if.c [new file with mode: 0644]
base/tdm-if.h [new file with mode: 0644]
fota_gui_common/CMakeLists.txt
fota_gui_common/fota_fbinfo.h [deleted file]
fota_gui_common/fota_gr_direct_ro_common.c
fota_gui_common/fota_gr_direct_ro_common.h
fota_gui_common/fota_gui_general.h [deleted file]
fota_gui_common/fota_gui_log.h [deleted file]
fota_gui_common/fota_gui_ro_common_main.c
fota_gui_common/fota_gui_util.c [deleted file]
fota_gui_common/fota_gui_util.h [deleted file]
fota_gui_common/fota_png.c [deleted file]
fota_gui_common/fota_png.h [deleted file]
fota_gui_common/tdm-if.c [deleted file]
fota_gui_common/tdm-if.h [deleted file]
fota_gui_wearable/CMakeLists.txt
fota_gui_wearable/fota_fbinfo.h [deleted file]
fota_gui_wearable/fota_gr_direct_ro_wearable.c
fota_gui_wearable/fota_gr_direct_ro_wearable.h
fota_gui_wearable/fota_gui_general.h [deleted file]
fota_gui_wearable/fota_gui_log.h [deleted file]
fota_gui_wearable/fota_gui_ro_wearable_main.c
fota_gui_wearable/fota_gui_util.c [deleted file]
fota_gui_wearable/fota_gui_util.h [deleted file]
fota_gui_wearable/fota_png.c [deleted file]
fota_gui_wearable/fota_png.h [deleted file]
fota_gui_wearable/tdm-if.c [deleted file]
fota_gui_wearable/tdm-if.h [deleted file]
recovery_gui_common/CMakeLists.txt
recovery_gui_common/recovery_fbinfo.h [deleted file]
recovery_gui_common/recovery_gr_direct_common.c
recovery_gui_common/recovery_gr_direct_common.h
recovery_gui_common/recovery_gui_common_main.c
recovery_gui_common/recovery_gui_general.h [deleted file]
recovery_gui_common/recovery_gui_log.h [deleted file]
recovery_gui_common/recovery_gui_util.c [deleted file]
recovery_gui_common/recovery_gui_util.h [deleted file]
recovery_gui_common/recovery_png.c [deleted file]
recovery_gui_common/recovery_png.h [deleted file]
recovery_gui_common/tdm-if.c [deleted file]
recovery_gui_common/tdm-if.h [deleted file]
rw-update-ani-common/CMakeLists.txt
rw-update-ani-common/fota_fbinfo.h [deleted file]
rw-update-ani-common/fota_gr_direct_rw_common.c
rw-update-ani-common/fota_gr_direct_rw_common.h
rw-update-ani-common/fota_gui_general.h [deleted file]
rw-update-ani-common/fota_gui_log.h [deleted file]
rw-update-ani-common/fota_gui_rw_common_main.c
rw-update-ani-common/fota_gui_util.c [deleted file]
rw-update-ani-common/fota_gui_util.h [deleted file]
rw-update-ani-common/fota_png.c [deleted file]
rw-update-ani-common/fota_png.h [deleted file]
rw-update-ani-common/tdm-if.c [deleted file]
rw-update-ani-common/tdm-if.h [deleted file]

diff --git a/base/fbinfo.h b/base/fbinfo.h
new file mode 100644 (file)
index 0000000..95df337
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FBINFO_H__
+#define __FBINFO_H__
+
+typedef struct _FbInfo {
+       unsigned char *buf[2];
+       unsigned int current_fb_id;
+       int w;
+       int h;
+       int sz;
+       int degree;
+       int full_flag;
+} FbInfo;
+
+#endif /* __FBINFO_H__ */
+
diff --git a/base/fota_png.c b/base/fota_png.c
new file mode 100644 (file)
index 0000000..65cc5cc
--- /dev/null
@@ -0,0 +1,573 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <png.h>
+#include "gui_general.h"
+#include "fota_png.h"
+
+int png_img_width;
+int png_img_height;
+/* clear screen based on img size */
+//int png_img_width_batt_normal;
+//int png_img_height_batt_normal;
+
+png_byte png_color_type;
+png_byte png_bit_depth;
+
+png_structp png_ptr;
+png_infop info_ptr;
+int number_of_passes;
+png_bytep *row_pointers;
+
+/*-----------------------------------------------------------------------------
+  read_png_file()
+ ----------------------------------------------------------------------------*/
+int read_png_file(char *file_name)
+{
+       char header[8];         /* 8 is the maximum size that can be checked */
+       int y;
+       size_t rn;
+
+       /* open file and test for it being a png */
+       FILE *fp = fopen(file_name, "rb");
+       if (!fp) {
+               LOG("[read_png_file] File %s could not be opened"
+                       " for reading \n", file_name);
+
+               LOG("Failed to open png file, path = [%s]\n", file_name);
+               return -1;
+       }
+
+       rn = fread(header, 1, 8, fp);
+       if (rn != 8)
+               LOG("fread() read num mismatch\n");
+       if (png_sig_cmp((png_bytep)header, 0, 8)) {
+               fclose(fp);
+               LOG("[read_png_file] File %s is not recognized"
+                       " as a PNG file \n", file_name);
+               LOG("Failed to recognized PNG file\n");
+               return -1;
+       }
+
+       /* initialize stuff */
+       png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+       if (!png_ptr) {
+               fclose(fp);
+               LOG("[read_png_file] png_create_read_struct failed \n");
+
+               LOG("Failed png_create_read_struct()\n");
+               return -1;
+       }
+
+       info_ptr = png_create_info_struct(png_ptr);
+       if (!info_ptr) {
+               png_destroy_read_struct(&png_ptr, NULL, NULL);
+               fclose(fp);
+               LOG("[read_png_file] png_create_info_struct failed \n");
+
+               LOG("Failed png_create_info_struct()\n");
+               return -1;
+       }
+
+       if (setjmp(png_jmpbuf(png_ptr))) {
+               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+               fclose(fp);
+               LOG("[read_png_file] Error during init_io \n");
+
+               LOG("Failed png_destroy_read_struct()\n");
+               return -1;
+       }
+
+       int bit_depth, color_type;
+       png_uint_32 png_width;
+       png_uint_32 png_height;
+
+       png_init_io(png_ptr, fp);
+       png_set_sig_bytes(png_ptr, 8);
+       png_read_info(png_ptr, info_ptr);
+
+       int ret = png_get_IHDR(png_ptr, info_ptr, &png_width, &png_height, &bit_depth, &color_type, NULL, NULL, NULL);
+       if (ret == 0) {
+               LOGE("Failed png_get_IHDR(), ret = [%d]\n", ret);
+       } else if (ret == 1) {
+               LOG("color_type = [%d]\n", color_type);
+
+               if (color_type == PNG_COLOR_TYPE_RGB)
+                       LOG("png color type is PNG_COLOR_TYPE_RGB, color_type = [%d]\n", color_type);
+               else if (color_type == PNG_COLOR_TYPE_RGBA)
+                       LOG("png color type is PNG_COLOR_TYPE_RGBA, color_type = [%d]\n", color_type);
+               else if (color_type == PNG_COLOR_TYPE_PALETTE)
+                       LOG("png color type is PNG_COLOR_TYPE_PALETTE, color_type = [%d]\n", color_type);
+               else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+                       LOG("png color type is PNG_COLOR_TYPE_RGB_ALPHA, color_type = [%d]\n", color_type);
+               else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+                       LOG("png color type is PNG_COLOR_TYPE_GRAY_ALPHA, color_type = [%d]\n", color_type);
+               else if (color_type == PNG_COLOR_TYPE_GA)
+                       LOG("png color type is PNG_COLOR_TYPE_GA, color_type = [%d]\n", color_type);
+               else
+                       LOG("Unknown color type = [%d]\n", color_type);
+       }
+
+       png_img_width = png_width;
+       png_img_height = png_height;
+       png_color_type = color_type;
+       LOG("png_color_type = [%d]\n", png_color_type);
+       png_bit_depth = bit_depth;
+
+       number_of_passes = png_set_interlace_handling(png_ptr);
+       png_read_update_info(png_ptr, info_ptr);
+
+       /* read file */
+       if (setjmp(png_jmpbuf(png_ptr))) {
+               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+               fclose(fp);
+               LOG("[read_png_file] Error during read_image \n");
+
+               LOG("Failed png_destroy_read_struct()\n");
+               return -1;
+       }
+
+       png_size_t row_size = 0;
+
+       row_pointers = (png_bytep *) malloc(sizeof(png_bytep)*png_img_height);
+       for (y = 0; y < png_img_height; y++) {
+               row_size = png_get_rowbytes(png_ptr, info_ptr);
+               row_pointers[y] = (png_byte *) malloc(row_size);
+       }
+
+       png_read_image(png_ptr, row_pointers);
+
+       fclose(fp);
+
+       return 0;
+}
+
+/*-----------------------------------------------------------------------------
+  draw_png_img_clip_xy()
+  - x1, y1 : cordinate on canvas (fb)
+  - cx, cy, cw, ch : image clip (rect on image)
+ ----------------------------------------------------------------------------*/
+void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch)
+{
+       unsigned int *fb_buf_cur = NULL;
+       int bpp;
+       int x, y;
+       /* temp patch - lcd resoultion for qualcomm */
+
+       fb_buf_cur = (unsigned int *)fbi->buf[0];
+
+       /* check out range */
+       if ((x1 + cw > fbi->w) ||
+           (y1 + ch > fbi->h)) {
+               LOG("[%s] output range exceeds frame buffer range \n", __func__);
+               return;
+       }
+
+       if ((cw > png_img_width) || (ch > png_img_height)) {
+               LOG("[%s] clip range exceeds image range \n", __func__);
+               return;
+       }
+
+       if (png_color_type == PNG_COLOR_TYPE_RGB)
+               bpp = 3;
+       else if (png_color_type == PNG_COLOR_TYPE_RGBA)
+               bpp = 4;
+       else {
+               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
+               return;
+       }
+       /* temp patch - lcd resoultion for qualcomm */
+       fb_buf_cur += (y1 * (fbi->w));
+       fb_buf_cur += x1;
+       for (y = 0; y < ch; y++) {
+               png_byte *row = (png_byte *) row_pointers[cy + y];
+               if (png_bit_depth == 8)
+                       row += (bpp * cx);
+               else if (png_bit_depth == 16)
+                       row += (bpp * 2 * cx);
+               for (x = 0; x < cw; x++) {
+                       if (bpp == 3) {
+                               if (png_bit_depth == 8) {
+                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
+                                       row += bpp;
+                               } else if (png_bit_depth == 16) {
+                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
+                                       row += bpp*2;
+                               }
+                       } else if (bpp == 4) {
+                               if (png_bit_depth == 8) {
+                                       if (row[3] != 0) {
+                                               char r1, g1, b1, a1;
+                                               char r2, g2, b2, a2;
+                                               char r3, g3, b3, a3;
+                                               // background pixel
+                                               b1 = ((*fb_buf_cur)&0x000000ff);
+                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
+                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
+                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
+                                               // new pixel
+                                               r2 = row[0];
+                                               g2 = row[1];
+                                               b2 = row[2];
+                                               a2 = row[3];
+                                               // blended pixel
+                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
+                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
+                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
+                                               a3 = a1;
+                                               (*fb_buf_cur) = (a3 << 24) |
+                                                   (r3 << 16) | (g3 << 8) | (b3);
+                                       }
+                                       row += bpp;
+                               } else if (png_bit_depth == 16) {
+                                       if (row[6] != 0) {
+                                               short r1, g1, b1, a1;
+                                               short r2, g2, b2, a2;
+                                               char r3, g3, b3, a3;
+                                               // background pixel
+                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
+                                               g1 = ((*fb_buf_cur)&0x0000ff00);
+                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
+                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
+                                               // new pixel
+                                               r2 = (row[0]<<8) + row[1];
+                                               g2 = (row[2]<<8) + row[3];
+                                               b2 = (row[4]<<8) + row[5];
+                                               a2 = (row[6]<<8) + row[7];
+                                               // blended pixel
+                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
+                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
+                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
+                                               a3 = a1 >> 8;
+                                               (*fb_buf_cur) = (a3 << 24) |
+                                                       (r3 << 16) | (g3 << 8) | (b3);
+                                       }
+                                       row += bpp*2;
+                               }
+                       }
+                       fb_buf_cur++;
+               }
+               fb_buf_cur -= cw;
+               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
+       }
+
+}
+
+/*-----------------------------------------------------------------------------
+  draw_png_img_xy()
+ ----------------------------------------------------------------------------*/
+void draw_png_img_xy(FbInfo *fbi, int x1, int y1)
+{
+       unsigned int *fb_buf_cur = NULL;
+       int bpp;
+       int x, y;
+       /* temp patch - lcd resoultion for qualcomm */
+
+       fb_buf_cur = (unsigned int *)fbi->buf[0];
+
+       /* check out range */
+       if ((x1 + png_img_width > fbi->w) ||
+               (y1 + png_img_height > fbi->h)) {
+               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
+
+               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
+               return;
+       }
+
+       LOG("png_color_type = [%d]", png_color_type);
+       if (png_color_type == PNG_COLOR_TYPE_RGB) {
+               bpp = 3;
+               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
+       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
+               bpp = 4;
+               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
+       } else {
+               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
+
+               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
+               return;
+       }
+
+       /* temp patch - lcd resoultion for qualcomm */
+       fb_buf_cur += (y1 * (fbi->w));
+       fb_buf_cur += x1;
+       for (y = 0; y < png_img_height; y++) {
+               png_byte *row = (png_byte *) row_pointers[y];
+               for (x = 0; x < png_img_width; x++) {
+                       if (bpp == 3) {
+                               if (png_bit_depth == 8) {
+                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
+                                       row += bpp;
+                               } else if (png_bit_depth == 16) {
+                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
+                                       row += bpp*2;
+                               }
+                       } else if (bpp == 4) {
+                               if (png_bit_depth == 8) {
+                                       if (row[3] != 0) {
+                                               char r1, g1, b1, a1;
+                                               char r2, g2, b2, a2;
+                                               char r3, g3, b3, a3;
+                                               // background pixel
+                                               b1 = ((*fb_buf_cur)&0x000000ff);
+                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
+                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
+                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
+                                               // new pixel
+                                               r2 = row[0];
+                                               g2 = row[1];
+                                               b2 = row[2];
+                                               a2 = row[3];
+                                               // blended pixel
+                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
+                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
+                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
+                                               a3 = a1;
+                                               (*fb_buf_cur) = (a3 << 24) |
+                                                   (r3 << 16) | (g3 << 8) | (b3);
+                                       }
+                                       row += bpp;
+                               } else if (png_bit_depth == 16) {
+                                       if (row[6] != 0) {
+                                               short r1, g1, b1, a1;
+                                               short r2, g2, b2, a2;
+                                               char r3, g3, b3, a3;
+                                               // background pixel
+                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
+                                               g1 = ((*fb_buf_cur)&0x0000ff00);
+                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
+                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
+                                               // new pixel
+                                               r2 = (row[0]<<8) + row[1];
+                                               g2 = (row[2]<<8) + row[3];
+                                               b2 = (row[4]<<8) + row[5];
+                                               a2 = (row[6]<<8) + row[7];
+                                               // blended pixel
+                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
+                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
+                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
+                                               a3 = a1 >> 8;
+                                               (*fb_buf_cur) = (a3 << 24) |
+                                                       (r3 << 16) | (g3 << 8) | (b3);
+                                       }
+                                       row += bpp*2;
+                               }
+                       }
+                       fb_buf_cur++;
+               }
+               fb_buf_cur -= png_img_width;
+               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
+       }
+
+}
+
+
+/*-----------------------------------------------------------------------------
+  draw_png_img_original()
+ ----------------------------------------------------------------------------*/
+void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride)
+{
+       unsigned int *fb_buf_cur = NULL;
+       int bpp;
+       int x, y;
+       int end_width, end_height;
+       /* temp patch - lcd resoultion for qualcomm */
+
+       fb_buf_cur = (unsigned int *)fbi;
+
+       /* check out range */
+       if ((x1 > fbi_w ) || (y1 > fbi_h)) {
+               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
+                       return;
+       }
+       if(x1 + png_img_width > fbi_w)
+               end_width = fbi_w- x1;
+       else
+               end_width = png_img_width;
+       if(y1 + png_img_height > fbi_h)
+               end_height = fbi_h - y1;
+       else
+               end_height = png_img_height;
+
+       LOG("png_color_type = [%d]", png_color_type);
+       if (png_color_type == PNG_COLOR_TYPE_RGB) {
+               bpp = 3;
+               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
+       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
+               bpp = 4;
+               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
+       } else {
+               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
+
+               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
+               return;
+       }
+
+       /* temp patch - lcd resoultion for qualcomm */
+       for (y = 0; y < png_img_height; y++) {
+               if(y > end_height) continue;
+               fb_buf_cur = (unsigned int *) (fbi  + ((y1 + y) * fbi_stride));
+               fb_buf_cur += x1;
+               png_byte *row = (png_byte *) row_pointers[y];
+               for (x = 0; x < png_img_width; x++) {
+                       if(x > end_width) continue;
+                       if (bpp == 3) {
+                               if (png_bit_depth == 8) {
+                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
+                                       row += bpp;
+                               } else if (png_bit_depth == 16) {
+                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
+                                       row += bpp*2;
+                               }
+                       } else if (bpp == 4) {
+                               if (png_bit_depth == 8) {
+                                       if (row[3] != 0) {
+                                               char r1, g1, b1, a1;
+                                               char r2, g2, b2, a2;
+                                               char r3, g3, b3, a3;
+                                               // background pixel
+                                               b1 = ((*fb_buf_cur)&0x000000ff);
+                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
+                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
+                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
+                                               // new pixel
+                                               r2 = row[0];
+                                               g2 = row[1];
+                                               b2 = row[2];
+                                               a2 = row[3];
+                                               // blended pixel
+                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
+                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
+                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
+                                               a3 = a1;
+                                               (*fb_buf_cur) = (a3 << 24) |
+                                                   (r3 << 16) | (g3 << 8) | (b3);
+                                       }
+                                       row += bpp;
+                               } else if (png_bit_depth == 16) {
+                                       if (row[6] != 0) {
+                                               short r1, g1, b1, a1;
+                                               short r2, g2, b2, a2;
+                                               char r3, g3, b3, a3;
+                                               // background pixel
+                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
+                                               g1 = ((*fb_buf_cur)&0x0000ff00);
+                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
+                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
+                                               // new pixel
+                                               r2 = (row[0]<<8) + row[1];
+                                               g2 = (row[2]<<8) + row[3];
+                                               b2 = (row[4]<<8) + row[5];
+                                               a2 = (row[6]<<8) + row[7];
+                                               // blended pixel
+                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
+                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
+                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
+                                               a3 = a1 >> 8;
+                                               (*fb_buf_cur) = (a3 << 24) |
+                                                       (r3 << 16) | (g3 << 8) | (b3);
+                                       }
+                                       row += bpp*2;
+                               }
+                       }
+                       fb_buf_cur++;
+               }
+       }
+
+}
+
+
+/*-----------------------------------------------------------------------------
+  draw_png_mask_xy()
+  - draw pixel only when alpha>0 of given png image
+ ----------------------------------------------------------------------------*/
+void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b)
+{
+       unsigned int *fb_buf_cur = NULL;
+       int bpp;
+       int x, y;
+       /* temp patch - lcd resoultion for qualcomm */
+
+       fb_buf_cur = (unsigned int *)fbi->buf[0];
+
+       /* check out range */
+       if ((x1 + png_img_width > fbi->w) ||
+           (y1 + png_img_height > fbi->h)) {
+               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
+               return;
+       }
+
+       if (png_color_type == PNG_COLOR_TYPE_RGB) {
+               bpp = 3;
+               LOG("[draw_png_img_xy] PNG_COLOR_TYPE_RGB : no mask channel \n");
+               return;
+       } else if (png_color_type == PNG_COLOR_TYPE_RGBA)
+               bpp = 4;
+       else {
+               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
+               return;
+       }
+       /* temp patch - lcd resoultion for qualcomm */
+       fb_buf_cur += (y1 * (fbi->w));
+       fb_buf_cur += x1;
+       for (y = 0; y < png_img_height; y++) {
+               png_byte *row = (png_byte *) row_pointers[y];
+               for (x = 0; x < png_img_width; x++) {
+                       if (bpp == 4) {
+                               if (png_bit_depth == 8) {
+                                       if (row[3] != 0) {
+                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                                       (r << 16) | (g << 8) | (b);
+                                       }
+                                       row += bpp;
+                               } else if (png_bit_depth == 16) {
+                                       if (row[6] != 0) {
+                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
+                                                       (r << 16) | (g << 8) | (b);
+                                       }
+                                       row += bpp*2;
+                               }
+                       }
+                       fb_buf_cur++;
+               }
+               fb_buf_cur -= png_img_width;
+               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
+       }
+
+}
+
+/*-----------------------------------------------------------------------------
+  release_png_res()
+ ----------------------------------------------------------------------------*/
+void release_png_res(void)
+{
+       int y;
+
+       for (y = 0; y < png_img_height; y++)
+               free((void *)row_pointers[y]);
+       free((void *)row_pointers);
+
+       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+}
diff --git a/base/fota_png.h b/base/fota_png.h
new file mode 100644 (file)
index 0000000..a6ebe7c
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FOTA_PNG_H__
+#define __FOTA_PNG_H__
+
+#include "fbinfo.h"
+
+extern int read_png_file(char *file_name);
+extern void draw_png_img_xy(FbInfo *fbi, int x1, int y1);
+extern void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride);
+extern void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch);
+extern void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b);
+extern void release_png_res(void);
+
+
+#endif /* __FOTA_PNG_H__ */
diff --git a/base/gui_general.h b/base/gui_general.h
new file mode 100644 (file)
index 0000000..f03b814
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __GUI_GENERAL_H__
+#define __GUI_GENERAL_H__
+
+
+#include <stdio.h>
+#include "gui_log.h"
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long sl32;
+typedef unsigned long ul32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+
+
+#endif /* __GUI_GENERAL_H__ */
diff --git a/base/gui_log.h b/base/gui_log.h
new file mode 100644 (file)
index 0000000..f7ee228
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __GUI_LOG_H__
+#define __GUI_LOG_H__
+
+#include <stdio.h>
+
+extern unsigned int __log_level__;
+extern FILE *__log_out_file__;
+
+#define LOG_INFO       (1<<8)
+#define LOG_SSENGINE   (1<<7)
+#define LOG_FUNCS      (1<<6)
+#define LOG_GUI                (1<<5)
+#define LOG_DEBUG      (1<<4)
+#define LOG_FILE       (1<<3)
+#define LOG_FLASH      (1<<2)
+
+#if !defined(LOG_PRFIX)
+#define LOG_PRFIX      "FOTA_GUI"
+#endif
+
+#define DEBUG_STDOUT
+//#define DEBUG_FILE
+
+#ifdef DEBUG_STDOUT
+#define LOGE(s, args...) printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args) // Error log
+#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
+       printf(LOG_PRFIX "/(%s): " s, __func__, ##args); } while (0)
+#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
+
+#elif defined(DEBUG_FILE)
+#define LOGE(s, args...) fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args)
+#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
+       fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s , __func__, ##args); } while (0)
+#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
+
+#elif defined(DEBUG_STDOUT_FILE) // debug printf
+#define LOGE(s, args...) do {\
+                                               printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
+                                               fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
+                                       } while (0)
+#define LOGL(mask, s, args...) do { \
+                                               if ((mask) & __log_level__) { \
+                                                       printf(LOG_PRFIX "/(%s): " s , __func__, ##args);\
+                                                   fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s, __func__, ##args);\
+                                               } \
+                                       } while (0)
+#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
+
+#else
+#define LOGE(s, args...)
+#define LOGL(mask, s, args...)
+#define LOG(s, args...)
+
+#endif
+
+
+#endif /* __GUI_LOG_H__ */
+
diff --git a/base/gui_util.c b/base/gui_util.c
new file mode 100644 (file)
index 0000000..f0ef7f6
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "gui_log.h"
+
+int s_fd_stdin = -1;
+int s_fd_stdout = -1;
+int s_fd_stderr = -1;
+
+/*-----------------------------------------------------------------------------
+  set_default_stdio
+ ----------------------------------------------------------------------------*/
+static int set_default_stdio(int flags, int nfd)
+{
+       int fd, r;
+
+       fd = open("/dev/null", flags|O_NOCTTY);
+       if (fd < 0)
+               return -errno;
+
+       if (fd == nfd) {
+               return fd;
+       } else {
+               r = dup2(fd, nfd) < 0 ? -errno : nfd;
+               close(fd);
+               return r;
+       }
+}
+
+/*-----------------------------------------------------------------------------
+  _init_stdio
+ ----------------------------------------------------------------------------*/
+void _init_stdio(void)
+{
+       s_fd_stdin = set_default_stdio(O_RDONLY, STDIN_FILENO);
+
+       s_fd_stdout = set_default_stdio(O_WRONLY, STDOUT_FILENO);
+
+       s_fd_stderr = set_default_stdio(O_WRONLY, STDERR_FILENO);
+}
+
+/*-----------------------------------------------------------------------------
+  _exit_stdio
+ ----------------------------------------------------------------------------*/
+void _exit_stdio(void)
+{
+       if (s_fd_stdin >= 0)
+               close(s_fd_stdin);
+
+       if (s_fd_stdout >= 0)
+               close(s_fd_stdout);
+
+       if (s_fd_stderr >= 0)
+               close(s_fd_stderr);
+}
+
diff --git a/base/gui_util.h b/base/gui_util.h
new file mode 100644 (file)
index 0000000..c6f8374
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _GUI_UTIL_H_
+#define _GUI_UTIL_H_
+
+extern void _init_stdio(void);
+extern void _exit_stdio(void);
+
+#endif /* _GUI_UTIL_H_ */
+
diff --git a/base/tdm-if.c b/base/tdm-if.c
new file mode 100644 (file)
index 0000000..1cc7f4e
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdbool.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/poll.h>
+#include <sys/time.h>
+#include "gui_general.h"
+#include "tdm-if.h"
+
+static void tdm_if_display_commit_handler_cb(tdm_output *output, unsigned int sequence,
+               unsigned int tv_sec, unsigned int tv_usec, void *user_data)
+{
+       LOG("commit_handle_cb!!\n");
+
+       return ;
+}
+
+int tdm_if_display_init(tdm_if_disp *st_disp)
+{
+       int color = 0;
+       int buf_cnt;
+
+       tdm_error err = TDM_ERROR_NONE;
+
+       tdm_output *output = NULL;
+       tdm_output_type output_type = TDM_OUTPUT_TYPE_Unknown;
+       tdm_output_conn_status conn_status = TDM_OUTPUT_CONN_STATUS_DISCONNECTED;
+       const tdm_output_mode *output_mode;
+       int output_count = 0;
+
+       tdm_info_layer layer_info;
+
+       tbm_surface_info_s surf_info;
+
+       int i = 0;
+
+       LOG("start\n");
+
+       st_disp->disp = tdm_display_init(&err);
+       if (!st_disp->disp) {
+               LOGE("failed to init tdm_display. error num = %d\n", err);
+               goto exit;
+       }
+
+       err = tdm_display_get_fd(st_disp->disp, &st_disp->tdm_fd);
+       if (err != TDM_ERROR_NONE) {
+               LOGE("failed to get tdm fd. error num = %d\n", err);
+               goto exit;
+       }
+
+       st_disp->drm_fd = tdm_helper_get_fd("TDM_DRM_MASTER_FD");
+       if (st_disp->drm_fd == -1) {
+               LOGE("failed to get tdm fd. error num = %d\n", err);
+               goto exit;
+       }
+
+       err = tdm_display_get_output_count(st_disp->disp, &output_count);
+       if (err != TDM_ERROR_NONE) {
+               LOGE("failed to get output count. error num = %d\n", err);
+               goto exit;
+       }
+
+       for (i = 0; i < output_count; i++) {
+               output = tdm_display_get_output(st_disp->disp, i, &err);
+               if (err != TDM_ERROR_NONE) {
+                       LOGE("failed to get outout. error num = %d\n", err);
+                       goto exit;
+               }
+
+               err = tdm_output_get_output_type(output, &output_type);
+               if (err != TDM_ERROR_NONE) {
+                       LOGE("failed to get output type. error num = %d\n", err);
+                       goto exit;
+               }
+
+               err = tdm_output_get_conn_status(output, &conn_status);
+               if (err != TDM_ERROR_NONE) {
+                       LOGE("failed to get output connection status. error num = %d\n", err);
+                       goto exit;
+               }
+
+               LOG("output_type=%d  conn_status=%d\n", output_type, conn_status);
+               if ((output_type == TDM_OUTPUT_TYPE_LVDS || output_type == TDM_OUTPUT_TYPE_DSI
+                       || output_type == TDM_OUTPUT_TYPE_HDMIA)
+                       && (conn_status == TDM_OUTPUT_CONN_STATUS_CONNECTED)) {
+                       int cnt = 0;
+                       err = tdm_output_get_available_modes(output, &output_mode, &cnt);
+                       if (err != TDM_ERROR_NONE) {
+                               LOGE("failed to get output available modes. error num = %d\n", err);
+                               goto exit;
+                       }
+
+                       err = tdm_output_set_mode(output, &output_mode[0]);
+                       if (err != TDM_ERROR_NONE) {
+                               LOGE("failed to set mode. error num = %d\n", err);
+                               goto exit;
+                       }
+
+                       /* GET MODE INFO */
+                       st_disp->output = output;
+                       st_disp->width = output_mode->hdisplay;
+                       st_disp->height = output_mode->vdisplay;
+
+                       unsigned int width_mm = 0;
+                       unsigned int height_mm = 0;
+                       err = tdm_output_get_physical_size(output, &width_mm, &height_mm);
+                       LOG("TDM_OUTPUT_MODE:name[%s] mode:wh[%d %d] mm[%d %d]\n",
+                                       output_mode->name, st_disp->width, st_disp->height, width_mm, height_mm);
+
+                       break;
+               }
+       }
+
+       /* MEMORY ALLOCATION */
+       st_disp->bufmgr = tbm_bufmgr_init(st_disp->drm_fd);
+       if (!st_disp->bufmgr) {
+               LOGE("failed to tbm_bufmgr_init\n");
+               goto exit;
+       }
+
+       st_disp->buffer_size = st_disp->width * st_disp->height * RGB32_PITCH;
+       st_disp->stride = st_disp->width * RGB32_PITCH;
+
+       surf_info.width = st_disp->width;
+       surf_info.height = st_disp->height;
+       surf_info.format = TBM_FORMAT_ARGB8888;
+       surf_info.bpp = 32;
+       surf_info.size = st_disp->buffer_size;
+       surf_info.num_planes = 1;
+       surf_info.planes[0].size = st_disp->buffer_size;
+       surf_info.planes[0].offset = 0;
+       surf_info.planes[0].stride = st_disp->stride;
+
+       for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
+               st_disp->bo[buf_cnt] = tbm_bo_alloc(st_disp->bufmgr, st_disp->buffer_size, TBM_BO_NONCACHABLE);
+               if (!st_disp->bo[buf_cnt]) {
+                       LOGE("failed to tbm_bo_alloc\n");
+                       goto exit;
+               }
+
+               st_disp->bo_handle[buf_cnt] = tbm_bo_map(st_disp->bo[buf_cnt], TBM_DEVICE_CPU, TBM_OPTION_WRITE);
+               st_disp->buffer[buf_cnt] = st_disp->bo_handle[buf_cnt].ptr;
+               st_disp->handle[buf_cnt] = tbm_bo_get_handle(st_disp->bo[buf_cnt], TBM_DEVICE_2D).u32;
+
+               memset(st_disp->buffer[buf_cnt], color, st_disp->stride * st_disp->height);
+
+               tbm_bo_unmap(st_disp->bo[buf_cnt]);
+
+               st_disp->surf[buf_cnt] = tbm_surface_internal_create_with_bos(&surf_info, &st_disp->bo[buf_cnt], 1);
+               if (!st_disp->surf[buf_cnt]) {
+                       LOGE("failed to create tbm_surface!!\n");
+                       goto exit;
+               }
+       }
+
+       /* CHECK HWC USAGE */
+       tdm_output_capability output_caps;
+       tdm_output_get_capabilities(st_disp->output, &output_caps);
+       if (output_caps & TDM_OUTPUT_CAPABILITY_HWC)
+               st_disp->use_tdm_hwc = true;
+       else
+               st_disp->use_tdm_hwc = false;
+
+       /* SET LAYER */
+       if (st_disp->use_tdm_hwc) {
+               st_disp->hwc = tdm_output_get_hwc(st_disp->output, &err);
+               if (!st_disp->hwc) {
+                       LOGE("failed to get hwc. error num = %d\n", err);
+                       goto exit;
+               }
+       } else {
+               tdm_layer_capability layer_caps;
+               tdm_layer *tmp_layer = NULL;
+               for (i = 0; i < output_count; i++) {
+                       tmp_layer = tdm_output_get_layer(st_disp->output, output_count, &err);
+                       tdm_layer_get_capabilities(tmp_layer, &layer_caps);
+                       if (layer_caps & TDM_LAYER_CAPABILITY_PRIMARY)
+                               break;
+               }
+
+               if (!tmp_layer) {
+                       LOGE("failed to get output layer. error num = %d\n", err);
+                       goto exit;
+               }
+
+               st_disp->layer = tmp_layer;
+
+               layer_info.src_config.size.h = st_disp->width;
+               layer_info.src_config.size.v = st_disp->height;
+               layer_info.src_config.pos.x = 0;
+               layer_info.src_config.pos.y = 0;
+               layer_info.src_config.pos.w = st_disp->width;
+               layer_info.src_config.pos.h = st_disp->height;
+               layer_info.src_config.format = TBM_FORMAT_ARGB8888;
+               layer_info.dst_pos.x = 0;
+               layer_info.dst_pos.y = 0;
+               layer_info.dst_pos.w = st_disp->width;
+               layer_info.dst_pos.h = st_disp->height;
+               layer_info.transform = TDM_TRANSFORM_NORMAL;
+
+               err = tdm_layer_set_info(st_disp->layer, &layer_info);
+               if (err != TDM_ERROR_NONE) {
+                       LOGE("failed to get output layer. error num = %d\n", err);
+                       goto exit;
+               }
+       }
+
+       st_disp->current_buf_id = 0;
+       LOG("done\n");
+       return 0;
+exit:
+       tdm_if_display_deinit(st_disp);
+       return -1;
+}
+
+void tdm_if_display_deinit(tdm_if_disp *st_disp)
+{
+       int buf_cnt = 0;
+
+       if (st_disp->disp != NULL) {
+               /* RELEASE RESOURCE */
+               for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
+                       if (st_disp->surf[buf_cnt] != NULL)
+                               tbm_surface_destroy(st_disp->surf[buf_cnt]);
+
+                       if (st_disp->bo[buf_cnt] != NULL)
+                               tbm_bo_unref(st_disp->bo[buf_cnt]);
+               }
+
+               if (st_disp->bufmgr != NULL)
+                       tbm_bufmgr_deinit(st_disp->bufmgr);
+               st_disp->bufmgr = NULL;
+
+               tdm_display_deinit(st_disp->disp);
+               st_disp->disp = NULL;
+       }
+}
+
+void tdm_if_display_update(tdm_if_disp *st_disp)
+{
+       /* DISPLAY UPDATE */
+       int buf_cnt = 0;
+
+       buf_cnt = st_disp->current_buf_id;
+       //st_disp->current_buf_id = (++st_disp->current_buf_id)%MAX_BUF;
+
+       if (st_disp->use_tdm_hwc) {
+               uint32_t num_types;
+               tdm_region damage;
+               memset(&damage, 0, sizeof(damage));
+
+               tdm_hwc_set_client_target_buffer(st_disp->hwc, st_disp->surf[buf_cnt], damage);
+               tdm_hwc_validate(st_disp->hwc, NULL, 0, &num_types);
+               tdm_hwc_accept_validation(st_disp->hwc);
+               tdm_hwc_commit(st_disp->hwc, 1, tdm_if_display_commit_handler_cb, st_disp);
+       } else {
+               tdm_layer_set_buffer(st_disp->layer, st_disp->surf[buf_cnt]);
+
+               // TODO: sync or async??
+               tdm_output_commit(st_disp->output, 1, tdm_if_display_commit_handler_cb, st_disp);
+       }
+
+       return ;
+}
+
+void tdm_if_lcd_on(tdm_if_disp *st_disp)
+{
+       /* SET DPMS ON */
+       LOG("DPMS ON!\n");
+       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_ON);
+       return ;
+}
+
+void tdm_if_lcd_suspend(tdm_if_disp *st_disp)
+{
+       /* SET DPMS SUSPEND */
+       LOG("DPMS SUSPEND!\n");
+       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_SUSPEND);
+
+       return ;
+}
+
+void tdm_if_lcd_off(tdm_if_disp *st_disp)
+{
+       /* SET DPMS OFF */
+       LOG("DPMS OFF!\n");
+
+       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_OFF);
+
+       return ;
+}
diff --git a/base/tdm-if.h b/base/tdm-if.h
new file mode 100644 (file)
index 0000000..dc67910
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * firmware-update-system-ui
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TDM_IF_H__
+#define __TDM_IF_H__
+
+#include <tdm.h>
+#include <tbm_bufmgr.h>
+#include <tdm_helper.h>
+#include <tbm_surface.h>
+#include <tbm_surface_internal.h>
+
+#define MAX_BUF 2
+#define RGB32_BPP 32
+#define RGB32_PITCH 4
+
+typedef struct _tdm_if_disp {
+       tdm_display *disp;
+       tdm_output *output;
+       tdm_layer *layer;
+       tdm_pp *pp;
+       int tdm_fd;
+       int drm_fd;
+
+       tbm_surface_h surf[MAX_BUF];
+       tbm_surface_h pp_surf[MAX_BUF];
+       tbm_bufmgr bufmgr;
+       unsigned int handle[MAX_BUF];
+       unsigned int pp_handle[MAX_BUF];
+       tbm_bo bo[MAX_BUF];
+       tbm_bo_handle bo_handle[MAX_BUF];
+       tbm_bo pp_bo[MAX_BUF];
+       tbm_bo_handle pp_bo_handle[MAX_BUF];
+       void *buffer[MAX_BUF];
+       void *pp_buffer[MAX_BUF];
+       int buffer_size;
+       int width;
+       int height;
+       int stride;
+       int current_buf_id;
+
+       bool use_tdm_hwc;
+       tdm_hwc *hwc;
+} tdm_if_disp;
+
+typedef enum {
+       FRONT_BUFFER = 0,
+       BACK_BUFFER
+} BUFFER_TYPE;
+
+extern tdm_if_disp s_disp;
+
+int tdm_if_display_init(tdm_if_disp *st_disp);
+void tdm_if_display_deinit(tdm_if_disp *st_disp);
+void tdm_if_display_update(tdm_if_disp *st_disp);
+void tdm_if_lcd_on(tdm_if_disp *st_disp);
+void tdm_if_lcd_suspend(tdm_if_disp *st_disp);
+void tdm_if_lcd_off(tdm_if_disp *st_disp);
+#endif /* __TDM_IF_H__ */
index 1f56fd39ef0c0d49b1c3109d4456babcd7bdddb7..f106021e67854df400e59b943b1faf8e2633e056 100644 (file)
@@ -15,6 +15,8 @@ STRING(FIND ${CMAKE_C_FLAGS} "mfloat-abi=hard" IFFOUND1)
 STRING(FIND ${CMAKE_C_FLAGS} "mhard-float" IFFOUND2)
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+SET(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../base)
+INCLUDE_DIRECTORIES(${BASE_DIR})
 
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
        SET(CMAKE_BUILD_TYPE "Release")
@@ -28,13 +30,17 @@ pkg_check_modules(gui_pkgs REQUIRED
        libtdm
        libpng
 )
+SET(BASE_SRCS
+       ${BASE_DIR}/fota_png.c
+       ${BASE_DIR}/gui_util.c
+       ${BASE_DIR}/tdm-if.c
+)
 SET(GUI_SRCS
+       ${BASE_SRCS}
        fota_gui_ro_common_main.c
        fota_gr_ro_common.c
-       fota_png.c
-       fota_gui_util.c
-       tdm-if.c
 )
+MESSAGE(${GUI_SRCS})
 
 FOREACH(flag ${gui_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -60,6 +66,7 @@ TARGET_LINK_LIBRARIES(${FOTA_GUI_COMMON} ${gui_pkgs_LDFLAGS} ${LIBS} -lpthread)
 
 ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
 ADD_DEFINITIONS("-DROTATE=0")
+ADD_DEFINITIONS("-DLOG_PRFIX=\"FOTA_RO\"")
 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/common/images DESTINATION ${RESDIR_COMMON})
 
 INSTALL(TARGETS ${FOTA_GUI_COMMON} DESTINATION ${BINDIR})
diff --git a/fota_gui_common/fota_fbinfo.h b/fota_gui_common/fota_fbinfo.h
deleted file mode 100644 (file)
index 6b73ed8..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_FBINFO_H__
-#define __FOTA_FBINFO_H__
-
-typedef struct _FbInfo {
-       unsigned char *buf[2];
-       unsigned int current_fb_id;
-       int w;
-       int h;
-       int sz;
-       int degree;
-       int full_flag;
-} FbInfo;
-
-#endif /* __FOTA_FBINFO_H__ */
-
index 8b3ebb5e76679a744a27e47bd1b071a0dd2aae67..827ee0bdd3a8870a7372a583558a565b5c89729b 100644 (file)
@@ -25,9 +25,9 @@
 #include <unistd.h>
 #include <pixman.h>
 
-#include "fota_gui_general.h"
+#include "gui_general.h"
 #include "fota_png.h"
-#include "fota_fbinfo.h"
+#include "fbinfo.h"
 #include "tdm-if.h"
 
 #define UNUSED(x) (void)(x)
index b2bb591cb717484972349a40e0d26983dec91cf5..34dcc1f5d5f781c1ba502ca7337fe5106b8e40d2 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __FOTA_GR_DIRECT_RO_COMMON_H__
 #define __FOTA_GR_DIRECT_RO_COMMON_H__
 
-#include "fota_gui_general.h"
+#include "gui_general.h"
 
 extern int fota_gr_direct_init(void);
 extern void fota_gr_direct_deinit(void);
diff --git a/fota_gui_common/fota_gui_general.h b/fota_gui_common/fota_gui_general.h
deleted file mode 100644 (file)
index 1677832..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_GUI_GENERAL_H__
-#define __FOTA_GUI_GENERAL_H__
-
-
-#include <stdio.h>
-#include "fota_gui_log.h"
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long sl32;
-typedef unsigned long ul32;
-
-typedef signed long long s64;
-typedef unsigned long long u64;
-
-
-#endif /* __FOTA_GUI_GENERAL_H__ */
diff --git a/fota_gui_common/fota_gui_log.h b/fota_gui_common/fota_gui_log.h
deleted file mode 100644 (file)
index e8d9420..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_GUI_LOG_H__
-#define __FOTA_GUI_LOG_H__
-
-#include <stdio.h>
-
-extern unsigned int __log_level__;
-extern FILE *__log_out_file__;
-
-#define LOG_INFO       (1<<8)
-#define LOG_SSENGINE   (1<<7)
-#define LOG_FUNCS      (1<<6)
-#define LOG_GUI                (1<<5)
-#define LOG_DEBUG      (1<<4)
-#define LOG_FILE       (1<<3)
-#define LOG_FLASH      (1<<2)
-
-#define LOG_PRFIX      "FOTA_GUI_RO"
-
-#define DEBUG_STDOUT
-//#define DEBUG_FILE
-
-#ifdef DEBUG_STDOUT
-#define LOGE(s, args...) printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args) // Error log
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       printf(LOG_PRFIX "/(%s): " s, __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_FILE)
-#define LOGE(s, args...) fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args)
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s , __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_STDOUT_FILE) // debug printf
-#define LOGE(s, args...) do {\
-                                               printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                               fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                       } while (0)
-#define LOGL(mask, s, args...) do { \
-                                               if ((mask) & __log_level__) { \
-                                                       printf(LOG_PRFIX "/(%s): " s , __func__, ##args);\
-                                                   fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s, __func__, ##args);\
-                                               } \
-                                       } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#else
-#define LOGE(s, args...)
-#define LOGL(mask, s, args...)
-#define LOG(s, args...)
-
-#endif
-
-
-#endif /* __FOTA_GUI_LOG_H__ */
-
index f36c03d5191804442b9ad5ab95b958d2283dc2a0..8a31e55bb4da7c0d4c5fe8578ca1bbaa83847892 100644 (file)
@@ -28,8 +28,8 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#include "fota_gui_general.h"
-#include "fota_gui_util.h"
+#include "gui_general.h"
+#include "gui_util.h"
 #include "fota_gr_ro_common.h"
 
 //#define WAIT
diff --git a/fota_gui_common/fota_gui_util.c b/fota_gui_common/fota_gui_util.c
deleted file mode 100644 (file)
index 5d7d480..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "fota_gui_log.h"
-
-int s_fd_stdin = -1;
-int s_fd_stdout = -1;
-int s_fd_stderr = -1;
-
-/*-----------------------------------------------------------------------------
-  set_default_stdio
- ----------------------------------------------------------------------------*/
-static int set_default_stdio(int flags, int nfd)
-{
-       int fd, r;
-
-       fd = open("/dev/null", flags|O_NOCTTY);
-       if (fd < 0)
-               return -errno;
-
-       if (fd == nfd) {
-               return fd;
-       } else {
-               r = dup2(fd, nfd) < 0 ? -errno : nfd;
-               close(fd);
-               return r;
-       }
-}
-
-/*-----------------------------------------------------------------------------
-  _init_stdio
- ----------------------------------------------------------------------------*/
-void _init_stdio(void)
-{
-       s_fd_stdin = set_default_stdio(O_RDONLY, STDIN_FILENO);
-
-       s_fd_stdout = set_default_stdio(O_WRONLY, STDOUT_FILENO);
-
-       s_fd_stderr = set_default_stdio(O_WRONLY, STDERR_FILENO);
-}
-
-/*-----------------------------------------------------------------------------
-  _exit_stdio
- ----------------------------------------------------------------------------*/
-void _exit_stdio(void)
-{
-       if (s_fd_stdin >= 0)
-               close(s_fd_stdin);
-
-       if (s_fd_stdout >= 0)
-               close(s_fd_stdout);
-
-       if (s_fd_stderr >= 0)
-               close(s_fd_stderr);
-}
-
diff --git a/fota_gui_common/fota_gui_util.h b/fota_gui_common/fota_gui_util.h
deleted file mode 100644 (file)
index 235a9e0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _FOTA_GUI_UTIL_H_
-#define _FOTA_GUI_UTIL_H_
-
-extern void _init_stdio(void);
-extern void _exit_stdio(void);
-
-#endif /* _FOTA_GUI_UTIL_H_ */
-
diff --git a/fota_gui_common/fota_png.c b/fota_gui_common/fota_png.c
deleted file mode 100644 (file)
index 86ee2a1..0000000
+++ /dev/null
@@ -1,573 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <png.h>
-#include "fota_gui_general.h"
-#include "fota_png.h"
-
-int png_img_width;
-int png_img_height;
-/* clear screen based on img size */
-//int png_img_width_batt_normal;
-//int png_img_height_batt_normal;
-
-png_byte png_color_type;
-png_byte png_bit_depth;
-
-png_structp png_ptr;
-png_infop info_ptr;
-int number_of_passes;
-png_bytep *row_pointers;
-
-/*-----------------------------------------------------------------------------
-  read_png_file()
- ----------------------------------------------------------------------------*/
-int read_png_file(char *file_name)
-{
-       char header[8];         /* 8 is the maximum size that can be checked */
-       int y;
-       size_t rn;
-
-       /* open file and test for it being a png */
-       FILE *fp = fopen(file_name, "rb");
-       if (!fp) {
-               LOG("[read_png_file] File %s could not be opened"
-                       " for reading \n", file_name);
-
-               LOG("Failed to open png file, path = [%s]\n", file_name);
-               return -1;
-       }
-
-       rn = fread(header, 1, 8, fp);
-       if (rn != 8)
-               LOG("fread() read num mismatch\n");
-       if (png_sig_cmp((png_bytep)header, 0, 8)) {
-               fclose(fp);
-               LOG("[read_png_file] File %s is not recognized"
-                       " as a PNG file \n", file_name);
-               LOG("Failed to recognized PNG file\n");
-               return -1;
-       }
-
-       /* initialize stuff */
-       png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-       if (!png_ptr) {
-               fclose(fp);
-               LOG("[read_png_file] png_create_read_struct failed \n");
-
-               LOG("Failed png_create_read_struct()\n");
-               return -1;
-       }
-
-       info_ptr = png_create_info_struct(png_ptr);
-       if (!info_ptr) {
-               png_destroy_read_struct(&png_ptr, NULL, NULL);
-               fclose(fp);
-               LOG("[read_png_file] png_create_info_struct failed \n");
-
-               LOG("Failed png_create_info_struct()\n");
-               return -1;
-       }
-
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during init_io \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       int bit_depth, color_type;
-       png_uint_32 png_width;
-       png_uint_32 png_height;
-
-       png_init_io(png_ptr, fp);
-       png_set_sig_bytes(png_ptr, 8);
-       png_read_info(png_ptr, info_ptr);
-
-       int ret = png_get_IHDR(png_ptr, info_ptr, &png_width, &png_height, &bit_depth, &color_type, NULL, NULL, NULL);
-       if (ret == 0) {
-               LOGE("Failed png_get_IHDR(), ret = [%d]\n", ret);
-       } else if (ret == 1) {
-               LOG("color_type = [%d]\n", color_type);
-
-               if (color_type == PNG_COLOR_TYPE_RGB)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGBA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGBA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_PALETTE)
-                       LOG("png color type is PNG_COLOR_TYPE_PALETTE, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_GRAY_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GA)
-                       LOG("png color type is PNG_COLOR_TYPE_GA, color_type = [%d]\n", color_type);
-               else
-                       LOG("Unknown color type = [%d]\n", color_type);
-       }
-
-       png_img_width = png_width;
-       png_img_height = png_height;
-       png_color_type = color_type;
-       LOG("png_color_type = [%d]\n", png_color_type);
-       png_bit_depth = bit_depth;
-
-       number_of_passes = png_set_interlace_handling(png_ptr);
-       png_read_update_info(png_ptr, info_ptr);
-
-       /* read file */
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during read_image \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       png_size_t row_size = 0;
-
-       row_pointers = (png_bytep *) malloc(sizeof(png_bytep)*png_img_height);
-       for (y = 0; y < png_img_height; y++) {
-               row_size = png_get_rowbytes(png_ptr, info_ptr);
-               row_pointers[y] = (png_byte *) malloc(row_size);
-       }
-
-       png_read_image(png_ptr, row_pointers);
-
-       fclose(fp);
-
-       return 0;
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_clip_xy()
-  - x1, y1 : cordinate on canvas (fb)
-  - cx, cy, cw, ch : image clip (rect on image)
- ----------------------------------------------------------------------------*/
-void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + cw > fbi->w) ||
-           (y1 + ch > fbi->h)) {
-               LOG("[%s] output range exceeds frame buffer range \n", __func__);
-               return;
-       }
-
-       if ((cw > png_img_width) || (ch > png_img_height)) {
-               LOG("[%s] clip range exceeds image range \n", __func__);
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB)
-               bpp = 3;
-       else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < ch; y++) {
-               png_byte *row = (png_byte *) row_pointers[cy + y];
-               if (png_bit_depth == 8)
-                       row += (bpp * cx);
-               else if (png_bit_depth == 16)
-                       row += (bpp * 2 * cx);
-               for (x = 0; x < cw; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= cw;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_xy()
- ----------------------------------------------------------------------------*/
-void draw_png_img_xy(FbInfo *fbi, int x1, int y1)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-               (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       LOG("png_color_type = [%d]", png_color_type);
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
-               bpp = 4;
-               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
-       } else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
-               return;
-       }
-
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_original()
- ----------------------------------------------------------------------------*/
-void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       int end_width, end_height;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi;
-
-       /* check out range */
-       if ((x1 > fbi_w ) || (y1 > fbi_h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-                       return;
-       }
-       if(x1 + png_img_width > fbi_w)
-               end_width = fbi_w- x1;
-       else
-               end_width = png_img_width;
-       if(y1 + png_img_height > fbi_h)
-               end_height = fbi_h - y1;
-       else
-               end_height = png_img_height;
-
-       LOG("png_color_type = [%d]", png_color_type);
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
-               bpp = 4;
-               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
-       } else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
-               return;
-       }
-
-       /* temp patch - lcd resoultion for qualcomm */
-       for (y = 0; y < png_img_height; y++) {
-               if(y > end_height) continue;
-               fb_buf_cur = (unsigned int *) (fbi  + ((y1 + y) * fbi_stride));
-               fb_buf_cur += x1;
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if(x > end_width) continue;
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-       }
-
-}
-
-
-/*-----------------------------------------------------------------------------
-  draw_png_mask_xy()
-  - draw pixel only when alpha>0 of given png image
- ----------------------------------------------------------------------------*/
-void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-           (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("[draw_png_img_xy] PNG_COLOR_TYPE_RGB : no mask channel \n");
-               return;
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  release_png_res()
- ----------------------------------------------------------------------------*/
-void release_png_res(void)
-{
-       int y;
-
-       for (y = 0; y < png_img_height; y++)
-               free((void *)row_pointers[y]);
-       free((void *)row_pointers);
-
-       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-}
diff --git a/fota_gui_common/fota_png.h b/fota_gui_common/fota_png.h
deleted file mode 100644 (file)
index f4545e1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_PNG_H__
-#define __FOTA_PNG_H__
-
-#include "fota_fbinfo.h"
-
-extern int read_png_file(char *file_name);
-extern void draw_png_img_xy(FbInfo *fbi, int x1, int y1);
-extern void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride);
-extern void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch);
-extern void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b);
-extern void release_png_res(void);
-
-
-#endif /* __FOTA_PNG_H__ */
diff --git a/fota_gui_common/tdm-if.c b/fota_gui_common/tdm-if.c
deleted file mode 100644 (file)
index 4d15710..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdbool.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include "fota_gui_general.h"
-#include "tdm-if.h"
-
-static void tdm_if_display_commit_handler_cb(tdm_output *output, unsigned int sequence,
-               unsigned int tv_sec, unsigned int tv_usec, void *user_data)
-{
-       LOG("commit_handle_cb!!\n");
-
-       return ;
-}
-
-int tdm_if_display_init(tdm_if_disp *st_disp)
-{
-       int color = 0;
-       int buf_cnt;
-
-       tdm_error err = TDM_ERROR_NONE;
-
-       tdm_output *output = NULL;
-       tdm_output_type output_type = TDM_OUTPUT_TYPE_Unknown;
-       tdm_output_conn_status conn_status = TDM_OUTPUT_CONN_STATUS_DISCONNECTED;
-       const tdm_output_mode *output_mode;
-       int output_count = 0;
-
-       tdm_info_layer layer_info;
-
-       tbm_surface_info_s surf_info;
-
-       int i = 0;
-
-       LOG("start\n");
-
-       st_disp->disp = tdm_display_init(&err);
-       if (!st_disp->disp) {
-               LOGE("failed to init tdm_display. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_fd(st_disp->disp, &st_disp->tdm_fd);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       st_disp->drm_fd = tdm_helper_get_fd("TDM_DRM_MASTER_FD");
-       if (st_disp->drm_fd == -1) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_output_count(st_disp->disp, &output_count);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get output count. error num = %d\n", err);
-               goto exit;
-       }
-
-       for (i = 0; i < output_count; i++) {
-               output = tdm_display_get_output(st_disp->disp, i, &err);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get outout. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_output_type(output, &output_type);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output type. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_conn_status(output, &conn_status);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output connection status. error num = %d\n", err);
-                       goto exit;
-               }
-
-               LOG("output_type=%d  conn_status=%d\n", output_type, conn_status);
-               if ((output_type == TDM_OUTPUT_TYPE_LVDS || output_type == TDM_OUTPUT_TYPE_DSI
-                       || output_type == TDM_OUTPUT_TYPE_HDMIA)
-                       && (conn_status == TDM_OUTPUT_CONN_STATUS_CONNECTED)) {
-                       int cnt = 0;
-                       err = tdm_output_get_available_modes(output, &output_mode, &cnt);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to get output available modes. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       err = tdm_output_set_mode(output, &output_mode[0]);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to set mode. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       /* GET MODE INFO */
-                       st_disp->output = output;
-                       st_disp->width = output_mode->hdisplay;
-                       st_disp->height = output_mode->vdisplay;
-
-                       unsigned int width_mm = 0;
-                       unsigned int height_mm = 0;
-                       err = tdm_output_get_physical_size(output, &width_mm, &height_mm);
-                       LOG("TDM_OUTPUT_MODE:name[%s] mode:wh[%d %d] mm[%d %d]\n",
-                                       output_mode->name, st_disp->width, st_disp->height, width_mm, height_mm);
-
-                       break;
-               }
-       }
-
-       /* MEMORY ALLOCATION */
-       st_disp->bufmgr = tbm_bufmgr_init(st_disp->drm_fd);
-       if (!st_disp->bufmgr) {
-               LOGE("failed to tbm_bufmgr_init\n");
-               goto exit;
-       }
-
-       st_disp->buffer_size = st_disp->width * st_disp->height * RGB32_PITCH;
-       st_disp->stride = st_disp->width * RGB32_PITCH;
-
-       surf_info.width = st_disp->width;
-       surf_info.height = st_disp->height;
-       surf_info.format = TBM_FORMAT_ARGB8888;
-       surf_info.bpp = 32;
-       surf_info.size = st_disp->buffer_size;
-       surf_info.num_planes = 1;
-       surf_info.planes[0].size = st_disp->buffer_size;
-       surf_info.planes[0].offset = 0;
-       surf_info.planes[0].stride = st_disp->stride;
-
-       for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-               st_disp->bo[buf_cnt] = tbm_bo_alloc(st_disp->bufmgr, st_disp->buffer_size, TBM_BO_NONCACHABLE);
-               if (!st_disp->bo[buf_cnt]) {
-                       LOGE("failed to tbm_bo_alloc\n");
-                       goto exit;
-               }
-
-               st_disp->bo_handle[buf_cnt] = tbm_bo_map(st_disp->bo[buf_cnt], TBM_DEVICE_CPU, TBM_OPTION_WRITE);
-               st_disp->buffer[buf_cnt] = st_disp->bo_handle[buf_cnt].ptr;
-               st_disp->handle[buf_cnt] = tbm_bo_get_handle(st_disp->bo[buf_cnt], TBM_DEVICE_2D).u32;
-
-               memset(st_disp->buffer[buf_cnt], color, st_disp->stride * st_disp->height);
-
-               tbm_bo_unmap(st_disp->bo[buf_cnt]);
-
-               st_disp->surf[buf_cnt] = tbm_surface_internal_create_with_bos(&surf_info, &st_disp->bo[buf_cnt], 1);
-               if (!st_disp->surf[buf_cnt]) {
-                       LOGE("failed to create tbm_surface!!\n");
-                       goto exit;
-               }
-       }
-
-       /* CHECK HWC USAGE */
-       tdm_output_capability output_caps;
-       tdm_output_get_capabilities(st_disp->output, &output_caps);
-       if (output_caps & TDM_OUTPUT_CAPABILITY_HWC)
-               st_disp->use_tdm_hwc = true;
-       else
-               st_disp->use_tdm_hwc = false;
-
-       /* SET LAYER */
-       if (st_disp->use_tdm_hwc) {
-               st_disp->hwc = tdm_output_get_hwc(st_disp->output, &err);
-               if (!st_disp->hwc) {
-                       LOGE("failed to get hwc. error num = %d\n", err);
-                       goto exit;
-               }
-       } else {
-               tdm_layer_capability layer_caps;
-               tdm_layer *tmp_layer = NULL;
-               for (i = 0; i < output_count; i++) {
-                       tmp_layer = tdm_output_get_layer(st_disp->output, output_count, &err);
-                       tdm_layer_get_capabilities(tmp_layer, &layer_caps);
-                       if (layer_caps & TDM_LAYER_CAPABILITY_PRIMARY)
-                               break;
-               }
-
-               if (!tmp_layer) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-
-               st_disp->layer = tmp_layer;
-
-               layer_info.src_config.size.h = st_disp->width;
-               layer_info.src_config.size.v = st_disp->height;
-               layer_info.src_config.pos.x = 0;
-               layer_info.src_config.pos.y = 0;
-               layer_info.src_config.pos.w = st_disp->width;
-               layer_info.src_config.pos.h = st_disp->height;
-               layer_info.src_config.format = TBM_FORMAT_ARGB8888;
-               layer_info.dst_pos.x = 0;
-               layer_info.dst_pos.y = 0;
-               layer_info.dst_pos.w = st_disp->width;
-               layer_info.dst_pos.h = st_disp->height;
-               layer_info.transform = TDM_TRANSFORM_NORMAL;
-
-               err = tdm_layer_set_info(st_disp->layer, &layer_info);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-       }
-
-       st_disp->current_buf_id = 0;
-       LOG("done\n");
-       return 0;
-exit:
-       tdm_if_display_deinit(st_disp);
-       return -1;
-}
-
-void tdm_if_display_deinit(tdm_if_disp *st_disp)
-{
-       int buf_cnt = 0;
-
-       if (st_disp->disp != NULL) {
-               /* RELEASE RESOURCE */
-               for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-                       if (st_disp->surf[buf_cnt] != NULL)
-                               tbm_surface_destroy(st_disp->surf[buf_cnt]);
-
-                       if (st_disp->bo[buf_cnt] != NULL)
-                               tbm_bo_unref(st_disp->bo[buf_cnt]);
-               }
-
-               if (st_disp->bufmgr != NULL)
-                       tbm_bufmgr_deinit(st_disp->bufmgr);
-               st_disp->bufmgr = NULL;
-
-               tdm_display_deinit(st_disp->disp);
-               st_disp->disp = NULL;
-       }
-}
-
-void tdm_if_display_update(tdm_if_disp *st_disp)
-{
-       /* DISPLAY UPDATE */
-       int buf_cnt = 0;
-
-       buf_cnt = st_disp->current_buf_id;
-       //st_disp->current_buf_id = (++st_disp->current_buf_id)%MAX_BUF;
-
-       if (st_disp->use_tdm_hwc) {
-               uint32_t num_types;
-               tdm_region damage;
-               memset(&damage, 0, sizeof(damage));
-
-               tdm_hwc_set_client_target_buffer(st_disp->hwc, st_disp->surf[buf_cnt], damage);
-               tdm_hwc_validate(st_disp->hwc, NULL, 0, &num_types);
-               tdm_hwc_accept_validation(st_disp->hwc);
-               tdm_hwc_commit(st_disp->hwc, 1, tdm_if_display_commit_handler_cb, st_disp);
-       } else {
-               tdm_layer_set_buffer(st_disp->layer, st_disp->surf[buf_cnt]);
-
-               // TODO: sync or async??
-               tdm_output_commit(st_disp->output, 1, tdm_if_display_commit_handler_cb, st_disp);
-       }
-
-       return ;
-}
-
-void tdm_if_lcd_on(tdm_if_disp *st_disp)
-{
-       /* SET DPMS ON */
-       LOG("DPMS ON!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_ON);
-       return ;
-}
-
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp)
-{
-       /* SET DPMS SUSPEND */
-       LOG("DPMS SUSPEND!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_SUSPEND);
-
-       return ;
-}
-
-void tdm_if_lcd_off(tdm_if_disp *st_disp)
-{
-       /* SET DPMS OFF */
-       LOG("DPMS OFF!\n");
-
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_OFF);
-
-       return ;
-}
diff --git a/fota_gui_common/tdm-if.h b/fota_gui_common/tdm-if.h
deleted file mode 100644 (file)
index dc67910..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __TDM_IF_H__
-#define __TDM_IF_H__
-
-#include <tdm.h>
-#include <tbm_bufmgr.h>
-#include <tdm_helper.h>
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-
-#define MAX_BUF 2
-#define RGB32_BPP 32
-#define RGB32_PITCH 4
-
-typedef struct _tdm_if_disp {
-       tdm_display *disp;
-       tdm_output *output;
-       tdm_layer *layer;
-       tdm_pp *pp;
-       int tdm_fd;
-       int drm_fd;
-
-       tbm_surface_h surf[MAX_BUF];
-       tbm_surface_h pp_surf[MAX_BUF];
-       tbm_bufmgr bufmgr;
-       unsigned int handle[MAX_BUF];
-       unsigned int pp_handle[MAX_BUF];
-       tbm_bo bo[MAX_BUF];
-       tbm_bo_handle bo_handle[MAX_BUF];
-       tbm_bo pp_bo[MAX_BUF];
-       tbm_bo_handle pp_bo_handle[MAX_BUF];
-       void *buffer[MAX_BUF];
-       void *pp_buffer[MAX_BUF];
-       int buffer_size;
-       int width;
-       int height;
-       int stride;
-       int current_buf_id;
-
-       bool use_tdm_hwc;
-       tdm_hwc *hwc;
-} tdm_if_disp;
-
-typedef enum {
-       FRONT_BUFFER = 0,
-       BACK_BUFFER
-} BUFFER_TYPE;
-
-extern tdm_if_disp s_disp;
-
-int tdm_if_display_init(tdm_if_disp *st_disp);
-void tdm_if_display_deinit(tdm_if_disp *st_disp);
-void tdm_if_display_update(tdm_if_disp *st_disp);
-void tdm_if_lcd_on(tdm_if_disp *st_disp);
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp);
-void tdm_if_lcd_off(tdm_if_disp *st_disp);
-#endif /* __TDM_IF_H__ */
index e25878404161ef4fcfd036b9202ba129f2110602..7a19d5bc4e5edbdb5802550e56a0f61ca6c85266 100644 (file)
@@ -15,6 +15,8 @@ STRING(FIND ${CMAKE_C_FLAGS} "mfloat-abi=hard" IFFOUND1)
 STRING(FIND ${CMAKE_C_FLAGS} "mhard-float" IFFOUND2)
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+SET(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../base)
+INCLUDE_DIRECTORIES(${BASE_DIR})
 
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
        SET(CMAKE_BUILD_TYPE "Release")
@@ -27,12 +29,15 @@ pkg_check_modules(gui_pkgs REQUIRED
        libtdm
        libpng
 )
+SET(BASE_SRCS
+       ${BASE_DIR}/fota_png.c
+       ${BASE_DIR}/gui_util.c
+       ${BASE_DIR}/tdm-if.c
+)
 SET(GUI_SRCS
+       ${BASE_SRCS}
        fota_gui_ro_wearable_main.c
        fota_gr_ro_wearable.c
-       fota_png.c
-       fota_gui_util.c
-       tdm-if.c
 )
 
 FOREACH(flag ${gui_pkgs_CFLAGS})
@@ -59,6 +64,7 @@ ADD_EXECUTABLE(${FOTA_GUI_WEARABLE} ${GUI_SRCS_WEARABLE})
 TARGET_LINK_LIBRARIES(${FOTA_GUI_WEARABLE} ${gui_pkgs_LDFLAGS} ${LIBS} -lpthread)
 
 ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
+ADD_DEFINITIONS("-DLOG_PRFIX=\"FOTA_TW_RO\"")
 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/wearable/ro_update/images DESTINATION ${RESDIR_WEARABLE})
 
 INSTALL(TARGETS ${FOTA_GUI_WEARABLE} DESTINATION ${BINDIR})
diff --git a/fota_gui_wearable/fota_fbinfo.h b/fota_gui_wearable/fota_fbinfo.h
deleted file mode 100644 (file)
index 6b73ed8..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_FBINFO_H__
-#define __FOTA_FBINFO_H__
-
-typedef struct _FbInfo {
-       unsigned char *buf[2];
-       unsigned int current_fb_id;
-       int w;
-       int h;
-       int sz;
-       int degree;
-       int full_flag;
-} FbInfo;
-
-#endif /* __FOTA_FBINFO_H__ */
-
index b637e8a39c08a29c2120d7f4933a24ba36f03cd0..11fd10824e7421be3328e4f92ee113b8cb6f0953 100644 (file)
@@ -24,9 +24,9 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "fota_gui_general.h"
+#include "gui_general.h"
 #include "fota_png.h"
-#include "fota_fbinfo.h"
+#include "fbinfo.h"
 #include "tdm-if.h"
 
 #define UNUSED(x) (void)(x)
index ffb7b7b2e584502cc502f8b24bf0b2f6da7c8ff0..a5ef056c343e4044fcbbebc6bd50dbfdfae99af8 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __FOTA_GR_DIRECT_RO_WEARABLE_H__
 #define __FOTA_GR_DIRECT_RO_WEARABLE_H__
 
-#include "fota_gui_general.h"
+#include "gui_general.h"
 
 extern int fota_gr_direct_init(void);
 extern void fota_gr_direct_deinit(void);
diff --git a/fota_gui_wearable/fota_gui_general.h b/fota_gui_wearable/fota_gui_general.h
deleted file mode 100644 (file)
index 1677832..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_GUI_GENERAL_H__
-#define __FOTA_GUI_GENERAL_H__
-
-
-#include <stdio.h>
-#include "fota_gui_log.h"
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long sl32;
-typedef unsigned long ul32;
-
-typedef signed long long s64;
-typedef unsigned long long u64;
-
-
-#endif /* __FOTA_GUI_GENERAL_H__ */
diff --git a/fota_gui_wearable/fota_gui_log.h b/fota_gui_wearable/fota_gui_log.h
deleted file mode 100644 (file)
index e8d9420..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_GUI_LOG_H__
-#define __FOTA_GUI_LOG_H__
-
-#include <stdio.h>
-
-extern unsigned int __log_level__;
-extern FILE *__log_out_file__;
-
-#define LOG_INFO       (1<<8)
-#define LOG_SSENGINE   (1<<7)
-#define LOG_FUNCS      (1<<6)
-#define LOG_GUI                (1<<5)
-#define LOG_DEBUG      (1<<4)
-#define LOG_FILE       (1<<3)
-#define LOG_FLASH      (1<<2)
-
-#define LOG_PRFIX      "FOTA_GUI_RO"
-
-#define DEBUG_STDOUT
-//#define DEBUG_FILE
-
-#ifdef DEBUG_STDOUT
-#define LOGE(s, args...) printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args) // Error log
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       printf(LOG_PRFIX "/(%s): " s, __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_FILE)
-#define LOGE(s, args...) fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args)
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s , __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_STDOUT_FILE) // debug printf
-#define LOGE(s, args...) do {\
-                                               printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                               fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                       } while (0)
-#define LOGL(mask, s, args...) do { \
-                                               if ((mask) & __log_level__) { \
-                                                       printf(LOG_PRFIX "/(%s): " s , __func__, ##args);\
-                                                   fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s, __func__, ##args);\
-                                               } \
-                                       } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#else
-#define LOGE(s, args...)
-#define LOGL(mask, s, args...)
-#define LOG(s, args...)
-
-#endif
-
-
-#endif /* __FOTA_GUI_LOG_H__ */
-
index a56337992d58cb476077d08e68d4f01c1cc5d71c..e8472c416a33fb9894ea56f08938f051d16d7283 100644 (file)
@@ -28,8 +28,8 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#include "fota_gui_general.h"
-#include "fota_gui_util.h"
+#include "gui_general.h"
+#include "gui_util.h"
 #include "fota_gr_ro_wearable.h"
 
 //#define WAIT
diff --git a/fota_gui_wearable/fota_gui_util.c b/fota_gui_wearable/fota_gui_util.c
deleted file mode 100644 (file)
index 5d7d480..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "fota_gui_log.h"
-
-int s_fd_stdin = -1;
-int s_fd_stdout = -1;
-int s_fd_stderr = -1;
-
-/*-----------------------------------------------------------------------------
-  set_default_stdio
- ----------------------------------------------------------------------------*/
-static int set_default_stdio(int flags, int nfd)
-{
-       int fd, r;
-
-       fd = open("/dev/null", flags|O_NOCTTY);
-       if (fd < 0)
-               return -errno;
-
-       if (fd == nfd) {
-               return fd;
-       } else {
-               r = dup2(fd, nfd) < 0 ? -errno : nfd;
-               close(fd);
-               return r;
-       }
-}
-
-/*-----------------------------------------------------------------------------
-  _init_stdio
- ----------------------------------------------------------------------------*/
-void _init_stdio(void)
-{
-       s_fd_stdin = set_default_stdio(O_RDONLY, STDIN_FILENO);
-
-       s_fd_stdout = set_default_stdio(O_WRONLY, STDOUT_FILENO);
-
-       s_fd_stderr = set_default_stdio(O_WRONLY, STDERR_FILENO);
-}
-
-/*-----------------------------------------------------------------------------
-  _exit_stdio
- ----------------------------------------------------------------------------*/
-void _exit_stdio(void)
-{
-       if (s_fd_stdin >= 0)
-               close(s_fd_stdin);
-
-       if (s_fd_stdout >= 0)
-               close(s_fd_stdout);
-
-       if (s_fd_stderr >= 0)
-               close(s_fd_stderr);
-}
-
diff --git a/fota_gui_wearable/fota_gui_util.h b/fota_gui_wearable/fota_gui_util.h
deleted file mode 100644 (file)
index 235a9e0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _FOTA_GUI_UTIL_H_
-#define _FOTA_GUI_UTIL_H_
-
-extern void _init_stdio(void);
-extern void _exit_stdio(void);
-
-#endif /* _FOTA_GUI_UTIL_H_ */
-
diff --git a/fota_gui_wearable/fota_png.c b/fota_gui_wearable/fota_png.c
deleted file mode 100644 (file)
index 88f6e86..0000000
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <png.h>
-#include "fota_gui_general.h"
-#include "fota_png.h"
-
-int png_img_width;
-int png_img_height;
-/* clear screen based on img size */
-//int png_img_width_batt_normal;
-//int png_img_height_batt_normal;
-
-png_byte png_color_type;
-png_byte png_bit_depth;
-
-png_structp png_ptr;
-png_infop info_ptr;
-int number_of_passes;
-png_bytep *row_pointers;
-
-/*-----------------------------------------------------------------------------
-  read_png_file()
- ----------------------------------------------------------------------------*/
-int read_png_file(char *file_name)
-{
-       char header[8];         /* 8 is the maximum size that can be checked */
-       int y;
-       size_t rn;
-
-       /* open file and test for it being a png */
-       FILE *fp = fopen(file_name, "rb");
-       if (!fp) {
-               LOG("[read_png_file] File %s could not be opened"
-                       " for reading \n", file_name);
-
-               LOG("Failed to open png file, path = [%s]\n", file_name);
-               return -1;
-       }
-
-       rn = fread(header, 1, 8, fp);
-       if (rn != 8)
-               LOG("fread() read num mismatch\n");
-       if (png_sig_cmp((png_bytep)header, 0, 8)) {
-               fclose(fp);
-               LOG("[read_png_file] File %s is not recognized"
-                       " as a PNG file \n", file_name);
-               LOG("Failed to recognized PNG file\n");
-               return -1;
-       }
-
-       /* initialize stuff */
-       png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-       if (!png_ptr) {
-               fclose(fp);
-               LOG("[read_png_file] png_create_read_struct failed \n");
-
-               LOG("Failed png_create_read_struct()\n");
-               return -1;
-       }
-
-       info_ptr = png_create_info_struct(png_ptr);
-       if (!info_ptr) {
-               png_destroy_read_struct(&png_ptr, NULL, NULL);
-               fclose(fp);
-               LOG("[read_png_file] png_create_info_struct failed \n");
-
-               LOG("Failed png_create_info_struct()\n");
-               return -1;
-       }
-
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during init_io \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       int bit_depth, color_type;
-       png_uint_32 png_width;
-       png_uint_32 png_height;
-
-       png_init_io(png_ptr, fp);
-       png_set_sig_bytes(png_ptr, 8);
-       png_read_info(png_ptr, info_ptr);
-
-       int ret = png_get_IHDR(png_ptr, info_ptr, &png_width, &png_height, &bit_depth, &color_type, NULL, NULL, NULL);
-       if (ret == 0) {
-               LOGE("Failed png_get_IHDR(), ret = [%d]\n", ret);
-       } else if (ret == 1) {
-               LOG("color_type = [%d]\n", color_type);
-
-               if (color_type == PNG_COLOR_TYPE_RGB)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGBA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGBA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_PALETTE)
-                       LOG("png color type is PNG_COLOR_TYPE_PALETTE, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_GRAY_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GA)
-                       LOG("png color type is PNG_COLOR_TYPE_GA, color_type = [%d]\n", color_type);
-               else
-                       LOG("Unknown color type = [%d]\n", color_type);
-       }
-
-       png_img_width = png_width;
-       png_img_height = png_height;
-       png_color_type = color_type;
-       LOG("png_color_type = [%d]\n", png_color_type);
-       png_bit_depth = bit_depth;
-
-       number_of_passes = png_set_interlace_handling(png_ptr);
-       png_read_update_info(png_ptr, info_ptr);
-
-       /* read file */
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during read_image \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       png_size_t row_size = 0;
-
-       row_pointers = (png_bytep *) malloc(sizeof(png_bytep)*png_img_height);
-       for (y = 0; y < png_img_height; y++) {
-               row_size = png_get_rowbytes(png_ptr, info_ptr);
-               row_pointers[y] = (png_byte *) malloc(row_size);
-       }
-
-       png_read_image(png_ptr, row_pointers);
-
-       fclose(fp);
-
-       return 0;
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_clip_xy()
-  - x1, y1 : cordinate on canvas (fb)
-  - cx, cy, cw, ch : image clip (rect on image)
- ----------------------------------------------------------------------------*/
-void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + cw > fbi->w) ||
-           (y1 + ch > fbi->h)) {
-               LOG("[%s] output range exceeds frame buffer range \n", __func__);
-               return;
-       }
-
-       if ((cw > png_img_width) || (ch > png_img_height)) {
-               LOG("[%s] clip range exceeds image range \n", __func__);
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB)
-               bpp = 3;
-       else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < ch; y++) {
-               png_byte *row = (png_byte *) row_pointers[cy + y];
-               if (png_bit_depth == 8)
-                       row += (bpp * cx);
-               else if (png_bit_depth == 16)
-                       row += (bpp * 2 * cx);
-               for (x = 0; x < cw; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= cw;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_xy()
- ----------------------------------------------------------------------------*/
-void draw_png_img_xy(FbInfo *fbi, int x1, int y1)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-               (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       LOG("png_color_type = [%d]", png_color_type);
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
-               bpp = 4;
-               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
-       } else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
-               return;
-       }
-
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_mask_xy()
-  - draw pixel only when alpha>0 of given png image
- ----------------------------------------------------------------------------*/
-void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-           (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("[draw_png_img_xy] PNG_COLOR_TYPE_RGB : no mask channel \n");
-               return;
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  release_png_res()
- ----------------------------------------------------------------------------*/
-void release_png_res(void)
-{
-       int y;
-
-       for (y = 0; y < png_img_height; y++)
-               free((void *)row_pointers[y]);
-       free((void *)row_pointers);
-
-       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-}
diff --git a/fota_gui_wearable/fota_png.h b/fota_gui_wearable/fota_png.h
deleted file mode 100644 (file)
index 4a8ce34..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_PNG_H__
-#define __FOTA_PNG_H__
-
-#include "fota_fbinfo.h"
-
-extern int read_png_file(char *file_name);
-extern void draw_png_img_xy(FbInfo *fbi, int x1, int y1);
-extern void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch);
-extern void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b);
-extern void release_png_res(void);
-
-
-#endif /* __FOTA_PNG_H__ */
diff --git a/fota_gui_wearable/tdm-if.c b/fota_gui_wearable/tdm-if.c
deleted file mode 100644 (file)
index 4d15710..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdbool.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include "fota_gui_general.h"
-#include "tdm-if.h"
-
-static void tdm_if_display_commit_handler_cb(tdm_output *output, unsigned int sequence,
-               unsigned int tv_sec, unsigned int tv_usec, void *user_data)
-{
-       LOG("commit_handle_cb!!\n");
-
-       return ;
-}
-
-int tdm_if_display_init(tdm_if_disp *st_disp)
-{
-       int color = 0;
-       int buf_cnt;
-
-       tdm_error err = TDM_ERROR_NONE;
-
-       tdm_output *output = NULL;
-       tdm_output_type output_type = TDM_OUTPUT_TYPE_Unknown;
-       tdm_output_conn_status conn_status = TDM_OUTPUT_CONN_STATUS_DISCONNECTED;
-       const tdm_output_mode *output_mode;
-       int output_count = 0;
-
-       tdm_info_layer layer_info;
-
-       tbm_surface_info_s surf_info;
-
-       int i = 0;
-
-       LOG("start\n");
-
-       st_disp->disp = tdm_display_init(&err);
-       if (!st_disp->disp) {
-               LOGE("failed to init tdm_display. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_fd(st_disp->disp, &st_disp->tdm_fd);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       st_disp->drm_fd = tdm_helper_get_fd("TDM_DRM_MASTER_FD");
-       if (st_disp->drm_fd == -1) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_output_count(st_disp->disp, &output_count);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get output count. error num = %d\n", err);
-               goto exit;
-       }
-
-       for (i = 0; i < output_count; i++) {
-               output = tdm_display_get_output(st_disp->disp, i, &err);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get outout. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_output_type(output, &output_type);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output type. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_conn_status(output, &conn_status);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output connection status. error num = %d\n", err);
-                       goto exit;
-               }
-
-               LOG("output_type=%d  conn_status=%d\n", output_type, conn_status);
-               if ((output_type == TDM_OUTPUT_TYPE_LVDS || output_type == TDM_OUTPUT_TYPE_DSI
-                       || output_type == TDM_OUTPUT_TYPE_HDMIA)
-                       && (conn_status == TDM_OUTPUT_CONN_STATUS_CONNECTED)) {
-                       int cnt = 0;
-                       err = tdm_output_get_available_modes(output, &output_mode, &cnt);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to get output available modes. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       err = tdm_output_set_mode(output, &output_mode[0]);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to set mode. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       /* GET MODE INFO */
-                       st_disp->output = output;
-                       st_disp->width = output_mode->hdisplay;
-                       st_disp->height = output_mode->vdisplay;
-
-                       unsigned int width_mm = 0;
-                       unsigned int height_mm = 0;
-                       err = tdm_output_get_physical_size(output, &width_mm, &height_mm);
-                       LOG("TDM_OUTPUT_MODE:name[%s] mode:wh[%d %d] mm[%d %d]\n",
-                                       output_mode->name, st_disp->width, st_disp->height, width_mm, height_mm);
-
-                       break;
-               }
-       }
-
-       /* MEMORY ALLOCATION */
-       st_disp->bufmgr = tbm_bufmgr_init(st_disp->drm_fd);
-       if (!st_disp->bufmgr) {
-               LOGE("failed to tbm_bufmgr_init\n");
-               goto exit;
-       }
-
-       st_disp->buffer_size = st_disp->width * st_disp->height * RGB32_PITCH;
-       st_disp->stride = st_disp->width * RGB32_PITCH;
-
-       surf_info.width = st_disp->width;
-       surf_info.height = st_disp->height;
-       surf_info.format = TBM_FORMAT_ARGB8888;
-       surf_info.bpp = 32;
-       surf_info.size = st_disp->buffer_size;
-       surf_info.num_planes = 1;
-       surf_info.planes[0].size = st_disp->buffer_size;
-       surf_info.planes[0].offset = 0;
-       surf_info.planes[0].stride = st_disp->stride;
-
-       for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-               st_disp->bo[buf_cnt] = tbm_bo_alloc(st_disp->bufmgr, st_disp->buffer_size, TBM_BO_NONCACHABLE);
-               if (!st_disp->bo[buf_cnt]) {
-                       LOGE("failed to tbm_bo_alloc\n");
-                       goto exit;
-               }
-
-               st_disp->bo_handle[buf_cnt] = tbm_bo_map(st_disp->bo[buf_cnt], TBM_DEVICE_CPU, TBM_OPTION_WRITE);
-               st_disp->buffer[buf_cnt] = st_disp->bo_handle[buf_cnt].ptr;
-               st_disp->handle[buf_cnt] = tbm_bo_get_handle(st_disp->bo[buf_cnt], TBM_DEVICE_2D).u32;
-
-               memset(st_disp->buffer[buf_cnt], color, st_disp->stride * st_disp->height);
-
-               tbm_bo_unmap(st_disp->bo[buf_cnt]);
-
-               st_disp->surf[buf_cnt] = tbm_surface_internal_create_with_bos(&surf_info, &st_disp->bo[buf_cnt], 1);
-               if (!st_disp->surf[buf_cnt]) {
-                       LOGE("failed to create tbm_surface!!\n");
-                       goto exit;
-               }
-       }
-
-       /* CHECK HWC USAGE */
-       tdm_output_capability output_caps;
-       tdm_output_get_capabilities(st_disp->output, &output_caps);
-       if (output_caps & TDM_OUTPUT_CAPABILITY_HWC)
-               st_disp->use_tdm_hwc = true;
-       else
-               st_disp->use_tdm_hwc = false;
-
-       /* SET LAYER */
-       if (st_disp->use_tdm_hwc) {
-               st_disp->hwc = tdm_output_get_hwc(st_disp->output, &err);
-               if (!st_disp->hwc) {
-                       LOGE("failed to get hwc. error num = %d\n", err);
-                       goto exit;
-               }
-       } else {
-               tdm_layer_capability layer_caps;
-               tdm_layer *tmp_layer = NULL;
-               for (i = 0; i < output_count; i++) {
-                       tmp_layer = tdm_output_get_layer(st_disp->output, output_count, &err);
-                       tdm_layer_get_capabilities(tmp_layer, &layer_caps);
-                       if (layer_caps & TDM_LAYER_CAPABILITY_PRIMARY)
-                               break;
-               }
-
-               if (!tmp_layer) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-
-               st_disp->layer = tmp_layer;
-
-               layer_info.src_config.size.h = st_disp->width;
-               layer_info.src_config.size.v = st_disp->height;
-               layer_info.src_config.pos.x = 0;
-               layer_info.src_config.pos.y = 0;
-               layer_info.src_config.pos.w = st_disp->width;
-               layer_info.src_config.pos.h = st_disp->height;
-               layer_info.src_config.format = TBM_FORMAT_ARGB8888;
-               layer_info.dst_pos.x = 0;
-               layer_info.dst_pos.y = 0;
-               layer_info.dst_pos.w = st_disp->width;
-               layer_info.dst_pos.h = st_disp->height;
-               layer_info.transform = TDM_TRANSFORM_NORMAL;
-
-               err = tdm_layer_set_info(st_disp->layer, &layer_info);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-       }
-
-       st_disp->current_buf_id = 0;
-       LOG("done\n");
-       return 0;
-exit:
-       tdm_if_display_deinit(st_disp);
-       return -1;
-}
-
-void tdm_if_display_deinit(tdm_if_disp *st_disp)
-{
-       int buf_cnt = 0;
-
-       if (st_disp->disp != NULL) {
-               /* RELEASE RESOURCE */
-               for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-                       if (st_disp->surf[buf_cnt] != NULL)
-                               tbm_surface_destroy(st_disp->surf[buf_cnt]);
-
-                       if (st_disp->bo[buf_cnt] != NULL)
-                               tbm_bo_unref(st_disp->bo[buf_cnt]);
-               }
-
-               if (st_disp->bufmgr != NULL)
-                       tbm_bufmgr_deinit(st_disp->bufmgr);
-               st_disp->bufmgr = NULL;
-
-               tdm_display_deinit(st_disp->disp);
-               st_disp->disp = NULL;
-       }
-}
-
-void tdm_if_display_update(tdm_if_disp *st_disp)
-{
-       /* DISPLAY UPDATE */
-       int buf_cnt = 0;
-
-       buf_cnt = st_disp->current_buf_id;
-       //st_disp->current_buf_id = (++st_disp->current_buf_id)%MAX_BUF;
-
-       if (st_disp->use_tdm_hwc) {
-               uint32_t num_types;
-               tdm_region damage;
-               memset(&damage, 0, sizeof(damage));
-
-               tdm_hwc_set_client_target_buffer(st_disp->hwc, st_disp->surf[buf_cnt], damage);
-               tdm_hwc_validate(st_disp->hwc, NULL, 0, &num_types);
-               tdm_hwc_accept_validation(st_disp->hwc);
-               tdm_hwc_commit(st_disp->hwc, 1, tdm_if_display_commit_handler_cb, st_disp);
-       } else {
-               tdm_layer_set_buffer(st_disp->layer, st_disp->surf[buf_cnt]);
-
-               // TODO: sync or async??
-               tdm_output_commit(st_disp->output, 1, tdm_if_display_commit_handler_cb, st_disp);
-       }
-
-       return ;
-}
-
-void tdm_if_lcd_on(tdm_if_disp *st_disp)
-{
-       /* SET DPMS ON */
-       LOG("DPMS ON!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_ON);
-       return ;
-}
-
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp)
-{
-       /* SET DPMS SUSPEND */
-       LOG("DPMS SUSPEND!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_SUSPEND);
-
-       return ;
-}
-
-void tdm_if_lcd_off(tdm_if_disp *st_disp)
-{
-       /* SET DPMS OFF */
-       LOG("DPMS OFF!\n");
-
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_OFF);
-
-       return ;
-}
diff --git a/fota_gui_wearable/tdm-if.h b/fota_gui_wearable/tdm-if.h
deleted file mode 100644 (file)
index dc67910..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __TDM_IF_H__
-#define __TDM_IF_H__
-
-#include <tdm.h>
-#include <tbm_bufmgr.h>
-#include <tdm_helper.h>
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-
-#define MAX_BUF 2
-#define RGB32_BPP 32
-#define RGB32_PITCH 4
-
-typedef struct _tdm_if_disp {
-       tdm_display *disp;
-       tdm_output *output;
-       tdm_layer *layer;
-       tdm_pp *pp;
-       int tdm_fd;
-       int drm_fd;
-
-       tbm_surface_h surf[MAX_BUF];
-       tbm_surface_h pp_surf[MAX_BUF];
-       tbm_bufmgr bufmgr;
-       unsigned int handle[MAX_BUF];
-       unsigned int pp_handle[MAX_BUF];
-       tbm_bo bo[MAX_BUF];
-       tbm_bo_handle bo_handle[MAX_BUF];
-       tbm_bo pp_bo[MAX_BUF];
-       tbm_bo_handle pp_bo_handle[MAX_BUF];
-       void *buffer[MAX_BUF];
-       void *pp_buffer[MAX_BUF];
-       int buffer_size;
-       int width;
-       int height;
-       int stride;
-       int current_buf_id;
-
-       bool use_tdm_hwc;
-       tdm_hwc *hwc;
-} tdm_if_disp;
-
-typedef enum {
-       FRONT_BUFFER = 0,
-       BACK_BUFFER
-} BUFFER_TYPE;
-
-extern tdm_if_disp s_disp;
-
-int tdm_if_display_init(tdm_if_disp *st_disp);
-void tdm_if_display_deinit(tdm_if_disp *st_disp);
-void tdm_if_display_update(tdm_if_disp *st_disp);
-void tdm_if_lcd_on(tdm_if_disp *st_disp);
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp);
-void tdm_if_lcd_off(tdm_if_disp *st_disp);
-#endif /* __TDM_IF_H__ */
index af4ef769a96b6ad58d671c74d4c1ce7ef90374d9..c63bca21a0cdb30d69e06c77365880fe08b28178 100644 (file)
@@ -14,6 +14,8 @@ STRING(FIND ${CMAKE_C_FLAGS} "mfloat-abi=hard" IFFOUND1)
 STRING(FIND ${CMAKE_C_FLAGS} "mhard-float" IFFOUND2)
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+SET(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../base)
+INCLUDE_DIRECTORIES(${BASE_DIR})
 
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
        SET(CMAKE_BUILD_TYPE "Release")
@@ -27,12 +29,15 @@ pkg_check_modules(gui_pkgs REQUIRED
        libtdm
        libpng
 )
+SET(BASE_SRCS
+       ${BASE_DIR}/gui_util.c
+       ${BASE_DIR}/tdm-if.c
+       ${BASE_DIR}/fota_png.c
+)
 SET(GUI_SRCS
+       ${BASE_SRCS}
        recovery_gui_common_main.c
        recovery_gr_common.c
-       recovery_png.c
-       recovery_gui_util.c
-       tdm-if.c
 )
 
 FOREACH(flag ${gui_pkgs_CFLAGS})
diff --git a/recovery_gui_common/recovery_fbinfo.h b/recovery_gui_common/recovery_fbinfo.h
deleted file mode 100644 (file)
index 9609898..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __RECOVERY_FBINFO_H__
-#define __RECOVERY_FBINFO_H__
-
-typedef struct _FbInfo {
-       unsigned char *buf[2];
-       unsigned int current_fb_id;
-       int w;
-       int h;
-       int sz;
-       int degree;
-       int full_flag;
-} FbInfo;
-
-#endif /* __RECOVERY_FBINFO_H__ */
-
index 1e62197d26a48c1dedc8809ec9f7695d47dcdcb0..a6c83bcfa7c421874df85bf5b484a7820de21e7b 100644 (file)
@@ -25,9 +25,9 @@
 #include <unistd.h>
 #include <pixman.h>
 
-#include "recovery_gui_general.h"
-#include "recovery_png.h"
-#include "recovery_fbinfo.h"
+#include "gui_general.h"
+#include "fota_png.h"
+#include "fbinfo.h"
 #include "tdm-if.h"
 
 #define UNUSED(x) (void)(x)
index e861dd856dbb4e5841409c59ac177e443ae2eb82..ceecc208877000b2865d2d59aa04e991e536ee80 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __RECOVERY_GR_DIRECT_COMMON_H__
 #define __RECOVERY_GR_DIRECT_COMMON_H__
 
-#include "recovery_gui_general.h"
+#include "gui_general.h"
 
 extern int recovery_gr_direct_init(void);
 extern void recovery_gr_direct_deinit(void);
index 2a64452763a54adf729a9c4df141a485629956a5..d1e5f8aca6735bd458022f18f0dc1ea1c40f725d 100644 (file)
@@ -28,8 +28,8 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#include "recovery_gui_general.h"
-#include "recovery_gui_util.h"
+#include "gui_general.h"
+#include "gui_util.h"
 #include "recovery_gr_common.h"
 
 //#define WAIT
diff --git a/recovery_gui_common/recovery_gui_general.h b/recovery_gui_common/recovery_gui_general.h
deleted file mode 100644 (file)
index 84005a1..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __RECOVERY_GUI_GENERAL_H__
-#define __RECOVERY_GUI_GENERAL_H__
-
-
-#include <stdio.h>
-#include "recovery_gui_log.h"
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long sl32;
-typedef unsigned long ul32;
-
-typedef signed long long s64;
-typedef unsigned long long u64;
-
-
-#endif /* __RECOVERY_GUI_GENERAL_H__ */
diff --git a/recovery_gui_common/recovery_gui_log.h b/recovery_gui_common/recovery_gui_log.h
deleted file mode 100644 (file)
index fe2d43e..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __RECOVERY_GUI_LOG_H__
-#define __RECOVERY_GUI_LOG_H__
-
-#include <stdio.h>
-
-extern unsigned int __log_level__;
-extern FILE *__log_out_file__;
-
-#define LOG_INFO       (1<<8)
-#define LOG_SSENGINE   (1<<7)
-#define LOG_FUNCS      (1<<6)
-#define LOG_GUI                (1<<5)
-#define LOG_DEBUG      (1<<4)
-#define LOG_FILE       (1<<3)
-#define LOG_FLASH      (1<<2)
-
-#define LOG_PRFIX      "RECOVERY_GUI"
-
-#define DEBUG_STDOUT
-//#define DEBUG_FILE
-
-#ifdef DEBUG_STDOUT
-#define LOGE(s, args...) printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args) // Error log
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       printf(LOG_PRFIX "/(%s): " s, __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_FILE)
-#define LOGE(s, args...) fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args)
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s , __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_STDOUT_FILE) // debug printf
-#define LOGE(s, args...) do {\
-                                               printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                               fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                       } while (0)
-#define LOGL(mask, s, args...) do { \
-                                               if ((mask) & __log_level__) { \
-                                                       printf(LOG_PRFIX "/(%s): " s , __func__, ##args);\
-                                                   fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s, __func__, ##args);\
-                                               } \
-                                       } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#else
-#define LOGE(s, args...)
-#define LOGL(mask, s, args...)
-#define LOG(s, args...)
-
-#endif
-
-
-#endif /* __RECOVERY_GUI_LOG_H__ */
-
diff --git a/recovery_gui_common/recovery_gui_util.c b/recovery_gui_common/recovery_gui_util.c
deleted file mode 100644 (file)
index 7a26510..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "recovery_gui_log.h"
-
-int s_fd_stdin = -1;
-int s_fd_stdout = -1;
-int s_fd_stderr = -1;
-
-/*-----------------------------------------------------------------------------
-  set_default_stdio
- ----------------------------------------------------------------------------*/
-static int set_default_stdio(int flags, int nfd)
-{
-       int fd, r;
-
-       fd = open("/dev/null", flags|O_NOCTTY);
-       if (fd < 0)
-               return -errno;
-
-       if (fd == nfd) {
-               return fd;
-       } else {
-               r = dup2(fd, nfd) < 0 ? -errno : nfd;
-               close(fd);
-               return r;
-       }
-}
-
-/*-----------------------------------------------------------------------------
-  _init_stdio
- ----------------------------------------------------------------------------*/
-void _init_stdio(void)
-{
-       s_fd_stdin = set_default_stdio(O_RDONLY, STDIN_FILENO);
-
-       s_fd_stdout = set_default_stdio(O_WRONLY, STDOUT_FILENO);
-
-       s_fd_stderr = set_default_stdio(O_WRONLY, STDERR_FILENO);
-}
-
-/*-----------------------------------------------------------------------------
-  _exit_stdio
- ----------------------------------------------------------------------------*/
-void _exit_stdio(void)
-{
-       if (s_fd_stdin >= 0)
-               close(s_fd_stdin);
-
-       if (s_fd_stdout >= 0)
-               close(s_fd_stdout);
-
-       if (s_fd_stderr >= 0)
-               close(s_fd_stderr);
-}
-
diff --git a/recovery_gui_common/recovery_gui_util.h b/recovery_gui_common/recovery_gui_util.h
deleted file mode 100644 (file)
index 938ff9b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _RECOVERY_GUI_UTIL_H_
-#define _RECOVERY_GUI_UTIL_H_
-
-extern void _init_stdio(void);
-extern void _exit_stdio(void);
-
-#endif /* _RECOVERY_GUI_UTIL_H_ */
-
diff --git a/recovery_gui_common/recovery_png.c b/recovery_gui_common/recovery_png.c
deleted file mode 100644 (file)
index 957e6fe..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <png.h>
-#include "recovery_gui_general.h"
-#include "recovery_png.h"
-
-int png_img_width;
-int png_img_height;
-/* clear screen based on img size */
-//int png_img_width_batt_normal;
-//int png_img_height_batt_normal;
-
-png_byte png_color_type;
-png_byte png_bit_depth;
-
-png_structp png_ptr;
-png_infop info_ptr;
-int number_of_passes;
-png_bytep *row_pointers;
-
-/*-----------------------------------------------------------------------------
-  read_png_file()
- ----------------------------------------------------------------------------*/
-int read_png_file(char *file_name)
-{
-       char header[8];         /* 8 is the maximum size that can be checked */
-       int y;
-       size_t rn;
-
-       /* open file and test for it being a png */
-       FILE *fp = fopen(file_name, "rb");
-       if (!fp) {
-               LOG("[read_png_file] File %s could not be opened"
-                       " for reading \n", file_name);
-
-               LOG("Failed to open png file, path = [%s]\n", file_name);
-               return -1;
-       }
-
-       rn = fread(header, 1, 8, fp);
-       if (rn != 8)
-               LOG("fread() read num mismatch\n");
-       if (png_sig_cmp((png_bytep)header, 0, 8)) {
-               fclose(fp);
-               LOG("[read_png_file] File %s is not recognized"
-                       " as a PNG file \n", file_name);
-               LOG("Failed to recognized PNG file\n");
-               return -1;
-       }
-
-       /* initialize stuff */
-       png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-       if (!png_ptr) {
-               fclose(fp);
-               LOG("[read_png_file] png_create_read_struct failed \n");
-
-               LOG("Failed png_create_read_struct()\n");
-               return -1;
-       }
-
-       info_ptr = png_create_info_struct(png_ptr);
-       if (!info_ptr) {
-               png_destroy_read_struct(&png_ptr, NULL, NULL);
-               fclose(fp);
-               LOG("[read_png_file] png_create_info_struct failed \n");
-
-               LOG("Failed png_create_info_struct()\n");
-               return -1;
-       }
-
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during init_io \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       int bit_depth, color_type;
-       png_uint_32 png_width;
-       png_uint_32 png_height;
-
-       png_init_io(png_ptr, fp);
-       png_set_sig_bytes(png_ptr, 8);
-       png_read_info(png_ptr, info_ptr);
-
-       int ret = png_get_IHDR(png_ptr, info_ptr, &png_width, &png_height, &bit_depth, &color_type, NULL, NULL, NULL);
-       if (ret == 0) {
-               LOGE("Failed png_get_IHDR(), ret = [%d]\n", ret);
-       } else if (ret == 1) {
-               LOG("color_type = [%d]\n", color_type);
-
-               if (color_type == PNG_COLOR_TYPE_RGB)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGBA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGBA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_PALETTE)
-                       LOG("png color type is PNG_COLOR_TYPE_PALETTE, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_GRAY_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GA)
-                       LOG("png color type is PNG_COLOR_TYPE_GA, color_type = [%d]\n", color_type);
-               else
-                       LOG("Unknown color type = [%d]\n", color_type);
-       }
-
-       png_img_width = png_width;
-       png_img_height = png_height;
-       png_color_type = color_type;
-       LOG("png_color_type = [%d]\n", png_color_type);
-       png_bit_depth = bit_depth;
-
-       number_of_passes = png_set_interlace_handling(png_ptr);
-       png_read_update_info(png_ptr, info_ptr);
-
-       /* read file */
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during read_image \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       png_size_t row_size = 0;
-
-       row_pointers = (png_bytep *) malloc(sizeof(png_bytep)*png_img_height);
-       for (y = 0; y < png_img_height; y++) {
-               row_size = png_get_rowbytes(png_ptr, info_ptr);
-               row_pointers[y] = (png_byte *) malloc(row_size);
-       }
-
-       png_read_image(png_ptr, row_pointers);
-
-       fclose(fp);
-
-       return 0;
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_clip_xy()
-  - x1, y1 : cordinate on canvas (fb)
-  - cx, cy, cw, ch : image clip (rect on image)
- ----------------------------------------------------------------------------*/
-void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + cw > fbi->w) ||
-           (y1 + ch > fbi->h)) {
-               LOG("[%s] output range exceeds frame buffer range \n", __func__);
-               return;
-       }
-
-       if ((cw > png_img_width) || (ch > png_img_height)) {
-               LOG("[%s] clip range exceeds image range \n", __func__);
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB)
-               bpp = 3;
-       else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < ch; y++) {
-               png_byte *row = (png_byte *) row_pointers[cy + y];
-               if (png_bit_depth == 8)
-                       row += (bpp * cx);
-               else if (png_bit_depth == 16)
-                       row += (bpp * 2 * cx);
-               for (x = 0; x < cw; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= cw;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_xy()
- ----------------------------------------------------------------------------*/
-void draw_png_img_xy(FbInfo *fbi, int x1, int y1)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-               (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       LOG("png_color_type = [%d]", png_color_type);
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
-               bpp = 4;
-               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
-       } else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
-               return;
-       }
-
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_original()
- ----------------------------------------------------------------------------*/
-void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       int end_width, end_height;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi;
-
-       /* check out range */
-       if ((x1 > fbi_w ) || (y1 > fbi_h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-                       return;
-       }
-       if(x1 + png_img_width > fbi_w)
-               end_width = fbi_w- x1;
-       else
-               end_width = png_img_width;
-       if(y1 + png_img_height > fbi_h)
-               end_height = fbi_h - y1;
-       else
-               end_height = png_img_height;
-
-       LOG("png_color_type = [%d]", png_color_type);
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
-               bpp = 4;
-               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
-       } else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
-               return;
-       }
-
-       /* temp patch - lcd resoultion for qualcomm */
-       for (y = 0; y < png_img_height; y++) {
-               if(y > end_height) continue;
-               fb_buf_cur = (unsigned int *) (fbi  + ((y1 + y) * fbi_stride));
-               fb_buf_cur += x1;
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if(x > end_width) continue;
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-       }
-
-}
-
-
-/*-----------------------------------------------------------------------------
-  draw_png_mask_xy()
-  - draw pixel only when alpha>0 of given png image
- ----------------------------------------------------------------------------*/
-void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-           (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("[draw_png_img_xy] PNG_COLOR_TYPE_RGB : no mask channel \n");
-               return;
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  release_png_res()
- ----------------------------------------------------------------------------*/
-void release_png_res(void)
-{
-       int y;
-
-       for (y = 0; y < png_img_height; y++)
-               free((void *)row_pointers[y]);
-       free((void *)row_pointers);
-
-       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-}
diff --git a/recovery_gui_common/recovery_png.h b/recovery_gui_common/recovery_png.h
deleted file mode 100644 (file)
index c576a83..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __RECOVERY_PNG_H__
-#define __RECOVERY_PNG_H__
-
-#include "recovery_fbinfo.h"
-
-extern int read_png_file(char *file_name);
-extern void draw_png_img_xy(FbInfo *fbi, int x1, int y1);
-extern void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride);
-extern void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch);
-extern void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b);
-extern void release_png_res(void);
-
-
-#endif /* __RECOVERY_PNG_H__ */
diff --git a/recovery_gui_common/tdm-if.c b/recovery_gui_common/tdm-if.c
deleted file mode 100644 (file)
index 7e7a3c4..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdbool.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include "recovery_gui_general.h"
-#include "tdm-if.h"
-
-static void tdm_if_display_commit_handler_cb(tdm_output *output, unsigned int sequence,
-               unsigned int tv_sec, unsigned int tv_usec, void *user_data)
-{
-       LOG("commit_handle_cb!!\n");
-
-       return ;
-}
-
-int tdm_if_display_init(tdm_if_disp *st_disp)
-{
-       int color = 0;
-       int buf_cnt;
-
-       tdm_error err = TDM_ERROR_NONE;
-
-       tdm_output *output = NULL;
-       tdm_output_type output_type = TDM_OUTPUT_TYPE_Unknown;
-       tdm_output_conn_status conn_status = TDM_OUTPUT_CONN_STATUS_DISCONNECTED;
-       const tdm_output_mode *output_mode;
-       int output_count = 0;
-
-       tdm_info_layer layer_info;
-
-       tbm_surface_info_s surf_info;
-
-       int i = 0;
-
-       LOG("start\n");
-
-       st_disp->disp = tdm_display_init(&err);
-       if (!st_disp->disp) {
-               LOGE("failed to init tdm_display. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_fd(st_disp->disp, &st_disp->tdm_fd);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       st_disp->drm_fd = tdm_helper_get_fd("TDM_DRM_MASTER_FD");
-       if (st_disp->drm_fd == -1) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_output_count(st_disp->disp, &output_count);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get output count. error num = %d\n", err);
-               goto exit;
-       }
-
-       for (i = 0; i < output_count; i++) {
-               output = tdm_display_get_output(st_disp->disp, i, &err);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get outout. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_output_type(output, &output_type);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output type. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_conn_status(output, &conn_status);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output connection status. error num = %d\n", err);
-                       goto exit;
-               }
-
-               LOG("output_type=%d  conn_status=%d\n", output_type, conn_status);
-               if ((output_type == TDM_OUTPUT_TYPE_LVDS || output_type == TDM_OUTPUT_TYPE_DSI
-                       || output_type == TDM_OUTPUT_TYPE_HDMIA)
-                       && (conn_status == TDM_OUTPUT_CONN_STATUS_CONNECTED)) {
-                       int cnt = 0;
-                       err = tdm_output_get_available_modes(output, &output_mode, &cnt);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to get output available modes. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       err = tdm_output_set_mode(output, &output_mode[0]);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to set mode. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       /* GET MODE INFO */
-                       st_disp->output = output;
-                       st_disp->width = output_mode->hdisplay;
-                       st_disp->height = output_mode->vdisplay;
-
-                       unsigned int width_mm = 0;
-                       unsigned int height_mm = 0;
-                       err = tdm_output_get_physical_size(output, &width_mm, &height_mm);
-                       LOG("TDM_OUTPUT_MODE:name[%s] mode:wh[%d %d] mm[%d %d]\n",
-                                       output_mode->name, st_disp->width, st_disp->height, width_mm, height_mm);
-
-                       break;
-               }
-       }
-
-       /* MEMORY ALLOCATION */
-       st_disp->bufmgr = tbm_bufmgr_init(st_disp->drm_fd);
-       if (!st_disp->bufmgr) {
-               LOGE("failed to tbm_bufmgr_init\n");
-               goto exit;
-       }
-
-       st_disp->buffer_size = st_disp->width * st_disp->height * RGB32_PITCH;
-       st_disp->stride = st_disp->width * RGB32_PITCH;
-
-       surf_info.width = st_disp->width;
-       surf_info.height = st_disp->height;
-       surf_info.format = TBM_FORMAT_ARGB8888;
-       surf_info.bpp = 32;
-       surf_info.size = st_disp->buffer_size;
-       surf_info.num_planes = 1;
-       surf_info.planes[0].size = st_disp->buffer_size;
-       surf_info.planes[0].offset = 0;
-       surf_info.planes[0].stride = st_disp->stride;
-
-       for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-               st_disp->bo[buf_cnt] = tbm_bo_alloc(st_disp->bufmgr, st_disp->buffer_size, TBM_BO_NONCACHABLE);
-               if (!st_disp->bo[buf_cnt]) {
-                       LOGE("failed to tbm_bo_alloc\n");
-                       goto exit;
-               }
-
-               st_disp->bo_handle[buf_cnt] = tbm_bo_map(st_disp->bo[buf_cnt], TBM_DEVICE_CPU, TBM_OPTION_WRITE);
-               st_disp->buffer[buf_cnt] = st_disp->bo_handle[buf_cnt].ptr;
-               st_disp->handle[buf_cnt] = tbm_bo_get_handle(st_disp->bo[buf_cnt], TBM_DEVICE_2D).u32;
-
-               memset(st_disp->buffer[buf_cnt], color, st_disp->stride * st_disp->height);
-
-               tbm_bo_unmap(st_disp->bo[buf_cnt]);
-
-               st_disp->surf[buf_cnt] = tbm_surface_internal_create_with_bos(&surf_info, &st_disp->bo[buf_cnt], 1);
-               if (!st_disp->surf[buf_cnt]) {
-                       LOGE("failed to create tbm_surface!!\n");
-                       goto exit;
-               }
-       }
-
-       /* CHECK HWC USAGE */
-       tdm_output_capability output_caps;
-       tdm_output_get_capabilities(st_disp->output, &output_caps);
-       if (output_caps & TDM_OUTPUT_CAPABILITY_HWC)
-               st_disp->use_tdm_hwc = true;
-       else
-               st_disp->use_tdm_hwc = false;
-
-       /* SET LAYER */
-       if (st_disp->use_tdm_hwc) {
-               st_disp->hwc = tdm_output_get_hwc(st_disp->output, &err);
-               if (!st_disp->hwc) {
-                       LOGE("failed to get hwc. error num = %d\n", err);
-                       goto exit;
-               }
-       } else {
-               tdm_layer_capability layer_caps;
-               tdm_layer *tmp_layer = NULL;
-               for (i = 0; i < output_count; i++) {
-                       tmp_layer = tdm_output_get_layer(st_disp->output, output_count, &err);
-                       tdm_layer_get_capabilities(tmp_layer, &layer_caps);
-                       if (layer_caps & TDM_LAYER_CAPABILITY_PRIMARY)
-                               break;
-               }
-
-               if (!tmp_layer) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-
-               st_disp->layer = tmp_layer;
-
-               layer_info.src_config.size.h = st_disp->width;
-               layer_info.src_config.size.v = st_disp->height;
-               layer_info.src_config.pos.x = 0;
-               layer_info.src_config.pos.y = 0;
-               layer_info.src_config.pos.w = st_disp->width;
-               layer_info.src_config.pos.h = st_disp->height;
-               layer_info.src_config.format = TBM_FORMAT_ARGB8888;
-               layer_info.dst_pos.x = 0;
-               layer_info.dst_pos.y = 0;
-               layer_info.dst_pos.w = st_disp->width;
-               layer_info.dst_pos.h = st_disp->height;
-               layer_info.transform = TDM_TRANSFORM_NORMAL;
-
-               err = tdm_layer_set_info(st_disp->layer, &layer_info);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-       }
-
-       st_disp->current_buf_id = 0;
-       LOG("done\n");
-       return 0;
-exit:
-       tdm_if_display_deinit(st_disp);
-       return -1;
-}
-
-void tdm_if_display_deinit(tdm_if_disp *st_disp)
-{
-       int buf_cnt = 0;
-
-       if (st_disp->disp != NULL) {
-               /* RELEASE RESOURCE */
-               for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-                       if (st_disp->surf[buf_cnt] != NULL)
-                               tbm_surface_destroy(st_disp->surf[buf_cnt]);
-
-                       if (st_disp->bo[buf_cnt] != NULL)
-                               tbm_bo_unref(st_disp->bo[buf_cnt]);
-               }
-
-               if (st_disp->bufmgr != NULL)
-                       tbm_bufmgr_deinit(st_disp->bufmgr);
-               st_disp->bufmgr = NULL;
-
-               tdm_display_deinit(st_disp->disp);
-               st_disp->disp = NULL;
-       }
-}
-
-void tdm_if_display_update(tdm_if_disp *st_disp)
-{
-       /* DISPLAY UPDATE */
-       int buf_cnt = 0;
-
-       buf_cnt = st_disp->current_buf_id;
-       //st_disp->current_buf_id = (++st_disp->current_buf_id)%MAX_BUF;
-
-       if (st_disp->use_tdm_hwc) {
-               uint32_t num_types;
-               tdm_region damage;
-               memset(&damage, 0, sizeof(damage));
-
-               tdm_hwc_set_client_target_buffer(st_disp->hwc, st_disp->surf[buf_cnt], damage);
-               tdm_hwc_validate(st_disp->hwc, NULL, 0, &num_types);
-               tdm_hwc_accept_validation(st_disp->hwc);
-               tdm_hwc_commit(st_disp->hwc, 1, tdm_if_display_commit_handler_cb, st_disp);
-       } else {
-               tdm_layer_set_buffer(st_disp->layer, st_disp->surf[buf_cnt]);
-
-               // TODO: sync or async??
-               tdm_output_commit(st_disp->output, 1, tdm_if_display_commit_handler_cb, st_disp);
-       }
-
-       return ;
-}
-
-void tdm_if_lcd_on(tdm_if_disp *st_disp)
-{
-       /* SET DPMS ON */
-       LOG("DPMS ON!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_ON);
-       return ;
-}
-
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp)
-{
-       /* SET DPMS SUSPEND */
-       LOG("DPMS SUSPEND!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_SUSPEND);
-
-       return ;
-}
-
-void tdm_if_lcd_off(tdm_if_disp *st_disp)
-{
-       /* SET DPMS OFF */
-       LOG("DPMS OFF!\n");
-
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_OFF);
-
-       return ;
-}
diff --git a/recovery_gui_common/tdm-if.h b/recovery_gui_common/tdm-if.h
deleted file mode 100644 (file)
index dc67910..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __TDM_IF_H__
-#define __TDM_IF_H__
-
-#include <tdm.h>
-#include <tbm_bufmgr.h>
-#include <tdm_helper.h>
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-
-#define MAX_BUF 2
-#define RGB32_BPP 32
-#define RGB32_PITCH 4
-
-typedef struct _tdm_if_disp {
-       tdm_display *disp;
-       tdm_output *output;
-       tdm_layer *layer;
-       tdm_pp *pp;
-       int tdm_fd;
-       int drm_fd;
-
-       tbm_surface_h surf[MAX_BUF];
-       tbm_surface_h pp_surf[MAX_BUF];
-       tbm_bufmgr bufmgr;
-       unsigned int handle[MAX_BUF];
-       unsigned int pp_handle[MAX_BUF];
-       tbm_bo bo[MAX_BUF];
-       tbm_bo_handle bo_handle[MAX_BUF];
-       tbm_bo pp_bo[MAX_BUF];
-       tbm_bo_handle pp_bo_handle[MAX_BUF];
-       void *buffer[MAX_BUF];
-       void *pp_buffer[MAX_BUF];
-       int buffer_size;
-       int width;
-       int height;
-       int stride;
-       int current_buf_id;
-
-       bool use_tdm_hwc;
-       tdm_hwc *hwc;
-} tdm_if_disp;
-
-typedef enum {
-       FRONT_BUFFER = 0,
-       BACK_BUFFER
-} BUFFER_TYPE;
-
-extern tdm_if_disp s_disp;
-
-int tdm_if_display_init(tdm_if_disp *st_disp);
-void tdm_if_display_deinit(tdm_if_disp *st_disp);
-void tdm_if_display_update(tdm_if_disp *st_disp);
-void tdm_if_lcd_on(tdm_if_disp *st_disp);
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp);
-void tdm_if_lcd_off(tdm_if_disp *st_disp);
-#endif /* __TDM_IF_H__ */
index 6ed7f887f0e75854ac962cd0e57017d0bafcce6c..ea4baf73c2912a55a6b029711d0d829e64755533 100644 (file)
@@ -17,6 +17,8 @@ SET(RESDIR_COMMON "${PKGDIR}/fota/res/images_common")
 #STRING(FIND ${CMAKE_C_FLAGS} "mhard-float" IFFOUND2)
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+SET(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../base)
+INCLUDE_DIRECTORIES(${BASE_DIR})
 
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
        SET(CMAKE_BUILD_TYPE "Release")
@@ -30,13 +32,17 @@ pkg_check_modules(pkgs_ani REQUIRED
        libtdm
        libpng
 )
+
+SET(BASE_SRCS
+       ${BASE_DIR}/fota_png.c
+       ${BASE_DIR}/gui_util.c
+       ${BASE_DIR}/tdm-if.c
+)
 SET(GUI_SRCS
+       ${BASE_SRCS}
        fota_gui_rw_common_main.c
        fota_gr_rw_common.c
-       fota_png.c
-       fota_gui_util.c
        fota_gr_direct_rw_common.c
-       tdm-if.c
 )
 
 FOREACH(flag ${pkgs_ani_CFLAGS})
@@ -61,5 +67,6 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_ani_LDFLAGS} ${LIBS} -lpthread)
 
 ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
 ADD_DEFINITIONS("-DROTATE=0")
+ADD_DEFINITIONS("-DLOG_PRFIX=\"FOTA_RW\"")
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
 #INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/common/images DESTINATION ${RESDIR_COMMON})
diff --git a/rw-update-ani-common/fota_fbinfo.h b/rw-update-ani-common/fota_fbinfo.h
deleted file mode 100644 (file)
index 6b73ed8..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_FBINFO_H__
-#define __FOTA_FBINFO_H__
-
-typedef struct _FbInfo {
-       unsigned char *buf[2];
-       unsigned int current_fb_id;
-       int w;
-       int h;
-       int sz;
-       int degree;
-       int full_flag;
-} FbInfo;
-
-#endif /* __FOTA_FBINFO_H__ */
-
index 901bf2590a376818ed9e8e0dd5862fabdaac27e0..770da426c621566dc516ace73fab48944ecb7e29 100644 (file)
@@ -25,9 +25,9 @@
 #include <unistd.h>
 #include <pixman.h>
 
-#include "fota_gui_general.h"
+#include "gui_general.h"
 #include "fota_png.h"
-#include "fota_fbinfo.h"
+#include "fbinfo.h"
 #include "tdm-if.h"
 
 #define UNUSED(x) (void)(x)
index 406deb7a50d3e84c3b9ac0dcceafaafa86a81edd..4da0225b0ab76ff4dd2057c1f98b3a5318d11e49 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __FOTA_GR_DIRECT_RW_COMMOM_H__
 #define __FOTA_GR_DIRECT_RW_COMMOM_H__
 
-#include "fota_gui_general.h"
+#include "gui_general.h"
 
 extern int fota_gr_direct_init(void);
 extern void fota_gr_direct_deinit(void);
diff --git a/rw-update-ani-common/fota_gui_general.h b/rw-update-ani-common/fota_gui_general.h
deleted file mode 100644 (file)
index 1677832..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_GUI_GENERAL_H__
-#define __FOTA_GUI_GENERAL_H__
-
-
-#include <stdio.h>
-#include "fota_gui_log.h"
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long sl32;
-typedef unsigned long ul32;
-
-typedef signed long long s64;
-typedef unsigned long long u64;
-
-
-#endif /* __FOTA_GUI_GENERAL_H__ */
diff --git a/rw-update-ani-common/fota_gui_log.h b/rw-update-ani-common/fota_gui_log.h
deleted file mode 100644 (file)
index b41a6d1..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_GUI_LOG_H__
-#define __FOTA_GUI_LOG_H__
-
-#include <stdio.h>
-
-extern unsigned int __log_level__;
-extern FILE *__log_out_file__;
-
-#define LOG_INFO       (1<<8)
-#define LOG_SSENGINE   (1<<7)
-#define LOG_FUNCS      (1<<6)
-#define LOG_GUI                (1<<5)
-#define LOG_DEBUG      (1<<4)
-#define LOG_FILE       (1<<3)
-#define LOG_FLASH      (1<<2)
-
-#define LOG_PRFIX      "FOTA_GUI_RW"
-
-#define DEBUG_STDOUT
-//#define DEBUG_FILE
-
-#ifdef DEBUG_STDOUT
-#define LOGE(s, args...) printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args) // Error log
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       printf(LOG_PRFIX "/(%s): " s, __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_FILE)
-#define LOGE(s, args...) fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args)
-#define LOGL(mask, s, args...) do { if ((mask) & __log_level__) \
-       fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s , __func__, ##args); } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#elif defined(DEBUG_STDOUT_FILE) // debug printf
-#define LOGE(s, args...) do {\
-                                               printf(LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                               fprintf(__log_out_file__, LOG_PRFIX "/ERROR(%s)  " s, __func__, ##args);\
-                                       } while (0)
-#define LOGL(mask, s, args...) do { \
-                                               if ((mask) & __log_level__) { \
-                                                       printf(LOG_PRFIX "/(%s): " s , __func__, ##args);\
-                                                   fprintf(__log_out_file__, LOG_PRFIX "/(%s): " s, __func__, ##args);\
-                                               } \
-                                       } while (0)
-#define LOG(s, args...) LOGL(LOG_DEBUG, s, ##args)
-
-#else
-#define LOGE(s, args...)
-#define LOGL(mask, s, args...)
-#define LOG(s, args...)
-
-#endif
-
-
-#endif /* __FOTA_GUI_LOG_H__ */
-
index 2cc108f0dddf0cc58d400f2495e6b9008ccd91a5..fae3a96390edefc67044adf5e1ac505433d0e466 100644 (file)
@@ -31,7 +31,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#include "fota_gui_general.h"
+#include "gui_general.h"
 #include "fota_gr_rw_common.h"
 
 unsigned int __log_level__ =
diff --git a/rw-update-ani-common/fota_gui_util.c b/rw-update-ani-common/fota_gui_util.c
deleted file mode 100644 (file)
index 5d7d480..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "fota_gui_log.h"
-
-int s_fd_stdin = -1;
-int s_fd_stdout = -1;
-int s_fd_stderr = -1;
-
-/*-----------------------------------------------------------------------------
-  set_default_stdio
- ----------------------------------------------------------------------------*/
-static int set_default_stdio(int flags, int nfd)
-{
-       int fd, r;
-
-       fd = open("/dev/null", flags|O_NOCTTY);
-       if (fd < 0)
-               return -errno;
-
-       if (fd == nfd) {
-               return fd;
-       } else {
-               r = dup2(fd, nfd) < 0 ? -errno : nfd;
-               close(fd);
-               return r;
-       }
-}
-
-/*-----------------------------------------------------------------------------
-  _init_stdio
- ----------------------------------------------------------------------------*/
-void _init_stdio(void)
-{
-       s_fd_stdin = set_default_stdio(O_RDONLY, STDIN_FILENO);
-
-       s_fd_stdout = set_default_stdio(O_WRONLY, STDOUT_FILENO);
-
-       s_fd_stderr = set_default_stdio(O_WRONLY, STDERR_FILENO);
-}
-
-/*-----------------------------------------------------------------------------
-  _exit_stdio
- ----------------------------------------------------------------------------*/
-void _exit_stdio(void)
-{
-       if (s_fd_stdin >= 0)
-               close(s_fd_stdin);
-
-       if (s_fd_stdout >= 0)
-               close(s_fd_stdout);
-
-       if (s_fd_stderr >= 0)
-               close(s_fd_stderr);
-}
-
diff --git a/rw-update-ani-common/fota_gui_util.h b/rw-update-ani-common/fota_gui_util.h
deleted file mode 100644 (file)
index 235a9e0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _FOTA_GUI_UTIL_H_
-#define _FOTA_GUI_UTIL_H_
-
-extern void _init_stdio(void);
-extern void _exit_stdio(void);
-
-#endif /* _FOTA_GUI_UTIL_H_ */
-
diff --git a/rw-update-ani-common/fota_png.c b/rw-update-ani-common/fota_png.c
deleted file mode 100644 (file)
index 4170ce2..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <png.h>
-#include "fota_gui_general.h"
-#include "fota_png.h"
-
-int png_img_width;
-int png_img_height;
-/* clear screen based on img size */
-//int png_img_width_batt_normal;
-//int png_img_height_batt_normal;
-
-png_byte png_color_type;
-png_byte png_bit_depth;
-
-png_structp png_ptr;
-png_infop info_ptr;
-int number_of_passes;
-png_bytep *row_pointers;
-
-/*-----------------------------------------------------------------------------
-  read_png_file()
- ----------------------------------------------------------------------------*/
-int read_png_file(char *file_name)
-{
-       char header[8];         /* 8 is the maximum size that can be checked */
-       int y;
-       size_t rn;
-
-       /* open file and test for it being a png */
-       FILE *fp = fopen(file_name, "rb");
-       if (!fp) {
-               LOG("[read_png_file] File %s could not be opened"
-                       " for reading \n", file_name);
-
-               LOG("Failed to open png file, path = [%s]\n", file_name);
-               return -1;
-       }
-
-       rn = fread(header, 1, 8, fp);
-       if (rn != 8)
-               LOG("fread() read num mismatch\n");
-       if (png_sig_cmp((png_bytep)header, 0, 8)) {
-               fclose(fp);
-               LOG("[read_png_file] File %s is not recognized"
-                       " as a PNG file \n", file_name);
-               LOG("Failed to recognized PNG file\n");
-               return -1;
-       }
-
-       /* initialize stuff */
-       png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-       if (!png_ptr) {
-               fclose(fp);
-               LOG("[read_png_file] png_create_read_struct failed \n");
-
-               LOG("Failed png_create_read_struct()\n");
-               return -1;
-       }
-
-       info_ptr = png_create_info_struct(png_ptr);
-       if (!info_ptr) {
-               png_destroy_read_struct(&png_ptr, NULL, NULL);
-               fclose(fp);
-               LOG("[read_png_file] png_create_info_struct failed \n");
-
-               LOG("Failed png_create_info_struct()\n");
-               return -1;
-       }
-
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during init_io \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       int bit_depth, color_type;
-       png_uint_32 png_width;
-       png_uint_32 png_height;
-
-       png_init_io(png_ptr, fp);
-       png_set_sig_bytes(png_ptr, 8);
-       png_read_info(png_ptr, info_ptr);
-
-       int ret = png_get_IHDR(png_ptr, info_ptr, &png_width, &png_height, &bit_depth, &color_type, NULL, NULL, NULL);
-       if (ret == 0) {
-               LOGE("Failed png_get_IHDR(), ret = [%d]\n", ret);
-       } else if (ret == 1) {
-               LOG("color_type = [%d]\n", color_type);
-
-               if (color_type == PNG_COLOR_TYPE_RGB)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGBA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGBA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_PALETTE)
-                       LOG("png color type is PNG_COLOR_TYPE_PALETTE, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_RGB_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-                       LOG("png color type is PNG_COLOR_TYPE_GRAY_ALPHA, color_type = [%d]\n", color_type);
-               else if (color_type == PNG_COLOR_TYPE_GA)
-                       LOG("png color type is PNG_COLOR_TYPE_GA, color_type = [%d]\n", color_type);
-               else
-                       LOG("Unknown color type = [%d]\n", color_type);
-       }
-
-       png_img_width = png_width;
-       png_img_height = png_height;
-       png_color_type = color_type;
-       LOG("png_color_type = [%d]\n", png_color_type);
-       png_bit_depth = bit_depth;
-
-       number_of_passes = png_set_interlace_handling(png_ptr);
-       png_read_update_info(png_ptr, info_ptr);
-
-       /* read file */
-       if (setjmp(png_jmpbuf(png_ptr))) {
-               png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-               fclose(fp);
-               LOG("[read_png_file] Error during read_image \n");
-
-               LOG("Failed png_destroy_read_struct()\n");
-               return -1;
-       }
-
-       png_size_t row_size = 0;
-
-       row_pointers = (png_bytep *) malloc(sizeof(png_bytep)*png_img_height);
-       for (y = 0; y < png_img_height; y++) {
-               row_size = png_get_rowbytes(png_ptr, info_ptr);
-               row_pointers[y] = (png_byte *) malloc(row_size);
-       }
-
-       png_read_image(png_ptr, row_pointers);
-
-       fclose(fp);
-
-       return 0;
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_clip_xy()
-  - x1, y1 : cordinate on canvas (fb)
-  - cx, cy, cw, ch : image clip (rect on image)
- ----------------------------------------------------------------------------*/
-void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + cw > fbi->w) ||
-           (y1 + ch > fbi->h)) {
-               LOG("[%s] output range exceeds frame buffer range \n", __func__);
-               return;
-       }
-
-       if ((cw > png_img_width) || (ch > png_img_height)) {
-               LOG("[%s] clip range exceeds image range \n", __func__);
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB)
-               bpp = 3;
-       else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < ch; y++) {
-               png_byte *row = (png_byte *) row_pointers[cy + y];
-               if (png_bit_depth == 8)
-                       row += (bpp * cx);
-               else if (png_bit_depth == 16)
-                       row += (bpp * 2 * cx);
-               for (x = 0; x < cw; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= cw;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_xy()
- ----------------------------------------------------------------------------*/
-void draw_png_img_xy(FbInfo *fbi, int x1, int y1)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-               (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       LOG("png_color_type = [%d]", png_color_type);
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
-               bpp = 4;
-               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
-       } else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
-               return;
-       }
-
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-
-/*-----------------------------------------------------------------------------
-  draw_png_img_original()
- ----------------------------------------------------------------------------*/
-void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       int end_width, end_height;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi;
-
-       /* check out range */
-       if ((x1 > fbi_w ) || (y1 > fbi_h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-                       return;
-       }
-       if(x1 + png_img_width > fbi_w)
-               end_width = fbi_w- x1;
-       else
-               end_width = png_img_width;
-       if(y1 + png_img_height > fbi_h)
-               end_height = fbi_h - y1;
-       else
-               end_height = png_img_height;
-
-       LOG("png_color_type = [%d]", png_color_type);
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("png color type is PNG_COLOR_TYPE_RGB, png_color_type = [%d]\n", png_color_type);
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA) {
-               bpp = 4;
-               LOG("png color type is PNG_COLOR_TYPE_RGBA, png_color_type = [%d]\n", png_color_type);
-       } else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA, png_color_type = [%d] \n", png_color_type);
-               return;
-       }
-
-       /* temp patch - lcd resoultion for qualcomm */
-       for (y = 0; y < png_img_height; y++) {
-               if(y > end_height) continue;
-               fb_buf_cur = (unsigned int *) (fbi  + ((y1 + y) * fbi_stride));
-               fb_buf_cur += x1;
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if(x > end_width) continue;
-                       if (bpp == 3) {
-                               if (png_bit_depth == 8) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[1] << 8) | (row[2]);
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                           (row[0] << 16) | (row[2] << 8) | (row[4]);
-                                       row += bpp*2;
-                               }
-                       } else if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               char r1, g1, b1, a1;
-                                               char r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff);
-                                               g1 = ((*fb_buf_cur)&0x0000ff00)>>8;
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>16;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>24;
-                                               // new pixel
-                                               r2 = row[0];
-                                               g2 = row[1];
-                                               b2 = row[2];
-                                               a2 = row[3];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xff - a2)) >> 8 ;
-                                               g3 = (g2 * a2 + g1 * (0xff - a2)) >> 8;
-                                               b3 = (b2 * a2 + b1 * (0xff - a2)) >> 8;
-                                               a3 = a1;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                   (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               short r1, g1, b1, a1;
-                                               short r2, g2, b2, a2;
-                                               char r3, g3, b3, a3;
-                                               // background pixel
-                                               b1 = ((*fb_buf_cur)&0x000000ff)<<8;
-                                               g1 = ((*fb_buf_cur)&0x0000ff00);
-                                               r1 = ((*fb_buf_cur)&0x00ff0000)>>8;
-                                               a1 = ((*fb_buf_cur)&0xff000000)>>16;
-                                               // new pixel
-                                               r2 = (row[0]<<8) + row[1];
-                                               g2 = (row[2]<<8) + row[3];
-                                               b2 = (row[4]<<8) + row[5];
-                                               a2 = (row[6]<<8) + row[7];
-                                               // blended pixel
-                                               r3 = (r2 * a2 + r1 * (0xffff - a2)) >> 24;
-                                               g3 = (g2 * a2 + g1 * (0xffff - a2)) >> 24;
-                                               b3 = (b2 * a2 + b1 * (0xffff - a2)) >> 24;
-                                               a3 = a1 >> 8;
-                                               (*fb_buf_cur) = (a3 << 24) |
-                                                       (r3 << 16) | (g3 << 8) | (b3);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  draw_png_mask_xy()
-  - draw pixel only when alpha>0 of given png image
- ----------------------------------------------------------------------------*/
-void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b)
-{
-       unsigned int *fb_buf_cur = NULL;
-       int bpp;
-       int x, y;
-       /* temp patch - lcd resoultion for qualcomm */
-
-       fb_buf_cur = (unsigned int *)fbi->buf[0];
-
-       /* check out range */
-       if ((x1 + png_img_width > fbi->w) ||
-           (y1 + png_img_height > fbi->h)) {
-               LOG("[draw_png_img_xy] output range exceeds frame buffer range \n");
-               return;
-       }
-
-       if (png_color_type == PNG_COLOR_TYPE_RGB) {
-               bpp = 3;
-               LOG("[draw_png_img_xy] PNG_COLOR_TYPE_RGB : no mask channel \n");
-               return;
-       } else if (png_color_type == PNG_COLOR_TYPE_RGBA)
-               bpp = 4;
-       else {
-               LOG("[draw_png_img_xy] png type does not match RGB or RGBA \n");
-               return;
-       }
-       /* temp patch - lcd resoultion for qualcomm */
-       fb_buf_cur += (y1 * (fbi->w));
-       fb_buf_cur += x1;
-       for (y = 0; y < png_img_height; y++) {
-               png_byte *row = (png_byte *) row_pointers[y];
-               for (x = 0; x < png_img_width; x++) {
-                       if (bpp == 4) {
-                               if (png_bit_depth == 8) {
-                                       if (row[3] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp;
-                               } else if (png_bit_depth == 16) {
-                                       if (row[6] != 0) {
-                                               (*fb_buf_cur) = ((*fb_buf_cur)&0xff000000) |
-                                                       (r << 16) | (g << 8) | (b);
-                                       }
-                                       row += bpp*2;
-                               }
-                       }
-                       fb_buf_cur++;
-               }
-               fb_buf_cur -= png_img_width;
-               fb_buf_cur += fbi->w;/* temp patch - lcd resoultion for qualcomm */
-       }
-
-}
-
-/*-----------------------------------------------------------------------------
-  release_png_res()
- ----------------------------------------------------------------------------*/
-void release_png_res(void)
-{
-       int y;
-
-       for (y = 0; y < png_img_height; y++)
-               free((void *)row_pointers[y]);
-       free((void *)row_pointers);
-
-       png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-}
diff --git a/rw-update-ani-common/fota_png.h b/rw-update-ani-common/fota_png.h
deleted file mode 100644 (file)
index f4545e1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FOTA_PNG_H__
-#define __FOTA_PNG_H__
-
-#include "fota_fbinfo.h"
-
-extern int read_png_file(char *file_name);
-extern void draw_png_img_xy(FbInfo *fbi, int x1, int y1);
-extern void draw_png_img_original(void *fbi, int x1, int y1, int fbi_w, int fbi_h, int fbi_stride);
-extern void draw_png_img_clip_xy(FbInfo *fbi, int x1, int y1, int cx, int cy, int cw, int ch);
-extern void draw_png_mask_xy(FbInfo *fbi, int x1, int y1, char r, char g, char b);
-extern void release_png_res(void);
-
-
-#endif /* __FOTA_PNG_H__ */
diff --git a/rw-update-ani-common/tdm-if.c b/rw-update-ani-common/tdm-if.c
deleted file mode 100644 (file)
index 4d15710..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdbool.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include "fota_gui_general.h"
-#include "tdm-if.h"
-
-static void tdm_if_display_commit_handler_cb(tdm_output *output, unsigned int sequence,
-               unsigned int tv_sec, unsigned int tv_usec, void *user_data)
-{
-       LOG("commit_handle_cb!!\n");
-
-       return ;
-}
-
-int tdm_if_display_init(tdm_if_disp *st_disp)
-{
-       int color = 0;
-       int buf_cnt;
-
-       tdm_error err = TDM_ERROR_NONE;
-
-       tdm_output *output = NULL;
-       tdm_output_type output_type = TDM_OUTPUT_TYPE_Unknown;
-       tdm_output_conn_status conn_status = TDM_OUTPUT_CONN_STATUS_DISCONNECTED;
-       const tdm_output_mode *output_mode;
-       int output_count = 0;
-
-       tdm_info_layer layer_info;
-
-       tbm_surface_info_s surf_info;
-
-       int i = 0;
-
-       LOG("start\n");
-
-       st_disp->disp = tdm_display_init(&err);
-       if (!st_disp->disp) {
-               LOGE("failed to init tdm_display. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_fd(st_disp->disp, &st_disp->tdm_fd);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       st_disp->drm_fd = tdm_helper_get_fd("TDM_DRM_MASTER_FD");
-       if (st_disp->drm_fd == -1) {
-               LOGE("failed to get tdm fd. error num = %d\n", err);
-               goto exit;
-       }
-
-       err = tdm_display_get_output_count(st_disp->disp, &output_count);
-       if (err != TDM_ERROR_NONE) {
-               LOGE("failed to get output count. error num = %d\n", err);
-               goto exit;
-       }
-
-       for (i = 0; i < output_count; i++) {
-               output = tdm_display_get_output(st_disp->disp, i, &err);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get outout. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_output_type(output, &output_type);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output type. error num = %d\n", err);
-                       goto exit;
-               }
-
-               err = tdm_output_get_conn_status(output, &conn_status);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output connection status. error num = %d\n", err);
-                       goto exit;
-               }
-
-               LOG("output_type=%d  conn_status=%d\n", output_type, conn_status);
-               if ((output_type == TDM_OUTPUT_TYPE_LVDS || output_type == TDM_OUTPUT_TYPE_DSI
-                       || output_type == TDM_OUTPUT_TYPE_HDMIA)
-                       && (conn_status == TDM_OUTPUT_CONN_STATUS_CONNECTED)) {
-                       int cnt = 0;
-                       err = tdm_output_get_available_modes(output, &output_mode, &cnt);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to get output available modes. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       err = tdm_output_set_mode(output, &output_mode[0]);
-                       if (err != TDM_ERROR_NONE) {
-                               LOGE("failed to set mode. error num = %d\n", err);
-                               goto exit;
-                       }
-
-                       /* GET MODE INFO */
-                       st_disp->output = output;
-                       st_disp->width = output_mode->hdisplay;
-                       st_disp->height = output_mode->vdisplay;
-
-                       unsigned int width_mm = 0;
-                       unsigned int height_mm = 0;
-                       err = tdm_output_get_physical_size(output, &width_mm, &height_mm);
-                       LOG("TDM_OUTPUT_MODE:name[%s] mode:wh[%d %d] mm[%d %d]\n",
-                                       output_mode->name, st_disp->width, st_disp->height, width_mm, height_mm);
-
-                       break;
-               }
-       }
-
-       /* MEMORY ALLOCATION */
-       st_disp->bufmgr = tbm_bufmgr_init(st_disp->drm_fd);
-       if (!st_disp->bufmgr) {
-               LOGE("failed to tbm_bufmgr_init\n");
-               goto exit;
-       }
-
-       st_disp->buffer_size = st_disp->width * st_disp->height * RGB32_PITCH;
-       st_disp->stride = st_disp->width * RGB32_PITCH;
-
-       surf_info.width = st_disp->width;
-       surf_info.height = st_disp->height;
-       surf_info.format = TBM_FORMAT_ARGB8888;
-       surf_info.bpp = 32;
-       surf_info.size = st_disp->buffer_size;
-       surf_info.num_planes = 1;
-       surf_info.planes[0].size = st_disp->buffer_size;
-       surf_info.planes[0].offset = 0;
-       surf_info.planes[0].stride = st_disp->stride;
-
-       for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-               st_disp->bo[buf_cnt] = tbm_bo_alloc(st_disp->bufmgr, st_disp->buffer_size, TBM_BO_NONCACHABLE);
-               if (!st_disp->bo[buf_cnt]) {
-                       LOGE("failed to tbm_bo_alloc\n");
-                       goto exit;
-               }
-
-               st_disp->bo_handle[buf_cnt] = tbm_bo_map(st_disp->bo[buf_cnt], TBM_DEVICE_CPU, TBM_OPTION_WRITE);
-               st_disp->buffer[buf_cnt] = st_disp->bo_handle[buf_cnt].ptr;
-               st_disp->handle[buf_cnt] = tbm_bo_get_handle(st_disp->bo[buf_cnt], TBM_DEVICE_2D).u32;
-
-               memset(st_disp->buffer[buf_cnt], color, st_disp->stride * st_disp->height);
-
-               tbm_bo_unmap(st_disp->bo[buf_cnt]);
-
-               st_disp->surf[buf_cnt] = tbm_surface_internal_create_with_bos(&surf_info, &st_disp->bo[buf_cnt], 1);
-               if (!st_disp->surf[buf_cnt]) {
-                       LOGE("failed to create tbm_surface!!\n");
-                       goto exit;
-               }
-       }
-
-       /* CHECK HWC USAGE */
-       tdm_output_capability output_caps;
-       tdm_output_get_capabilities(st_disp->output, &output_caps);
-       if (output_caps & TDM_OUTPUT_CAPABILITY_HWC)
-               st_disp->use_tdm_hwc = true;
-       else
-               st_disp->use_tdm_hwc = false;
-
-       /* SET LAYER */
-       if (st_disp->use_tdm_hwc) {
-               st_disp->hwc = tdm_output_get_hwc(st_disp->output, &err);
-               if (!st_disp->hwc) {
-                       LOGE("failed to get hwc. error num = %d\n", err);
-                       goto exit;
-               }
-       } else {
-               tdm_layer_capability layer_caps;
-               tdm_layer *tmp_layer = NULL;
-               for (i = 0; i < output_count; i++) {
-                       tmp_layer = tdm_output_get_layer(st_disp->output, output_count, &err);
-                       tdm_layer_get_capabilities(tmp_layer, &layer_caps);
-                       if (layer_caps & TDM_LAYER_CAPABILITY_PRIMARY)
-                               break;
-               }
-
-               if (!tmp_layer) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-
-               st_disp->layer = tmp_layer;
-
-               layer_info.src_config.size.h = st_disp->width;
-               layer_info.src_config.size.v = st_disp->height;
-               layer_info.src_config.pos.x = 0;
-               layer_info.src_config.pos.y = 0;
-               layer_info.src_config.pos.w = st_disp->width;
-               layer_info.src_config.pos.h = st_disp->height;
-               layer_info.src_config.format = TBM_FORMAT_ARGB8888;
-               layer_info.dst_pos.x = 0;
-               layer_info.dst_pos.y = 0;
-               layer_info.dst_pos.w = st_disp->width;
-               layer_info.dst_pos.h = st_disp->height;
-               layer_info.transform = TDM_TRANSFORM_NORMAL;
-
-               err = tdm_layer_set_info(st_disp->layer, &layer_info);
-               if (err != TDM_ERROR_NONE) {
-                       LOGE("failed to get output layer. error num = %d\n", err);
-                       goto exit;
-               }
-       }
-
-       st_disp->current_buf_id = 0;
-       LOG("done\n");
-       return 0;
-exit:
-       tdm_if_display_deinit(st_disp);
-       return -1;
-}
-
-void tdm_if_display_deinit(tdm_if_disp *st_disp)
-{
-       int buf_cnt = 0;
-
-       if (st_disp->disp != NULL) {
-               /* RELEASE RESOURCE */
-               for (buf_cnt = 0; buf_cnt < MAX_BUF; buf_cnt++) {
-                       if (st_disp->surf[buf_cnt] != NULL)
-                               tbm_surface_destroy(st_disp->surf[buf_cnt]);
-
-                       if (st_disp->bo[buf_cnt] != NULL)
-                               tbm_bo_unref(st_disp->bo[buf_cnt]);
-               }
-
-               if (st_disp->bufmgr != NULL)
-                       tbm_bufmgr_deinit(st_disp->bufmgr);
-               st_disp->bufmgr = NULL;
-
-               tdm_display_deinit(st_disp->disp);
-               st_disp->disp = NULL;
-       }
-}
-
-void tdm_if_display_update(tdm_if_disp *st_disp)
-{
-       /* DISPLAY UPDATE */
-       int buf_cnt = 0;
-
-       buf_cnt = st_disp->current_buf_id;
-       //st_disp->current_buf_id = (++st_disp->current_buf_id)%MAX_BUF;
-
-       if (st_disp->use_tdm_hwc) {
-               uint32_t num_types;
-               tdm_region damage;
-               memset(&damage, 0, sizeof(damage));
-
-               tdm_hwc_set_client_target_buffer(st_disp->hwc, st_disp->surf[buf_cnt], damage);
-               tdm_hwc_validate(st_disp->hwc, NULL, 0, &num_types);
-               tdm_hwc_accept_validation(st_disp->hwc);
-               tdm_hwc_commit(st_disp->hwc, 1, tdm_if_display_commit_handler_cb, st_disp);
-       } else {
-               tdm_layer_set_buffer(st_disp->layer, st_disp->surf[buf_cnt]);
-
-               // TODO: sync or async??
-               tdm_output_commit(st_disp->output, 1, tdm_if_display_commit_handler_cb, st_disp);
-       }
-
-       return ;
-}
-
-void tdm_if_lcd_on(tdm_if_disp *st_disp)
-{
-       /* SET DPMS ON */
-       LOG("DPMS ON!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_ON);
-       return ;
-}
-
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp)
-{
-       /* SET DPMS SUSPEND */
-       LOG("DPMS SUSPEND!\n");
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_SUSPEND);
-
-       return ;
-}
-
-void tdm_if_lcd_off(tdm_if_disp *st_disp)
-{
-       /* SET DPMS OFF */
-       LOG("DPMS OFF!\n");
-
-       tdm_output_set_dpms(st_disp->output, TDM_OUTPUT_DPMS_OFF);
-
-       return ;
-}
diff --git a/rw-update-ani-common/tdm-if.h b/rw-update-ani-common/tdm-if.h
deleted file mode 100644 (file)
index dc67910..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * firmware-update-system-ui
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __TDM_IF_H__
-#define __TDM_IF_H__
-
-#include <tdm.h>
-#include <tbm_bufmgr.h>
-#include <tdm_helper.h>
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-
-#define MAX_BUF 2
-#define RGB32_BPP 32
-#define RGB32_PITCH 4
-
-typedef struct _tdm_if_disp {
-       tdm_display *disp;
-       tdm_output *output;
-       tdm_layer *layer;
-       tdm_pp *pp;
-       int tdm_fd;
-       int drm_fd;
-
-       tbm_surface_h surf[MAX_BUF];
-       tbm_surface_h pp_surf[MAX_BUF];
-       tbm_bufmgr bufmgr;
-       unsigned int handle[MAX_BUF];
-       unsigned int pp_handle[MAX_BUF];
-       tbm_bo bo[MAX_BUF];
-       tbm_bo_handle bo_handle[MAX_BUF];
-       tbm_bo pp_bo[MAX_BUF];
-       tbm_bo_handle pp_bo_handle[MAX_BUF];
-       void *buffer[MAX_BUF];
-       void *pp_buffer[MAX_BUF];
-       int buffer_size;
-       int width;
-       int height;
-       int stride;
-       int current_buf_id;
-
-       bool use_tdm_hwc;
-       tdm_hwc *hwc;
-} tdm_if_disp;
-
-typedef enum {
-       FRONT_BUFFER = 0,
-       BACK_BUFFER
-} BUFFER_TYPE;
-
-extern tdm_if_disp s_disp;
-
-int tdm_if_display_init(tdm_if_disp *st_disp);
-void tdm_if_display_deinit(tdm_if_disp *st_disp);
-void tdm_if_display_update(tdm_if_disp *st_disp);
-void tdm_if_lcd_on(tdm_if_disp *st_disp);
-void tdm_if_lcd_suspend(tdm_if_disp *st_disp);
-void tdm_if_lcd_off(tdm_if_disp *st_disp);
-#endif /* __TDM_IF_H__ */