完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
1个回答
|
|
RK3368 Recovery界面旋转方向调试
1. 串口打印调试/重新调试可启动/Android.m 将打印日志重新打开到控制台,方便调试。 @@ -60,7 +60,7 @@ LOCAL_CFLAGS += -D_FILE_OFFSET_BITS=64 #SDCARD: save log to sdcard #CACHE: save log to /cache/recovery/ dir #UART: redirect log to uart output -REDIRECT_LOG_TO := CACHE +REDIRECT_LOG_TO := UART LOCAL_C_INCLUDES := $(prebuilt_stdcxx_PATH)/gnu-libstdc++/include 2. 修改代码 旋转UI代码参考了:Android O恢复出厂设置时,图标和屏的方向不一致; 修改当前设备的BoardConfig.mk,定义需要旋转的角度: BOARD_RECOVERY_UI_ROTATION := 270 修改bootable/recovery/minui/Android.mk,添加以下代码: +ifeq ($(strip $(BOARD_RECOVERY_UI_ROTATION)), 0) + LOCAL_CFLAGS += -DBOARD_RECOVERY_UI_ROTATION_0 +else +ifeq ($(strip $(BOARD_RECOVERY_UI_ROTATION)), 90) + LOCAL_CFLAGS += -DBOARD_RECOVERY_UI_ROTATION_90 +else +ifeq ($(strip $(BOARD_RECOVERY_UI_ROTATION)), 180) + LOCAL_CFLAGS += -DBOARD_RECOVERY_UI_ROTATION_180 +else +ifeq ($(strip $(BOARD_RECOVERY_UI_ROTATION)), 270) + LOCAL_CFLAGS += -DBOARD_RECOVERY_UI_ROTATION_270 +else + LOCAL_CFLAGS += -DBOARD_RECOVERY_UI_ROTATION_0 +endif +endif +endif +endif + bootable/recovery/minui/graphics_fbdev.cpp添加旋转方向代码: static GRSurface *gr_rotate_draw = NULL; #define swap(a, b) do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) static GRSurface *rotate_surface_init(GRSurface *surface) { static GRSurface *rotateSurface = (GRSurface *)malloc(sizeof(GRSurface)); if (rotateSurface == NULL) { return NULL; } memcpy(rotateSurface, surface, sizeof(GRSurface)); #if defined(BOARD_RECOVERY_UI_ROTATION_90) || defined(BOARD_RECOVERY_UI_ROTATION_270) swap(rotateSurface->width, rotateSurface->height); rotateSurface->row_bytes = rotateSurface->width * rotateSurface->pixel_bytes; #endif rotateSurface->data = (unsigned char *)malloc(rotateSurface->height * rotateSurface->row_bytes); if (rotateSurface->data == NULL) { free(rotateSurface); return NULL; } memset(rotateSurface->data, 0, rotateSurface->height * rotateSurface->row_bytes); return rotateSurface; } static void rotate_surface_exit(GRSurface *surface) { if (surface) { if (surface->data) free(surface->data); free(surface); } surface = NULL; } static void rotate_surface_0(GRSurface *dst, GRSurface *src) { memcpy(dst->data, src->data, src->height * src->row_bytes); } static void rotate_surface_270(GRSurface *dst, GRSurface *src) { int v, w, h; unsigned int *src_pixel; unsigned int *dst_pixel; for (h = 0, v = src->width - 1; h < dst->height; h++, v--) { for (w = 0; w < dst->width; w++) { dst_pixel = (unsigned int *)(dst->data + dst->row_bytes * h); src_pixel = (unsigned int *)(src->data + src->row_bytes * w); *(dst_pixel + w) = *(src_pixel + v); } } } static void rotate_surface_180(GRSurface *dst, GRSurface *src) { int v, w, k, h; unsigned int *src_pixel; unsigned int *dst_pixel; for (h = 0, k = src->height - 1; h < dst->height && k >= 0; h++, k--) { dst_pixel = (unsigned int *)(dst->data + dst->row_bytes * h); src_pixel = (unsigned int *)(src->data + src->row_bytes * k); for (w = 0, v = src->width - 1; w < dst->width && v >= 0; w++, v--) { *(dst_pixel + w) = *(src_pixel + v); } } } static void rotate_surface_90(GRSurface *dst, GRSurface *src) { int w, k, h; unsigned int *src_pixel; unsigned int *dst_pixel; for (h = 0; h < dst->height; h++) { for (w = 0, k = src->height - 1; w < dst->width; w++, k--) { dst_pixel = (unsigned int *)(dst->data + dst->row_bytes * h); src_pixel = (unsigned int *)(src->data + src->row_bytes * k); *(dst_pixel + w) = *(src_pixel + h); } } } 修改open_fbdev, fbdev_flip, fbdev_exit: minui_backend* open_fbdev() { return &my_backend; @@ -220,7 +298,9 @@ static GRSurface* fbdev_init(minui_backend* backend) { fbdev_blank(backend, true); fbdev_blank(backend, false); - return gr_draw; + //return gr_draw; + gr_rotate_draw = rotate_surface_init(gr_draw); + return gr_rotate_draw; } static GRSurface* fbdev_flip(minui_backend* backend __unused) { @@ -237,26 +317,46 @@ static GRSurface* fbdev_flip(minui_backend* backend __unused) { ucfb_vaddr[idx + 2] = tmp; } #endif + +#ifdef BOARD_RECOVERY_UI_ROTATION_0 + rotate_surface_0(gr_draw, gr_rotate_draw); +#else +#ifdef BOARD_RECOVERY_UI_ROTATION_90 + rotate_surface_90(gr_draw, gr_rotate_draw); +#else +#ifdef BOARD_RECOVERY_UI_ROTATION_180 + rotate_surface_180(gr_draw, gr_rotate_draw); +#else +#ifdef BOARD_RECOVERY_UI_ROTATION_270 + rotate_surface_270(gr_draw, gr_rotate_draw); +#else + rotate_surface_0(gr_draw, gr_rotate_draw); +#endif +#endif +#endif +#endif + // Change gr_draw to point to the buffer currently displayed, // then flip the driver so we're displaying the other buffer // instead. gr_draw = gr_framebuffer + displayed_buffer; -#ifdef BOARD_HAS_FLIPPED_SCREEN - rk_rotate_surface_180( &gr_framebuffer[1-displayed_buffer]); -#endif + set_displayed_framebuffer(1-displayed_buffer); } else { // Copy from the in-memory surface to the framebuffer. memcpy(gr_framebuffer[0].data, gr_draw->data, gr_draw->height * gr_draw->row_bytes); } - return gr_draw; + //return gr_draw; + return gr_rotate_draw; } static void fbdev_exit(minui_backend* backend __unused) { close(fb_fd); fb_fd = -1; + rotate_surface_exit(gr_rotate_draw); + if (!double_buffered && gr_draw) { free(gr_draw->data); free(gr_draw); 3.编译 执行以下命令,可以单独编译recovery,但需要重新刷入recovery.img进行测试验证。 $ source build/envsetup.sh $ touch bootable/recovery/minui/* $ make recoveryimage -j8 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1820 浏览 1 评论
synopsys 的design ware:DW_fpv_div,浮点数除法器,默认32位下,想提升覆盖率(TMAX),如果用功能case去提升覆盖率呢?
2269 浏览 1 评论
RK3588 GStreamer调试四路鱼眼摄像头四宫格显示报错
5092 浏览 1 评论
【飞凌嵌入式OK3576-C开发板体验】RKNN神经网络-YOLO图像识别
254 浏览 0 评论
【飞凌嵌入式OK3576-C开发板体验】SSH远程登录网络配置及CAN通讯
1336 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 13:15 , Processed in 0.614467 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号