Граф коммитов

115 Коммитов

Автор SHA1 Сообщение Дата
sotaro 80f17b60f8 Bug 1651587 - Make image::Image released efficient on main thread r=aosmond
Current gecko dispatches tasks of releasing image::Image to main thread at some places. The task was dispatched individually. Then there were cases that the releasing took long time. It increased peak memory usage and caused a problem like Bug 1639280. When main thread is very busy like WebGL, it takes longer time until the Image is released on main thread. If Images are released quickly on main thread, we could reduce peak memory usage.

When SurfaceCache::ReleaseImageOnMainThread() is called, there could be already an ongoing task for releasing Image. It could reduce a duration until release on main thread.

Differential Revision: https://phabricator.services.mozilla.com/D82864
2020-07-10 14:34:01 +00:00
Andrew Osmond da72652618 Bug 1620600 - Add flags to allow image decoders to produce sRGB output. r=tnikkel
Currently we can only use the gfx.color_management.force_srgb pref to
force all images to sRGB, or just accept device space. It would be nice
to be able to test device space in our tests, as well as sRGB. This
patch adds a surface flag which allows us to selectively output sRGB.

This will also be useful for clipboard and re-encoding purposes, since
they want a neutral output. In an ideal world we would just output the
color profile and the pixel data in the original color space, but for
now this is a relatively simple approach that works on all platforms and
interops well with all applications.

Differential Revision: https://phabricator.services.mozilla.com/D65734

--HG--
extra : moz-landing-system : lando
2020-04-10 16:26:33 +00:00
Andreas Farre 63e21eec70 Bug 1620594 - Part 1: Rework NS_ReleaseOnMainThreadSystemGroup. r=nika
To be able to remove SystemGroup, NS_ReleaseOnMainThreadSystemGroup
needs to have its dependency on SystemGroup removed. Since all
releases using SystemGroup would've released on the main thread anyway
we can safely replace NS_ReleaseOnMainThreadSystemGroup with
NS_ReleaseOnMainThread.

Depends on D64390

Differential Revision: https://phabricator.services.mozilla.com/D67631

--HG--
extra : moz-landing-system : lando
2020-04-07 15:16:23 +00:00
Arthur Iakab 6990ddf5e2 Backed out changeset e6e5816403d9 (bug 1620600) for causing Gtest failures.
CLOSED TREE
2020-03-12 04:44:59 +02:00
Andrew Osmond 5c7e1dd283 Bug 1620600 - Add flags to allow image decoders to produce sRGB output. r=tnikkel
Currently we can only use the gfx.color_management.force_srgb pref to
force all images to sRGB, or just accept device space. It would be nice
to be able to test device space in our tests, as well as sRGB. This
patch adds a surface flag which allows us to selectively output sRGB.

This will also be useful for clipboard and re-encoding purposes, since
they want a neutral output. In an ideal world we would just output the
color profile and the pixel data in the original color space, but for
now this is a relatively simple approach that works on all platforms and
interops well with all applications.

Differential Revision: https://phabricator.services.mozilla.com/D65734

--HG--
extra : moz-landing-system : lando
2020-03-12 00:37:53 +00:00
Andrew Osmond 127fcd7b52 Bug 1255105 - Use SurfacePipe in the BMP decoder. r=tnikkel
This patch converts the BMP decoder to use SurfacePipe instead of using
AllocateFrame and Downscaler directly. As a result, it now uses the
accelerated premultiplication path, honours the
SurfaceFlags::NO_PREMULTIPLY_ALPHA flag, and allows for a path forward
to support color management and clipboard better.

Differential Revision: https://phabricator.services.mozilla.com/D64866

--HG--
extra : moz-landing-system : lando
2020-03-02 23:24:12 +00:00
Andrew Osmond a445258270 Bug 1255106 - Part 1. Move color transform state to image decoder base class. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D26369
2019-05-28 11:38:46 -04:00
Andrew Osmond 3befab3ee9 Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D23716
2019-03-18 07:30:34 -04:00
Markus Stange ad3f9a53de Bug 1500692 - Add GRAPHICS subcategories. r=njn,mattwoodrow
r?njn only because this is the first example that adds any actual subcategories.

Differential Revision: https://phabricator.services.mozilla.com/D11340

--HG--
extra : moz-landing-system : lando
2019-02-16 17:38:23 +00:00
Andrew Osmond 98da085964 Bug 1516011 - Part 2. Deny recycling for frames used in blob recordings. r=tnikkel
Given the crash resolved in part 1, it is possible for the blob
rasterizer in the compositor process to still be using surfaces after
the animation has advanced to the next frame. With recycling this can be
problematic as the recycled surface will be reused for a future frame.
In an ideal world, the blob recording would use the animation's image
key instead, but the rasterizer doesn't have easy access to the mapping
table. As such, for any frames used in a blob recording, we now
explicitly mark them as non-recyclable and we will be forced to allocate
a new frame instead.

Differential Revision: https://phabricator.services.mozilla.com/D16192
2019-01-14 13:21:57 -05:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Andrew Osmond 4e0ba74469 Bug 1465619 - Part 7. Add support for recycling to image::Decoder. r=tnikkel
The owner for the decoder may implement IDecoderFrameRecycler to allow
the decoder to request a recycled frame instead of allocating a new one.
If none are available, it will fallback to allocating a new frame.

Not only may the IDecoderFrameRecycler not have any frames available for
recycling, the recycled frame itself may still be in use by other
entities outside of imagelib. Additionally it may still be required by
BlendAnimationFilter to restore the previous frame's data. It may even
be the same frame as to restore. In the worst case, we will simply
choose to allocate an entirely new frame, just like before.

When we allocate a new frame, that means the old frame we tried to
recycle will be taken out of circulation and not reused again,
regardless of why it failed.

Differential Revision: https://phabricator.services.mozilla.com/D7512
2018-10-22 13:40:35 -04:00
Andrew Osmond 2c6fa568a4 Bug 1465619 - Part 4. Move the first frame refresh area calculation to frame commit. r=tnikkel
If we discard a frame during decoding, e.g. due to an error, then we
don't want to take that frame into account for the first frame refresh
area. We should also be handling partial frames here (the dirty rect
needs to encompass the rows that did not get written with actual pixel
data). The only place that can have the necessary information is at the
end rather than at the beginning.

Differential Revision: https://phabricator.services.mozilla.com/D7509
2018-10-22 13:40:35 -04:00
Andrew Osmond c838361d7c Bug 1465619 - Part 2. Add basic support for recycling a frame buffer to BlendAnimationFilter. r=tnikkel
Given an invalidation rect, called the recycle rect, which represents
the area which may have changed between the current frame and the frame
we are recycling, we can not only reuse the buffer itself to avoid an
allocation and free, we can also avoid copying pixel data from the
restore frame which is already set.

Differential Revision: https://phabricator.services.mozilla.com/D7507
2018-10-22 13:40:35 -04:00
Andrew Osmond 8be55f0165 Bug 1337111 - Part 5. Add pref to force decoding of full frames, disabled by default. r=tnikkel 2018-09-17 15:06:29 -04:00
Andrew Osmond 5024f42bc6 Bug 1337111 - Part 2. Add an image decoder flag to request complete frames. r=tnikkel
DecoderFlags::BLEND_ANIMATION will cause the decoder to inject the
BlendAnimationFilter from the previous patch into the SurfacePipe filter
chain. All frames produced by this decoder will be complete, and
should be equivalent to the result outputted by FrameAnimator.
2018-09-17 15:06:28 -04:00
Coroiu Cristina de5411772c Backed out 6 changesets (bug 1337111) for build bustages at builds/worker/workspace/build/src/image/SurfaceFilters.h on a CLOSED TREE
Backed out changeset ca0caa556dc9 (bug 1337111)
Backed out changeset d7d7fa868d0d (bug 1337111)
Backed out changeset 93e956e89a21 (bug 1337111)
Backed out changeset f36337c1309b (bug 1337111)
Backed out changeset 1b1e25b0b345 (bug 1337111)
Backed out changeset 3785cdebe6a3 (bug 1337111)
2018-09-17 20:42:30 +03:00
Andrew Osmond f823b924c8 Bug 1337111 - Part 5. Add pref to force decoding of full frames, disabled by default. r=tnikkel 2018-09-17 13:21:38 -04:00
Andrew Osmond d923b67d0f Bug 1337111 - Part 2. Add an image decoder flag to request complete frames. r=tnikkel
DecoderFlags::BLEND_ANIMATION will cause the decoder to inject the
BlendAnimationFilter from the previous patch into the SurfacePipe filter
chain. All frames produced by this decoder will be complete, and
should be equivalent to the result outputted by FrameAnimator.
2018-09-17 13:21:38 -04:00
Andrew Osmond d588cc7135 Bug 1472520 - Fix a crash when generating image decoder telemetry. r=tnikkel
It is possible for a decoder's iterator to be invalid in some error
conditions, all related to the ICO decoder seeking behaviour. Since we
assume that the iterator is always valid for the purposes of generating
the decoder's telemetry data, a malformed ICO image could cause a crash.

This patch removes the assumption that the iterator is valid, and
ensures we don't add the decoder's data to telemetry if it is invalid.
2018-07-04 08:50:02 -04: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 6c32a5f985 Bug 1462355 - Part 1b. Update Decoder and SurfacePipe plumbing to use updated imgFrame methods. r=tnikkel 2018-05-29 08:36:12 -04:00
Timothy Nikkel 7d6982559e Bug 1443232. Don't insert frames into our AnimationFrameBuffer that we consider in error and unusable. r=aosmond
After decoding the first frame we allocate the second frame, but before it finishes we encounter an error, Decoder::PostError is called it aborts the second frame and decrements the frame count. But AnimationSurfaceProvider::CheckForFrameAtTerminalState just asks for the current frame ref from the decoder (which it never cleared) and inserts that.

The condition that we use from the decoder to decide to report a new frame is mFinishedNewFrame (via TakeCompleteFrameCount), however this doesn't directly correspond to mFrameCount. So we create a new bool on the Decoder to track when there is a frame that we can take.

This didn't cause any problems before but now we have tighter coupling between the list of frames the AnimationSurfaceProvider has and what FrameAnimator expects.

Another possible fix would be to clear the current frame ref in PostError, but the only place we clear the current frame is when we allocate the new frame and we have the mImageData pointer still around that decoders could theorhetically use to do final processing on the last partial frame.
2018-03-08 17:33:04 -06:00
Jonathan Watt 7c5d39a558 Bug 1417021 - Fix various non-unified build errors in imagelib. r=aosmond 2017-10-24 23:22:55 +01:00
Gerald Squelart d2ed3d6312 Bug 1410252 - Convert 'WrapNotNull(new T(...' to 'MakeNotNull<T*>(...' - r=njn
Most cases where the pointer is stored into an already-declared variable can
trivially be changed to MakeNotNull<T*>, as the NotNull raw pointer will end
up in a smart pointer.

In RAII cases, the target type can be specified (e.g.:
`MakeNotNull<RefPtr<imgFrame>>)`), in which case the variable type may just be
`auto`, similar to the common use of MakeUnique.
Except when the target type is a base pointer, in which case it must be
specified in the declaration.

MozReview-Commit-ID: BYaSsvMhiDi

--HG--
extra : rebase_source : 8fe6f2aeaff5f515b7af2276c439004fa3a1f3ab
2017-10-20 18:25:33 +11: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
Andrew Osmond ac14e4f8f5 Bug 1315554 - Part 1. Enforce the parent decoder size (ICO) for child decoders (BMP, PNG). r=tnikkel 2017-07-22 07:50:31 -04:00
Sebastian Hengst cc27374338 Backed out changeset fd310390a64a (bug 1315554) for failing GTest's ImageDecoders.LargeICOWithPNGSingleChunk on OS X opt. r=backout 2017-07-22 11:05:35 +02:00
Andrew Osmond 1e83b97079 Bug 1315554 - Part 1. Enforce the parent decoder size (ICO) for child decoders (BMP, PNG). r=tnikkel 2017-07-22 00:14:58 -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 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
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 42d8ee76ab Bug 1290293 - Part 2f. Assert there is no frame on the finish decoding error path. r=tnikkel 2017-02-10 08:33:11 -05:00
Andrew McCreight 55073ae53d Bug 1333974, part 2 - Use new API for images. r=tnikkel
MozReview-Commit-ID: CmjVpXAFmjx

--HG--
extra : rebase_source : 16349f1628e54ed59df3003ab6dca1b7aa12cc7d
2017-01-31 11:34:01 -08:00
Andrew Osmond 46250e2a5e Bug 1258741 - Part 2. Ensure we consistently render partially decoded images. r=tnikkel 2016-09-26 14:18:37 -04:00
Andrew Osmond 54d6f7e0c4 Bug 1258741 - Part 1. Remove dead/unused image decoder aborted flag. r=tnikkel 2016-09-21 07:13:08 -04:00
Seth Fowler 1f92f3a7b9 Bug 1293472 (Part 3) - Store animated images in the surface cache as a sequence of frames, rather than each frame getting its own cache entry. r=dholbert,edwin,njn 2016-08-18 15:42:48 -07:00
Seth Fowler 0403b4baba Bug 1291071 (Part 5) - Pass the decoder's final status explicitly to FinalizeDecoder(). r=edwin 2016-08-05 18:50:31 -07:00
Seth Fowler 98a9fd7db6 Bug 1291071 (Part 4) - Clean up Decoder::SpeedHistogram() and related code. r=edwin 2016-08-05 18:50:29 -07:00
Seth Fowler baf4983cd8 Bug 1291071 (Part 3) - Pass telemetry explicitly to FinalizeDecoder. r=edwin 2016-08-05 18:50:27 -07:00
Seth Fowler 694b00bcd2 Bug 1291045 (Part 3) - Handle interactions with the SurfaceCache in DecodingTask. r=dholbert,edwin 2016-08-05 18:46:13 -07:00
Seth Fowler f2c6e25053 Bug 1292505 (Part 1a) - Replace Decoder::SetTargetSize() with Decoder::SetOutputSize(). r=edwin 2016-08-05 13:44:44 -07:00
Seth Fowler 3cca5ff418 Bug 1291054 (Part 3) - Rename Decoder::GetSize() to Decoder::Size() to be consistent with the style guide. r=edwin 2016-08-02 04:10:51 -07:00
Seth Fowler 16cff1aefa Bug 1290759 - Convert frame number check in Decoder::AllocateFrame() into an assert. r=edwin 2016-08-01 17:40:05 -07:00
Seth Fowler 97b4a5d8c7 Bug 1289957 (Part 2) - Notify RasterImage about new frames in NotifyProgress() and remove OnAddedFrame(). r=edwin 2016-07-28 00:12:50 -07:00
Seth Fowler 3e8d8d790f Bug 1288040 (Part 10) - Determine the first frame refresh area of animated images while decoding them. r=edwin 2016-07-20 16:30:39 -07:00
Seth Fowler 642c28d837 Bug 1288040 (Part 9) - Determine the loop length of animated images while decoding them. r=edwin 2016-07-20 16:30:36 -07:00