Example #1
0
/*!	Creates the initial mode list of the primary accelerant.
	It's called from vesa_init_accelerant().
*/
status_t
create_mode_list(void)
{
	const color_space kVesaSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE,
		B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8};
	const color_space kUefiSpaces[] = {
		(color_space)gInfo->shared_info->current_mode.space
	};

	uint32 initialModesCount = 0;
	bool vesaAvailable = gInfo->vesa_modes != NULL;

	// Add initial VESA modes.
	display_mode* initialModes = NULL;
	if (vesaAvailable) {
		initialModes = (display_mode*)malloc(
			sizeof(display_mode) * gInfo->shared_info->vesa_mode_count);
	}

	if (initialModes != NULL) {
		initialModesCount = gInfo->shared_info->vesa_mode_count;
		vesa_mode* vesaModes = gInfo->vesa_modes;

		for (uint32 i = 0; i < initialModesCount; i++) {
			compute_display_timing(vesaModes[i].width, vesaModes[i].height,
				60, false, &initialModes[i].timing);
			fill_display_mode(vesaModes[i].width, vesaModes[i].height,
				&initialModes[i]);
		}
	} else {
		// UEFI doesn't give us any VESA modes
		initialModes = (display_mode*)malloc(sizeof(display_mode));
		if (initialModes != NULL) {
			initialModesCount = 1;

			compute_display_timing(initialModes[0].virtual_width,
				initialModes[0].virtual_height, 60, false,
				&initialModes[0].timing);
			fill_display_mode(initialModes[0].virtual_width,
				initialModes[0].virtual_height, &initialModes[0]);
		}
	}

	const color_space *colorSpaces = vesaAvailable ? kVesaSpaces : kUefiSpaces;
	size_t colorSpaceCount = vesaAvailable ?
		sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]) : 1;

	gInfo->mode_list_area = create_display_modes("vesa modes",
		gInfo->shared_info->has_edid ? &gInfo->shared_info->edid_info : NULL,
		initialModes, initialModesCount, colorSpaces, colorSpaceCount,
		is_mode_supported, &gInfo->mode_list, &gInfo->shared_info->mode_count);

	free(initialModes);

	if (gInfo->mode_list_area < 0)
		return gInfo->mode_list_area;

	gInfo->shared_info->mode_list_area = gInfo->mode_list_area;
	return B_OK;
}
Example #2
0
/*!	Creates the initial mode list of the primary accelerant.
	It's called from vesa_init_accelerant().
*/
status_t
create_mode_list(void)
{
	const color_space colorspace[] = {
		(color_space)gInfo->shared_info->current_mode.space
	};
	display_mode mode = gInfo->shared_info->current_mode;

	compute_display_timing(mode.virtual_width, mode.virtual_height, 60, false,
		&mode.timing);
	fill_display_mode(mode.virtual_width, mode.virtual_height, &mode);

	gInfo->mode_list_area = create_display_modes("framebuffer modes",
		NULL, &mode, 1, colorspace, 1, is_mode_supported, &gInfo->mode_list,
		&gInfo->shared_info->mode_count);

	if (gInfo->mode_list_area < 0)
		return gInfo->mode_list_area;

	gInfo->shared_info->mode_list_area = gInfo->mode_list_area;
	return B_OK;
}