Commit Graph

353 Commits

Author SHA1 Message Date
Ryan Hunt
432f7c72e6 Remove BufferContentType and add ValidBufferSize (bug 1399692 part 3, r=bas)
BufferContentType and BufferSizeOkFor make more sense as general functions for
any RotatedBuffer, and this helps out in a later patch.

MozReview-Commit-ID: EAVodvl4WTu
2017-10-23 14:56:13 -04:00
Ryan Hunt
c2f753d80f Simplify the code for creating a new back buffer (bug 1399692 part 2, r=bas)
MozReview-Commit-ID: D28JNYWD9Uc
2017-10-23 12:40:01 -04:00
NARCIS BELEUZU
d773899b54 Backed out 7 changesets (bug 1399692) failing on browser chrome browser/base/content/test/performance/browser_urlbar_search_reflows.js
Backed out changeset e9349ad2f1f8 (bug 1399692)
Backed out changeset cb6507b560aa (bug 1399692)
Backed out changeset 3d0da6564096 (bug 1399692)
Backed out changeset 926af2eca400 (bug 1399692)
Backed out changeset b57a3f0d0847 (bug 1399692)
Backed out changeset 9fcb661df79e (bug 1399692)
Backed out changeset 744c8fabaa1c (bug 1399692)
2017-11-03 14:32:46 +02:00
Ryan Hunt
d96026ce41 Replay buffer commands on paint thread when OMTP is enabled (bug 1399692 part 7, r=bas)
This commit does the work of actually dispatching the recorded buffer operations
to the paint thread, and removing some main thread asserts from TextureClient.

MozReview-Commit-ID: CN3RoQPz9fP
2017-10-26 00:47:17 -04:00
Ryan Hunt
a9762efedf Record buffer operations to a struct for replaying on paint thread (bug 1399692 part 6, r=bas)
This commit adds a CapturedBufferState which is used to record all the operations
that are necessary for preparing the buffers. The commands are then instantly
executed to preserve the same behavior, but in the following commit they will
be dispatched to the paint thread.

Note: RotatedBuffer's aren't thread safe and so a shallow copy needs to be made
for sending to the paint thread. This complicates the code for AdjustTo as it can
fail naturally and the buffer parameter changes are needed later in BeginPaint.
So the code for AdjustTo is split up a bit to accomodate that.

MozReview-Commit-ID: FwSwFay887o
2017-10-25 10:20:49 -04:00
Ryan Hunt
f5da6dfc9f Simplify copying the front buffer to the back buffer (bug 1399692 part 5, r=bas)
To sync the back buffer with the front buffer, we set the back buffer rect and
rotation to the front buffer's, and then copy over the pixels that different.

We used to do the updating of the rect and rotation before BeginPaint, but that
isn't necessary and we can move it to be with the copying of pixels.

MozReview-Commit-ID: HzBKvMZkn1
2017-10-23 18:27:53 -04:00
Ryan Hunt
93c66db022 Don't create back buffer for front buffer until we know what type to create. (bug 1399692 part 4, r=bas)
This commit is an optimization for double buffering that delays the creation of
a back buffer until we know what kind of content type it needs to be.

Before this commit, we would EnsureBackBufferIfFrontBuffer before BeginPaint,
then in BeginPaint we could determine that we actually needed a different kind
of buffer because the content changed type, and recreate it.

This was needed because BeginPaint would copy the old front buffer to the buffer
created by EnsureBackBufferIfFrontBuffer, and then if anything failed or we had
determined we couldn't reuse the buffer, we would create a new one and copy that
"temporary" back buffer over, and use the new one.

This is unnecessary because we only need read access on that "temporary" back
buffer, and so we can just use the current front buffer instead.

This optimization only affects the double buffered case, and the single buffered
or basic cases should remain the same.

Note: Because we now need the front buffer for copying into the new back buffer,
we cannot Clear() it away in some error cases.

MozReview-Commit-ID: 2hyrrUhA4zO
2017-10-23 15:33:40 -04:00
Ryan Hunt
bc2124ed06 Remove BufferContentType and add ValidBufferSize (bug 1399692 part 3, r=bas)
BufferContentType and BufferSizeOkFor make more sense as general functions for
any RotatedBuffer, and this helps out in a later patch.

MozReview-Commit-ID: EAVodvl4WTu
2017-10-23 14:56:13 -04:00
Ryan Hunt
e07a67fc9b Simplify the code for creating a new back buffer (bug 1399692 part 2, r=bas)
MozReview-Commit-ID: D28JNYWD9Uc
2017-10-23 12:40:01 -04:00
Sebastian Hengst
4c3e66715b merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: 4PW6ESqLL73
2017-10-30 23:52:23 +01:00
Ryan Hunt
25c8dfaadf Be sure to invalidate the buffer when content changes and we cannot reuse the buffer. (bug 1412150, r=nical)
Even if we cannot reuse the back buffer, we still use it to initialize the new back buffer.
The correct condition for detecting changes to buffer mode should only care if there is a
buffer, not if we decided to reuse it.

If the buffer mode has changed to component alpha, we need to invalidate and repaint everything
because we won't be able to copy over content to the new buffer correctly.

I believe this is a regression from the refactoring that created this function from
RotatedContentBuffer::BeginPaint.

MozReview-Commit-ID: H9G7GxqekLt
2017-10-28 15:21:13 -05:00
Daniel Holbert
bb0a8b6602 Bug 1412427 part 8: (automated patch) Switch a bunch of C++ files in gfx to use our standard mode lines. r=jrmuizel
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: 77D61xpSmIl
2017-10-27 16:10:06 -07:00
Ryan Hunt
49c1a97d3c Be sure to unlock the old back buffer before we release it. (bug 1409871 part 20, r=nical)
MozReview-Commit-ID: HR9EiYrDeqT
2017-10-20 12:28:41 -04:00
Ryan Hunt
1e087d255d Remove mInAsyncPaint and move locking new back buffer into BeginPaint (bug 1409871 part 19, r=nical)
mInAsyncPaint is only needed because the code using CreateBuffer expects the
buffer to be locked when it is returned. This isn't necessary because we can
now lock in BeginPaint.

MozReview-Commit-ID: 8WazvBKMbvb
2017-10-18 15:31:15 -04:00
Ryan Hunt
0d74eb35a6 Remove BeginPaintBuffer (bug 1409871 part 18, r=nical)
Now that BeginPaintBuffer and BeginPaint are both implemented by content client,
I think it makes sense to just merge them into one method. This simplifies the
interface clients have to use.

MozReview-Commit-ID: 8bjH6WcpZS9
2017-10-18 15:20:14 -04:00
Ryan Hunt
f6ac493ed4 Clean up some methods on ContentClient (bug 1409871 part 17, r=nical)
This commit does some more cleanup on the content client class hierarchy.
Some methods were virtual or instance methods when they didn't need to be.

MozReview-Commit-ID: 2y2D3zYtYvM
2017-10-18 14:54:26 -04:00
Ryan Hunt
506f8e4a2e Fix PrepareDrawTargetForPainting (bug 1409871 part 16, r=dvander)
CapturedPaintState::mTarget is actually a dual draw target to the black and
white draw targets, so this code will have the white draw target cleared black
and then white. This isn't incorrect, it's just wasteful.

MozReview-Commit-ID: ItgiSmegPK6
2017-10-18 14:46:54 -04:00
Ryan Hunt
4adbf800ba Use a rect instead of a region for UpdateDestinationFrom (bug 1409871 part 15, r=nical)
UpdateDestinationFrom actually only uses a rect, so it's best to not be
misleading and force the clients of it to do the conversion.

MozReview-Commit-ID: EsUv3apqnku
2017-10-18 14:35:18 -04:00
Ryan Hunt
c381686c72 Update comments for ContentClient (bug 1409871 part 13, r=nical)
This could be a part of the previous commit, but I omitted it to keep the size
down. Just some updates to comments and documentation.

MozReview-Commit-ID: HkCOSIQhBNv
2017-10-18 13:42:19 -04:00
Ryan Hunt
78f2e18a94 Kill RotatedContentBuffer (bug 1409871 part 12, r=nical)
This commit is the guts of the refactoring.

This commit removes rotated content buffer, and moves the necessary
functionality to content client. All content clients now do not inherit from
rotated content buffer, but contain a refptr to a rotated buffer.

For the basic content client, this is a DrawTargetRotatedBuffer.
For the remote content client, this is a RemoteRotatedBuffer.
The double buffered content client contains an additional RemoteRotatedBuffer
for the front buffer.

Each derived class of content client only needs to implement a method to
create its own rotated buffer. The rest is handled by the base content
client. The remote content clients still override some additional methods
to sync buffers and do IPC.

MozReview-Commit-ID: B9vcSi8UYhm
2017-10-16 19:45:11 -04:00
Ryan Hunt
1d8186c2bd Remove PaintState::mDidSelfCopy. (bug 1409871 part 9, r=nical)
Miscellaneous cleanup, PaintState doesn't need to know this as no one uses
this information outside of the content client classes.

MozReview-Commit-ID: 6K8LxEPvp4V
2017-10-12 17:24:50 -04:00
Ryan Hunt
7f1f7469a9 Move mFrontAndBackBufferDiffer to ContentClientDoubleBuffered. (bug 1409871 part 8, r=nical)
Miscellaneous cleanup, ContentClientSingleBuffered doesn't need to track if
the front and back buffer differ.

MozReview-Commit-ID: IvAw0b92jsh
2017-10-12 12:58:17 -04:00
Ryan Hunt
284c1e869d Use a RemoteRotatedBuffer for the front buffer of ContentClientDoubleBuffered. (bug 1409871 part 5, r=nical)
The front buffer for a double buffered content client is really just another
rotated buffer, so it can simplify the code to use the class we just added.
The goal is to have the back and the front buffer using remote rotated buffers,
but this is a good first step.

Note: The front buffer is represented as a Maybe<RemoteRotatedBuffer> in this
commit, but in the future it will be a RefPtr. That can't be done yet, because
rotated buffer can't implement refcounting in addition to compositable client.

MozReview-Commit-ID: Czk3otkf1pb
2017-10-11 15:22:57 -04:00
Ryan Hunt
6129ac13bb Move DrawTo to RotatedBuffer. (bug 1409871 part 3, r=nical)
Similar to the previous patch, more functionality can be moved to rotated
buffer and out of rotated content client.

MozReview-Commit-ID: FNqfonyBBq9
2017-10-11 15:31:20 -04:00
Ryan Hunt
30634cbbaa Move UpdateDestinationFrom to RotatedBuffer. (bug 1409871 part 2, r=nical)
UpdateDestinationFrom is a useful method for any rotated buffer. This will be
needed when content clients are no longer rotated buffers.

Note: EnsureBuffer and EnsureBufferOnWhite were moved out of
UpdateDestinationFrom because I'd like to kill those methods, and so the calls
were moved to all users of UpdateDestinationFrom.

MozReview-Commit-ID: 2e3HhUsZ6iw
2017-10-11 13:40:16 -04:00
Ryan Hunt
453f7753fd Remove ContentClientRemote. (bug 1409871 part 1, r=nical)
This class doesn't seem to be necessary and only complicates the class
hierarchy.

MozReview-Commit-ID: 6dRXce1vB9T
2017-10-11 12:43:39 -04:00
Sebastian Hengst
94853f4e18 Backed out changeset 45596e6d2e2f (bug 1409871) on request from rhunt for causing black context menus on Windows. r=backout 2017-10-23 23:44:15 +02:00
Sebastian Hengst
fb6a690cd5 Backed out changeset 0c763c30594d (bug 1409871) 2017-10-23 23:44:09 +02:00
Sebastian Hengst
66ebccfbb4 Backed out changeset a9f8832adcb4 (bug 1409871) 2017-10-23 23:44:04 +02:00
Sebastian Hengst
3636244275 Backed out changeset 92d59687d486 (bug 1409871) 2017-10-23 23:43:52 +02:00
Sebastian Hengst
4cf15d869e Backed out changeset d57058c8c12e (bug 1409871) 2017-10-23 23:43:36 +02:00
Sebastian Hengst
db74b2b58f Backed out changeset cce97a15c945 (bug 1409871) 2017-10-23 23:43:30 +02:00
Sebastian Hengst
0a8fb1e0f8 Backed out changeset 7b7bcdf87539 (bug 1409871) 2017-10-23 23:43:13 +02:00
Sebastian Hengst
a9b4fa54d4 Backed out changeset 2d9d7435eb63 (bug 1409871) 2017-10-23 23:43:07 +02:00
Sebastian Hengst
f047f5fa6e Backed out changeset 482309a25d13 (bug 1409871) 2017-10-23 23:42:56 +02:00
Sebastian Hengst
05fcd344ca Backed out changeset 7e2fc94f5be9 (bug 1409871) 2017-10-23 23:42:51 +02:00
Sebastian Hengst
f4cf06d700 Backed out changeset 466f20f34a13 (bug 1409871) 2017-10-23 23:42:45 +02:00
Sebastian Hengst
196b098371 Backed out changeset 352a6f520d27 (bug 1409871) 2017-10-23 23:42:39 +02:00
Sebastian Hengst
37096c3eab Backed out changeset 56fe4c3c3b04 (bug 1409871) 2017-10-23 23:42:34 +02:00
Sebastian Hengst
bb46083256 Backed out changeset a4e35be8cf4c (bug 1409871) 2017-10-23 23:42:28 +02:00
Ryan Hunt
ff2e451f32 Be sure to unlock the old back buffer before we release it. (bug 1409871 part 20, r=nical)
MozReview-Commit-ID: HR9EiYrDeqT
2017-10-20 12:28:41 -04:00
Ryan Hunt
b347cc81a4 Remove mInAsyncPaint and move locking new back buffer into BeginPaint (bug 1409871 part 19, r=nical)
mInAsyncPaint is only needed because the code using CreateBuffer expects the
buffer to be locked when it is returned. This isn't necessary because we can
now lock in BeginPaint.

MozReview-Commit-ID: 8WazvBKMbvb
2017-10-18 15:31:15 -04:00
Ryan Hunt
7d5f9141d9 Remove BeginPaintBuffer (bug 1409871 part 18, r=nical)
Now that BeginPaintBuffer and BeginPaint are both implemented by content client,
I think it makes sense to just merge them into one method. This simplifies the
interface clients have to use.

MozReview-Commit-ID: 8bjH6WcpZS9
2017-10-18 15:20:14 -04:00
Ryan Hunt
ad0bb37ab6 Clean up some methods on ContentClient (bug 1409871 part 17, r=nical)
This commit does some more cleanup on the content client class hierarchy.
Some methods were virtual or instance methods when they didn't need to be.

MozReview-Commit-ID: 2y2D3zYtYvM
2017-10-18 14:54:26 -04:00
Ryan Hunt
07962ccf99 Fix PrepareDrawTargetForPainting (bug 1409871 part 16, r=dvander)
CapturedPaintState::mTarget is actually a dual draw target to the black and
white draw targets, so this code will have the white draw target cleared black
and then white. This isn't incorrect, it's just wasteful.

MozReview-Commit-ID: ItgiSmegPK6
2017-10-18 14:46:54 -04:00
Ryan Hunt
5a2fc8bc61 Use a rect instead of a region for UpdateDestinationFrom (bug 1409871 part 15, r=nical)
UpdateDestinationFrom actually only uses a rect, so it's best to not be
misleading and force the clients of it to do the conversion.

MozReview-Commit-ID: EsUv3apqnku
2017-10-18 14:35:18 -04:00
Ryan Hunt
4898a9b3ee Update comments for ContentClient (bug 1409871 part 13, r=nical)
This could be a part of the previous commit, but I omitted it to keep the size
down. Just some updates to comments and documentation.

MozReview-Commit-ID: HkCOSIQhBNv
2017-10-18 13:42:19 -04:00
Ryan Hunt
d9c72a4bbc Kill RotatedContentBuffer (bug 1409871 part 12, r=nical)
This commit is the guts of the refactoring.

This commit removes rotated content buffer, and moves the necessary
functionality to content client. All content clients now do not inherit from
rotated content buffer, but contain a refptr to a rotated buffer.

For the basic content client, this is a DrawTargetRotatedBuffer.
For the remote content client, this is a RemoteRotatedBuffer.
The double buffered content client contains an additional RemoteRotatedBuffer
for the front buffer.

Each derived class of content client only needs to implement a method to
create its own rotated buffer. The rest is handled by the base content
client. The remote content clients still override some additional methods
to sync buffers and do IPC.

MozReview-Commit-ID: B9vcSi8UYhm
2017-10-16 19:45:11 -04:00
Ryan Hunt
8f4fb20f73 Remove PaintState::mDidSelfCopy. (bug 1409871 part 9, r=nical)
Miscellaneous cleanup, PaintState doesn't need to know this as no one uses
this information outside of the content client classes.

MozReview-Commit-ID: 6K8LxEPvp4V
2017-10-12 17:24:50 -04:00
Ryan Hunt
f8e9d02ff3 Move mFrontAndBackBufferDiffer to ContentClientDoubleBuffered. (bug 1409871 part 8, r=nical)
Miscellaneous cleanup, ContentClientSingleBuffered doesn't need to track if
the front and back buffer differ.

MozReview-Commit-ID: IvAw0b92jsh
2017-10-12 12:58:17 -04:00