Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Issue 1168853002: Use mapped memory for uploading large textures. (Closed)

Created:
5 years, 6 months ago by David Yen
Modified:
5 years, 6 months ago
Reviewers:
jbauman, piman
CC:
chromium-reviews, piman+watch_chromium.org, Ken Russell (switch to Gerrit), vmiura
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use mapped memory for uploading large textures. When TexImage2D/TexImage3D is called with an image that is larger than the ring buffer, we had previously fallen back to calling TexSubImage2D/TexSubImage3D multiple times. This is suboptimal because we always issue a clear along with TexSubImage calls for security reasons (the image is not being completely replaced so we do not want to leak old texture data). This CL now makes it so it falls back to using mapped memory instead. If we run out of memory, then we fall back to TexSubImage2D as we did before. R=jbauman@chromium.org, piman@chromium.org BUG=462078 Committed: https://crrev.com/4e297d74fef5371fe545e994aa479c5e7b7eb2f9 Cr-Commit-Position: refs/heads/master@{#333851}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Same fix for TexImage3D, also share uploading code. #

Total comments: 5

Patch Set 3 : Removed old code. #

Patch Set 4 : Fixed old unit tests and added new unit tests. #

Patch Set 5 : Added method to discard last block in ringbuffer #

Patch Set 6 : Discard blocks by simply marking them as padding. #

Total comments: 2

Patch Set 7 : Added new max allocated bytes limit to mapped memory manager #

Total comments: 4

Patch Set 8 : Modified discard to actually modify the blocks #

Patch Set 9 : Bad upload, reupload #

Total comments: 6

Patch Set 10 : Simplified how discard is implemented #

Patch Set 11 : Added dcheck and improved other error messages #

Unified diffs Side-by-side diffs Delta from patch set Stats (+605 lines, -16 lines) Patch
M gpu/command_buffer/client/gles2_implementation.cc View 1 2 3 4 5 6 7 8 9 5 chunks +49 lines, -14 lines 0 comments Download
M gpu/command_buffer/client/gles2_implementation_unittest.cc View 1 2 3 4 5 6 6 chunks +123 lines, -1 line 0 comments Download
M gpu/command_buffer/client/mapped_memory.h View 1 2 3 4 5 6 2 chunks +69 lines, -0 lines 0 comments Download
M gpu/command_buffer/client/mapped_memory.cc View 1 2 3 4 5 6 3 chunks +29 lines, -1 line 0 comments Download
M gpu/command_buffer/client/mapped_memory_unittest.cc View 1 2 3 4 5 6 1 chunk +48 lines, -0 lines 0 comments Download
M gpu/command_buffer/client/ring_buffer.h View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download
M gpu/command_buffer/client/ring_buffer.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +39 lines, -0 lines 0 comments Download
M gpu/command_buffer/client/ring_buffer_test.cc View 1 2 3 4 5 6 7 1 chunk +225 lines, -0 lines 0 comments Download
M gpu/command_buffer/client/transfer_buffer.h View 1 2 3 4 5 3 chunks +5 lines, -0 lines 0 comments Download
M gpu/command_buffer/client/transfer_buffer.cc View 1 2 3 4 5 2 chunks +12 lines, -0 lines 0 comments Download

Messages

Total messages: 25 (6 generated)
David Yen
5 years, 6 months ago (2015-06-08 20:55:40 UTC) #1
piman
One thing, but otherwise LGTM in principle. https://codereview.chromium.org/1168853002/diff/1/gpu/command_buffer/client/gles2_implementation.cc File gpu/command_buffer/client/gles2_implementation.cc (right): https://codereview.chromium.org/1168853002/diff/1/gpu/command_buffer/client/gles2_implementation.cc#newcode2218 gpu/command_buffer/client/gles2_implementation.cc:2218: mapped_memory_->FreePendingToken(mem, helper_->InsertToken()); ...
5 years, 6 months ago (2015-06-08 21:12:35 UTC) #2
David Yen
I noticed TexImage3D had the same problem so I did the same change. TexImage3D was ...
5 years, 6 months ago (2015-06-08 21:34:06 UTC) #3
piman
https://codereview.chromium.org/1168853002/diff/20001/gpu/command_buffer/client/gles2_implementation.cc File gpu/command_buffer/client/gles2_implementation.cc (right): https://codereview.chromium.org/1168853002/diff/20001/gpu/command_buffer/client/gles2_implementation.cc#newcode2203 gpu/command_buffer/client/gles2_implementation.cc:2203: if (mapped_alloc.valid()) { It would be good actually in ...
5 years, 6 months ago (2015-06-08 21:57:38 UTC) #4
David Yen
Deleted the old code, but now I have an issue of fixing the unit tests. ...
5 years, 6 months ago (2015-06-08 22:18:01 UTC) #5
piman
On Mon, Jun 8, 2015 at 3:18 PM, <dyen@chromium.org> wrote: > Deleted the old code, ...
5 years, 6 months ago (2015-06-08 22:32:01 UTC) #6
David Yen
+jbauman to look at mapped_memory changes as well as the unit tests. I've fixed all ...
5 years, 6 months ago (2015-06-09 02:03:52 UTC) #8
David Yen
On 2015/06/09 02:03:52, David Yen wrote: > +jbauman to look at mapped_memory changes as well ...
5 years, 6 months ago (2015-06-09 02:17:03 UTC) #9
jbauman
https://codereview.chromium.org/1168853002/diff/100001/gpu/command_buffer/client/mapped_memory.cc File gpu/command_buffer/client/mapped_memory.cc (right): https://codereview.chromium.org/1168853002/diff/100001/gpu/command_buffer/client/mapped_memory.cc#newcode85 gpu/command_buffer/client/mapped_memory.cc:85: (allocated_memory_ + size) > max_free_bytes_) { This wasn't intended ...
5 years, 6 months ago (2015-06-09 02:30:13 UTC) #10
David Yen
I've reverted the mapped memory manager changes and added a new concept which actually limits ...
5 years, 6 months ago (2015-06-09 17:07:08 UTC) #11
piman
https://codereview.chromium.org/1168853002/diff/120001/gpu/command_buffer/client/ring_buffer.cc File gpu/command_buffer/client/ring_buffer.cc (right): https://codereview.chromium.org/1168853002/diff/120001/gpu/command_buffer/client/ring_buffer.cc#newcode119 gpu/command_buffer/client/ring_buffer.cc:119: // updating all the various offsets. I think this ...
5 years, 6 months ago (2015-06-09 17:38:27 UTC) #12
David Yen
https://codereview.chromium.org/1168853002/diff/120001/gpu/command_buffer/client/ring_buffer.cc File gpu/command_buffer/client/ring_buffer.cc (right): https://codereview.chromium.org/1168853002/diff/120001/gpu/command_buffer/client/ring_buffer.cc#newcode119 gpu/command_buffer/client/ring_buffer.cc:119: // updating all the various offsets. On 2015/06/09 17:38:27, ...
5 years, 6 months ago (2015-06-09 20:11:20 UTC) #13
piman
LGTM, but I think the code can be simplified a bit. https://codereview.chromium.org/1168853002/diff/120001/gpu/command_buffer/client/ring_buffer.cc File gpu/command_buffer/client/ring_buffer.cc (right): ...
5 years, 6 months ago (2015-06-09 22:55:06 UTC) #14
David Yen
https://codereview.chromium.org/1168853002/diff/120001/gpu/command_buffer/client/ring_buffer.cc File gpu/command_buffer/client/ring_buffer.cc (right): https://codereview.chromium.org/1168853002/diff/120001/gpu/command_buffer/client/ring_buffer.cc#newcode116 gpu/command_buffer/client/ring_buffer.cc:116: << "block that corresponds to offset already freed"; On ...
5 years, 6 months ago (2015-06-10 18:17:10 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1168853002/170001
5 years, 6 months ago (2015-06-10 22:34:23 UTC) #18
commit-bot: I haz the power
Commit queue failed due to new patchset.
5 years, 6 months ago (2015-06-10 22:41:48 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1168853002/190001
5 years, 6 months ago (2015-06-10 22:42:02 UTC) #23
commit-bot: I haz the power
Committed patchset #11 (id:190001)
5 years, 6 months ago (2015-06-10 23:56:28 UTC) #24
commit-bot: I haz the power
5 years, 6 months ago (2015-06-10 23:57:30 UTC) #25
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/4e297d74fef5371fe545e994aa479c5e7b7eb2f9
Cr-Commit-Position: refs/heads/master@{#333851}

Powered by Google App Engine
This is Rietveld 408576698