mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-22 14:43:08 +00:00
display: Add 'retina' flag to display_parse_mode
Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
parent
7f4347ebe8
commit
8147c2d374
3 changed files with 18 additions and 5 deletions
|
@ -199,7 +199,11 @@ static int display_start_dcp(void)
|
||||||
return 0;
|
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));
|
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,
|
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);
|
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)
|
int display_configure(const char *config)
|
||||||
{
|
{
|
||||||
dcp_timing_mode_t want;
|
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();
|
int ret = display_start_dcp();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -422,7 +434,7 @@ int display_configure(const char *config)
|
||||||
cur_boot_args.video.stride = stride;
|
cur_boot_args.video.stride = stride;
|
||||||
cur_boot_args.video.width = tbest.width;
|
cur_boot_args.video.width = tbest.width;
|
||||||
cur_boot_args.video.height = tbest.height;
|
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();
|
fb_reinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
src/fb.c
3
src/fb.c
|
@ -10,8 +10,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "xnuboot.h"
|
#include "xnuboot.h"
|
||||||
|
|
||||||
#define FB_DEPTH_FLAG_RETINA 0x10000
|
#define FB_DEPTH_MASK 0xff
|
||||||
#define FB_DEPTH_MASK 0xff
|
|
||||||
|
|
||||||
fb_t fb;
|
fb_t fb;
|
||||||
|
|
||||||
|
|
2
src/fb.h
2
src/fb.h
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#define FB_DEPTH_FLAG_RETINA 0x10000
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 *ptr; /* pointer to the start of the framebuffer */
|
u32 *ptr; /* pointer to the start of the framebuffer */
|
||||||
u32 *hwptr; /* pointer to the start of the real framebuffer */
|
u32 *hwptr; /* pointer to the start of the real framebuffer */
|
||||||
|
|
Loading…
Reference in a new issue