Gentoo Archives: gentoo-commits

From: "Thomas Sachau (tommy)" <tommy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-emulation/qemu-kvm/files: qemu-kvm-0.12.3-fix-crash-with-sdl.patch qemu-kvm-0.12.3-include-madvise-defines.patch
Date: Sat, 03 Apr 2010 13:51:59
Message-Id: E1Ny3lT-000772-KK@stork.gentoo.org
1 tommy 10/04/03 13:51:55
2
3 Added: qemu-kvm-0.12.3-fix-crash-with-sdl.patch
4 qemu-kvm-0.12.3-include-madvise-defines.patch
5 Log:
6 Include madvise defines, fixes bug 305785, include virtio-large-iovecs patch, fixes bug 308451, include upstream fix for crash with sdl as default sound option, fixes sound issues of bug 294269
7 (Portage version: 2.2_rc67-r3/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 app-emulation/qemu-kvm/files/qemu-kvm-0.12.3-fix-crash-with-sdl.patch
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-emulation/qemu-kvm/files/qemu-kvm-0.12.3-fix-crash-with-sdl.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-emulation/qemu-kvm/files/qemu-kvm-0.12.3-fix-crash-with-sdl.patch?rev=1.1&content-type=text/plain
14
15 Index: qemu-kvm-0.12.3-fix-crash-with-sdl.patch
16 ===================================================================
17 From ff5414990645653bf43bf64adfc1ca77ffb9edcb Mon Sep 17 00:00:00 2001
18 From: malc <av1474@×××××.ru>
19 Date: Sun, 17 Jan 2010 00:25:29 +0300
20 Subject: [PATCH] Revert "sdlaudio: make it suck less"
21
22 This reverts commit 4839abe78fd466a3cf06faa7c362154afd5404f1.
23
24 The commit was badly broken, Gentoo has sdl as the default driver,
25 consequently 5 gentoo users have hit the breakage and were kind enough
26 to report, so thank you:
27
28 Claes Gyllenswrd
29 vekin
30 Chris
31
32 But above all thanks to Toralf Foerster who actually provied enough
33 information to pinpoint the breakage to sdlaudio.
34
35 http://bugs.gentoo.org/show_bug.cgi?id=294269
36 ---
37 audio/sdlaudio.c | 80 +++++++++++++++++++++++++++++++++--------------------
38 1 files changed, 50 insertions(+), 30 deletions(-)
39
40 diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
41 index aa39c33..8e7e5cb 100644
42 --- a/audio/sdlaudio.c
43 +++ b/audio/sdlaudio.c
44 @@ -41,8 +41,8 @@
45 typedef struct SDLVoiceOut {
46 HWVoiceOut hw;
47 int live;
48 + int rpos;
49 int decr;
50 - int pending;
51 } SDLVoiceOut;
52
53 static struct {
54 @@ -225,10 +225,6 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
55 HWVoiceOut *hw = &sdl->hw;
56 int samples = len >> hw->info.shift;
57
58 - if (sdl_lock (s, "sdl_callback")) {
59 - return;
60 - }
61 -
62 if (s->exit) {
63 return;
64 }
65 @@ -236,34 +232,49 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
66 while (samples) {
67 int to_mix, decr;
68
69 - while (!sdl->pending) {
70 - if (sdl_unlock (s, "sdl_callback")) {
71 - return;
72 - }
73 -
74 - sdl_wait (s, "sdl_callback");
75 - if (s->exit) {
76 - return;
77 - }
78 -
79 - if (sdl_lock (s, "sdl_callback")) {
80 - return;
81 - }
82 - sdl->pending += sdl->live;
83 - sdl->live = 0;
84 + /* dolog ("in callback samples=%d\n", samples); */
85 + sdl_wait (s, "sdl_callback");
86 + if (s->exit) {
87 + return;
88 + }
89 +
90 + if (sdl_lock (s, "sdl_callback")) {
91 + return;
92 + }
93 +
94 + if (audio_bug (AUDIO_FUNC, sdl->live < 0 || sdl->live > hw->samples)) {
95 + dolog ("sdl->live=%d hw->samples=%d\n",
96 + sdl->live, hw->samples);
97 + return;
98 + }
99 +
100 + if (!sdl->live) {
101 + goto again;
102 }
103
104 - to_mix = audio_MIN (samples, sdl->pending);
105 - decr = audio_pcm_hw_clip_out (hw, buf, to_mix, 0);
106 - buf += decr << hw->info.shift;
107 + /* dolog ("in callback live=%d\n", live); */
108 + to_mix = audio_MIN (samples, sdl->live);
109 + decr = to_mix;
110 + while (to_mix) {
111 + int chunk = audio_MIN (to_mix, hw->samples - hw->rpos);
112 + struct st_sample *src = hw->mix_buf + hw->rpos;
113 +
114 + /* dolog ("in callback to_mix %d, chunk %d\n", to_mix, chunk); */
115 + hw->clip (buf, src, chunk);
116 + sdl->rpos = (sdl->rpos + chunk) % hw->samples;
117 + to_mix -= chunk;
118 + buf += chunk << hw->info.shift;
119 + }
120 samples -= decr;
121 + sdl->live -= decr;
122 sdl->decr += decr;
123 - sdl->pending -= decr;
124 - }
125
126 - if (sdl_unlock (s, "sdl_callback")) {
127 - return;
128 + again:
129 + if (sdl_unlock (s, "sdl_callback")) {
130 + return;
131 + }
132 }
133 + /* dolog ("done len=%d\n", len); */
134 }
135
136 static int sdl_write_out (SWVoiceOut *sw, void *buf, int len)
137 @@ -281,9 +292,18 @@ static int sdl_run_out (HWVoiceOut *hw, int live)
138 return 0;
139 }
140
141 - sdl->live = live;
142 - decr = sdl->decr;
143 - sdl->decr = 0;
144 + if (sdl->decr > live) {
145 + ldebug ("sdl->decr %d live %d sdl->live %d\n",
146 + sdl->decr,
147 + live,
148 + sdl->live);
149 + }
150 +
151 + decr = audio_MIN (sdl->decr, live);
152 + sdl->decr -= decr;
153 +
154 + sdl->live = live - decr;
155 + hw->rpos = sdl->rpos;
156
157 if (sdl->live > 0) {
158 sdl_unlock_and_post (s, "sdl_run_out");
159 --
160 1.7.0.4
161
162
163
164
165 1.1 app-emulation/qemu-kvm/files/qemu-kvm-0.12.3-include-madvise-defines.patch
166
167 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-emulation/qemu-kvm/files/qemu-kvm-0.12.3-include-madvise-defines.patch?rev=1.1&view=markup
168 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-emulation/qemu-kvm/files/qemu-kvm-0.12.3-include-madvise-defines.patch?rev=1.1&content-type=text/plain
169
170 Index: qemu-kvm-0.12.3-include-madvise-defines.patch
171 ===================================================================
172 --- exec.c 2010-02-26 03:34:00.000000000 +0100
173 +++ exec.c.new 2010-04-03 15:31:53.000000000 +0200
174 @@ -22,6 +22,9 @@
175 #else
176 #include <sys/types.h>
177 #include <sys/mman.h>
178 +#ifndef MADV_MERGEABLE
179 +#include <asm/mman.h>
180 +#endif
181 #endif
182 #include <stdlib.h>
183 #include <stdio.h>