Homesource Forums

Homeworld Source Editing Talk
It is currently Mon Apr 24, 2017 9:54 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 20 posts ] 
Author Message
 Post subject: Segfault
PostPosted: Tue Jan 27, 2009 10:48 pm 
Offline

Joined: Wed Jan 14, 2009 8:33 pm
Posts: 1
I checked out the latest svn and it compiled ok. I set HW_CDROM to
the path my Homeworld CD is mounted on. When I run 'homeworld' all
it does is seg fault. Here is all the console output I get:

Quote:
hatta@debian:~/homeworld-svn/homeworld/Linux/src$ ls
Game homeworld homeworld.o Makefile Missions obj SDL Ships ThirdParty
hatta@debian:~/homeworld-svn/homeworld/Linux/src$ ./homeworld
Segmentation fault


Any thoughts? The operating system is Debian Sid.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Sun Feb 01, 2009 6:55 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

From memory, the first time the game runs it doesn't have access to a lot of the config entries as they're not created.

Try copying the binary into the folder where the game is installed and running it from there. There is a different environment variable but I cannot remember what it is without checking.

I think we need some installation notes somewhere. :(

Aunxx.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Tue Feb 24, 2009 2:39 am 
Offline

Joined: Sun Feb 22, 2009 7:10 pm
Posts: 7
I have the same problem. Here is what happens when running the binary from the homeworld directory:
Code:
 
: /home/thomas/games/homeworld/Homeworld                            !1418 23:34
:; ./homeworld
      42 files found in Update.big
   13851 files found in Homeworld.big
Segmentation fault
 : /home/thomas/games/homeworld/Homeworld                            !1419 23:34
 :;


this is with r676 with and without the --enable-linuxfixme configure flag.

SDL 1.2.13

any ideas?


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Tue Feb 24, 2009 2:54 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.
The --disable-linuxfixme configure option is really for development only so we can test and replace some of the kludges.
Can you try the following.
Code:
make clean
../configure
make

from the Linux folder please?

Once that has compiled copy the src/homeworld binary into the folder where you've the Homeworld .big files (Homeworld.big, HW_Music.wxd, et al)
cd into that folder and then run the binary with ./homeworld

I see you've run the game from the homeworld folder initially, so can you check to see if the following file has been created ~/.homeworld/Homeworld.cfg
If it has and there is a HomeworldDataPath value defined then you can run the binary from anywhere. (hopefully)

If this still doesn't work then post again and we'll try some other things.

we really,really must write an up-to-date install guide. :)

Aunxx


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Tue Feb 24, 2009 3:15 am 
Offline

Joined: Sun Feb 22, 2009 7:10 pm
Posts: 7
Thanks!
Recompiled, still segfaults though.
No Homeworld.cfg in ~/.homeworld/, all I have is ~/.homeworld/reg, which is an empty file.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Tue Feb 24, 2009 3:34 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

Okay, looks like it's not getting to the point of writing that file yet then.
Two thoughts at the moment.
1) Have you tried running the game as root? This is usually a bad thing to do but will show us if there is a permissions related problem, probably with accessing the graphics card.
2) I think that there was an issue regarding the naming of libGL so could you try and find libGL.so on your file system? It can be found using
Code:
find / -name libGL.so
but you'll probably get a lot of errors relating to permissions.
If it is there, make sure it's pointing to the correct version of libGL.


Aunxx


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Tue Feb 24, 2009 10:46 am 
Offline

Joined: Sun Feb 22, 2009 7:10 pm
Posts: 7
libGL.so points to libGL.so.1, which in turn points to libGL.so.1.2, so I don't think that's the problem... here is the last part of "#strace ./homeworld" if it's any help:
Code:
........
open("/usr/lib/libdrm.so.2", O_RDONLY)  = 7
read(7, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320 \0\0004\0\0\0t"..., 512) = 512
fstat64(7, {st_mode=S_IFREG|0755, st_size=33903, ...}) = 0
mmap2(NULL, 31528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 7, 0) = 0xb3ad2000
mmap2(0xb3ad9000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x6) = 0xb3ad9000
close(7)                                = 0
open("/lib/librt.so.1", O_RDONLY)       = 7
read(7, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240\30\0\0004\0\0\0\234"..., 512) = 512
fstat64(7, {st_mode=S_IFREG|0755, st_size=39252, ...}) = 0
mmap2(NULL, 33364, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 7, 0) = 0xb3ac9000
mmap2(0xb3ad0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x6) = 0xb3ad0000
close(7)                                = 0
mprotect(0xb3ad0000, 4096, PROT_READ)   = 0
munmap(0xb3cea000, 86272)               = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
rt_sigaction(SIGSEGV, {SIG_DFL, [SEGV], SA_RESTART}, {0xb7f20280, [], 0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [INT], SA_RESTART}, {0xb7f27900, [INT], SA_RESTART}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [TERM], SA_RESTART}, {0xb7f27900, [TERM], SA_RESTART}, 8) = 0
select(6, [5], [5], NULL, NULL)         = 1 (out [5])
writev(5, [{"_\1\2\0\v\0\300\0+\0\1\0"..., 12}, {NULL, 0}, {""..., 0}], 3) = 12
select(6, [5], [], NULL, NULL)          = 1 (in [5])
read(5, "\1\1M\0\0\0\0\0\"\0\200\0\0\0\0\0\4\0\0\0w\0\0\0xG\334\t\0\0\0\0"..., 4096) = 32
read(5, 0x84cd748, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
select(7, [6], [6], NULL, NULL)         = 1 (out [6])
writev(6, [{"+\0\1\0"..., 4}, {NULL, 0}, {""..., 0}], 3) = 4
select(7, [6], [], NULL, NULL)          = 1 (in [6])
read(6, "\1\1\7\0\0\0\0\0\"\0\200\0\0\0\0\0\4\0\0\0w\0\0\0\270\363F\t\0\0\0\0"..., 4096) = 32
read(6, 0x84d73c0, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
munmap(0xb3a88000, 237568)              = 0
select(6, [5], [5], NULL, NULL)         = 1 (out [5])
writev(5, [{"\n\1\2\0\3\0\300\0O\0\2\0\1\0\300\0l\1\1\0"..., 20}, {NULL, 0}, {""..., 0}], 3) = 20
select(6, [5], [], NULL, NULL)          = 1 (in [5])
read(5, "\1\0P\0\0\0\0\0\0\0X\2\1\1\0\0\4\0\0\0w\0\0\0xG\334\t\0\0\0\0"..., 4096) = 32
read(5, 0x84cd748, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
select(6, [5], [5], NULL, NULL)         = 1 (out [5])
writev(5, [{"k\1\3\0X\2X\2\1\1\2\0\212\4\1\0_\1\2\0\7\0\300\0+\0\1\0"..., 28}, {NULL, 0}, {""..., 0}], 3) = 28
select(6, [5], [], NULL, NULL)          = 1 (in [5])
read(5, "\1\1T\0\0\0\0\0\"\0\200\0\0\0\0\0\4\0\0\0\0\0\0\0xG\334\t\0\0\0\0"..., 4096) = 32
read(5, 0x84cd748, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
select(7, [6], [6], NULL, NULL)         = 1 (out [6])
writev(6, [{"<\0\2\0\0\0\340\0+\0\1\0"..., 12}, {NULL, 0}, {""..., 0}], 3) = 12
select(7, [6], [], NULL, NULL)          = 1 (in [6])
read(6, "\1\1\t\0\0\0\0\0\"\0\200\0\0\0\0\0\4\0\0\0w\0\0\0\270\363F\t\0\0\0\0"..., 4096) = 32
read(6, 0x84d73c0, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
close(6)                                = 0
select(6, [5], [5], NULL, NULL)         = 1 (out [5])
writev(5, [{"<\1\2\0\0\0\300\0+\1\1\0"..., 12}, {NULL, 0}, {""..., 0}], 3) = 12
select(6, [5], [], NULL, NULL)          = 1 (in [5])
read(5, "\1\1V\0\0\0\0\0\"\0\200\0\0\0\0\0\4\0\0\0w\0\0\0xG\334\t\0\0\0\0"..., 4096) = 32
read(5, 0x84cd748, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
close(5)                                = 0
munmap(0xb3ada000, 408960)              = 0
munmap(0xb809f000, 19200)               = 0
munmap(0xb3b5a000, 9132)                = 0
munmap(0xb3b58000, 5600)                = 0
munmap(0xb3b47000, 68176)               = 0
munmap(0xb3ad2000, 31528)               = 0
munmap(0xb3cdb000, 59936)               = 0
rt_sigaction(SIGSEGV, NULL, {SIG_DFL, [SEGV], SA_RESTART}, 8) = 0
rt_sigaction(SIGBUS, NULL, {0xb7f20280, [], 0}, 8) = 0
rt_sigaction(SIGBUS, {SIG_DFL, [], 0}, NULL, 8) = 0
rt_sigaction(SIGFPE, NULL, {0xb7f20280, [], 0}, 8) = 0
rt_sigaction(SIGFPE, {SIG_DFL, [], 0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {0xb7f20280, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, NULL, 8) = 0
tgkill(3172, 3172, SIGSEGV)             = 0
sigreturn()                             = ? (mask now [])
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


Running as root segfaults as well. I'll try messing with xorg.conf, since the video card runs kind of poorly right now anyway (very slow flash, etc.). My videocard is an ATI Radeon Mobility M6 LY, and I'm using the open source drivers.
Thanks!

EDIT: Turned all Options in xorg.conf concerning the video card off, which had no effect. I don't think it's even the video card, since the screen doesn't even flicker on startup, just an immediate segfault :/


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Wed Feb 25, 2009 2:17 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

The strace all looks fine. I cannot see anything which points to a file problem.
can you try
Code:
 glxinfo | grep glx
for me please? It should show a bit about how the openGL is configured.
You can also test that GL is running correctly with a program like glxgears.

I cannot comment on the functionality of the open source drivers with homeworld, but I assume that they should be fine. Personally, I use the fglrx drivers from ATI and apart from finding a problem with the later drivers not supporting my laptop properly they seemed to be better. However it's been a while since I tried the open source drivers so I could be well out of date. :)

Aunxx.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Wed Feb 25, 2009 2:27 am 
Offline

Joined: Sun Feb 22, 2009 7:10 pm
Posts: 7
Hey,

glxinfo | grep glx gives:
Code:
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
client glx vendor string: SGI
client glx version string: 1.4
client glx extensions:


server and client are running different versions of glx? Is this normal? glxgears gives me gears.. :)

Maybe I'll try the fglrx drivers, but I think my card is so old it's not even supported.

/Thomas


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Wed Feb 25, 2009 7:42 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
The version doesn't matter, as they're above/equal to1.2.

Have you ever used a debugger?

Can you try
Code:
 gdb ./homeworld
run /window


The first command starts the debugger, and the second starts the game but in windowed mode. This is important because if the game crashes in GL mode you cannot get your screen back.

then when the game crashes you should be able to enter
Code:
bt full

To exit the debugger use quit
Can you then post the results and I should be able to see why the game's crashing.

Aunxx


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Wed Feb 25, 2009 1:47 pm 
Offline

Joined: Sun Feb 22, 2009 7:10 pm
Posts: 7
OK here is the output from gdb:
Code:
(gdb) run /window
Starting program: /home/thomas/games/homeworld/Homeworld/homeworld /window
[Thread debugging using libthread_db enabled]
      42 files found in Update.big
   13851 files found in Homeworld.big
[New Thread 0xb7be4a90 (LWP 11094)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7be4a90 (LWP 11094)]
0xb39b05d6 in glGetString () from /usr/lib/libGL.so
(gdb) bt full
#0  0xb39b05d6 in glGetString () from /usr/lib/libGL.so
No symbol table info available.
#1  0x080733b9 in glCapStartup () at ../../../src/SDL/glcaps.c:609
   i = <value optimized out>
   data = "\030\202ä¿\017\000\000\000\000\000\000\000ä\206ä¿ô?׷\000\200ô·p\000\000\000À\177ô·T\202ä¿Àmü\bm\226ó·À\177ô·À'ü\b\220\202ä¿P\202ä¿Ê\230ó·\220\202信úK\005êG߷ \031¿·\024Wô·l<ô·\000\000\000\000À\177ô·\220\202ä¿)\000\000\000t\203俴Qó·\220\202ä¿(7ô·\000\000\000\000\000\000\000\000\200\202ô·êG߷P´ò·\000\000\000\000\000\000\000\000À\177ô·x\006ü\b\026é\217\at\203ä¿.Qó·undefined symbol: glXGetSwapInte"...
   param = <value optimized out>
   str = <value optimized out>
#2  0x0804c55d in main (argc=2, argv=0x0) at ../../../src/SDL/main.c:2333
   e = {type = 56 '8', active = {type = 56 '8', gain = 134 '\206', state = 228 'ä'}, key = {type = 56 '8', which = 134 '\206', state = 228 'ä', keysym = {
      scancode = 152 '\230', sym = 3084337140, mod = 137150728, unicode = 34392}}, motion = {type = 56 '8', which = 134 '\206', state = 228 'ä', x = 40856, y = 2052,
    xrel = 16372, yrel = -18473}, button = {type = 56 '8', which = 134 '\206', button = 228 'ä', state = 191 '¿', x = 40856, y = 2052}, jaxis = {type = 56 '8',
    which = 134 '\206', axis = 228 'ä', value = -24680}, jball = {type = 56 '8', which = 134 '\206', ball = 228 'ä', xrel = -24680, yrel = 2052}, jhat = {
    type = 56 '8', which = 134 '\206', hat = 228 'ä', value = 191 '¿'}, jbutton = {type = 56 '8', which = 134 '\206', button = 228 'ä', state = 191 '¿'}, resize = {
    type = 56 '8', w = 134520728, h = -1210630156}, expose = {type = 56 '8'}, quit = {type = 56 '8'}, user = {type = 56 '8', code = 134520728, data1 = 0xb7d73ff4,
    data2 = 0x82cc108}, syswm = {type = 56 '8', msg = 0x8049f98}}
   event_res = <value optimized out>
   errorString = 0x0
   preInit = 1
(gdb)



Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Thu Feb 26, 2009 7:03 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

Short post whilst I try and think of the best way forward.

Basically it is a fault in the GL of your system and it is crashing the game when it is trying to work out what the capabilities of you system's GL is.
You can see in the backtrace that the
Code:
#1  0x080733b9 in glCapStartup () at ../../../src/SDL/glcaps.c:609
is
Code:
GLC_EXTENSIONS = (char const*)glGetString(GL_EXTENSIONS);


This is showing an error hidden away in the backtrace of
Code:
undefined symbol: glXGetSwapInte...
which I think refers to glXGetSwapIntervalMESA one of the GL functions.

Let me have a look at the code and think about the best way to sort this.

Aunxx


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Fri Feb 27, 2009 1:55 am 
Offline

Joined: Sun Feb 22, 2009 7:10 pm
Posts: 7
googling results in other bugs of the same nature, and this from http://www.mesa3d.org/brianp/sig97/exten.htm

Quote:
Be aware that glGetString(GL_EXTENSIONS) must be called after we've established an active OpenGL rendering context. For example, we must call glXMakeCurrent or wglMakeCurrent before calling glGetString. The reason is that OpenGL extensions are dependant on the OpenGL renderer and the renderer isn't bound until MakeCurrent is called.


I'll keep looking at the code although I don't really understand that much of it.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Sun Mar 01, 2009 6:00 am 
Offline
coder

Joined: Wed Oct 01, 2008 2:55 pm
Posts: 103
Location: Michigan
I only skimmed the thread, so ignore this if it's not helpful, but I once ran into some buggy problems finding files and the sort when I put my Homeworld compile folder too deep into my hard drive. I believe what happened was that the path became so long that it created an infinite loop when the program was trying to iterate to the end of it. moving my Homeworld folder to the root of the hard drive fixed the problem. I didn't bother to fix it at that point, this might be something to try.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Sun Mar 08, 2009 9:29 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

Sorry, been afk for a while.

Can you try something for me?
Find each instance of libGL which isn't a symlink and grep in the file for the string glXGetSwapIntervalMESA
I would assume that it can be found in the currently running libGL.

Can you also let me know which linux distribution you're running please?

I'll have a look at the code and see what use the function gives us, and whether I can arrange for it to be bypassed for you.

Aunxx.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Wed Mar 11, 2009 2:20 am 
Offline

Joined: Sun Feb 22, 2009 7:10 pm
Posts: 7
hello,

Code:
 
: /usr/lib                                                          !1017 00:15
 :; grep glXGetSwapIntervalMESA libGL.so.1.2
Binary file libGL.so.1.2 matches


I'm running arch linux with kernel 2.6.28

Thanks!

/Thomas


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Wed Apr 01, 2009 4:35 pm 
Offline

Joined: Sat Mar 29, 2008 11:06 am
Posts: 61
Sorry to dig up this thread if you've fixed the problem, but I've seen this issue on 2 different machines with Ubuntu 8.10 and as far as I can tell it's a bug in the SW render where it returns the string. Rebuilding Mesa from source fixed that issue (although completely foobared the menu graphics, but this was an older version of Mesa). If your GPU is supported under Linux then install the driver for that and it should fix the issue, otherwise could be a rebuild of Mesa. The thing that I find really strange is glxinfo works :/.


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Thu Aug 06, 2009 12:02 am 
Offline

Joined: Wed Aug 05, 2009 1:14 am
Posts: 2
Well, a bit of a lag-time on this, but I'm having the same issue. glGetString seems to be the issue. :/

I'd rather avoid rebuilding mesa, as that's a bit of a mess. Any idea on a fix for this? I've tried mucking with glcaps.c to setup the glcontext, but, well... I'm kinda just poking at things without much clue.

Any guidance on how to get this fixed beyond a mesa rebuild?

For the record, this is on both Ubuntu 9.04 and the 9.10 alpha, 3d is otherwise working (Quake 3, frex, is working fine). The HWSDL version is the latest SVN checkout. I've tried building with mulitple versions of GCC just to be sure that's not an issue (it doesn't build with 4.4, in case anyone cares :p).


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Sat Aug 08, 2009 1:57 am 
Offline

Joined: Wed Aug 05, 2009 1:14 am
Posts: 2
Aye yai yai!

Okay, so I've "solved" this. Or, well, hacked around it in a nasty way.

The segfault is caused by what jensvejmand mentioned above. glGetString can't be called without first establishing a context anymore (well, it wasn't supposed to be allowed to in the first place). So, not having a clue how to properly do this with what was already in the glcaps.c, I included SDL.h and did it with that and made a quick hack that works on my machine (even the resolution of my screen is hardcoded). OBVIOUSLY not the right way to fix it, but it at least shows the problem and the general idea of how to fix it properly.

basicmark wrote:
Rebuilding Mesa from source fixed that issue (although completely foobared the menu graphics, but this was an older version of Mesa).


So, yeah -- I suspect this worked *only* because it was an older version of Mesa, not in spite of it :)

Secondly, I wasn't getting movie playback. Checking over the config log, libavcodec is found, but the function img_convert was not. After a little research, I found that img_convert was removed from ffmpeg at... some point. In any case, img_convert is no longer available, and sws_scale is the replacement. So, in avi.c, I included libswscale.h (will need to have configure check for that now...), and added the -lswscale linker argument. Now everything, including movie playback, is working. :)

Was going to attach the files, but it seems this forum doesn't allow attaching of .patch or .txt files?

They're short anyway, so... (again, please keep in mind, these are just the raw nasty patches that I used to get things working -- I know they're a mess, but I thought they might be useful to the devs.)

glcaps.c.patch
Code:
--- glcaps.c.orig   2009-08-08 02:30:50.000000000 -0400
+++ glcaps.c.mod   2009-08-08 02:30:41.000000000 -0400
@@ -17,6 +17,8 @@
 #include "main.h"
 #include "render.h"
 
+#include "SDL.h"
+
 #ifdef _MSC_VER
 #define strcasecmp _stricmp
 #endif
@@ -606,6 +608,16 @@
    }
 #endif
 
+
+//  glGetString no longer allows you to call it without first establishing a context
+//  So, establish a stupid little context of my native resolution to prevent a segfault
+    SDL_Surface* drawContext;
+    Uint32 flags;
+
+    flags = SDL_OPENGL | SDL_FULLSCREEN;
+    drawContext = SDL_SetVideoMode(1024, 600, 0, flags);
+
+
     GLC_EXTENSIONS = (char const*)glGetString(GL_EXTENSIONS);
     GLC_RENDERER   = (char const*)glGetString(GL_RENDERER);
     GLC_VENDOR     = (char const*)glGetString(GL_VENDOR);


avi.c.patch
Code:
--- avi.c.orig   2009-08-08 02:30:21.000000000 -0400
+++ avi.c.mod   2009-08-08 02:30:30.000000000 -0400
@@ -39,8 +39,9 @@
 #endif
 
 #ifdef HW_ENABLE_MOVIES
-    #include <ffmpeg/avformat.h>
-    #include <ffmpeg/avcodec.h>
+    #include <libavformat/avformat.h>
+    #include <libavcodec/avcodec.h>
+    #include <libswscale/swscale.h>
 #endif
 
 
@@ -455,10 +456,25 @@
 
         if(frameFinished) {
             // Convert the image from its native format to RGB
+           
+             
+           
+/*          img_convert is no longer in libavcodec!
+
             img_convert(pPictureRGB, PIX_FMT_RGB32,
                 (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width,
                 pCodecCtx->height);
+*/
 
+//          Do the same as above, but with libswscale
+            static struct SwsContext *img_convert_ctx;
+           
+            struct SwsContext *sws = sws_getContext(pCodecCtx->width, pCodecCtx->height,
+                              pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height,
+                              PIX_FMT_RGB32, SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW | SWS_POINT ,
+                               NULL, NULL, NULL);
+            sws_scale(sws, pFrame->data,pFrame->linesize,0 ,pCodecCtx->height, pPictureRGB->data, pPictureRGB->linesize);
+           
             animAviDecode(frame);
 
             while (SDL_GetTicks() - last_time < 67)


Top
 Profile  
 
 Post subject: Re: Segfault
PostPosted: Mon Aug 31, 2009 4:23 am 
Offline

Joined: Sat Mar 29, 2008 11:06 am
Posts: 61
I hit this issue again last time I compiled homeworld and yes, your right that it's due to needing to have a valid GL contextbefore calling glGetString. I don't have the code with me a.t.m. but U remember that there is a call to create a GL context before querying the gl strings but it was wrapped in a MACOS define. I just removed that an it worked :). As the GL spec specifies you must have a GL context before calling glGetString I think we should just remove the #ifdef MACOS so all platforms "do the right thing".

When I get home I'll dig out the change.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group