diff --git a/src/display.c b/src/display.c index 42a5ec30..21ef7304 100644 --- a/src/display.c +++ b/src/display.c @@ -199,7 +199,11 @@ static int display_start_dcp(void) return 0; } -int display_parse_mode(const char *config, dcp_timing_mode_t *mode) +struct display_options { + bool retina; +}; + +int display_parse_mode(const char *config, dcp_timing_mode_t *mode, struct display_options *opts) { memset(mode, 0, sizeof(*mode)); @@ -226,6 +230,13 @@ int display_parse_mode(const char *config, dcp_timing_mode_t *mode) } } + const char *option = config; + while (option && opts) { + if (!strncmp(option + 1, "retina", 6)) + opts->retina = true; + option = strchr(option + 1, ','); + } + printf("display: want mode: valid=%d %dx%d %d.%02d Hz\n", mode->valid, mode->width, mode->height, mode->fps >> 16, ((mode->fps & 0xffff) * 100 + 0x7fff) >> 16); @@ -274,8 +285,9 @@ static int display_swap(u64 iova, u32 stride, u32 width, u32 height) int display_configure(const char *config) { dcp_timing_mode_t want; + struct display_options opts = {0}; - display_parse_mode(config, &want); + display_parse_mode(config, &want, &opts); int ret = display_start_dcp(); if (ret < 0) @@ -422,7 +434,7 @@ int display_configure(const char *config) cur_boot_args.video.stride = stride; cur_boot_args.video.width = tbest.width; cur_boot_args.video.height = tbest.height; - cur_boot_args.video.depth = 30; + cur_boot_args.video.depth = 30 | (opts.retina ? FB_DEPTH_FLAG_RETINA : 0); fb_reinit(); } diff --git a/src/fb.c b/src/fb.c index 49be944c..27a54e74 100644 --- a/src/fb.c +++ b/src/fb.c @@ -10,8 +10,7 @@ #include "utils.h" #include "xnuboot.h" -#define FB_DEPTH_FLAG_RETINA 0x10000 -#define FB_DEPTH_MASK 0xff +#define FB_DEPTH_MASK 0xff fb_t fb; diff --git a/src/fb.h b/src/fb.h index c79ac313..e3002b01 100644 --- a/src/fb.h +++ b/src/fb.h @@ -5,6 +5,8 @@ #include "types.h" +#define FB_DEPTH_FLAG_RETINA 0x10000 + typedef struct { u32 *ptr; /* pointer to the start of the framebuffer */ u32 *hwptr; /* pointer to the start of the real framebuffer */