mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Targets with HAVE_LCD_ENABLE: Provide a means to receive notifications when the lcd is enabled and the image is refreshed so overlayed drawing can also be refreshed. Chiefly mpegplayer needs this so it can redraw the YUV data after the backlight is turned on while paused or when using 'Set Start Time'.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17640 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b57b779fbc
commit
adf2e4c9a0
15 changed files with 90 additions and 1 deletions
|
@ -601,6 +601,10 @@ static const struct plugin_api rockbox_api = {
|
|||
simplelist_info_init,
|
||||
simplelist_show_list,
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
lcd_set_enable_hook,
|
||||
&button_queue,
|
||||
#endif
|
||||
};
|
||||
|
||||
int plugin_load(const char* plugin, const void* parameter)
|
||||
|
|
|
@ -124,7 +124,7 @@ void* plugin_get_buffer(size_t *buffer_size);
|
|||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||
|
||||
/* increase this every time the api struct changes */
|
||||
#define PLUGIN_API_VERSION 115
|
||||
#define PLUGIN_API_VERSION 116
|
||||
|
||||
/* update this to latest version if a change to the api struct breaks
|
||||
backwards compatibility (and please take the opportunity to sort in any
|
||||
|
@ -752,6 +752,10 @@ struct plugin_api {
|
|||
int count, void* data);
|
||||
bool (*simplelist_show_list)(struct simplelist_info *info);
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
void (*lcd_set_enable_hook)(void (*enable_hook)(void));
|
||||
struct event_queue *button_queue;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* plugin header */
|
||||
|
|
|
@ -543,6 +543,13 @@ static uint32_t increment_time(uint32_t val, int32_t amount, uint32_t range)
|
|||
return val;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
static void get_start_time_lcd_enable_hook(void)
|
||||
{
|
||||
rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0);
|
||||
}
|
||||
#endif /* HAVE_LCD_ENABLE */
|
||||
|
||||
static int get_start_time(uint32_t duration)
|
||||
{
|
||||
int button = 0;
|
||||
|
@ -556,6 +563,10 @@ static int get_start_time(uint32_t duration)
|
|||
lcd_(clear_display)();
|
||||
lcd_(update)();
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
rb->lcd_set_enable_hook(get_start_time_lcd_enable_hook);
|
||||
#endif
|
||||
|
||||
draw_slider(0, 100, &rc_bound);
|
||||
rc_bound.b = rc_bound.t - SLIDER_TMARGIN;
|
||||
rc_bound.t = SCREEN_MARGIN;
|
||||
|
@ -707,6 +718,13 @@ static int get_start_time(uint32_t duration)
|
|||
slider_state = state9;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
case LCD_ENABLE_EVENT_0:
|
||||
if (slider_state == state2)
|
||||
display_thumb_image(&rc_vid);
|
||||
continue;
|
||||
#endif
|
||||
|
||||
default:
|
||||
rb->default_event_handler(button);
|
||||
rb->yield();
|
||||
|
@ -736,6 +754,10 @@ static int get_start_time(uint32_t duration)
|
|||
rb->yield();
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
rb->lcd_set_enable_hook(NULL);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LCD_COLOR
|
||||
stream_gray_show(false);
|
||||
grey_clear_display();
|
||||
|
|
|
@ -587,13 +587,27 @@ static void draw_putsxy_oriented(int x, int y, const char *str)
|
|||
}
|
||||
#endif /* LCD_PORTRAIT */
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
/* So we can refresh the overlay */
|
||||
static void wvs_lcd_enable_hook(void)
|
||||
{
|
||||
rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void wvs_backlight_on_video_mode(bool video_on)
|
||||
{
|
||||
if (video_on) {
|
||||
/* Turn off backlight timeout */
|
||||
/* backlight control in lib/helper.c */
|
||||
backlight_force_on(rb);
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
rb->lcd_set_enable_hook(NULL);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
rb->lcd_set_enable_hook(wvs_lcd_enable_hook);
|
||||
#endif
|
||||
/* Revert to user's backlight settings */
|
||||
backlight_use_settings(rb);
|
||||
}
|
||||
|
@ -1441,6 +1455,15 @@ static void button_loop(void)
|
|||
continue;
|
||||
} /* BUTTON_NONE: */
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
case LCD_ENABLE_EVENT_1:
|
||||
{
|
||||
/* Draw the current frame if prepared already */
|
||||
stream_draw_frame(true);
|
||||
break;
|
||||
} /* LCD_ENABLE_EVENT_1: */
|
||||
#endif
|
||||
|
||||
case MPEG_VOLUP:
|
||||
case MPEG_VOLUP|BUTTON_REPEAT:
|
||||
#ifdef MPEG_VOLUP2
|
||||
|
|
|
@ -104,4 +104,7 @@ enum mpeg_malloc_reason_t
|
|||
#include "disk_buf.h"
|
||||
#include "stream_mgr.h"
|
||||
|
||||
#define LCD_ENABLE_EVENT_0 MAKE_SYS_EVENT(SYS_EVENT_CLS_PRIVATE, 0)
|
||||
#define LCD_ENABLE_EVENT_1 MAKE_SYS_EVENT(SYS_EVENT_CLS_PRIVATE, 1)
|
||||
|
||||
#endif /* MPEGPLAYER_H */
|
||||
|
|
|
@ -49,6 +49,10 @@ fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]
|
|||
static fb_data* lcd_backdrop = NULL;
|
||||
static long lcd_backdrop_offset IDATA_ATTR = 0;
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
static void (*lcd_enable_hook)(void) = NULL;
|
||||
#endif
|
||||
|
||||
static struct viewport default_vp =
|
||||
{
|
||||
.x = 0,
|
||||
|
@ -84,6 +88,23 @@ void lcd_init(void)
|
|||
scroll_init();
|
||||
}
|
||||
|
||||
/*** Helpers - consolidate optional code ***/
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
void lcd_set_enable_hook(void (*enable_hook)(void))
|
||||
{
|
||||
lcd_enable_hook = enable_hook;
|
||||
}
|
||||
|
||||
/* To be called by target driver after enabling display and refreshing it */
|
||||
void lcd_call_enable_hook(void)
|
||||
{
|
||||
void (*enable_hook)(void) = lcd_enable_hook;
|
||||
|
||||
if (enable_hook != NULL)
|
||||
enable_hook();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Viewports ***/
|
||||
|
||||
void lcd_set_viewport(struct viewport* vp)
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#define SYS_EVENT_CLS_FILESYS 3
|
||||
#define SYS_EVENT_CLS_PLUG 4
|
||||
#define SYS_EVENT_CLS_MISC 5
|
||||
#define SYS_EVENT_CLS_PRIVATE 7 /* For use inside plugins */
|
||||
/* make sure SYS_EVENT_CLS_BITS has enough range */
|
||||
|
||||
/* Bit 31->|S|c...c|i...i| */
|
||||
|
|
|
@ -341,6 +341,10 @@ void lcd_poweroff(void);
|
|||
/* Enable/disable the main display. */
|
||||
extern void lcd_enable(bool on);
|
||||
extern bool lcd_enabled(void);
|
||||
/* Register a hook that is called when the lcd is powered and after the
|
||||
* framebuffer data is synchronized */
|
||||
void lcd_set_enable_hook(void (*enable_hook)(void));
|
||||
void lcd_call_enable_hook(void);
|
||||
#endif /* HAVE_LCD_ENABLE */
|
||||
|
||||
#ifdef HAVE_LCD_SLEEP
|
||||
|
|
|
@ -361,6 +361,7 @@ void lcd_enable(bool on)
|
|||
/* Probably out of sync and we don't wanna pepper the code with
|
||||
lcd_update() calls for this. */
|
||||
lcd_update();
|
||||
lcd_call_enable_hook();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -287,6 +287,7 @@ void lcd_enable(bool state)
|
|||
|
||||
lcd_on = true;
|
||||
lcd_update();
|
||||
lcd_call_enable_hook();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -436,6 +436,7 @@ void lcd_enable(bool on)
|
|||
DEV_EN |= DEV_LCD; /* Enable LCD controller */
|
||||
lcd_display_on(); /* Turn on display */
|
||||
lcd_update(); /* Resync display */
|
||||
lcd_call_enable_hook();
|
||||
LCD_REG_6 |= 1; /* Restart DMA */
|
||||
sleep(HZ/50); /* Wait for a frame to be written */
|
||||
}
|
||||
|
|
|
@ -212,6 +212,7 @@ void lcd_enable(bool on)
|
|||
lcd_display_on();
|
||||
LCDC_CTRL |= 1; /* controller enable */
|
||||
lcd_update(); /* Resync display */
|
||||
lcd_call_enable_hook();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -235,6 +235,7 @@ return;
|
|||
{
|
||||
lcd_display_on(false); /* Turn on display */
|
||||
lcd_update(); /* Resync display */
|
||||
lcd_call_enable_hook();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -383,6 +383,7 @@ void lcd_enable(bool on)
|
|||
/* Probably out of sync and we don't wanna pepper the code with
|
||||
lcd_update() calls for this. */
|
||||
lcd_update();
|
||||
lcd_call_enable_hook();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -261,6 +261,7 @@ void lcd_enable(bool on)
|
|||
if(on)
|
||||
{
|
||||
_display_on();
|
||||
lcd_call_enable_hook();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue