Skip to content

Commit b70c59c

Browse files
committed
Support 16/32 bit color depth
Mado currently supports 32-bit color depth for desktop and laptop display devices. To enhance its compatibility across diverse Linux framebuffer environments, I have made the following changes to support both 16-bit and 32-bit color depths: - Distinguish the color format and perform color format conversion. - Examine the correctness of the framebuffer format based on the color format. These updates improve Mado's compatibility, enabling it to be used on devices with low memory overhead, such as the Raspberry Pi, in addition to desktop display devices.
1 parent a4f2521 commit b70c59c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

backend/fbdev.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,21 @@ static bool twin_fbdev_work(void *closure)
123123
return true;
124124
}
125125

126-
static bool twin_fbdev_is_rgb565(twin_fbdev_t *tx)
126+
static inline bool twin_fbdev_is_rgb565(twin_fbdev_t *tx)
127127
{
128128
return tx->fb_var.red.offset == 11 && tx->fb_var.red.length == 5 &&
129129
tx->fb_var.green.offset == 5 && tx->fb_var.green.length == 6 &&
130130
tx->fb_var.blue.offset == 0 && tx->fb_var.blue.length == 5;
131131
}
132132

133-
static bool twin_fbdev_is_rgb888(twin_fbdev_t *tx)
133+
static inline bool twin_fbdev_is_rgb888(twin_fbdev_t *tx)
134134
{
135135
return tx->fb_var.red.offset == 16 && tx->fb_var.red.length == 8 &&
136136
tx->fb_var.green.offset == 8 && tx->fb_var.green.length == 8 &&
137137
tx->fb_var.blue.offset == 0 && tx->fb_var.blue.length == 8;
138138
}
139139

140-
static bool twin_fbdev_is_argb32(twin_fbdev_t *tx)
140+
static inline bool twin_fbdev_is_argb32(twin_fbdev_t *tx)
141141
{
142142
return tx->fb_var.red.offset == 16 && tx->fb_var.red.length == 8 &&
143143
tx->fb_var.green.offset == 8 && tx->fb_var.green.length == 8 &&
@@ -169,19 +169,19 @@ static bool twin_fbdev_apply_config(twin_fbdev_t *tx)
169169

170170
/* Examine the framebuffer format */
171171
switch (tx->fb_var.bits_per_pixel) {
172-
case 16: // RGB565
172+
case 16: /* RGB565 */
173173
if (!twin_fbdev_is_rgb565(tx)) {
174174
log_error("Invalid framebuffer format for 16 bpp");
175175
return false;
176176
}
177177
break;
178-
case 24: // RGB888
178+
case 24: /* RGB888 */
179179
if (!twin_fbdev_is_rgb888(tx)) {
180180
log_error("Invalid framebuffer format for 24 bpp");
181181
return false;
182182
}
183183
break;
184-
case 32: // ARGB32
184+
case 32: /* ARGB32 */
185185
if (!twin_fbdev_is_argb32(tx)) {
186186
log_error("Invalid framebuffer format for 32 bpp");
187187
return false;

0 commit comments

Comments
 (0)