838
|
1 |
From 8dc9e73b80ec33fe1a1c855829ef1438301a5de1 Mon Sep 17 00:00:00 2001
|
|
2 |
From: Mike Hommey <mh+mozilla@glandium.org>
|
|
3 |
Date: Thu, 26 Feb 2015 14:14:02 +0900
|
|
4 |
Subject: [PATCH 1/2] Bug 1136958 - Remove duplicate
|
|
5 |
SkDiscardableMemory_none.cpp from gfx/skia/moz.build
|
|
6 |
|
|
7 |
And to do so, cleanup gfx/skia/generate_mozbuild.py a little.
|
|
8 |
---
|
|
9 |
gfx/skia/generate_mozbuild.py | 53 ++++++++++++++++---------------------------
|
|
10 |
gfx/skia/moz.build | 1 -
|
|
11 |
2 files changed, 20 insertions(+), 34 deletions(-)
|
|
12 |
|
|
13 |
diff --git a/configure.in b/configure.in
|
|
14 |
--- a/configure.in
|
|
15 |
+++ b/configure.in
|
|
16 |
@@ -7997,39 +7997,16 @@ dnl ====================================
|
|
17 |
|
|
18 |
if test "${OS_TARGET}" = "WINNT"; then
|
|
19 |
if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
|
|
20 |
MOZ_ENABLE_DIRECT2D1_1=1
|
|
21 |
AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
|
|
22 |
fi
|
|
23 |
fi
|
|
24 |
|
|
25 |
-if test "${OS_TARGET}" = "WINNT" -o \
|
|
26 |
- "${OS_ARCH}" = "Darwin" -o \
|
|
27 |
- "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
|
|
28 |
- "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
|
|
29 |
- "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
|
|
30 |
- "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
|
|
31 |
- case "${target_cpu}" in
|
|
32 |
- i*86*|x86_64|arm)
|
|
33 |
- MOZ_ENABLE_SKIA=1
|
|
34 |
- ;;
|
|
35 |
- *)
|
|
36 |
- MOZ_ENABLE_SKIA=
|
|
37 |
- ;;
|
|
38 |
- esac
|
|
39 |
-else
|
|
40 |
-MOZ_ENABLE_SKIA=
|
|
41 |
-fi
|
|
42 |
-
|
|
43 |
-MOZ_ARG_ENABLE_BOOL(skia,
|
|
44 |
-[ --enable-skia Enable use of Skia],
|
|
45 |
-MOZ_ENABLE_SKIA=1,
|
|
46 |
-MOZ_ENABLE_SKIA=)
|
|
47 |
-
|
|
48 |
MOZ_ARG_DISABLE_BOOL(skia-gpu,
|
|
49 |
[ --disable-skia-gpu Disable use of Skia-GPU],
|
|
50 |
MOZ_DISABLE_SKIA_GPU=1,
|
|
51 |
MOZ_DISABLE_SKIA_GPU=)
|
|
52 |
|
|
53 |
if test "$USE_FC_FREETYPE"; then
|
|
54 |
if test "$COMPILE_ENVIRONMENT"; then
|
|
55 |
dnl ========================================================
|
|
56 |
@@ -8252,30 +8229,26 @@ AC_SUBST(MOZ_TREE_CAIRO)
|
|
57 |
AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
|
|
58 |
AC_SUBST_LIST(MOZ_CAIRO_LIBS)
|
|
59 |
AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
|
|
60 |
AC_SUBST(MOZ_TREE_PIXMAN)
|
|
61 |
|
|
62 |
dnl ========================================================
|
|
63 |
dnl Skia
|
|
64 |
dnl ========================================================
|
|
65 |
-if test "$MOZ_ENABLE_SKIA"; then
|
|
66 |
- AC_DEFINE(MOZ_ENABLE_SKIA)
|
|
67 |
- AC_DEFINE(USE_SKIA)
|
|
68 |
- if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
|
|
69 |
- AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
|
|
70 |
- fi
|
|
71 |
-
|
|
72 |
- if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
|
|
73 |
- MOZ_ENABLE_SKIA_GPU=1
|
|
74 |
- AC_DEFINE(USE_SKIA_GPU)
|
|
75 |
- AC_SUBST(MOZ_ENABLE_SKIA_GPU)
|
|
76 |
- fi
|
|
77 |
-fi
|
|
78 |
-AC_SUBST(MOZ_ENABLE_SKIA)
|
|
79 |
+AC_DEFINE(USE_SKIA)
|
|
80 |
+if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
|
|
81 |
+ AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
|
|
82 |
+fi
|
|
83 |
+
|
|
84 |
+if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
|
|
85 |
+ MOZ_ENABLE_SKIA_GPU=1
|
|
86 |
+ AC_DEFINE(USE_SKIA_GPU)
|
|
87 |
+ AC_SUBST(MOZ_ENABLE_SKIA_GPU)
|
|
88 |
+fi
|
|
89 |
|
|
90 |
dnl ========================================================
|
|
91 |
dnl Check for nss-shared-helper
|
|
92 |
dnl ========================================================
|
|
93 |
|
|
94 |
PKG_CHECK_MODULES(NSSHELPER, nss-shared-helper,
|
|
95 |
[MOZ_ENABLE_NSSHELPER=1],
|
|
96 |
[MOZ_ENABLE_NSSHELPER=])
|
|
97 |
diff --git a/gfx/2d/moz.build b/gfx/2d/moz.build
|
|
98 |
--- a/gfx/2d/moz.build
|
|
99 |
+++ b/gfx/2d/moz.build
|
|
100 |
@@ -64,51 +64,46 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wi
|
|
101 |
SOURCES += [
|
|
102 |
'DrawTargetD2D1.cpp',
|
|
103 |
'FilterNodeD2D1.cpp',
|
|
104 |
'RadialGradientEffectD2D1.cpp',
|
|
105 |
'SourceSurfaceD2D1.cpp'
|
|
106 |
]
|
|
107 |
DEFINES['USE_D2D1_1'] = True
|
|
108 |
|
|
109 |
-if CONFIG['MOZ_ENABLE_SKIA']:
|
|
110 |
- UNIFIED_SOURCES += [
|
|
111 |
- 'convolver.cpp',
|
|
112 |
- 'DrawTargetSkia.cpp',
|
|
113 |
- 'PathSkia.cpp',
|
|
114 |
- 'SourceSurfaceSkia.cpp',
|
|
115 |
- ]
|
|
116 |
- SOURCES += [
|
|
117 |
- 'image_operations.cpp', # Uses _USE_MATH_DEFINES
|
|
118 |
- ]
|
|
119 |
- EXPORTS.mozilla.gfx += [
|
|
120 |
- 'HelpersSkia.h',
|
|
121 |
- ]
|
|
122 |
+UNIFIED_SOURCES += [
|
|
123 |
+ 'convolver.cpp',
|
|
124 |
+ 'DrawTargetSkia.cpp',
|
|
125 |
+ 'PathSkia.cpp',
|
|
126 |
+ 'SourceSurfaceSkia.cpp',
|
|
127 |
+]
|
|
128 |
+SOURCES += [
|
|
129 |
+ 'image_operations.cpp', # Uses _USE_MATH_DEFINES
|
|
130 |
+]
|
|
131 |
+EXPORTS.mozilla.gfx += [
|
|
132 |
+ 'HelpersSkia.h',
|
|
133 |
+]
|
|
134 |
|
|
135 |
# Are we targeting x86 or x64? If so, build SSE2 files.
|
|
136 |
if CONFIG['INTEL_ARCHITECTURE']:
|
|
137 |
# VC2005 doesn't support _mm_castsi128_ps, so SSE2 is turned off
|
|
138 |
if CONFIG['_MSC_VER'] != '1400':
|
|
139 |
SOURCES += [
|
|
140 |
'BlurSSE2.cpp',
|
|
141 |
+ 'convolverSSE2.cpp',
|
|
142 |
'FilterProcessingSSE2.cpp',
|
|
143 |
'ImageScalingSSE2.cpp',
|
|
144 |
]
|
|
145 |
- if CONFIG['MOZ_ENABLE_SKIA']:
|
|
146 |
- SOURCES += [
|
|
147 |
- 'convolverSSE2.cpp',
|
|
148 |
- ]
|
|
149 |
DEFINES['USE_SSE2'] = True
|
|
150 |
# The file uses SSE2 intrinsics, so it needs special compile flags on some
|
|
151 |
# compilers.
|
|
152 |
SOURCES['BlurSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
|
153 |
SOURCES['FilterProcessingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
|
154 |
SOURCES['ImageScalingSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
|
155 |
- if CONFIG['MOZ_ENABLE_SKIA']:
|
|
156 |
- SOURCES['convolverSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
|
157 |
+ SOURCES['convolverSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
|
158 |
|
|
159 |
UNIFIED_SOURCES += [
|
|
160 |
'Blur.cpp',
|
|
161 |
'DataSourceSurface.cpp',
|
|
162 |
'DataSurfaceHelpers.cpp',
|
|
163 |
'DrawEventRecorder.cpp',
|
|
164 |
'DrawTarget.cpp',
|
|
165 |
'DrawTargetCairo.cpp',
|
|
166 |
diff --git a/gfx/moz.build b/gfx/moz.build
|
|
167 |
--- a/gfx/moz.build
|
|
168 |
+++ b/gfx/moz.build
|
|
169 |
@@ -17,16 +17,15 @@ DIRS += [
|
|
170 |
'layers',
|
|
171 |
'graphite2/src',
|
|
172 |
'harfbuzz/src',
|
|
173 |
'ots/src',
|
|
174 |
'thebes',
|
|
175 |
'ipc',
|
|
176 |
]
|
|
177 |
|
|
178 |
-if CONFIG['MOZ_ENABLE_SKIA']:
|
|
179 |
- DIRS += ['skia']
|
|
180 |
+DIRS += ['skia']
|
|
181 |
|
|
182 |
if CONFIG['ENABLE_TESTS']:
|
|
183 |
DIRS += ['tests/gtest']
|
|
184 |
|
|
185 |
TEST_DIRS += ['tests']
|
|
186 |
|
|
187 |
diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py
|
|
188 |
--- a/gfx/skia/generate_mozbuild.py
|
|
189 |
+++ b/gfx/skia/generate_mozbuild.py
|
|
190 |
@@ -1,13 +1,14 @@
|
|
191 |
#!/usr/bin/env python
|
|
192 |
|
|
193 |
import os
|
|
194 |
|
|
195 |
import locale
|
|
196 |
+from collections import defaultdict
|
|
197 |
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
|
|
198 |
|
|
199 |
header = """
|
|
200 |
#
|
|
201 |
# ##### ####### # # # # # #
|
|
202 |
# ## # # # # # # # # # # # #
|
|
203 |
# ## # # # # # # # # # # #
|
|
204 |
# ## #### # # # # # # # # # #
|
|
205 |
@@ -187,17 +188,17 @@ def generate_platform_sources():
|
|
206 |
|
|
207 |
for plat in platforms:
|
|
208 |
if os.system("cd trunk && GYP_GENERATORS=dump_mozbuild ./gyp_skia -D OS=%s gyp/skia_lib.gyp" % plat) != 0:
|
|
209 |
print 'Failed to generate sources for ' + plat
|
|
210 |
continue
|
|
211 |
|
|
212 |
|
|
213 |
f = open('trunk/sources.json');
|
|
214 |
- sources[plat] = set(json.load(f));
|
|
215 |
+ sources[plat] = set(v.replace('../', 'trunk/') for v in json.load(f));
|
|
216 |
f.close()
|
|
217 |
|
|
218 |
return dict(sources.items() + generate_opt_sources().items())
|
|
219 |
|
|
220 |
|
|
221 |
def generate_separated_sources(platform_sources):
|
|
222 |
blacklist = [
|
|
223 |
'ChromeUtils',
|
|
224 |
@@ -232,17 +233,17 @@ def generate_separated_sources(platform_
|
|
225 |
|
|
226 |
def isblacklisted(value):
|
|
227 |
for item in blacklist:
|
|
228 |
if value.find(item) >= 0:
|
|
229 |
return True
|
|
230 |
|
|
231 |
return False
|
|
232 |
|
|
233 |
- separated = {
|
|
234 |
+ separated = defaultdict(set, {
|
|
235 |
'common': {
|
|
236 |
#'trunk/src/effects/gradients/SkGradientTileProc.cpp',
|
|
237 |
'trunk/src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
|
|
238 |
'trunk/src/ports/SkDiscardableMemory_none.cpp',
|
|
239 |
'trunk/src/ports/SkImageDecoder_empty.cpp',
|
|
240 |
'trunk/src/ports/SkMemory_mozalloc.cpp',
|
|
241 |
# 'trunk/src/images/SkImages.cpp',
|
|
242 |
# 'trunk/src/images/SkImageRef.cpp',
|
|
243 |
@@ -277,69 +278,55 @@ def generate_separated_sources(platform_
|
|
244 |
'trunk/src/core/SkUtilsArm.cpp',
|
|
245 |
},
|
|
246 |
'neon': {
|
|
247 |
'trunk/src/opts/SkBitmapProcState_arm_neon.cpp',
|
|
248 |
},
|
|
249 |
'none': {
|
|
250 |
'trunk/src/opts/SkUtils_opts_none.cpp',
|
|
251 |
}
|
|
252 |
- }
|
|
253 |
+ })
|
|
254 |
|
|
255 |
for plat in platform_sources.keys():
|
|
256 |
- if not separated.has_key(plat):
|
|
257 |
- separated[plat] = set()
|
|
258 |
-
|
|
259 |
for value in platform_sources[plat]:
|
|
260 |
if isblacklisted(value):
|
|
261 |
continue
|
|
262 |
|
|
263 |
- if value.find('_SSE') > 0 or value.find('_SSSE') > 0 or value.find('_SSE4') > 0 : #lol
|
|
264 |
- separated['intel'].add(value)
|
|
265 |
+ if value in separated['common']:
|
|
266 |
continue
|
|
267 |
|
|
268 |
- if value.find('_neon') > 0:
|
|
269 |
- separated['neon'].add(value)
|
|
270 |
- continue
|
|
271 |
+ key = plat
|
|
272 |
|
|
273 |
- if value.find('_arm') > 0:
|
|
274 |
- separated['arm'].add(value)
|
|
275 |
- continue
|
|
276 |
+ if '_SSE' in value or '_SSSE' in value:
|
|
277 |
+ key = 'intel'
|
|
278 |
+ elif '_neon' in value:
|
|
279 |
+ key = 'neon'
|
|
280 |
+ elif '_arm' in value:
|
|
281 |
+ key = 'arm'
|
|
282 |
+ elif '_none' in value:
|
|
283 |
+ key = 'none'
|
|
284 |
+ elif all(value in platform_sources.get(p, {})
|
|
285 |
+ for p in platforms if p != plat):
|
|
286 |
+ key = 'common'
|
|
287 |
|
|
288 |
- if value.find('_none') > 0:
|
|
289 |
- separated['none'].add(value)
|
|
290 |
- continue
|
|
291 |
-
|
|
292 |
- found = True
|
|
293 |
- for other in platforms:
|
|
294 |
- if other == plat or not platform_sources.has_key(other):
|
|
295 |
- continue
|
|
296 |
-
|
|
297 |
- if not value in platform_sources[other]:
|
|
298 |
- found = False
|
|
299 |
- break;
|
|
300 |
-
|
|
301 |
- if found:
|
|
302 |
- separated['common'].add(value)
|
|
303 |
- else:
|
|
304 |
- separated[plat].add(value)
|
|
305 |
+ separated[key].add(value)
|
|
306 |
|
|
307 |
return separated
|
|
308 |
|
|
309 |
def uniq(seq):
|
|
310 |
seen = set()
|
|
311 |
seen_add = seen.add
|
|
312 |
return [ x for x in seq if x not in seen and not seen_add(x)]
|
|
313 |
|
|
314 |
def write_cflags(f, values, subsearch, cflag, indent):
|
|
315 |
def write_indent(indent):
|
|
316 |
for _ in range(indent):
|
|
317 |
f.write(' ')
|
|
318 |
|
|
319 |
- val_list = uniq(sorted(map(lambda val: val.replace('../', 'trunk/'), values), key=lambda x: x.lower()))
|
|
320 |
+ val_list = uniq(sorted(values, key=lambda x: x.lower()))
|
|
321 |
|
|
322 |
if len(val_list) == 0:
|
|
323 |
return
|
|
324 |
|
|
325 |
for val in val_list:
|
|
326 |
if val.find(subsearch) > 0:
|
|
327 |
write_indent(indent)
|
|
328 |
f.write("SOURCES[\'" + val + "\'].flags += [\'" + cflag + "\']\n")
|
|
329 |
@@ -391,17 +378,17 @@ def write_sources(f, values, indent):
|
|
330 |
write_list(f, "UNIFIED_SOURCES", sources['unified'], indent)
|
|
331 |
write_list(f, "SOURCES", sources['nonunified'], indent)
|
|
332 |
|
|
333 |
def write_list(f, name, values, indent):
|
|
334 |
def write_indent(indent):
|
|
335 |
for _ in range(indent):
|
|
336 |
f.write(' ')
|
|
337 |
|
|
338 |
- val_list = uniq(sorted(map(lambda val: val.replace('../', 'trunk/'), values), key=lambda x: x.lower()))
|
|
339 |
+ val_list = uniq(sorted(values, key=lambda x: x.lower()))
|
|
340 |
|
|
341 |
if len(val_list) == 0:
|
|
342 |
return
|
|
343 |
|
|
344 |
write_indent(indent)
|
|
345 |
f.write(name + ' += [\n')
|
|
346 |
for val in val_list:
|
|
347 |
write_indent(indent + 4)
|
|
348 |
diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
|
|
349 |
--- a/gfx/skia/moz.build
|
|
350 |
+++ b/gfx/skia/moz.build
|
|
351 |
@@ -847,17 +847,16 @@ else:
|
|
352 |
'trunk/src/opts/SkBitmapProcState_opts_none.cpp',
|
|
353 |
'trunk/src/opts/SkBlitMask_opts_none.cpp',
|
|
354 |
'trunk/src/opts/SkBlitRow_opts_none.cpp',
|
|
355 |
'trunk/src/opts/SkBlurImage_opts_none.cpp',
|
|
356 |
'trunk/src/opts/SkMorphology_opts_none.cpp',
|
|
357 |
'trunk/src/opts/SkTextureCompression_opts_none.cpp',
|
|
358 |
'trunk/src/opts/SkUtils_opts_none.cpp',
|
|
359 |
'trunk/src/opts/SkXfermode_opts_none.cpp',
|
|
360 |
- 'trunk/src/ports/SkDiscardableMemory_none.cpp',
|
|
361 |
]
|
|
362 |
|
|
363 |
|
|
364 |
# can we find a better way of dealing with asm sources?
|
|
365 |
|
|
366 |
# left out of UNIFIED_SOURCES for now; that's not C++ anyway, nothing else to unify it with
|
|
367 |
if not CONFIG['INTEL_ARCHITECTURE'] and CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:
|
|
368 |
SOURCES += [
|
|
369 |
diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp
|
|
370 |
--- a/image/src/RasterImage.cpp
|
|
371 |
+++ b/image/src/RasterImage.cpp
|
|
372 |
@@ -2090,20 +2090,16 @@ RasterImage::RecoverFromLossOfFrames()
|
|
373 |
RequestDecodeCore(ASYNCHRONOUS);
|
|
374 |
}
|
|
375 |
|
|
376 |
bool
|
|
377 |
RasterImage::CanScale(GraphicsFilter aFilter,
|
|
378 |
const nsIntSize& aSize,
|
|
379 |
uint32_t aFlags)
|
|
380 |
{
|
|
381 |
-#ifndef MOZ_ENABLE_SKIA
|
|
382 |
- // The high-quality scaler requires Skia.
|
|
383 |
- return false;
|
|
384 |
-#else
|
|
385 |
// Check basic requirements: HQ downscaling is enabled, we're decoded, the
|
|
386 |
// flags allow us to do it, and a 'good' filter is being used. The flags may
|
|
387 |
// ask us not to scale because the caller isn't drawing to the window. If
|
|
388 |
// we're drawing to something else (e.g. a canvas) we usually have no way of
|
|
389 |
// updating what we've drawn, so HQ scaling is useless.
|
|
390 |
if (!gfxPrefs::ImageHQDownscalingEnabled() || !mDecoded ||
|
|
391 |
!(aFlags & imgIContainer::FLAG_HIGH_QUALITY_SCALING) ||
|
|
392 |
aFilter != GraphicsFilter::FILTER_GOOD) {
|
|
393 |
@@ -2137,17 +2133,16 @@ RasterImage::CanScale(GraphicsFilter aFi
|
|
394 |
// XXX(seth): It's not clear what this check buys us over
|
|
395 |
// gfxPrefs::ImageHQUpscalingMaxSize().
|
|
396 |
// The default value of this pref is 1000, which means that we never upscale.
|
|
397 |
// If that's all it's getting us, I'd rather we just forbid that explicitly.
|
|
398 |
gfx::Size scale(double(aSize.width) / mSize.width,
|
|
399 |
double(aSize.height) / mSize.height);
|
|
400 |
gfxFloat minFactor = gfxPrefs::ImageHQDownscalingMinFactor() / 1000.0;
|
|
401 |
return (scale.width < minFactor || scale.height < minFactor);
|
|
402 |
-#endif
|
|
403 |
}
|
|
404 |
|
|
405 |
void
|
|
406 |
RasterImage::NotifyNewScaledFrame()
|
|
407 |
{
|
|
408 |
if (mProgressTracker) {
|
|
409 |
// Send an invalidation so observers will repaint and can take advantage of
|
|
410 |
// the new scaled frame if possible.
|