From 1fc89d4c84e512b484d82d971d997bdb0aef40e2 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 10 Sep 2013 16:52:54 -0700 Subject: minui: convert ev_*() event interface to epoll Help enable external main loop combined with ev_*() key event processing. Specify EPOLLWAKEUP to hold a wakelock on any event, assuming this is needed (may need to make this optional). Convert callback events parameter to unsigned int. Change-Id: Ib5e09abbd7724ffd830e2cf8e25e7eb59d3aa072 --- minui/minui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 1b8dd059b..805c58bed 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -50,7 +50,7 @@ unsigned int gr_get_height(gr_surface surface); // see http://www.mjmwired.net/kernel/Documentation/input/ for info. struct input_event; -typedef int (*ev_callback)(int fd, short revents, void *data); +typedef int (*ev_callback)(int fd, unsigned int epevents, void *data); typedef int (*ev_set_key_callback)(int code, int value, void *data); int ev_init(ev_callback input_cb, void *data); @@ -65,7 +65,7 @@ int ev_sync_key_state(ev_set_key_callback set_key_cb, void *data); */ int ev_wait(int timeout); -int ev_get_input(int fd, short revents, struct input_event *ev); +int ev_get_input(int fd, unsigned int epevents, struct input_event *ev); void ev_dispatch(void); // Resources -- cgit v1.2.3 From 4665ede960301144eeebcf6b145ac83fd9d2c778 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 10 Sep 2013 17:03:45 -0700 Subject: minui: add ev_get_epollfd() to retrieve epoll file descriptor To allow use of ev_* functions with an external main loop. Change-Id: If73717b64d7c455ca726b90a815a31c1edf52544 --- minui/minui.h | 1 + 1 file changed, 1 insertion(+) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 805c58bed..ab08202f4 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -67,6 +67,7 @@ int ev_wait(int timeout); int ev_get_input(int fd, unsigned int epevents, struct input_event *ev); void ev_dispatch(void); +int ev_get_epollfd(void); // Resources -- cgit v1.2.3 From a5ef19fabd10428ccff2055455ef1a55dfdc5fa0 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 17 Sep 2013 13:39:10 -0700 Subject: recovery: fix epoll events type to uint32_t Change-Id: I5db9987102201c18821acb45d1f824e9865a1451 --- minui/minui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index ab08202f4..573dd71f4 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -50,7 +50,7 @@ unsigned int gr_get_height(gr_surface surface); // see http://www.mjmwired.net/kernel/Documentation/input/ for info. struct input_event; -typedef int (*ev_callback)(int fd, unsigned int epevents, void *data); +typedef int (*ev_callback)(int fd, uint32_t epevents, void *data); typedef int (*ev_set_key_callback)(int code, int value, void *data); int ev_init(ev_callback input_cb, void *data); @@ -65,7 +65,7 @@ int ev_sync_key_state(ev_set_key_callback set_key_cb, void *data); */ int ev_wait(int timeout); -int ev_get_input(int fd, unsigned int epevents, struct input_event *ev); +int ev_get_input(int fd, uint32_t epevents, struct input_event *ev); void ev_dispatch(void); int ev_get_epollfd(void); -- cgit v1.2.3 From eac881c952fc6be0beeb5f719e3a70e651f3610e Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Fri, 7 Mar 2014 09:21:25 -0800 Subject: change how recovery animation is implemented Instead of one 'base' installing image and a number of overlay images that are drawn on top of it, we represent the installing animation with one PNG that contains all the animation frames, interlaced by row. The PNG is expected to have a text chunk with the keyword 'Frames' and a value that's the number of frames (as an ascii string). This representation provides better compression, removes the need to subclass ScreenRecoveryUI just to change the position of the overlay or number of frames, and doesn't require gr_blit() to support an alpha channel. We also remove the 'indeterminate' progress bar used when wiping data and/or cache. The main animation serves the same purpose (showing that the device is still alive); the spinning progress bar has been redundant for a while. This changes the default recovery animation to include the antenna-wiggling and gear-turning that's used in the Nexus 5 recovery animation. Change-Id: I51930a76035ac09969a25472f4e572b289418729 --- minui/minui.h | 1 + 1 file changed, 1 insertion(+) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 573dd71f4..3250955c7 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -73,6 +73,7 @@ int ev_get_epollfd(void); // Returns 0 if no error, else negative. int res_create_surface(const char* name, gr_surface* pSurface); +int res_create_multi_surface(const char* name, int* frames, gr_surface** pSurface); int res_create_localized_surface(const char* name, gr_surface* pSurface); void res_free_surface(gr_surface surface); -- cgit v1.2.3 From 39cf417e17011a72dd39acfe4cc8c90af26bdbaf Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 6 Mar 2014 16:16:05 -0800 Subject: remove pixelflinger from recovery Recovery now draws directly to the framebuffer by rolling its own graphics code, rather than depending on libpixelflinger. The recovery UI is modified slightly to eliminate operations that are slow with the software implementation: when the text display / menu is turned on, it now appears on a black background instead of a dimmed version of the recovery icon. There's probably substantial room for optimization of the graphics operations. Bug: 12131110 Change-Id: Iab6520e0a7aaec39e2ce39377c10aef82ae0c595 --- minui/minui.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 3250955c7..83c121e26 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -23,22 +23,30 @@ extern "C" { #endif -typedef void* gr_surface; -typedef unsigned short gr_pixel; +typedef struct { + int width; + int height; + int row_bytes; + int pixel_bytes; + unsigned char* data; +} GRSurface; + +typedef GRSurface* gr_surface; int gr_init(void); void gr_exit(void); int gr_fb_width(void); int gr_fb_height(void); -gr_pixel *gr_fb_data(void); + void gr_flip(void); void gr_fb_blank(bool blank); +void gr_clear(); // clear entire surface to current color void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a); void gr_fill(int x1, int y1, int x2, int y2); -int gr_text(int x, int y, const char *s, int bold); - void gr_texticon(int x, int y, gr_surface icon); +void gr_text(int x, int y, const char *s, int bold); +void gr_texticon(int x, int y, gr_surface icon); int gr_measure(const char *s); void gr_font_size(int *x, int *y); -- cgit v1.2.3 From 830b3e33634391e8f7264e5567acf0b510ea2d19 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 11 Mar 2014 13:22:04 -0700 Subject: separate fbdev-specific code out from minui Isolate the code that interacts with fbdev, in preparation for adding a new backend. Change-Id: I19105e9da1ca6408cebc110f7e2bb5abfb481ee9 --- minui/minui.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 83c121e26..b4b57e1db 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -17,6 +17,8 @@ #ifndef _MINUI_H_ #define _MINUI_H_ +#include + #include #ifdef __cplusplus -- cgit v1.2.3 From 469954fe3d7c3d729e500512ab911a037b90cc77 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Fri, 7 Mar 2014 09:21:25 -0800 Subject: change how recovery animation is implemented Instead of one 'base' installing image and a number of overlay images that are drawn on top of it, we represent the installing animation with one PNG that contains all the animation frames, interlaced by row. The PNG is expected to have a text chunk with the keyword 'Frames' and a value that's the number of frames (as an ascii string). This representation provides better compression, removes the need to subclass ScreenRecoveryUI just to change the position of the overlay or number of frames, and doesn't require gr_blit() to support an alpha channel. We also remove the 'indeterminate' progress bar used when wiping data and/or cache. The main animation serves the same purpose (showing that the device is still alive); the spinning progress bar has been redundant for a while. This changes the default recovery animation to include the antenna-wiggling and gear-turning that's used in the Nexus 5 recovery animation. Change-Id: I51930a76035ac09969a25472f4e572b289418729 Conflicts: screen_ui.cpp screen_ui.h --- minui/minui.h | 1 + 1 file changed, 1 insertion(+) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 1b8dd059b..5c0defc40 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -72,6 +72,7 @@ void ev_dispatch(void); // Returns 0 if no error, else negative. int res_create_surface(const char* name, gr_surface* pSurface); +int res_create_multi_surface(const char* name, int* frames, gr_surface** pSurface); int res_create_localized_surface(const char* name, gr_surface* pSurface); void res_free_surface(gr_surface surface); -- cgit v1.2.3 From 16f97c3961f08e5db7930d99e592f0a9f752df46 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 6 Mar 2014 16:16:05 -0800 Subject: remove pixelflinger from recovery Recovery now draws directly to the framebuffer by rolling its own graphics code, rather than depending on libpixelflinger. The recovery UI is modified slightly to eliminate operations that are slow with the software implementation: when the text display / menu is turned on, it now appears on a black background instead of a dimmed version of the recovery icon. There's probably substantial room for optimization of the graphics operations. Bug: 12131110 Change-Id: Iab6520e0a7aaec39e2ce39377c10aef82ae0c595 Conflicts: minui/resources.c --- minui/minui.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 5c0defc40..cb930cc4f 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -23,22 +23,30 @@ extern "C" { #endif -typedef void* gr_surface; -typedef unsigned short gr_pixel; +typedef struct { + int width; + int height; + int row_bytes; + int pixel_bytes; + unsigned char* data; +} GRSurface; + +typedef GRSurface* gr_surface; int gr_init(void); void gr_exit(void); int gr_fb_width(void); int gr_fb_height(void); -gr_pixel *gr_fb_data(void); + void gr_flip(void); void gr_fb_blank(bool blank); +void gr_clear(); // clear entire surface to current color void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a); void gr_fill(int x1, int y1, int x2, int y2); -int gr_text(int x, int y, const char *s, int bold); - void gr_texticon(int x, int y, gr_surface icon); +void gr_text(int x, int y, const char *s, int bold); +void gr_texticon(int x, int y, gr_surface icon); int gr_measure(const char *s); void gr_font_size(int *x, int *y); -- cgit v1.2.3 From 5290f2087a314506e2926edd9640cf1feb793866 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 11 Mar 2014 13:22:04 -0700 Subject: separate fbdev-specific code out from minui Isolate the code that interacts with fbdev, in preparation for adding a new backend. Change-Id: I19105e9da1ca6408cebc110f7e2bb5abfb481ee9 --- minui/minui.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index cb930cc4f..328da1e6c 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -17,6 +17,8 @@ #ifndef _MINUI_H_ #define _MINUI_H_ +#include + #include #ifdef __cplusplus -- cgit v1.2.3 From a418aa7dd5e94cbf1ab2a6fa1c63f60e5e087d42 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Mon, 17 Mar 2014 12:10:02 -0700 Subject: refactor image resource loading code in minui Reduce the number of copies of libpng boilerplate. Rename res_create_* functions to be more clear. Make explicit the use of the framebuffer pixel format for images, and handle more combinations of input and output (eg, loading a grayscale image for display rather than use as a text alpha channel). Change-Id: I3d41c800a8f4c22b2f0167967ce6ee4d6b2b8846 --- minui/minui.h | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 328da1e6c..d8d53fa27 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -80,10 +80,40 @@ void ev_dispatch(void); // Resources -// Returns 0 if no error, else negative. -int res_create_surface(const char* name, gr_surface* pSurface); -int res_create_multi_surface(const char* name, int* frames, gr_surface** pSurface); -int res_create_localized_surface(const char* name, gr_surface* pSurface); +// res_create_*_surface() functions return 0 if no error, else +// negative. +// +// A "display" surface is one that is intended to be drawn to the +// screen with gr_blit(). An "alpha" surface is a grayscale image +// interpreted as an alpha mask used to render text in the current +// color (with gr_text() or gr_texticon()). +// +// All these functions load PNG images from "/res/images/${name}.png". + +// Load a single display surface from a PNG image. +int res_create_display_surface(const char* name, gr_surface* pSurface); + +// Load an array of display surfaces from a single PNG image. The PNG +// should have a 'Frames' text chunk whose value is the number of +// frames this image represents. The pixel data itself is interlaced +// by row. +int res_create_multi_display_surface(const char* name, + int* frames, gr_surface** pSurface); + +// Load a single alpha surface from a grayscale PNG image. +int res_create_alpha_surface(const char* name, gr_surface* pSurface); + +// Load part of a grayscale PNG image that is the first match for the +// given locale. The image is expected to be a composite of multiple +// translations of the same text, with special added rows that encode +// the subimages' size and intended locale in the pixel data. See +// development/tools/recovery_l10n for an app that will generate these +// specialized images from Android resources. +int res_create_localized_alpha_surface(const char* name, const char* locale, + gr_surface* pSurface); + +// Free a surface allocated by any of the res_create_*_surface() +// functions. void res_free_surface(gr_surface surface); #ifdef __cplusplus -- cgit v1.2.3