Problem with display destruction order
Vaelin

If I run the code below without the reversing I get an error:

 Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  159 (ATIFGLEXTENSION)
  Minor opcode of failed request:  73 ()
  Value in failed request:  0x1200004
  Serial number of failed request:  203
  Current serial number in output stream:  205

Is this a bug or am I missing something?
System: Linux 3.13.0-54-generic #91-Ubuntu SMP Tue May 26 19:15:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Allegro: 5.0.10

#SelectExpand
1#include <iostream> 2#include <vector> 3#include <allegro5/allegro.h> 4#include <algorithm> 5 6int main() 7{ 8 if(!al_init()) { 9 fprintf(stderr, "failed to initialize allegro!\n"); 10 return -1; 11 } 12 13 std::vector<ALLEGRO_DISPLAY*> v; 14 15 for (uint i = 0; i < 10; ++i) 16 { 17 v.push_back(al_create_display(320, 240)); 18 } 19 20 std::reverse(v.begin(), v.end()); 21 22 for (uint i = 0; i < 10; ++i) 23 { 24 al_set_target_bitmap(nullptr); 25 al_destroy_display(v[i]); 26 } 27 28 return 0; 29}

pkrcel

That's an error with the AMD video driver, following what google says.

It's kinda weird, looking from here, there would be no strict need to reverse the order of destruction of displays...

I don't think this strictly relates to Allegro, but a fellow Linux user mught try this out on a different platform

SiegeLord

I can reproduce this (also with an AMD card). The error message comes about after a call to XCloseDisplay in src/x/xystem.c:127. Not sure what the issue is just yet.

Thomas Fjellstrom

I'm curious if it happens with any number of displays? 2? 3? 5? 10? Maybe AMD has a stupid limit to the number of display contexts open?

SiegeLord

I got it to happen with just two displays.

EDIT: I should note that, perhaps obviously, the real issue is whether or not the first display created is destroyed before any other display is destroyed. Something in the code makes the first display special, such that when it gets destroyed, it invalidates something somewhere. I don't really know where to start, however.

beoran

Well then, the time being, let's document this limitation.

pkrcel

Is this related to linux only and AMD cards only maybe?

I'm sorry I can't be more helpful but I am unable to run anything Allegro related by now.

Thomas Fjellstrom
SiegeLord said:

I don't really know where to start, however.

If what you said is the case, maybe allegro is telling it to invalidate all contexts created by the app? Or if context sharing is enabled, the first one is probably the "parent" context, and manages the resources, where as the rest of them are sharing the resources of the main one (though I didn't think we supported that yet).

J-Gamer

I can attest that it seems to be a Linux-only bug, tried on Windows with an AMD card, no crash.

pkrcel

Shoudl try forcing use of the OPENGL driver thou.

Thomas Fjellstrom

There is only one driver on linux. OpenGL. Unless of course you mean he should test with forcing opengl on windows... then never mind. ;D.

SiegeLord

What'd really be useful is if someone tested this with anything but an AMD card on Linux :P.

Izual

Lubuntu Linux
Nvidia GeeForce 9600GT
Allegro 5.1.11
gcc 4.8.4

The program compiles, runs and exits without any errors.

SiegeLord

Izual, just to be sure, did you comment out the std::reverse call in that code? The code is set to work ok by default and you need to do that modification to trigger the issue (on AMD cards at least).

Izual

Duh, so much for reading only the last post carefully. :-/

I have set-up allegro on my work notebook. It has some kind of Intel gen3 VGA.
Again on Lubuntu and gcc 4.8.4 and this time without the reverse. ;D

The results are the same, compiles, runs and exits without any error.

When i get home i will try it on my Nvidia card again.

EDIT:
The code with removed std::reverse also works and exits without any error on my Nvidia 9600GT.

SiegeLord

Awesome, thanks Izual. You're a very tedious boss in Diablo II btw.

NVidia is known to be more tolerant to garbage input, but at least this means we're not doing something so crazy that even NVidia rejects it. Since it works on Intel, however, it does seem like it might be AMD only... I'm not sure how to proceed though, hah. Ideally we'd find some workaround, since AMD is our #1 platform (because it's what I use on my desktop 8-)).

Thread #615466. Printed from Allegro.cc