Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » config_section=old

Credits go to Peter Wang for helping out!
This thread is locked; no one can reply to it. rss feed Print
config_section=old
Matthew Leverton
Supreme Loser
January 1999
avatar

xglx_config.c#SelectExpand
378static void select_best_visual(ALLEGRO_DISPLAY_XGLX *glx, 379 ALLEGRO_EXTRA_DISPLAY_SETTINGS* *eds, int eds_count, 380 bool using_fbc) 381{ 382 ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); 383 384 qsort(eds, eds_count, sizeof(*eds), _al_display_settings_sorter); 385
386 ASSERT(eds[0]);
387 388 if (!eds[0]->info) { 389 ALLEGRO_ERROR("No matching displays found.\n"); 390 glx->xvinfo = NULL; 391 return; 392 }

Using VirtualBox, the assert (added by me) is triggered. All 64 visuals are "incomplete", but it still says eds_count=64.

xgl_config.c#SelectExpand
226 ALLEGRO_INFO("%i formats.\n", num_fbconfigs); 227 228 for (i = 0; i < num_fbconfigs; i++) { 229 ALLEGRO_DEBUG("-- \n"); 230 ALLEGRO_DEBUG("Decoding visual no. %i...\n", i); 231 eds[i] = read_fbconfig(system->gfxdisplay, fbconfig[i]); 232 if (!eds[i])
233 continue;
234#ifdef DEBUGMODE 235 display_pixel_format(eds[i]); 236#endif 237 eds[i]->score = _al_score_display_settings(eds[i], ref); 238 if (eds[i]->score == -1) { 239 continue; 240 } 241 eds[i]->index = i; 242 eds[i]->info = al_malloc(sizeof(GLXFBConfig)); 243 memcpy(eds[i]->info, &fbconfig[i], sizeof(GLXFBConfig)); 244 } 245 246 *eds_count = i; 247 ALLEGRO_INFO("%i visuals are good enough.\n", i);

Could somebody who is familiar with this clean that up? It seems very sloppy to ignore NULL values, and still consider eds_count to equal i. It appears to me that you'd get 64 NULLs which are happily passed along.

I could hack in a check to switch to the old function if everything is NULL, but that isn't very proper.

With the following config, it works:

[graphics]
config_selection=old

Peter Wang
Member #23
April 2000

You mean like this? (not really tested)

Matthew Leverton
Supreme Loser
January 1999
avatar

Cannot really tell from that patch, but does this mean it will automatically fall back to "old" if "new" fails? I don't even know what's going on in that file or what the difference is between the two, so pardon my lack of effort in trying to do any debugging.

Peter Wang
Member #23
April 2000

It should do (fall back) although that wasn't what I was going for. Actually I wasn't sure what your bug report was about.

Matthew Leverton
Supreme Loser
January 1999
avatar

Running Ubuntu under a VM triggers the behavior of those NULL values and crash on every created display.

Using the config to skip that function "fixes" it. People complain about it from time to time (not sure under what environment), and usually Elias stops by to tell them to create an allegro5.cfg with the above settings.

Update:

The patch seems to work. I just applied it as-is, and the examples all run.

Peter Wang
Member #23
April 2000

I always assumed that the crash was due to a bug in the newer GLX functions, otherwise why did Milan make it a configurable option? I will apply the patch.

Don Freeman
Member #5,110
October 2004
avatar

Matt what was the host system when you ran the VM?

--
"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

Matthew Leverton
Supreme Loser
January 1999
avatar

Go to: