aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-07-21 17:26:11 +1000
committerinmarket <andrewh@inmarket.com.au>2013-07-21 17:26:11 +1000
commit5b2d56148352ceaf4f3c1e7db302d6723b51b64a (patch)
tree0bd90b0bac098e75006001b6e0309192208d2e2f
parent2bef5da2f3a3a5c3f1e667d5f50c2f28f6d96baf (diff)
downloaduGFX-5b2d56148352ceaf4f3c1e7db302d6723b51b64a.tar.gz
uGFX-5b2d56148352ceaf4f3c1e7db302d6723b51b64a.tar.bz2
uGFX-5b2d56148352ceaf4f3c1e7db302d6723b51b64a.zip
Remove GDISP_THREAD_CHIBIOS. This is always used now.
-rw-r--r--drivers/multiple/X/gdisp_lld.c75
-rw-r--r--drivers/multiple/X/gdisp_lld_config.h2
-rw-r--r--drivers/multiple/X/readme.txt5
-rw-r--r--gfxconf.example.h1
4 files changed, 22 insertions, 61 deletions
diff --git a/drivers/multiple/X/gdisp_lld.c b/drivers/multiple/X/gdisp_lld.c
index 96ceeed2..d5edd9c6 100644
--- a/drivers/multiple/X/gdisp_lld.c
+++ b/drivers/multiple/X/gdisp_lld.c
@@ -14,11 +14,6 @@
#if GFX_USE_GDISP
-/* Our threading model - ChibiOS or POSIX */
-#ifndef GDISP_THREAD_CHIBIOS
- #define GDISP_THREAD_CHIBIOS TRUE
-#endif
-
/**
* Our color model - Default or 24 bit only.
*
@@ -42,9 +37,6 @@
#include <X11/Xutil.h>
#include <stdio.h>
#include <stdlib.h>
-#if !GDISP_THREAD_CHIBIOS
- #include <pthread.h>
-#endif
#ifndef GDISP_SCREEN_HEIGHT
#define GDISP_SCREEN_HEIGHT 480
@@ -116,34 +108,19 @@ static void ProcessEvent(void) {
}
/* this is the X11 thread which keeps track of all events */
-#if GDISP_THREAD_CHIBIOS
- static DECLARE_THREAD_STACK(waXThread, 1024);
- static DECLARE_THREAD_FUNCTION(ThreadX, arg) {
- (void)arg;
-
- while(1) {
- gfxSleepMilliseconds(100);
- while(XPending(dis)) {
- XNextEvent(dis, &evt);
- ProcessEvent();
- }
+static DECLARE_THREAD_STACK(waXThread, 1024);
+static DECLARE_THREAD_FUNCTION(ThreadX, arg) {
+ (void)arg;
+
+ while(1) {
+ gfxSleepMilliseconds(100);
+ while(XPending(dis)) {
+ XNextEvent(dis, &evt);
+ ProcessEvent();
}
- return 0;
}
-#else
- static void * ThreadX(void *arg) {
- (void)arg;
-
- while(1) {
- pthread_yield(); // This could be a 100ms delay
- while(XPending(dis)) {
- XNextEvent(dis, &evt);
- ProcessEvent();
- }
- }
- return 0;
- }
-#endif
+ return 0;
+}
static int FatalXIOError(Display *d) {
(void) d;
@@ -159,12 +136,9 @@ bool_t gdisp_lld_init(void)
XSetWindowAttributes xa;
XTextProperty WindowTitle;
char * WindowTitleText;
- #if GDISP_THREAD_CHIBIOS
- gfxThreadHandle hth;
- #else
- pthread_attr_t thattr;
- pthread_t thid;
+ gfxThreadHandle hth;
+ #if GFX_USE_OS_POSIX
XInitThreads();
#endif
@@ -227,22 +201,15 @@ bool_t gdisp_lld_init(void)
XSelectInput(dis, win,
ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
- #if GDISP_THREAD_CHIBIOS
- if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) {
- fprintf(stderr, "Cannot start X Thread\n");
- XCloseDisplay(dis);
- exit(0);
- }
- gfxThreadClose(hth);
- #else
- if (pthread_attr_init(&thattr)
- || pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED)
- || pthread_create(&thid, &thattr, ThreadX, 0)) {
- fprintf(stderr, "Cannot start X Thread\n");
- XCloseDisplay(dis);
- exit(0);
- }
+ if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) {
+ fprintf(stderr, "Cannot start X Thread\n");
+ XCloseDisplay(dis);
+ exit(0);
+ }
+ #if GFX_USE_OS_POSIX
+ pthread_detach(hth);
#endif
+ gfxThreadClose(hth);
/* Initialise the GDISP structure to match */
GDISP.Orientation = GDISP_ROTATE_0;
diff --git a/drivers/multiple/X/gdisp_lld_config.h b/drivers/multiple/X/gdisp_lld_config.h
index 5fae5efe..6feee5f3 100644
--- a/drivers/multiple/X/gdisp_lld_config.h
+++ b/drivers/multiple/X/gdisp_lld_config.h
@@ -32,7 +32,7 @@
#define GDISP_HARDWARE_CONTROL FALSE
#define GDISP_HARDWARE_CIRCLES FALSE
#define GDISP_HARDWARE_CIRCLEFILLS FALSE
-#define GDISP_HARDWARE_ARCS FALSE
+#define GDISP_HARDWARE_ARCS FALSE
#define GDISP_HARDWARE_ARCFILLS FALSE
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
diff --git a/drivers/multiple/X/readme.txt b/drivers/multiple/X/readme.txt
index 9c54b143..fd2e3fc1 100644
--- a/drivers/multiple/X/readme.txt
+++ b/drivers/multiple/X/readme.txt
@@ -20,8 +20,3 @@ and a touchscreen driver.
3. Modify your makefile to add -lX11 to the DLIBS line. i.e.
DLIBS = -lX11
-
-3. If you changed your threading model to POSIX modify your makefile
- to add -pthread to the CC (or DDEFS) line. i.e.
- CC = $(TRGT)gcc -pthread
-
diff --git a/gfxconf.example.h b/gfxconf.example.h
index dfeb707a..daa766df 100644
--- a/gfxconf.example.h
+++ b/gfxconf.example.h
@@ -143,7 +143,6 @@
#define GDISP_USE_GPIO
#define TDISP_COLUMNS 16
#define TDISP_ROWS 2
- #define GDISP_THREAD_CHIBIOS TRUE
*/
#endif /* _GFXCONF_H */