|
|
Created:
5 years, 8 months ago by Daniele Castagna Modified:
5 years, 8 months ago CC:
chromium-reviews, piman+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionTest gfx::GpuMemoryBuffer::BGRA_8888 GpuMemoryBuffer lifecycle.
The test fixture GpuMemoryBufferTest has been parametrized in terms of
gfx::GpuMemoryBuffer::Format so that GpuMemoryBufferTest.Lifecycle can
be run with different gfx::GpuMemoryBuffer::Format.
gfx::GpuMemoryBuffer::BGRA_8888 has been added along with the already
present RGBA_8888.
BUG=
Committed: https://crrev.com/409804aa7155bc497d6be7e17a26f76fad18defb
Cr-Commit-Position: refs/heads/master@{#323948}
Patch Set 1 : #
Total comments: 16
Patch Set 2 : Address code review's comments. #Patch Set 3 : Make the source and dest internal formats match. #
Total comments: 2
Patch Set 4 : s/uint32/int. #Messages
Total messages: 27 (12 generated)
Patchset #1 (id:1) has been deleted
dcastagna@chromium.org changed reviewers: + reveman@chromium.org
https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... File gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc (right): https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:73: namespace { nit: we use a blank line between namespace and code in most chromium code https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:89: default: Please avoid a default case and explicitly list all formats. I'd like to make sure that when we add a new format we update this code. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:106: default: ditto https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:111: } // namespace nit: we use a blank line between namespace and code in most chromium code https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:132: for (uint32 x_offset = 0; x_offset < stride; x_offset += pixel.size()) { I don't think we should be writing past kImageWidth. We should also avoid logic that prevents a negative stride from working correctly as I think we need to support that in the future.
https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... File gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc (right): https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:73: namespace { On 2015/04/03 at 02:20:16, reveman wrote: > nit: we use a blank line between namespace and code in most chromium code Ack. It'll be there at the next iteration. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:89: default: On 2015/04/03 at 02:20:16, reveman wrote: > Please avoid a default case and explicitly list all formats. I'd like to make sure that when we add a new format we update this code. I don't see why if someone adds a new format (to GpuMemoryBuffer), they'd have to touch this code. Listing all the formats in all the places where format is used make it so the number of lines of code we have to write is O(max_enum * places_where_its_used). Wouldn't it be better, at least in this case where we're in a test, to assert that the default case is not executed? If someone adds a new format to GpuMemoryBuffer, but not to this test, I don't see why this test should change. On the other side, if someone adds a new format to the test, I'd expect they'd run the test at least once, and they would easily figure out what to change. If you're OK with that, I can just change NOTREACHED() with ASSERT_TRUE(false); https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:106: default: On 2015/04/03 at 02:20:16, reveman wrote: > ditto Ack. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:111: } // namespace On 2015/04/03 at 02:20:16, reveman wrote: > nit: we use a blank line between namespace and code in most chromium code Ack. I'll add it at the next iteration. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:132: for (uint32 x_offset = 0; x_offset < stride; x_offset += pixel.size()) { On 2015/04/03 at 02:20:16, reveman wrote: > I don't think we should be writing past kImageWidth. We should also avoid logic that prevents a negative stride from working correctly as I think we need to support that in the future. Isn't this similar to what you were suggesting in crrev.com/1051503003 with memset(mapped_buffer + y * stride, 0xff, ..)? Do we support negative stride anywhere right now? There is an assert just above, to make sure that stride is positive. As soon as we add a new format with a negative stride to this test, it would be pretty clear what to change. If you're not OK with this, what would you suggest to do instead?
https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... File gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc (right): https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:89: default: On 2015/04/03 at 02:56:14, Daniele Castagna wrote: > On 2015/04/03 at 02:20:16, reveman wrote: > > Please avoid a default case and explicitly list all formats. I'd like to make sure that when we add a new format we update this code. > > I don't see why if someone adds a new format (to GpuMemoryBuffer), they'd have to touch this code. > > Listing all the formats in all the places where format is used make it so the number of lines of code we have to write is O(max_enum * places_where_its_used). > > Wouldn't it be better, at least in this case where we're in a test, to assert that the default case is not executed? > > If someone adds a new format to GpuMemoryBuffer, but not to this test, I don't see why this test should change. > On the other side, if someone adds a new format to the test, I'd expect they'd run the test at least once, and they would easily figure out what to change. > > If you're OK with that, I can just change NOTREACHED() with ASSERT_TRUE(false); If someone adds a new format to GpuMemoryBuffer, they might not know or remember that we have these tests. I'd like the compiler to remind me so please change this. Having a default case to save ourselves from typing a few lines of code is the wrong trade-off imo. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:132: for (uint32 x_offset = 0; x_offset < stride; x_offset += pixel.size()) { On 2015/04/03 at 02:56:14, Daniele Castagna wrote: > On 2015/04/03 at 02:20:16, reveman wrote: > > I don't think we should be writing past kImageWidth. We should also avoid logic that prevents a negative stride from working correctly as I think we need to support that in the future. > > Isn't this similar to what you were suggesting in crrev.com/1051503003 with memset(mapped_buffer + y * stride, 0xff, ..)? memset(mapped_buffer + y * stride, 0xff, ..) works with a negative stride > > Do we support negative stride anywhere right now? There is an assert just above, to make sure that stride is positive. As soon as we add a new format with a negative stride to this test, it would be pretty clear what to change. I'm not aware of any gmb type independent code that doesn't support this right now. If you know of some let me know as it looks like we'll have to change this soon. Let's get it right now instead of having to fix it later. > > If you're not OK with this, what would you suggest to do instead? for (int y = 0; y < kImageHeight; ++y) { for (int x = 0; x < kImageWidth; ++x) { std::copy(pixel.begin(), pixel.end(), mapped_buffer + y * stride + x * pixel.size()); } }
https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... File gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc (right): https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:73: namespace { On 2015/04/03 at 02:56:14, Daniele Castagna wrote: > On 2015/04/03 at 02:20:16, reveman wrote: > > nit: we use a blank line between namespace and code in most chromium code > > Ack. It'll be there at the next iteration. Done. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:89: default: On 2015/04/03 at 03:41:02, reveman wrote: > On 2015/04/03 at 02:56:14, Daniele Castagna wrote: > > On 2015/04/03 at 02:20:16, reveman wrote: > > > Please avoid a default case and explicitly list all formats. I'd like to make sure that when we add a new format we update this code. > > > > I don't see why if someone adds a new format (to GpuMemoryBuffer), they'd have to touch this code. > > > > Listing all the formats in all the places where format is used make it so the number of lines of code we have to write is O(max_enum * places_where_its_used). > > > > Wouldn't it be better, at least in this case where we're in a test, to assert that the default case is not executed? > > > > If someone adds a new format to GpuMemoryBuffer, but not to this test, I don't see why this test should change. > > On the other side, if someone adds a new format to the test, I'd expect they'd run the test at least once, and they would easily figure out what to change. > > > > If you're OK with that, I can just change NOTREACHED() with ASSERT_TRUE(false); > > If someone adds a new format to GpuMemoryBuffer, they might not know or remember that we have these tests. I'd like the compiler to remind me so please change this. > > Having a default case to save ourselves from typing a few lines of code is the wrong trade-off imo. Done. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:106: default: On 2015/04/03 at 02:56:14, Daniele Castagna wrote: > On 2015/04/03 at 02:20:16, reveman wrote: > > ditto > > Ack. Done. https://codereview.chromium.org/1055143003/diff/20001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:111: } // namespace On 2015/04/03 at 02:56:14, Daniele Castagna wrote: > On 2015/04/03 at 02:20:16, reveman wrote: > > nit: we use a blank line between namespace and code in most chromium code > > Ack. I'll add it at the next iteration. Done.
Thank you for the review! It's still going to fail on linux_android_rel_ng. I'll take a look at it tomorrow.
lgtm with nit https://codereview.chromium.org/1055143003/diff/60001/gpu/command_buffer/test... File gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc (right): https://codereview.chromium.org/1055143003/diff/60001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:170: for (uint32 x = 0; x < kImageWidth; ++x) { nit: s/uint32/int/
Patchset #4 (id:80001) has been deleted
Patchset #4 (id:100001) has been deleted
Patchset #4 (id:120001) has been deleted
Patchset #4 (id:140001) has been deleted
Patchset #4 (id:160001) has been deleted
https://codereview.chromium.org/1055143003/diff/60001/gpu/command_buffer/test... File gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc (right): https://codereview.chromium.org/1055143003/diff/60001/gpu/command_buffer/test... gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc:170: for (uint32 x = 0; x < kImageWidth; ++x) { On 2015/04/06 at 16:02:49, reveman wrote: > nit: s/uint32/int/ Done.
The CQ bit was checked by dcastagna@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from reveman@chromium.org Link to the patchset: https://codereview.chromium.org/1055143003/#ps100002 (title: "s/uint32/int.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1055143003/100002
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
dcastagna@chromium.org changed reviewers: + piman@chromium.org
+piman for owner approval.
lgtm
The CQ bit was checked by dcastagna@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1055143003/100002
Message was sent while issue was closed.
Committed patchset #4 (id:100002)
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/409804aa7155bc497d6be7e17a26f76fad18defb Cr-Commit-Position: refs/heads/master@{#323948} |