MaartenBaert / ssr

SimpleScreenRecorder, a screen recorder for Linux
http://www.maartenbaert.be/simplescreenrecorder/
GNU General Public License v3.0
2.59k stars 291 forks source link

"Could not get the size of the OpenGL application" error when recording a Steam game with fglrx drivers #200

Open egeexyz opened 10 years ago

egeexyz commented 10 years ago

When trying to use OpenGL to record a game launched via Steam, the follow error occurs:

[PageRecord::StartOutput] Starting output ... [PageRecord::StartOutput] Error: Could not get the size of the OpenGL application. Either the application wasn't started correctly, or the application hasn't created an OpenGL window yet. If you want to start recording before starting the application, you have to enable scaling and enter the video size manually. [PageRecord::StartOutput] Error: Something went wrong during initialization.

Enabling the "scale video" feature results in an empty (5kb) video container.

Launching an OpenGL application that doesn't require Steam such as SuperTuxKart works fine.

The following methods were tried:

  1. Adding LD_PRELOAD... To the game's launch options
  2. Adding steam steam://rungameid/240 to the command option
  3. Launching Steam from the terminal with LD_PRELOAD... manually

All of these avenues result in the same error; it's like SSR doesn't think an OpenGL window is even running.

This doesn't appear to affect the radeon ati driver. I am using a Radeon R7 260x and performance is far greater with the fglrx. Using the radeonsi driver isn't an option.

I am using Ubuntu 14.04 (Unity) and the application I have been testing with is Counter Strike. Steam with Wine has the exact same issue.

egeexyz commented 10 years ago

This may be interesting. I launched both SuperTuxKart and Counter Strike from the terminal. Each returned distinctly different outputs.

SuperTuxKart: [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] GLFrameGrabber for [0xec01e0-0x4600002-0x4600003] created. [SSR-GLInject] OpenGL version = 4.4 (4.4.12967 Compatibility Profile Context 13.35.1005). [SSR-GLInject] GLFrameGrabber for [0xec01e0-0x4600002-0x4600003] frame size = 1680x1050

CounterStrike: [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library unloaded. [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library unloaded. [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library unloaded. [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library loaded (64-bit). [SSR-GLInject] Library successfully initialized.

MaartenBaert commented 10 years ago

The first step is figuring out whether this is a Steam or a Counter Strike problem. Have you tried the same with other Steam games?

The OpenGL recording system has been rewritten some time ago, but I haven't released the new version yet. You could try to compile SSR from source to get the new version, which may work better.

egeexyz commented 10 years ago

I've confirmed this issue with Counter Strike, Witcher 2, and Left 4 Dead 2, all launched through Steam. This also occurs with Steam through Wine.

Is it possible that the fglrx driver is doing something funky to the display when applications go full screen?

Also, notice that the only library being loaded is 64bit. I have the 32bit libraries installed.. Should it be using the 64 bit libraries? Could this be an artefact of something messed up on my machine?

egeexyz commented 10 years ago

I've attempted to build latest from source and have failed at configuration. The error that is occurring is here:

checking for GL/gl.h... yes checking for GL/glext.h... yes checking for GL/glx.h... yes checking for glPushAttrib in -lGL... no configure: error: required library missing

I've googled the missing library and have returned nothing. I've also built and compiled SSR many times in the past and I've never seen this error before. Apparently, Google hasn't either.

iamgreaser commented 10 years ago

Look through config.log, it should have some information as to why it's breaking.

egeexyz commented 10 years ago

Sounds like the issue goes a bit deeper than it seems at first glance:

configure:17453: checking for glPushAttrib in -lGL configure:17478: gcc -m32 -o conftest -Wall -O2 -pipe conftest.c -lGL >&5 /usr/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status

I'm not interested in debugging much further than this.

iamgreaser commented 10 years ago

Try configuring like so: ./configure LDFLAGS="-L/usr/local/lib"

egeexyz commented 10 years ago

Doing that just returned a bunch of other "/usr/bin/ld: cannot find ..." errors. I'm not interested in debugging this any further.

MaartenBaert commented 10 years ago

The fglrx driver is probably putting the 32-bit OpenGL libs in a weird place, so the compiler can't find them. But somehow the games still work. I haven't seen that before. If you change your mind, you should try to find out where fglrx puts the 32-bit libGL.so library, and maybe make some symlinks (it's explained in the README).

egeexyz commented 10 years ago

I'm using the latest fglrx driver (14.6 beta) from AMD's website. I don't recall when the problems started happening, that may be part of the problem here. I was unable to find any information about where AMD places the libGL libraries, only a diagram of it (which was useless).

I'm going to restore a backup of Ubuntu before I changed the graphics drivers and start from scratch.

Is it possible that during a driver update something got moved or linked to the wrong place and was never moved/linked back?

MaartenBaert commented 10 years ago

The drivers in the Ubuntu repositories are not identical to the ones from the AMD website (the same is true for NVidia, by the way). If you install the drivers manually, things can go wrong if you aren't careful (conflicts between the two closed-source drivers, or conflicts between the closed-source and open-source driver). I did all my testing with the fglrx driver from the repository, so that might explain the difference.

egeexyz commented 10 years ago

Interesting, I think we may have found the issue then. I'm going to reopen this issue and write up some test cases. I'll take snapshots of a new Ubuntu environment to keep things sanitized.

From what I recall I first installed an early version of fglrx from AMD's website, uninstalled it, installed the Ubuntu fglrx driver, uninstalled it, then installed the beta fglrx driver from AMD and used their new (beta) feature to create a distribution package for Ubuntu. I speculate this issue may have something to do with using either the beta or non beta driver from AMD before or after using the Ubuntu fglrx driver.

MaartenBaert commented 10 years ago

Yes, that's possible. The packages from the Ubuntu repository are relatively simple, AFAIK they just create some new files in the right places and that's it. The install scripts that AMD uses for manual installation are a bit more aggressive: I think they do things like blacklisting the open-source driver to avoid interference, messing with symlinks, renaming existing OpenGL libraries so they don't interfere, ...

It's hard to figure out what exactly happened after installing and uninstalling multiple drivers. The easiest solution is probably to start with a fresh environment.

egeexyz commented 10 years ago

I think the fundamental problem is the graphics card I am using. Both fglrx and radeonsi are at least a year behind as far as driver development on Linux is concerned. My Radeon R7 260x was released in October of 2013 (hasn't even been a year as of today). The open source support (radeonsi) is pretty much abysmal without using "xorg-edgers" and even then, support is sketchy. Support via fglrx is meagre at best and comes with it's own issues. To further compound the issue, the fglrx drivers in the base Ubuntu repository are appear to be 13.04, which don't even support my Radeon R7.

For what it's worth, I've written some test cases:

  1. Have/Use Radeon R7 260x with radeonsi driver
  2. Install Ubuntu 14.04 64bit
  3. Install Steam
  4. Install Simple Screen Recorder
  5. Initialize OpenGL Capture via SSR
  6. Launch Game (Counter Strike or Witcher 2)

Result: Error: Could not get the size of the OpenGL application. Side Note: Capturing "entire screen" works just fine

  1. Have/Use Radeon R7 260x with Ubuntu fglrx driver
  2. Install Ubuntu 14.04 64bit
  3. Install Steam
  4. Install Simple Screen Recorder
  5. Initialize OpenGL Capture via SSR
  6. Launch Game (Counter Strike or Witcher 2)

Result: Error: Could not get the size of the OpenGL application. Side Note: Capturing "entire screen" does NOT work (https://github.com/MaartenBaert/ssr/issues/128)

  1. Have/Use GeForce GTX 550 Ti with Ubuntu NVIDIA 331.38 driver (A card I had laying around)
  2. Install Ubuntu 14.04 64bit
  3. Install Steam
  4. Install Simple Screen Recorder
  5. Initialize OpenGL Capture via SSR
  6. Launch Game (Counter Strike or Witcher 2)

Result: Capturing OpenGL application works just fine Side Note: Capturing "entire screen" works just fine

I am a software development engineer in test in the real world and this is about as far as I'm going to test this issue. Until the Radeonsi or fglrx driver becomes more mature I'd say go ahead and label Radeon Rx 200 series of cards as having dodgy support at this point.

MaartenBaert commented 10 years ago

That's unfortunate. The new driver must be doing something weird with Steam (or just 32-bit) games. I guess you will have to wait until driver support improves a bit.

mashu commented 6 years ago

I have the same issue 2018. SSR works kind of randomly. Once it works, once I get errors that something is wrong.

[PageRecord::StartOutput] Error: Could not get the size of the OpenGL application. Either the application wasn't started correctly, or the application hasn't created an OpenGL window yet. If you want to start recording before starting the application, you have to enable scaling and enter the video size manually.
[PageRecord::StartOutput] Error: Something went wrong during initialization.