vesa: don't switch to the current mode.
* If a mode change is requested, check if it is equivalent to the current one, and don't do anything in this case.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2011, Axel Dörfler, [email protected].
|
* Copyright 2005-2015, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -162,6 +162,13 @@ vesa_set_display_mode(display_mode* _mode)
|
|||||||
if (vesa_propose_display_mode(&mode, &mode, &mode) != B_OK)
|
if (vesa_propose_display_mode(&mode, &mode, &mode) != B_OK)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
if (gInfo->shared_info->current_mode.virtual_width == mode.virtual_width
|
||||||
|
&& gInfo->shared_info->current_mode.virtual_height
|
||||||
|
== mode.virtual_height
|
||||||
|
&& gInfo->shared_info->current_mode.space == mode.space) {
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
vesa_mode* modes = gInfo->vesa_modes;
|
vesa_mode* modes = gInfo->vesa_modes;
|
||||||
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
|
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
|
||||||
// search mode in VESA mode list
|
// search mode in VESA mode list
|
||||||
@@ -169,8 +176,9 @@ vesa_set_display_mode(display_mode* _mode)
|
|||||||
if (modes[i].width == mode.virtual_width
|
if (modes[i].width == mode.virtual_width
|
||||||
&& modes[i].height == mode.virtual_height
|
&& modes[i].height == mode.virtual_height
|
||||||
&& get_color_space_for_depth(modes[i].bits_per_pixel)
|
&& get_color_space_for_depth(modes[i].bits_per_pixel)
|
||||||
== mode.space)
|
== mode.space) {
|
||||||
return ioctl(gInfo->device, VESA_SET_DISPLAY_MODE, &i, sizeof(i));
|
return ioctl(gInfo->device, VESA_SET_DISPLAY_MODE, &i, sizeof(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
|
|||||||
Reference in New Issue
Block a user