Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor

Showing 2 changed files with 26 additions and 9 deletions. Show diff stats Hide diff stats

  1. 33  src/fb.c
  2. 2  src/main.c
33  src/fb.c
@@ -54,6 +54,16 @@ static void get_resolution(int mode, int *hres, int *vres)
54 54
 	}
55 55
 }
56 56
 
  57
+static int current_mode = -1;
  58
+
  59
+static void set_mode(int mode)
  60
+{
  61
+	if(current_mode != mode) {
  62
+		ioctl(framebuffer_fd, FBIOSETVIDEOMODE, mode);
  63
+		current_mode = mode;
  64
+	}
  65
+}
  66
+
57 67
 void init_fb_mtk(int quiet)
58 68
 {
59 69
 	struct fb_fix_screeninfo fb_fix;
@@ -65,17 +75,26 @@ void init_fb_mtk(int quiet)
65 75
 	assert(framebuffer_fd != -1);
66 76
 	mode = sysconfig_get_resolution();
67 77
 	get_resolution(mode, &hres, &vres);
68  
-	if(!quiet)
69  
-		ioctl(framebuffer_fd, FBIOSETVIDEOMODE, mode);
  78
+	if(quiet)
  79
+		/* Assume we will go into rendering mode, and prevent screen blinking. */
  80
+		set_mode(SC_RESOLUTION_640_480);
  81
+	else
  82
+		set_mode(mode);
70 83
 	ioctl(framebuffer_fd, FBIOGET_FSCREENINFO, &fb_fix);
71 84
 	
72 85
 	mtk_init((void *)fb_fix.smem_start, hres, vres);
  86
+	
  87
+	if(quiet) {
  88
+		ioctl(framebuffer_fd, FBIOSETBUFFERMODE, FB_TRIPLE_BUFFERED);
  89
+		ioctl(framebuffer_fd, FBIOSWAPBUFFERS);
  90
+	}
73 91
 }
74 92
 
75 93
 void fb_unblank()
76 94
 {
77 95
 	if(blanked) {
78  
-		ioctl(framebuffer_fd, FBIOSETVIDEOMODE, sysconfig_get_resolution());
  96
+		set_mode(sysconfig_get_resolution());
  97
+		ioctl(framebuffer_fd, FBIOSETBUFFERMODE, FB_SINGLE_BUFFERED);
79 98
 		blanked = 0;
80 99
 		/* FIXME: work around "black screen" bug in MTK */
81 100
 		mtk_cmd(1, "screen.refresh()");
@@ -84,8 +103,7 @@ void fb_unblank()
84 103
 
85 104
 void fb_render_mode()
86 105
 {
87  
-	if((sysconfig_get_resolution() != SC_RESOLUTION_640_480) || blanked)
88  
-		ioctl(framebuffer_fd, FBIOSETVIDEOMODE, SC_RESOLUTION_640_480);
  106
+	set_mode(SC_RESOLUTION_640_480);
89 107
 	ioctl(framebuffer_fd, FBIOSETBUFFERMODE, FB_TRIPLE_BUFFERED);
90 108
 	blanked = 0;
91 109
 	g_render_mode = 1;
@@ -93,8 +111,7 @@ void fb_render_mode()
93 111
 
94 112
 void fb_gui_mode()
95 113
 {
96  
-	if(sysconfig_get_resolution() != SC_RESOLUTION_640_480)
97  
-		ioctl(framebuffer_fd, FBIOSETVIDEOMODE, sysconfig_get_resolution());
  114
+	set_mode(sysconfig_get_resolution());
98 115
 	ioctl(framebuffer_fd, FBIOSETBUFFERMODE, FB_SINGLE_BUFFERED);
99 116
 	blanked = 0;
100 117
 	g_render_mode = 0;
@@ -111,7 +128,7 @@ void fb_resize_gui()
111 128
 	int mode, hres, vres;
112 129
 	
113 130
 	mode = sysconfig_get_resolution();
114  
-	ioctl(framebuffer_fd, FBIOSETVIDEOMODE, mode);
  131
+	set_mode(mode);
115 132
 	get_resolution(mode, &hres, &vres);
116 133
 	ioctl(framebuffer_fd, FBIOGET_FSCREENINFO, &fb_fix);
117 134
 	mtk_resize((void *)fb_fix.smem_start, hres, vres);
2  src/main.c
@@ -86,7 +86,7 @@
86 86
 
87 87
 static rtems_task gui_task(rtems_task_argument argument)
88 88
 {
89  
-	init_fb_mtk(sysconfig_get_autostart_mode() != SC_AUTOSTART_NONE);
  89
+	init_fb_mtk(sysconfig_get_autostart_mode() == SC_AUTOSTART_FILE);
90 90
 	sysconfig_set_mtk_language();
91 91
 	sysconfig_set_mtk_wallpaper();
92 92
 	init_input();

No commit comments for this range

Something went wrong with that request. Please try again.