Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/libi386/vbe.c
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
* VESA BIOS Extensions routines | * VESA BIOS Extensions routines | ||||
*/ | */ | ||||
static struct vbeinfoblock *vbe; | static struct vbeinfoblock *vbe; | ||||
static struct modeinfoblock *vbe_mode; | static struct modeinfoblock *vbe_mode; | ||||
static uint16_t *vbe_mode_list; | static uint16_t *vbe_mode_list; | ||||
static size_t vbe_mode_list_size; | static size_t vbe_mode_list_size; | ||||
struct vesa_edid_info *edid_info = NULL; | |||||
/* The default VGA color palette format is 6 bits per primary color. */ | /* The default VGA color palette format is 6 bits per primary color. */ | ||||
int palette_format = 6; | int palette_format = 6; | ||||
#define VESA_MODE_BASE 0x100 | #define VESA_MODE_BASE 0x100 | ||||
/* | /* | ||||
* palette array for 8-bit indexed colors. In this case, cmap does store | * palette array for 8-bit indexed colors. In this case, cmap does store | ||||
▲ Show 20 Lines • Show All 769 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
printf("0x%x=%dx%dx%d", modenum, | printf("0x%x=%dx%dx%d", modenum, | ||||
mi->XResolution, mi->YResolution, mi->BitsPerPixel); | mi->XResolution, mi->YResolution, mi->BitsPerPixel); | ||||
} | } | ||||
static bool | static bool | ||||
vbe_get_edid(edid_res_list_t *res) | vbe_get_edid(edid_res_list_t *res) | ||||
{ | { | ||||
struct vesa_edid_info *edid_info; | struct vesa_edid_info *edidp; | ||||
const uint8_t magic[] = EDID_MAGIC; | const uint8_t magic[] = EDID_MAGIC; | ||||
int ddc_caps; | int ddc_caps; | ||||
bool ret = false; | bool ret = false; | ||||
if (edid_info != NULL) | |||||
return (gfx_get_edid_resolution(edid_info, res)); | |||||
ddc_caps = biosvbe_ddc_caps(); | ddc_caps = biosvbe_ddc_caps(); | ||||
if (ddc_caps == 0) { | if (ddc_caps == 0) { | ||||
return (ret); | return (ret); | ||||
} | } | ||||
edid_info = bio_alloc(sizeof (*edid_info)); | edidp = bio_alloc(sizeof(*edidp)); | ||||
if (edid_info == NULL) | if (edidp == NULL) | ||||
return (ret); | return (ret); | ||||
memset(edid_info, 0, sizeof (*edid_info)); | memset(edidp, 0, sizeof(*edidp)); | ||||
if (VBE_ERROR(biosvbe_ddc_read_edid(0, edid_info))) | if (VBE_ERROR(biosvbe_ddc_read_edid(0, edidp))) | ||||
goto done; | goto done; | ||||
if (memcmp(edid_info, magic, sizeof (magic)) != 0) | if (memcmp(edidp, magic, sizeof(magic)) != 0) | ||||
goto done; | goto done; | ||||
/* Unknown EDID version. */ | /* Unknown EDID version. */ | ||||
if (edid_info->header.version != 1) | if (edidp->header.version != 1) | ||||
goto done; | goto done; | ||||
ret = gfx_get_edid_resolution(edid_info, res); | ret = gfx_get_edid_resolution(edidp, res); | ||||
edid_info = malloc(sizeof(*edid_info)); | |||||
if (edid_info != NULL) | |||||
memcpy(edid_info, edidp, sizeof (*edid_info)); | |||||
done: | done: | ||||
bio_free(edid_info, sizeof (*edid_info)); | bio_free(edidp, sizeof(*edidp)); | ||||
return (ret); | return (ret); | ||||
} | } | ||||
static bool | static bool | ||||
vbe_get_flatpanel(uint32_t *pwidth, uint32_t *pheight) | vbe_get_flatpanel(uint32_t *pwidth, uint32_t *pheight) | ||||
{ | { | ||||
struct vesa_flat_panel_info *fp_info; | struct vesa_flat_panel_info *fp_info; | ||||
bool ret = false; | bool ret = false; | ||||
▲ Show 20 Lines • Show All 387 Lines • Show Last 20 Lines |