diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-09-30 10:25:28 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-09-30 10:42:49 +0100 |
commit | f373c97c90e816404c00ab48b2e36b18fd5e6c49 (patch) | |
tree | b268985996c496f9149e4508f9fea950711e1a6c /firmware | |
parent | 9ed36ec22f7ea880b64fa11d2c0d49485287ad03 (diff) | |
download | rockbox-f373c97c90e816404c00ab48b2e36b18fd5e6c49.tar.gz rockbox-f373c97c90e816404c00ab48b2e36b18fd5e6c49.zip |
Define LCD_STRIDEFORMAT unconditionally
Instead of putting "#ifdef LCD_STRIDEFORMAT" at every usage of the
macro it's simpler to have config.h define LCD_STRIDEFORMAT to the
default of horizontal stride when the target leaves it unspecified.
Change-Id: Ib187012aad65ac678dbd837b1464a83bad722411
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-1bit-vert.c | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-horz.c | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-vert.c | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-vi.c | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-color-common.c | 2 | ||||
-rw-r--r-- | firmware/export/config.h | 8 | ||||
-rw-r--r-- | firmware/export/lcd.h | 4 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 4 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/lcd-sdl.c | 6 |
10 files changed, 19 insertions, 15 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 49d1d9ac95..abce59fe04 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -300,7 +300,7 @@ drivers/lcd-2bit-vert.c | |||
300 | drivers/lcd-2bit-vi.c | 300 | drivers/lcd-2bit-vi.c |
301 | #endif /* LCD_PIXELFORMAT */ | 301 | #endif /* LCD_PIXELFORMAT */ |
302 | #elif LCD_DEPTH == 16 | 302 | #elif LCD_DEPTH == 16 |
303 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 303 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
304 | drivers/lcd-16bit-vert.c | 304 | drivers/lcd-16bit-vert.c |
305 | #else | 305 | #else |
306 | drivers/lcd-16bit.c | 306 | drivers/lcd-16bit.c |
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index ff95eacdbc..e574d4c191 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c | |||
@@ -83,7 +83,7 @@ static void *LCDFN(frameaddress_default)(int x, int y) | |||
83 | { | 83 | { |
84 | /* the default expects a buffer the same size as the screen */ | 84 | /* the default expects a buffer the same size as the screen */ |
85 | struct frame_buffer_t *fb = CURRENT_VP->buffer; | 85 | struct frame_buffer_t *fb = CURRENT_VP->buffer; |
86 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 86 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
87 | size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y; | 87 | size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y; |
88 | #else | 88 | #else |
89 | size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x; | 89 | size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x; |
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 66313d624b..1bc489247c 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c | |||
@@ -81,7 +81,7 @@ static void *lcd_frameaddress_default(int x, int y) | |||
81 | /* the default expects a buffer the same size as the screen */ | 81 | /* the default expects a buffer the same size as the screen */ |
82 | struct frame_buffer_t *fb = lcd_current_viewport->buffer; | 82 | struct frame_buffer_t *fb = lcd_current_viewport->buffer; |
83 | 83 | ||
84 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 84 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
85 | size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; | 85 | size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; |
86 | #else | 86 | #else |
87 | size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; | 87 | size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; |
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index 4ce9960419..b206a2d816 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c | |||
@@ -83,7 +83,7 @@ static void *lcd_frameaddress_default(int x, int y) | |||
83 | /* the default expects a buffer the same size as the screen */ | 83 | /* the default expects a buffer the same size as the screen */ |
84 | struct frame_buffer_t *fb = lcd_current_viewport->buffer; | 84 | struct frame_buffer_t *fb = lcd_current_viewport->buffer; |
85 | 85 | ||
86 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 86 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
87 | size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; | 87 | size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; |
88 | #else | 88 | #else |
89 | size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; | 89 | size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; |
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index b969c93216..0bcf60767e 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c | |||
@@ -95,7 +95,7 @@ static void *LCDFN(frameaddress_default)(int x, int y) | |||
95 | { | 95 | { |
96 | /* the default expects a buffer the same size as the screen */ | 96 | /* the default expects a buffer the same size as the screen */ |
97 | struct frame_buffer_t *fb = CURRENT_VP->buffer; | 97 | struct frame_buffer_t *fb = CURRENT_VP->buffer; |
98 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 98 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
99 | size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y; | 99 | size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y; |
100 | #else | 100 | #else |
101 | size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x; | 101 | size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x; |
diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c index 36144b574c..9feba9f894 100644 --- a/firmware/drivers/lcd-color-common.c +++ b/firmware/drivers/lcd-color-common.c | |||
@@ -76,7 +76,7 @@ static void *lcd_frameaddress_default(int x, int y) | |||
76 | /* the default expects a buffer the same size as the screen */ | 76 | /* the default expects a buffer the same size as the screen */ |
77 | struct frame_buffer_t *fb = lcd_current_viewport->buffer; | 77 | struct frame_buffer_t *fb = lcd_current_viewport->buffer; |
78 | 78 | ||
79 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 79 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
80 | size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; | 80 | size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; |
81 | #else | 81 | #else |
82 | size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; | 82 | size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; |
diff --git a/firmware/export/config.h b/firmware/export/config.h index 2519b87f0d..e83194e0f4 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -772,6 +772,11 @@ Lyre prototype 1 */ | |||
772 | #define LCD_SPLIT_LINES 0 | 772 | #define LCD_SPLIT_LINES 0 |
773 | #endif | 773 | #endif |
774 | 774 | ||
775 | /* Most displays have a horizontal stride */ | ||
776 | #ifndef LCD_STRIDEFORMAT | ||
777 | # define LCD_STRIDEFORMAT HORIZONTAL_STRIDE | ||
778 | #endif | ||
779 | |||
775 | /* Simulator LCD dimensions. Set to standard dimensions if undefined */ | 780 | /* Simulator LCD dimensions. Set to standard dimensions if undefined */ |
776 | #ifndef SIM_LCD_WIDTH | 781 | #ifndef SIM_LCD_WIDTH |
777 | #define SIM_LCD_WIDTH LCD_WIDTH | 782 | #define SIM_LCD_WIDTH LCD_WIDTH |
@@ -978,8 +983,7 @@ Lyre prototype 1 */ | |||
978 | || defined(CPU_S5L870X) || (CONFIG_CPU == S3C2440) \ | 983 | || defined(CPU_S5L870X) || (CONFIG_CPU == S3C2440) \ |
979 | || defined(APPLICATION) || (CONFIG_CPU == PP5002) \ | 984 | || defined(APPLICATION) || (CONFIG_CPU == PP5002) \ |
980 | || (CONFIG_CPU == RK27XX) || (CONFIG_CPU == IMX233) || \ | 985 | || (CONFIG_CPU == RK27XX) || (CONFIG_CPU == IMX233) || \ |
981 | (defined(HAVE_LCD_COLOR) && \ | 986 | (defined(HAVE_LCD_COLOR) && (LCD_STRIDEFORMAT == HORIZONTAL_STRIDE)) |
982 | (!defined(LCD_STRIDEFORMAT) || (LCD_STRIDEFORMAT != VERTICAL_STRIDE))) | ||
983 | #define HAVE_SEMAPHORE_OBJECTS | 987 | #define HAVE_SEMAPHORE_OBJECTS |
984 | #endif | 988 | #endif |
985 | 989 | ||
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 0edef7b866..67b22190ad 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -82,7 +82,7 @@ enum screen_type { | |||
82 | 82 | ||
83 | struct scrollinfo; | 83 | struct scrollinfo; |
84 | 84 | ||
85 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 85 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
86 | #define STRIDE_MAIN(w, h) (h) | 86 | #define STRIDE_MAIN(w, h) (h) |
87 | #else | 87 | #else |
88 | #define STRIDE_MAIN(w, h) (w) | 88 | #define STRIDE_MAIN(w, h) (w) |
@@ -496,7 +496,7 @@ typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits); | |||
496 | #endif | 496 | #endif |
497 | 497 | ||
498 | #ifndef LCD_NBELEMS | 498 | #ifndef LCD_NBELEMS |
499 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 499 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
500 | #define LCD_NBELEMS(w, h) (((w-1)*STRIDE_MAIN(w, h)) + h) | 500 | #define LCD_NBELEMS(w, h) (((w-1)*STRIDE_MAIN(w, h)) + h) |
501 | #else | 501 | #else |
502 | #define LCD_NBELEMS(w, h) (((h-1)*STRIDE_MAIN(w, h)) + w) | 502 | #define LCD_NBELEMS(w, h) (((h-1)*STRIDE_MAIN(w, h)) + w) |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index d952d3d40d..8620c672e1 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT | 39 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT |
40 | #define LCD_USE_DMA | 40 | #define LCD_USE_DMA |
41 | #elif defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 41 | #elif LCD_STRIDEFORMAT == VERTICAL_STRIDE |
42 | #define LCD_USE_DMA | 42 | #define LCD_USE_DMA |
43 | #endif | 43 | #endif |
44 | 44 | ||
@@ -511,7 +511,7 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
511 | 511 | ||
512 | #else | 512 | #else |
513 | 513 | ||
514 | #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE | 514 | #if LCD_STRIDEFORMAT == VERTICAL_STRIDE |
515 | 515 | ||
516 | #if defined(LCD_USE_DMA) | 516 | #if defined(LCD_USE_DMA) |
517 | dma_start_transfer16( (char *)FBADDR(0,0), x, y, LCD_HEIGHT, | 517 | dma_start_transfer16( (char *)FBADDR(0,0), x, y, LCD_HEIGHT, |
diff --git a/firmware/target/hosted/sdl/lcd-sdl.c b/firmware/target/hosted/sdl/lcd-sdl.c index de19de365a..8cbb6c5651 100644 --- a/firmware/target/hosted/sdl/lcd-sdl.c +++ b/firmware/target/hosted/sdl/lcd-sdl.c | |||
@@ -31,9 +31,9 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, | |||
31 | unsigned long (*getpixel)(int, int)) | 31 | unsigned long (*getpixel)(int, int)) |
32 | { | 32 | { |
33 | SDL_Rect dest; | 33 | SDL_Rect dest; |
34 | #if LCD_DEPTH >= 8 && (LCD_PIXELFORMAT == RGB565) \ | 34 | #if LCD_DEPTH >= 8 && (LCD_PIXELFORMAT == RGB565) && \ |
35 | && !defined(LCD_STRIDEFORMAT) && !defined(HAVE_LCD_SPLIT) \ | 35 | (LCD_STRIDEFORMAT == HORIZONTAL_STRIDE) && \ |
36 | && !defined(HAVE_REMOTE_LCD) | 36 | !defined(HAVE_LCD_SPLIT) && !defined(HAVE_REMOTE_LCD) |
37 | SDL_Rect src; | 37 | SDL_Rect src; |
38 | (void)max_x; | 38 | (void)max_x; |
39 | (void)max_y; | 39 | (void)max_y; |