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}
Showing
Please register or sign in to comment