|
|
Chromium Code Reviews|
Created:
5 years, 3 months ago by ccameron Modified:
5 years, 3 months ago CC:
chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, mcasas+watch_chromium.org, piman+watch_chromium.org, posciak+watch_chromium.org, wjia+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionMac Overlays: Enable h264 overlays
Punch a hole from GpuVideoDecodeAccelerator to VTVideoDecodeAccelerator
via a callback to BindImage, following the model found in
VaapiVideoDecodeAccelerator. If successful, set allow_overlay on the
frame's resource.
BUG=527650
Committed: https://crrev.com/7ed442bbaf3a5038ce6b9d712200557a0854f888
Cr-Commit-Position: refs/heads/master@{#347546}
Patch Set 1 #
Total comments: 4
Patch Set 2 : Clean up #
Total comments: 14
Patch Set 3 : Incorporate review feedback #Patch Set 4 : Add comment #
Total comments: 2
Patch Set 5 : ScopedPtrMap, service/client names #
Total comments: 1
Patch Set 6 : Include fix for compositor #
Total comments: 4
Patch Set 7 : Fix compile #Patch Set 8 : Incorporate review feedback #
Messages
Total messages: 35 (10 generated)
ccameron@chromium.org changed reviewers: + reveman@chromium.org, sandersd@chromium.org
Did I miss something here, or was it actually that simple? https://codereview.chromium.org/1320893004/diff/1/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1320893004/diff/1/ui/gl/gl_image_io_surface.m... ui/gl/gl_image_io_surface.mm:150: DCHECK(thread_checker_.CalledOnValidThread()); So, deleting DCHECKs never feels legit. I was hitting this in the stack descending from SetLevelImage -- that call was removing the last reference to the previously bound GLImage. Is there a particular need for ::Destroy to be called in this instance? The IOSurface can be unrefed from basically any context.
https://codereview.chromium.org/1320893004/diff/1/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1320893004/diff/1/ui/gl/gl_image_io_surface.m... ui/gl/gl_image_io_surface.mm:150: DCHECK(thread_checker_.CalledOnValidThread()); On 2015/09/03 at 03:53:07, ccameron wrote: > So, deleting DCHECKs never feels legit. > > I was hitting this in the stack descending from SetLevelImage -- that call was removing the last reference to the previously bound GLImage. > > Is there a particular need for ::Destroy to be called in this instance? The IOSurface can be unrefed from basically any context. The image manager should keep track of all images and make sure Destroy is called before the image manager's context is destroyed. The DCHECK is here as a sanity check and could be removed if there's a good reason to why Destroy has not been called.
An alternative to the BindImage callback is to modify the TextureRef yourself, similar to ~line 380 here: https://codereview.chromium.org/1278733003/diff/1/content/common/gpu/media/an... I see that VAAPI does the same thing already, so I'm only recommending this if having the TextureRef makes things easier.
https://codereview.chromium.org/1320893004/diff/1/content/common/gpu/media/vt... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/1/content/common/gpu/media/vt... content/common/gpu/media/vt_video_decode_accelerator.cc:1025: gfx::GenericSharedMemoryId(), frame.coded_size, GL_BGRA_EXT)); Instead of removing the DCHECK, maybe keep a reference to each image here and call destroy at tear down
Thanks! Updated -- ptal. I merged texture_ids_ and picture_bindings_ (and the 2 new maps that I was about to add). This tracking makes calling Destroy() convenient. https://codereview.chromium.org/1320893004/diff/1/content/common/gpu/media/vt... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/1/content/common/gpu/media/vt... content/common/gpu/media/vt_video_decode_accelerator.cc:1025: gfx::GenericSharedMemoryId(), frame.coded_size, GL_BGRA_EXT)); On 2015/09/03 19:20:37, reveman wrote: > Instead of removing the DCHECK, maybe keep a reference to each image here and > call destroy at tear down Yes, agree. Updated.
Ping -- does this look good to go?
A few small questions, design seems solid to me. https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:832: picture_info_map_[picture.id()] = linked_ptr<PictureInfo>(new PictureInfo( Why is a linked_ptr necessary? https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:846: linked_ptr<PictureInfo>& picture_info = picture_info_map_[picture_id]; nit: I'd prefer all the DCHECKs before the code. https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:1047: allow_overlay = true; Braces for multi-line conditional. https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:1054: picture_info->gl_image = gl_image; Why does this need to be saved? Why is the texture binding not enough?
Thanks -- updated https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:832: picture_info_map_[picture.id()] = linked_ptr<PictureInfo>(new PictureInfo( On 2015/09/03 23:11:09, sandersd wrote: > Why is a linked_ptr necessary? It's not -- changed it to .reset(). If you meant, for the map itself, we want, in effect, a map of scoped_ptrs (but blows up in various ways). https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:846: linked_ptr<PictureInfo>& picture_info = picture_info_map_[picture_id]; On 2015/09/03 23:11:09, sandersd wrote: > nit: I'd prefer all the DCHECKs before the code. This needs access to the picture_info struct (no sense in looking it up in the map twice). https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:1047: allow_overlay = true; On 2015/09/03 23:11:09, sandersd wrote: > Braces for multi-line conditional. Done. https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:1054: picture_info->gl_image = gl_image; On 2015/09/03 23:11:09, sandersd wrote: > Why does this need to be saved? Why is the texture binding not enough? The reason for saving it is that there is a DCHECK that GLImageIOSurface will have Destroy called on it before it hits its destructor. The binding will result in the destructor being called at unpredictable times. My first thought was to remove the DCHECK, but reveman wanted to keep it in (see discussion in PS1).
https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:832: picture_info_map_[picture.id()] = linked_ptr<PictureInfo>(new PictureInfo( On 2015/09/04 01:31:30, ccameron wrote: > On 2015/09/03 23:11:09, sandersd wrote: > > Why is a linked_ptr necessary? > > It's not -- changed it to .reset(). > > If you meant, for the map itself, we want, in effect, a map of scoped_ptrs (but > blows up in various ways). I did mean for the map itself. What exactly goes wrong? https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:846: linked_ptr<PictureInfo>& picture_info = picture_info_map_[picture_id]; On 2015/09/04 01:31:30, ccameron wrote: > On 2015/09/03 23:11:09, sandersd wrote: > > nit: I'd prefer all the DCHECKs before the code. > > This needs access to the picture_info struct (no sense in looking it up in the > map twice). Acknowledged. https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:1054: picture_info->gl_image = gl_image; On 2015/09/04 01:31:30, ccameron wrote: > On 2015/09/03 23:11:09, sandersd wrote: > > Why does this need to be saved? Why is the texture binding not enough? > > The reason for saving it is that there is a DCHECK that GLImageIOSurface will > have Destroy called on it before it hits its destructor. The binding will result > in the destructor being called at unpredictable times. > > My first thought was to remove the DCHECK, but reveman wanted to keep it in (see > discussion in PS1). I don't like it, but I won't fight for a change as long as you include a comment to explain it.
Updated. I'm pretty sure that map thing doesn't work (this is where I get antsy that I don't actually understand anything in C++). https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:832: picture_info_map_[picture.id()] = linked_ptr<PictureInfo>(new PictureInfo( On 2015/09/04 01:37:49, sandersd wrote: > On 2015/09/04 01:31:30, ccameron wrote: > > On 2015/09/03 23:11:09, sandersd wrote: > > > Why is a linked_ptr necessary? > > > > It's not -- changed it to .reset(). > > > > If you meant, for the map itself, we want, in effect, a map of scoped_ptrs > (but > > blows up in various ways). > > I did mean for the map itself. What exactly goes wrong? Oh -- it calls a copy constructor (at insert) -- scoped_ptr doesn't allow copy constructor. https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:1054: picture_info->gl_image = gl_image; On 2015/09/04 01:37:49, sandersd wrote: > On 2015/09/04 01:31:30, ccameron wrote: > > On 2015/09/03 23:11:09, sandersd wrote: > > > Why does this need to be saved? Why is the texture binding not enough? > > > > The reason for saving it is that there is a DCHECK that GLImageIOSurface will > > have Destroy called on it before it hits its destructor. The binding will > result > > in the destructor being called at unpredictable times. > > > > My first thought was to remove the DCHECK, but reveman wanted to keep it in > (see > > discussion in PS1). > > I don't like it, but I won't fight for a change as long as you include a comment > to explain it. Put a comment at its definition in the header.
https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:832: picture_info_map_[picture.id()] = linked_ptr<PictureInfo>(new PictureInfo( On 2015/09/04 01:59:04, ccameron wrote: > On 2015/09/04 01:37:49, sandersd wrote: > > On 2015/09/04 01:31:30, ccameron wrote: > > > On 2015/09/03 23:11:09, sandersd wrote: > > > > Why is a linked_ptr necessary? > > > > > > It's not -- changed it to .reset(). > > > > > > If you meant, for the map itself, we want, in effect, a map of scoped_ptrs > > (but > > > blows up in various ways). > > > > I did mean for the map itself. What exactly goes wrong? > > Oh -- it calls a copy constructor (at insert) -- scoped_ptr doesn't allow copy > constructor. Okay, I understand what you are explaining. With the change to .reset(), you should be fine to switch to a regular scoped_ptr now. Better would be to have no pointers at all and use moves to get the PictureInfo into the map, but sadly we are not yet allowed to use C++11 library features to do that. If PictureInfo was itself copyable then that would be fine too, but the currently implementation means it would Destroy() the image immediately. This leaves two options: a) Remove the DCHECK and delete a bunch of code. b) Switch to scoped_ptr and mark PictureInfo as DISALLOW_COPY_AND_ASSIGN.
piman@chromium.org changed reviewers: + piman@chromium.org
https://codereview.chromium.org/1320893004/diff/60001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/60001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:833: picture.texture_id(), picture.internal_texture_id())); drive-by nit: so, there's a double inversion which makes things super confusing. in PictureBuffer, texture_id is the service id (the actual GL id), and internal_texture_id is the client id (the command buffer id). On l.1024 below, you definitely want to use the service id in the ScopedTextureBinder (which operates at the GL level and doesn't know about command buffers) On l.1051, below, you definitely want to use the client id in BindImage, which operates on command buffer structures. The code you currently have works, but because the 2 ids are inverted here, the code below that uses it looks really wrong...
On 2015/09/04 02:41:25, sandersd wrote: > https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... > File content/common/gpu/media/vt_video_decode_accelerator.cc (right): > > https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... > content/common/gpu/media/vt_video_decode_accelerator.cc:832: > picture_info_map_[picture.id()] = linked_ptr<PictureInfo>(new PictureInfo( > On 2015/09/04 01:59:04, ccameron wrote: > > On 2015/09/04 01:37:49, sandersd wrote: > > > On 2015/09/04 01:31:30, ccameron wrote: > > > > On 2015/09/03 23:11:09, sandersd wrote: > > > > > Why is a linked_ptr necessary? > > > > > > > > It's not -- changed it to .reset(). > > > > > > > > If you meant, for the map itself, we want, in effect, a map of scoped_ptrs > > > (but > > > > blows up in various ways). > > > > > > I did mean for the map itself. What exactly goes wrong? > > > > Oh -- it calls a copy constructor (at insert) -- scoped_ptr doesn't allow copy > > constructor. > > Okay, I understand what you are explaining. > > With the change to .reset(), you should be fine to switch to a regular > scoped_ptr now. > > Better would be to have no pointers at all and use moves to get the PictureInfo > into the map, but sadly we are not yet allowed to use C++11 library features to > do that. If PictureInfo was itself copyable then that would be fine too, but the > currently implementation means it would Destroy() the image immediately. This > leaves two options: > a) Remove the DCHECK and delete a bunch of code. > b) Switch to scoped_ptr and mark PictureInfo as DISALLOW_COPY_AND_ASSIGN. Even with reset, scoped_ptr doesn't work -- operator[] can potentially instantiate the copy constructor. It looks like most people use ScopedPtrMap, so I switched to doing that (of note is that I do see some map<K, scoped_ptr<T>> instances in Windows-specific code). This may sound like a troll, but it is a serious (although perhaps dumb) question: In C++'s data structures, there is no specifying what interface a templated class must conform to -- it looks like std::map "wants" a copy constructor to be present, but nowhere is this formally specified. I would like it to be the case that std::map<T> would say "the following T-related functions must exist", and trying to instantiate a std::map<T> would fail with a meaningful error like "function F(const T&) doesn't exist", instead of the five pages of unparseable spew I currently get. Is there a name for this behavior? Vaguely reminds me of something about existential types from somewhere in my distant past. Is there any push to add such a feature to the language?
Updated! https://codereview.chromium.org/1320893004/diff/60001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/60001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:833: picture.texture_id(), picture.internal_texture_id())); On 2015/09/04 03:04:57, piman (slow to review) wrote: > drive-by nit: so, there's a double inversion which makes things super confusing. > > in PictureBuffer, texture_id is the service id (the actual GL id), and > internal_texture_id is the client id (the command buffer id). > > On l.1024 below, you definitely want to use the service id in the > ScopedTextureBinder (which operates at the GL level and doesn't know about > command buffers) > > On l.1051, below, you definitely want to use the client id in BindImage, which > operates on command buffer structures. > > > The code you currently have works, but because the 2 ids are inverted here, the > code below that uses it looks really wrong... Ack! That's what I get for last-minute search-replace! Fixed.
On Fri, Sep 4, 2015 at 1:53 AM, <ccameron@chromium.org> wrote: > On 2015/09/04 02:41:25, sandersd wrote: > > > https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... > >> File content/common/gpu/media/vt_video_decode_accelerator.cc (right): >> > > > > https://codereview.chromium.org/1320893004/diff/20001/content/common/gpu/medi... > >> content/common/gpu/media/vt_video_decode_accelerator.cc:832: >> picture_info_map_[picture.id()] = linked_ptr<PictureInfo>(new >> PictureInfo( >> On 2015/09/04 01:59:04, ccameron wrote: >> > On 2015/09/04 01:37:49, sandersd wrote: >> > > On 2015/09/04 01:31:30, ccameron wrote: >> > > > On 2015/09/03 23:11:09, sandersd wrote: >> > > > > Why is a linked_ptr necessary? >> > > > >> > > > It's not -- changed it to .reset(). >> > > > >> > > > If you meant, for the map itself, we want, in effect, a map of >> > scoped_ptrs > >> > > (but >> > > > blows up in various ways). >> > > >> > > I did mean for the map itself. What exactly goes wrong? >> > >> > Oh -- it calls a copy constructor (at insert) -- scoped_ptr doesn't >> allow >> > copy > >> > constructor. >> > > Okay, I understand what you are explaining. >> > > With the change to .reset(), you should be fine to switch to a regular >> scoped_ptr now. >> > > Better would be to have no pointers at all and use moves to get the >> > PictureInfo > >> into the map, but sadly we are not yet allowed to use C++11 library >> features >> > to > >> do that. If PictureInfo was itself copyable then that would be fine too, >> but >> > the > >> currently implementation means it would Destroy() the image immediately. >> This >> leaves two options: >> a) Remove the DCHECK and delete a bunch of code. >> b) Switch to scoped_ptr and mark PictureInfo as >> DISALLOW_COPY_AND_ASSIGN. >> > > Even with reset, scoped_ptr doesn't work -- operator[] can potentially > instantiate the copy constructor. It looks like most people use > ScopedPtrMap, so > I switched to doing that (of note is that I do see some map<K, > scoped_ptr<T>> > instances in Windows-specific code). > > This may sound like a troll, but it is a serious (although perhaps dumb) > question: > > In C++'s data structures, there is no specifying what interface a templated > class must conform to -- it looks like std::map "wants" a copy constructor > to be > present, but nowhere is this formally specified. > > I would like it to be the case that std::map<T> would say "the following > T-related functions must exist", and trying to instantiate a std::map<T> > would > fail with a meaningful error like "function F(const T&) doesn't exist", > instead > of the five pages of unparseable spew I currently get. > > Is there a name for this behavior? Vaguely reminds me of something about > existential types from somewhere in my distant past. Is there any push to > add > such a feature to the language? > Yep - http://en.cppreference.com/w/cpp/language/constraints > > https://codereview.chromium.org/1320893004/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
LGTM for the nit, now I'm running away.
lgtm
dalecurtis@chromium.org changed reviewers: + dalecurtis@chromium.org
https://codereview.chromium.org/1320893004/diff/80001/content/common/gpu/medi... File content/common/gpu/media/vt_video_decode_accelerator.cc (right): https://codereview.chromium.org/1320893004/diff/80001/content/common/gpu/medi... content/common/gpu/media/vt_video_decode_accelerator.cc:302: const base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>& Drive-by: This is a bit weird as a non-const& bound to a function which passes a scoped_refptr by value: https://code.google.com/p/chromium/codesearch#chromium/src/content/common/gpu... Seems like a cleanup for a followup CL though since VAAPI is already doing this.
dalecurtis@chromium.org changed reviewers: - dalecurtis@chromium.org
On 2015/09/04 18:56:24, DaleCurtis wrote: > https://codereview.chromium.org/1320893004/diff/80001/content/common/gpu/medi... > File content/common/gpu/media/vt_video_decode_accelerator.cc (right): > > https://codereview.chromium.org/1320893004/diff/80001/content/common/gpu/medi... > content/common/gpu/media/vt_video_decode_accelerator.cc:302: const > base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>& > Drive-by: This is a bit weird as a non-const& bound to a function which passes a > scoped_refptr by value: > > https://code.google.com/p/chromium/codesearch#chromium/src/content/common/gpu... > > Seems like a cleanup for a followup CL though since VAAPI is already doing this. Yeah, I'd also like to do a rename on the "internal_texture v texture" vs "client_texture v service_texture" -- I'll wait until the frenetic M46 merging is done ...
dcastagna@chromium.org changed reviewers: + dcastagna@chromium.org
https://codereview.chromium.org/1320893004/diff/100001/content/browser/compos... File content/browser/compositor/gpu_process_transport_factory.cc (right): https://codereview.chromium.org/1320893004/diff/100001/content/browser/compos... content/browser/compositor/gpu_process_transport_factory.cc:317: if (!surface) { Are you sure this check is needed? Isn't surface always not set? https://codereview.chromium.org/1320893004/diff/100001/content/browser/compos... content/browser/compositor/gpu_process_transport_factory.cc:319: #if !defined(OS_MACOSX) It'd nice to reduce the number of negations is possible.
content/browser/compositor LGTM
Thanks -- updated! https://codereview.chromium.org/1320893004/diff/100001/content/browser/compos... File content/browser/compositor/gpu_process_transport_factory.cc (right): https://codereview.chromium.org/1320893004/diff/100001/content/browser/compos... content/browser/compositor/gpu_process_transport_factory.cc:317: if (!surface) { On 2015/09/04 23:33:43, Daniele Castagna wrote: > Are you sure this check is needed? Isn't surface always not set? Huh -- maybe it had a purpose sometime in the past. Removed. https://codereview.chromium.org/1320893004/diff/100001/content/browser/compos... content/browser/compositor/gpu_process_transport_factory.cc:319: #if !defined(OS_MACOSX) On 2015/09/04 23:33:43, Daniele Castagna wrote: > It'd nice to reduce the number of negations is possible. Changed comment to a single negation.
The CQ bit was checked by ccameron@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from sandersd@chromium.org, piman@chromium.org Link to the patchset: https://codereview.chromium.org/1320893004/#ps140001 (title: "Incorporate review feedback")
The CQ bit was unchecked by ccameron@chromium.org
The CQ bit was checked by ccameron@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from sandersd@chromium.org, piman@chromium.org Link to the patchset: https://codereview.chromium.org/1320893004/#ps140001 (title: "Incorporate review feedback")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1320893004/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1320893004/140001
Message was sent while issue was closed.
Committed patchset #8 (id:140001)
Message was sent while issue was closed.
Patchset 8 (id:??) landed as https://crrev.com/7ed442bbaf3a5038ce6b9d712200557a0854f888 Cr-Commit-Position: refs/heads/master@{#347546} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
