Commit Graph

93 Commits

Author SHA1 Message Date
Andrew Osmond
a52fbf8ab5 Bug 1469964 - Part 2. Make shared surfaces use external image update mechanism. r=nical 2018-07-12 11:43:12 -04:00
Andi-Bogdan Postelnicu
7f8217a2ea Bug 1453795 - Image - Initialize member fields in classes/ structures. r=tnikkel 2018-06-14 08:21:37 +03:00
Andrew Osmond
e76059bf98 Bug 1465496 - Backout part 9 of bug 1462355 to fix talos regressions. r=aosmond 2018-05-30 19:35:40 -04:00
Andrew Osmond
14b23692e6 Bug 1462355 - Part 9. Lock animated imgFrame objects at creation rather than deferring. r=tnikkel 2018-05-29 08:36:13 -04:00
Andrew Osmond
8e097f0169 Bug 1462355 - Part 4. Remove imgFrame::GetAnimationData as it is no longer used. r=tnikkel 2018-05-29 08:36:12 -04:00
Andrew Osmond
fdd7908a05 Bug 1462355 - Part 2. Expose imgFrame's data pointers via RawAccessFrameRef. r=tnikkel
RawAccessFrameRef ensures there is a valid data pointer to the pixel
data for the frame. It is a common pattern for users of
RawAccessFrameRef to follow up with a request for the data pointer
shortly after creation. We can avoid an extra lock by exposing this data
pointer from RawAccessFrameRef, and populating it via
imgFrame::LockImageData.
2018-05-29 08:36:12 -04:00
Andrew Osmond
5d9ffb0638 Bug 1462355 - Part 1a. Make imgFrame animation parameters threadsafe. r=tnikkel
We currently choose to set the animation parameters (blend method, blend
rect, disposal method, timeout) in imgFrame::Finish instead of
imgFrame::InitForDecoder. The decoders themselves already have access to
the necessary information at the time InitForDecoder is called, so there
is no reason to do this. Moving the configuration to initialization will
allow us to relax the mutex protection on these parameters.

This part simply reorganizes imgFrame, and subsequent parts will
introduce the necessary changes to SurfacePipe and decoders.
2018-05-29 08:36:11 -04:00
Sebastian Hengst
0819f35e51 Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Tristan Bourvon
a3a77c0312 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Andrew Osmond
4986917db0 Bug 1435291 - Part 2. Make background SVGs use WebRender instead of fallback. r=jrmuizel 2018-03-14 14:19:13 -04:00
Andrew Osmond
c887fd120c Backed out changeset 7f0409a405f2 (bug 1435291). 2018-03-13 16:03:59 -04:00
Andrew Osmond
785d1f4d18 Bug 1435291 - Part 2. Make background SVGs use WebRender instead of fallback. r=jrmuizel 2018-03-13 15:59:05 -04:00
Andrew Osmond
cd7cf0fad3 Bug 1427639 - Part 2. Fix misleading image memory reporting on Android. r=tnikkel
The shared memory handle reporting has been generalized to be an
external handle reporting. This is used for both shared memory, and for
volatile memory (on Android.) This will allow us to have a better sense
of just how many handles are being used by images on Android.

Additionally we were not properly reporting forced heap allocated
memory, if we were putting animated frames on the heap. This is because
we used SourceSurfaceAlignedRawData without implementing
AddSizeOfExcludingThis.
2018-02-22 14:26:29 -05:00
Andrew Osmond
b18fc05e36 Bug 1427639 - Part 1. Add preferences to control image frame allocations in volatile memory or the heap. r=tnikkel
image.mem.volatile.min_threshold_kb is the minimum buffer allocation for
an image frame in KB before it will use volatile memory. If it is less
than it will use the heap. This only is set to > 0 on Android.

image.mem.animated.use_heap forces image frames to use the heap if it is
for an animated image. This is only enabled for Android, and was
previously a compile time option also for Android.
2018-02-22 14:26:29 -05:00
Andrew Osmond
6529a8c077 Bug 1437886 - Prevent shared surfaces from being used without WebRender. r=nical
Move the initialization of SharedSurfacesParent from the compositor
thread creation to mirror the other WebRender-specific components, such
as the render thread creation. Now it will only be created if WebRender
is in use. Also prevent shared surfaces from being used by the image
frame allocator, even if image.mem.shared is set -- there is no purpose
in allowing this at present. It was causing startup crashes for users
who requested image.mem.shared and/or WebRender via gfx.webrender.all
but did not actually get WebRender at all. Surfaces would get allocated
in the shared memory, try to register themselves with the WR render
thread, and then crash since that thread was never created.
2018-02-16 09:50:40 -05:00
Andrew Osmond
71ec66dad0 Backed out changeset 2ffed9c081fa (bug 1437886) for test bustage on a CLOSED TREE. r=backout 2018-02-15 10:03:42 -05:00
Andrew Osmond
ddb7905e51 Bug 1437886 - Prevent shared surfaces from being used without WebRender. r=nical
Move the initialization of SharedSurfacesParent from the compositor
thread creation to mirror the other WebRender-specific components, such
as the render thread creation. Now it will only be created if WebRender
is in use. Also prevent shared surfaces from being used by the image
frame allocator, even if image.mem.shared is set -- there is no purpose
in allowing this at present. It was causing startup crashes for users
who requested image.mem.shared and/or WebRender via gfx.webrender.all
but did not actually get WebRender at all. Surfaces would get allocated
in the shared memory, try to register themselves with the WR render
thread, and then crash since that thread was never created.
2018-02-15 09:26:05 -05:00
Andrew Osmond
5567686405 Bug 1432375 - Part 2. Images decoded into an SourceSurfaceSharedData should be shared immediately. r=nical 2018-02-12 07:59:58 -05:00
Milan Sreckovic
d0d070b48c Bug 1423567: Use BaseRect access methods instead of member variables in image/ r=aosmond
MozReview-Commit-ID: JNYZsts6pCO

--HG--
extra : rebase_source : d37ce77ec84af302018f95285cff61b2ba28c957
2017-12-20 16:46:28 -05:00
Andrew Osmond
59aeaef70a Bug 1419912 - Part 2. Ensure the decoders invalidate the surface as written to. r=tnikkel 2017-12-01 06:59:21 -05:00
Andrew Osmond
675137dd9f Bug 1419767 - Remove gfxPlatform::CanRenderContentToDataSurface. r=nical
Factory::DoesBackendSupportDataDrawtarget already fulfills the same
purpose and we should use that instead, as imgFrame is the only user of
the former API. It has the added bonus of allowing us to use shared
surfaces on Linux with WebRender, and using volatile surfaces on Windows
when D2D is disabled.
2017-11-24 08:10:03 -05:00
Andrew Osmond
2c86b9676b Bug 1391430 - Force heap allocated surfaces for image decoding to use an unaligned stride. r=tnikkel
In bug 1383499 we fixed the case where on Android, animated images could
consume all of the available file handles. This is because each volatile
buffer will contain a file handle on Android, and animated images can
contain many, many frames. However in doing so we introduced a bug where
the stride of replacement surface was aligned to a 16-byte boundary. We
do not currently support any stride value but pixel size * image width
in the image decoding framework. This may be something we correct in the
future but for now, we should just ensure all surfaces follow the
expected stride value.
2017-08-31 06:38:55 -04:00
Andrew Osmond
539ab65d03 Bug 1383499 - Animated PNGs should allocate after-first frames on the heap instead of as volatile buffers on Android. r=tnikkel
Animated image frames are never actually released to let the OS purge
them, because AnimationSurfaceProvider keeps them as RawAccessFrameRef.
Meanwhile, each volatile buffer on Android needs a file handle to be
retained for as long as the buffer lives. Given sufficient number of
animated image frames, we could easily exhaust the available file
handles (which in turn causes many problems). As such on Android we
should stick with the heap for animated image frames. On other platforms
it is better to stay because we will avoid a memset, because the OS will
zero-fill the requested pages on our behalf.
2017-08-16 08:57:40 -04:00
Milan Sreckovic
5c01b5706c Bug 1387514: Upgrade BaseRect (derived classes) width and height direct member variable use to instead use Width()/SetWidth() and Height()/SetHeight() in image/*. r=aosmond
MozReview-Commit-ID: 8gyxxLziVe7

--HG--
extra : rebase_source : c79e81e10c54106645539c590bf81a03a300a909
2017-08-14 08:29:56 -04:00
Sylvestre Ledru
4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00
Kartikaya Gupta
7332c6da98 Bug 1376782 - Replace gfxSize with a typedef to SizeDouble. r=jrmuizel
Most of the changes in this patch are just using the explicit
constructor from gfx::IntSize to gfx::Size, since gfxSize did
that implicitly but gfx::Size doesn't.

MozReview-Commit-ID: CzikGjHEXje

--HG--
extra : rebase_source : 9d19977f2a774d9a2a653db923553a6c2e06f82a
2017-06-28 11:41:21 -04:00
Nicholas Nethercote
58786e1ea7 Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.

- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
  classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
  mostly misused.

- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
  universally available now anyway.

- Combines the first two string literal arguments of PROFILER_LABEL and
  PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
  them to be separate, and it forced a '::' in the label, which isn't always
  appropriate. Also, the meaning of the "name_space" argument was interpreted
  in an interesting variety of ways.

- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
  it clearer they construct RAII objects rather than just being function calls.
  (I myself have screwed up the scoping because of this in the past.)

- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
  the caller doesn't need to. This makes a *lot* more of the uses fit onto a
  single line.

The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).

- Fixes a bunch of labels that had gotten out of sync with the name of the
  class and/or function that encloses them.

- Removes a useless PROFILER_LABEL use within a trivial scope in
  EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
  any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
  a good idea.

- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
  done within them, instead of at their callsites, because that's a more
  standard way of doing things.

--HG--
extra : rebase_source : 318d1bc6fc1425a94aacbf489dd46e4f83211de4
2017-06-22 17:08:53 +10:00
Andrew Osmond
d93e9c00e1 Bug 1298652 - Allow 64k width/height images to be rendered. r=jrmuizel
MozReview-Commit-ID: DIK9y9acV0M

--HG--
extra : rebase_source : 55129089afacd7a4a932a1ada59d366db54ea33a
2016-09-01 07:32:02 -04:00
Andrew Osmond
13df27efb8 Bug 1341624 - Include shared handle totals in memory reports for images. r=tnikkel 2017-02-22 09:30:22 -05:00
Andrew Osmond
4f8eb1363e Bug 1339202 - Decode images to shared surfaces for WebRender. r=tnikkel 2017-02-08 15:48:59 -05:00
Phil Ringnalda
c7b01ecbda Backed out 5 changesets (bug 1290292, bug 1290293) for gfx assertions
CLOSED TREE

Backed out changeset 652c909b75ad (bug 1290293)
Backed out changeset 90a284ea19e3 (bug 1290292)
Backed out changeset 8401d12fe936 (bug 1290293)
Backed out changeset d87488b69c18 (bug 1290293)
Backed out changeset 7368aa665fae (bug 1290293)
2017-02-13 19:28:45 -08:00
Andrew Osmond
136381647d Bug 1290293 - Part 4. Remove surface buffer initialization for raster images. 2016-08-18 09:55:45 -04:00
Andrew Osmond
6679005d2a Bug 1290293 - Part 2e. Make SurfacePipe users clear unwritten pixels if the image is truncated. r=tnikkel 2016-08-18 09:55:45 -04:00
Sebastian Hengst
3ce82bcd4f Backed out changeset 45dd83a63162 (bug 1339202) for crashing in image processing related tests, e.g. xpcshell test test_imgtools.js. r=backout 2017-02-13 22:34:54 +01:00
Andrew Osmond
1683b602b4 Bug 1339202 - Decode images to shared surfaces for WebRender. r=tnikkel 2017-02-08 15:48:59 -05:00
Andrew Osmond
6dc0c7d3e0 Bug 1337790 - Fix null pointer dereference when a frame has no surface and one is requested. r=me 2017-02-08 10:51:08 -05:00
Andrew Osmond
c31478a16b Bug 1331938 - Part 3. Switch to using VolatileSourceSurface instead of VolatileBuffer directly in imgFrame. r=tnikkel 2017-01-18 13:31:20 -05:00
Andrew Osmond
ef3aee28a1 Bug 1332005 - Remove opaque BGRA8 image surface optimization. r=tnikkel 2017-01-18 12:52:42 -05:00
cku
09c56e6da6 Bug 1323912 - Part 2. Pass opacity down to imgIContainer::Draw. r=mstange
Each concrete class of imgIContainer is able to handle opacity already. All we
need to do is pass opacity value to them.

MozReview-Commit-ID: EMkLnG3YXA1

--HG--
extra : rebase_source : b0a0aad1fec0c2765e96d23ed9b627345c793795
2017-01-03 13:53:22 +08:00
Iris Hsiao
c8e876e89c Backed out changeset c868ab532766 (bug 1323912) 2017-01-04 21:47:12 -05:00
cku
adab9bea9f Bug 1323912 - Part 2. Pass opacity down to imgIContainer::Draw. r=mstange
Each concrete class of imgIContainer is able to handle opacity already. All we
need to do is pass opacity value to them.

MozReview-Commit-ID: EMkLnG3YXA1

--HG--
extra : rebase_source : 080a843b34cc1ca27831310d474243b4066f59f2
2017-01-03 13:53:22 +08:00
Andrew Osmond
0eb070a4cc Bug 1311779 - Part 2. Add telemetry to track optimizable opaque images decoded into B8G8R8A8 surfaces. r=tnikkel 2016-10-19 12:34:30 -04:00
Nathan Froyd
19607c3802 Bug 1306625 - fix wonky identation in imgFrame.cpp; r=tnikkel
DONTBUILD because whitespace-only fixes are always safe...right?
2016-09-30 23:11:59 -04:00
Bas Schouten
77e2a32f4a Bug 1296657: Attempt to create an mOptSurface of the correct type for the DT we're drawing to. r=tnikkel
MozReview-Commit-ID: 2LIQWUPAuaF
2016-09-15 13:53:12 +02:00
Seth Fowler
2977081713 Bug 1296147 (Part 2) - Rename imgFrame::GetSurface() to imgFrame::GetSourceSurface() for clarity. r=edwin 2016-08-18 13:03:49 -07:00
Seth Fowler
7a29534fe8 Bug 1293794 - Allow imgFrame volatile buffers to be freed on all platforms. r=jrmuizel 2016-08-15 17:42:30 -07:00
Ryan Hunt
92206266e3 Bug 1294586 - Remove dependency on gfxPlatform from CreateDrawTargetFromData. r=dvander
MozReview-Commit-ID: A355fBJKWP6

--HG--
extra : rebase_source : 85ffd4b9d5f9708a1666bbc8e229ba576cc97680
2016-08-11 14:54:08 -07:00
Nicholas Nethercote
e7f10a07fd Bug 1293603 (part 2) - Make Run() declarations consistent. r=erahm.
This patch makes most Run() declarations in subclasses of nsIRunnable have the
same form: |NS_IMETHOD Run() override|.

As a result of these changes, I had to add |override| to a couple of other
functions to satisfy clang's -Winconsistent-missing-override warning.

--HG--
extra : rebase_source : 815d0018b0b13329bb5698c410f500dddcc3ee12
2016-08-08 12:18:10 +10:00
Seth Fowler
ba8bb5de9d Bug 1292747 (Part 3) - Clean up some comments in imgFrame related to Optimize()'s behavior. r=edwin 2016-08-08 16:25:50 -07:00
Seth Fowler
ad2f26e773 Bug 1292747 (Part 2) - Remove the 565 optimization from imgFrame. r=edwin 2016-08-08 16:25:48 -07:00