[haiku-commits] haiku: hrev50501 - src/add-ons/accelerants/vesa

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 20 Aug 2016 16:39:39 +0200 (CEST)

hrev50501 adds 1 changeset to branch 'master'
old head: 928f78f5a3877beb7823e84b435d14b7aeb60f0d
new head: e0c25f9892404842a8457561bc9bc67a82e366b6
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=e0c25f989240+%5E928f78f5a387

----------------------------------------------------------------------------

e0c25f989240: VESA: compare modes by index, instead of contents
  
  We only compared the height, width, and depth of modes to decide if the
  mode was already set. However, at boot, we may have these settings right
  and other things not properly configured, preventing VESA to set a
  working mode unless forced from the boot menu.
  
  Fixes #12918

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50501
Commit:      e0c25f9892404842a8457561bc9bc67a82e366b6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e0c25f989240
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sat Aug 20 13:14:51 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/12918

----------------------------------------------------------------------------

3 files changed, 8 insertions(+), 8 deletions(-)
src/add-ons/accelerants/vesa/accelerant.cpp |  1 +
src/add-ons/accelerants/vesa/accelerant.h   |  1 +
src/add-ons/accelerants/vesa/mode.cpp       | 14 ++++++--------

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/vesa/accelerant.cpp 
b/src/add-ons/accelerants/vesa/accelerant.cpp
index 77875ef..886d249 100644
--- a/src/add-ons/accelerants/vesa/accelerant.cpp
+++ b/src/add-ons/accelerants/vesa/accelerant.cpp
@@ -90,6 +90,7 @@ init_common(int device, bool isClone)
 
        gInfo->is_clone = isClone;
        gInfo->device = device;
+       gInfo->current_mode = UINT16_MAX;
 
        // get basic info from driver
 
diff --git a/src/add-ons/accelerants/vesa/accelerant.h 
b/src/add-ons/accelerants/vesa/accelerant.h
index 51bf68c..a820d1c 100644
--- a/src/add-ons/accelerants/vesa/accelerant.h
+++ b/src/add-ons/accelerants/vesa/accelerant.h
@@ -19,6 +19,7 @@ typedef struct accelerant_info {
        area_id                         mode_list_area;
                // cloned list of standard display modes
        display_mode            *mode_list;
+       uint16                          current_mode;
 
        vesa_mode                       *vesa_modes;
 } accelerant_info;
diff --git a/src/add-ons/accelerants/vesa/mode.cpp 
b/src/add-ons/accelerants/vesa/mode.cpp
index 054fc03..8dedbcd 100644
--- a/src/add-ons/accelerants/vesa/mode.cpp
+++ b/src/add-ons/accelerants/vesa/mode.cpp
@@ -162,13 +162,6 @@ vesa_set_display_mode(display_mode* _mode)
        if (vesa_propose_display_mode(&mode, &mode, &mode) != B_OK)
                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;
        for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
                // search mode in VESA mode list
@@ -177,7 +170,12 @@ vesa_set_display_mode(display_mode* _mode)
                        && modes[i].height == mode.virtual_height
                        && get_color_space_for_depth(modes[i].bits_per_pixel)
                                == mode.space) {
-                       return ioctl(gInfo->device, VESA_SET_DISPLAY_MODE, &i, 
sizeof(i));
+                       if (gInfo->current_mode == i)
+                               return B_OK;
+                       status_t result = ioctl(gInfo->device, 
VESA_SET_DISPLAY_MODE, &i, sizeof(i));
+                       if (result == B_OK)
+                               gInfo->current_mode = i;
+                       return result;
                }
        }
 


Other related posts: