[haiku-bugs] Re: [Haiku] #4166: Recent changes to video modes seem to have removed some modes.

  • From: "bga" <trac@xxxxxxxxxxxx>
  • Date: Mon, 08 Aug 2011 15:00:11 -0000

#4166: Recent changes to video modes seem to have removed some modes.
--------------------------------+---------------------------
   Reporter:  bga               |      Owner:  axeld
       Type:  bug               |     Status:  new
   Priority:  normal            |  Milestone:  R1
  Component:  Drivers/Graphics  |    Version:  R1/pre-alpha1
 Resolution:                    |   Keywords:
 Blocked By:                    |   Blocking:
Has a Patch:  0                 |   Platform:  All
--------------------------------+---------------------------

Comment (by bga):

 Ok, I guess I figured it out.

 The problem is that the EDID info does not contain all modes that are
 supported for some reason while the vesa modes list does. In
 vesa/mode.cpp, there is the following code:

 {{{
 /*!     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};

         // Create the initial list from the support mode list - but only
 if we don't
         // have EDID info available, as that should be good enough.
         display_mode* initialModes = NULL;
         uint32 initialModesCount = 0;
         if (!gInfo->shared_info->has_edid) {
                 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 =
 gInfo->shared_info->vesa_mode_count; i-- > 0;) {
                                 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]);
                         }
                 }
         }

         gInfo->mode_list_area = create_display_modes("vesa modes",
                 gInfo->shared_info->has_edid ?
 &gInfo->shared_info->edid_info : NULL,
                 initialModes, initialModesCount,
                 kVesaSpaces, sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]),
                 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;
 }
 }}}

 The initial mode list does not include the vesa modes if EDID information
 is present. I got it working as expected by simply removing the check for
 has_edid. This wll populate the initila mode list with the vesa modes and,
 then, the mode I want will be picked up later as expected and I will be
 able to select it.

 Does this change seem reasonable? It seems, based on the comment in the
 code, that not filling the initial mode list with the vesa modes when we
 have EDID is simply an optimization and does not really serve any other
 purpose and the EDID info alone is not "good enough", as can be noticed in
 my case.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/4166#comment:20>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: