Proper way for redirect or disable stderr for libva messages

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
alanwww1 Offline
Team-XBMC Member
Posts: 1,299
Joined: Nov 2008
Reputation: 31
Location: Hungary
Post: #1
I noticed that after each movie opened with vaapi, libva prints out a log message to stderr. It trashes the terminal after a few movies completely like this:

Code:
~$ xbmc
libva: libva version 0.32.0
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/i965_drv_video.so
libva: va_openDriver() returns 0
libva: libva version 0.32.0
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/i965_drv_video.so
libva: va_openDriver() returns 0
libva: libva version 0.32.0
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/i965_drv_video.so
libva: va_openDriver() returns 0

in libva the line looks like this:

Code:
va_infoMessage("Trying to open %s\n", driver_path);

Code:
void va_infoMessage(const char *msg, ...)
{
    va_list args;

    fprintf(stderr, "libva: ");
    va_start(args, msg);
    vfprintf(stderr, msg, args);
    va_end(args);
}

In xbmc the initalization function is called like this.

Code:
VADisplay disp;
  disp = vaGetDisplayGLX(g_Windowing.GetDisplay());

  int major_version, minor_version;
  VAStatus res = vaInitialize(disp, &major_version, &minor_version);

  if(res != VA_STATUS_SUCCESS)
  {
    CLog::Log(LOGERROR, "VAAPI - unable to initialize display %d - %s", res, vaErrorStr(res));
    return display;
  }

  CLog::Log(LOGDEBUG, "VAAPI - initialize version %d.%d", major_version, minor_version);
  display = CDisplayPtr(new CDisplay(disp));
  display_global = display;
  return display;

Is there a way to completely redirect these messages to the xbmc log file ? How to do this properly ?

If not is there a way to completely disable them ? After all we already haver a debug info logged about the status of the opening and the version of libva.

Thanks,

Alan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
spiff Offline
Grumpy Bastard Developer
Posts: 12,172
Joined: Nov 2003
Reputation: 81
Post: #2
correct way is for libva to have log callbacks. only way to do it otherwise, as far as i know (don't have the details here), is to use freopen (stderr), but that's not really nice as that is application wide..

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
alanwww1 Offline
Team-XBMC Member
Posts: 1,299
Joined: Nov 2008
Reputation: 31
Location: Hungary
Post: #3
Thanks Spiff !

I'll contact Gwenole if there is a possibility to handle this in libva.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote