After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 684399 - videomixer: can't compile orc_overlay_argb on x86, not enough registers, crash
videomixer: can't compile orc_overlay_argb on x86, not enough registers, crash
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.x
Other Windows
: Normal normal
: 1.1.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 693790 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-09-19 19:30 UTC by Michael Rubinstein
Modified: 2013-03-22 11:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
orccompiler: Allow fallback to backup/emulation if the target specific register allocation fails (1.54 KB, patch)
2013-01-10 17:19 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Michael Rubinstein 2012-09-19 19:30:08 UTC
This problem was seen on a MinGW build of RELEASE-0.11.94.  It could be Windows specific:

The problem occurs when background=transparent and the video has an alpha component.

Pipeline:

run videomixer name=mix  background=transparent   ! videoconvert ! autovideosink  videotestsrc ! video/x-raw,format=RGBA, width=200,height=200,framerate=10/1  ! videoconvert ! mix.sink_1  videotestsrc pattern=smpte ! video/x-raw,format=RGBA, width=720,height=480,framerate=10/1  ! videoconvert ! mix.sink_0

Debug Trace:

Breakpoint 2, video_mixer_orc_overlay_bgra (d1=d1@entry=0x6850070 "", d1_stride=d1_stride@entry=2880, s1=s1@entry=0x66f0070 '\377' <repeats 200 times>..., s1_stride=s1_stride@entry=2880, p1=255, n=n@entry=720, m=m@entry=480)
    at tmp-orc.c:1858
1858    {
(gdb) call orc_debug_set_level(5)
$3 = 5
(gdb) c
Continuing.
ORC: INFO: orccompiler.c(193): orc_program_compile_full(): initializing compiler for program "video_mixer_orc_overlay_bgra"
ORC: LOG: orccompiler.c(208): orc_program_compile_full(): variables
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 0: d1 size 4 type 2 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 4: s1 size 4 type 1 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 16: c1 size 4 type 3 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 17: c2 size 4 type 3 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 18: c3 size 4 type 3 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 19: c4 size 4 type 3 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 20: c5 size 4 type 3 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 24: p1 size 2 type 4 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 32: t1 size 4 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 33: t2 size 4 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 34: t3 size 2 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 35: t4 size 1 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 36: t5 size 8 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 37: t6 size 8 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 38: t7 size 8 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 39: t8 size 4 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 40: t9 size 8 type 0 alloc 0
ORC: LOG: orccompiler.c(215): orc_program_compile_full(): 41: t10 size 8 type 0 alloc 0
ORC: LOG: orccompiler.c(218): orc_program_compile_full(): instructions
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 0: loadl 32 0 4 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 1: shrul 33 0 32 19
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 2: convlw 34 0 33 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 3: convwb 35 0 34 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 4: splatbl 39 0 35 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 5: convubw 36 0 39 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 6: mullw 36 0 36 24
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 7: shruw 36 0 36 20
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 8: convubw 41 0 32 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 9: mullw 41 0 41 36
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 10: loadpl 39 0 16 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 11: convubw 37 0 39 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 12: subw 37 0 37 36
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 13: loadl 32 0 0 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 14: shrul 33 0 32 19
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 15: convlw 34 0 33 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 16: convwb 35 0 34 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 17: splatbl 39 0 35 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 18: convubw 38 0 39 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 19: mullw 38 0 38 37
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 20: div255w 38 0 38 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 21: convubw 40 0 32 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 22: mullw 40 0 40 38
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 23: addw 40 0 40 41
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 24: addw 38 0 38 36
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 25: divluw 40 0 40 38
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 26: convwb 32 0 40 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 27: andl 32 0 32 18
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 28: convwb 39 0 38 0
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 29: andl 39 0 39 17
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 30: orl 32 0 32 39
ORC: LOG: orccompiler.c(225): orc_program_compile_full(): 31: storel 0 0 32 0
ORC: WARNING: orccompiler.c(376): orc_program_compile_full(): program video_mixer_orc_overlay_bgra failed to compile, reason: register overflow for vector reg
ORC: INFO: orccompiler.c(399): orc_program_compile_full(): finished compiling (fail)

Program received signal SIGSEGV, Segmentation fault.
video_mixer_orc_overlay_bgra (d1=d1@entry=0x6850070 "", d1_stride=d1_stride@entry=2880, s1=s1@entry=0x66f0070 '\377' <repeats 200 times>..., s1_stride=s1_stride@entry=2880, p1=255, n=n@entry=720, m=m@entry=480)
    at tmp-orc.c:1944
1944      func (ex);
(gdb)

There are two issues:

1.  The orc compile failed.
2.  The error was not detected and the backup function was not called.

I'm using orc-0.4.16, which I built using the instructions on the GStreamer wiki.

Other orc programs compile and run properly.
Comment 1 Tim-Philipp Müller 2012-09-20 13:06:29 UTC
The main issue is that it doesn't use the backup function here IMHO.
Comment 2 Michael Rubinstein 2012-10-28 17:10:29 UTC
The problem was also seen in 1.0.2.  I'm using MinGW.

I think the problem will happen on most any Intel platform if the application is in 32 bit mode.

The ORC program "video_mixer_orc_overlay_argb" requires 13 SSE registers but there are only 8 available in 32 bit apps.

The following works in my application, however it does not have the full functionality of the original program.  It doesn't scale the incoming alpha or set the output alpha.  However, it uses only 8 registers.

.function video_mixer_orc_overlay_argb
.flags 2d
.dest 4 d orc_uint8
.source 4 s orc_uint8
.param 2 alpha
.temp 4 t
.temp 2 tw
.temp 1 tb
.temp 4 t2
.temp 8 w1
.temp 8 w2
.temp 8 w3
.const 4 xfs 0xffffffff

# Get source, extract alpha from low byte.
loadl t, s              # t = *src
convlw tw, t            # tw = alpha
convwb tb, tw           # tb = alpha
splatbl t2, tb          # t2 = a:a:a:a 
x4 convubw w1, t2       # w1 = 0a:0a:0a:0a

# Scale source
x4 convubw w2, t        # w2 = 0s:0s:0s:0s
x4 mullw w2, w1, w2     # w2 = Sx:Sx:Sx:xx

# Get 255-alpha
loadpl t2, xfs          # t2 = F:F:F:F
x4 convubw w3, t2       # w3 = 0F:0F:0F:0F
x4 subw w1, w3, w1      # w1 = 0A:0A:0A:0A

# Get destination and scale it.
loadl t, d              # t  = *dst
x4 convubw w3, t        # w3 = 0d:0d:0d:0d
x4 mullw w1, w1, w3     # w1 = Dx:Dx:Dx:Dx

# Combine, divide by 256 and store.
x4 addw w2, w1, w2      # w2 = Bx:Bx:Bx:Bx
x4 convhwb t, w2        # t  = B:B:B:x
storel d, t             # *dst = t

This is my first attempt at ORC or SSE, so the above may not be optimal.
Comment 3 Sebastian Dröge (slomo) 2013-01-10 17:19:34 UTC
Created attachment 233164 [details] [review]
orccompiler: Allow fallback to backup/emulation if the target specific register allocation fails

The OrcCode of the program wouldn't be filled with all required fields
if the register allocation happens to early.
Comment 4 Sebastian Dröge (slomo) 2013-01-11 09:06:01 UTC
Comment on attachment 233164 [details] [review]
orccompiler: Allow fallback to backup/emulation if the target specific register allocation fails

That's in orc GIT now
Comment 5 Tim-Philipp Müller 2013-01-11 09:22:42 UTC
Ok,  now all we need is a new orc release ...
Comment 6 Sebastian Dröge (slomo) 2013-02-15 09:15:05 UTC
*** Bug 693862 has been marked as a duplicate of this bug. ***
Comment 7 Sebastian Dröge (slomo) 2013-02-15 09:15:56 UTC
*** Bug 693790 has been marked as a duplicate of this bug. ***
Comment 8 Sebastian Dröge (slomo) 2013-02-15 09:16:35 UTC
*** Bug 693860 has been marked as a duplicate of this bug. ***
Comment 9 Tim-Philipp Müller 2013-03-22 11:20:55 UTC
Bug in Orc not GStreamer, but milestoning to 1.1.1 since orc requirement was bumped to 0.4.17 in master:


commit 76c56beb5af6e0034f245e6b5ba6fe5b48b51f9b
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Fri Mar 22 10:50:34 2013 +0000

    Require Orc >= 0.4.17
    
    Orc 0.4.17 fixes a bunch crashes on i386 and RPi when orc
    functions can't be compiled and the fallback function is
    supposed to be used. Also fixes some issues on PowerPC.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684399
    https://bugzilla.gnome.org/show_bug.cgi?id=693862