Reland "media/platform_vf_utils: Handle null GMB factory."
This is a reland of 09825450 No changes are made to the original CL. The original change was reverted because "Cast Audio Linux" was failing to build [1]. It looks like this happened not because of the change but because //media/gpu/chromeos/BUILD.gn was taking effect in Chromecast unintentionally which triggered an assert in one of the dependencies. The root cause was that use_vaapi was getting set to true for Chromecast and this is fixed by [2]. [1] https://ci.chromium.org/ui/p/chromium/builders/ci/Cast%20Audio%20Linux/92923/overview [2] https://chromium-review.googlesource.com/c/chromium/src/+/2580449 Original change's description: > media/platform_vf_utils: Handle null GMB factory. > > This CL handles a null GpuMemoryBufferFactory in > AllocateGpuMemoryBufferHandle() so that the caller is not obligated to > pass a valid factory. This is in preparation for follow-ups CLs to > remove the need for video encode accelerators to have access to a > GpuMemoryBufferFactory. > > When the GpuMemoryBufferFactory is null, we just use the render node > directly to allocate a native buffer object and then we wrap it into a > GpuMemoryBufferHandle. > > So, why do we still keep the option to have a non-null > GpuMemoryBufferFactory? This is because that path is still useful in the > decoding case: when a buffer is created with the GpuMemoryBufferFactory, > the corresponding NativePixmap is cached [1]; eventually, a SharedImage > needs to be created and to do so we pass the GpuMemoryBufferHandle > obtained from the factory [2]; when the SharedImage system needs to > create the GLImage for the buffer, it passes the handle to the > factory [3] which in turn uses it to look up the cached > NativePixmap [4]. This saves us from going through a gbm_bo_import() > (which also implies a thread hop to the DRM thread). > > So, in conclusion, for buffers that need to be displayed later, it's > still better to use the GMB factory owned by the GpuServiceImpl. For > encoders this is not the case. > > [1] https://source.chromium.org/chromium/chromium/src/+/master:gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.cc;l=319;drc=d81c5852498699fe3cd812e78d31c77c28e29281 > [2] https://source.chromium.org/chromium/chromium/src/+/master:media/gpu/chromeos/mailbox_video_frame_converter.cc;l=355-359;drc=d81c5852498699fe3cd812e78d31c77c28e29281 > [3] https://source.chromium.org/chromium/chromium/src/+/master:gpu/command_buffer/service/shared_image_backing_gl_texture.cc;l=355-356;drc=d81c5852498699fe3cd812e78d31c77c28e29281 > [4] https://source.chromium.org/chromium/chromium/src/+/master:gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.cc;l=164-172;drc=d81c5852498699fe3cd812e78d31c77c28e29281 > > Bug: b:173167846 > Test: video.EncodeAccel.h264_720p_nv12_dmabuf on elm > Change-Id: I7b730eb843da7503c61bffe30dce7a5ce51dec60 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568937 > Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org> > Reviewed-by: Miguel Casas <mcasas@chromium.org> > Reviewed-by: Hirokazu Honda <hiroh@chromium.org> > Cr-Commit-Position: refs/heads/master@{#834608} Bug: b:173167846 Change-Id: I88b4849b01de86e7f2783db22561e8160a1f7a6b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2579646Reviewed-by:Hirokazu Honda <hiroh@chromium.org> Reviewed-by:
Miguel Casas <mcasas@chromium.org> Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org> Cr-Commit-Position: refs/heads/master@{#835009}
Showing
Please register or sign in to comment