aboutsummaryrefslogtreecommitdiff
path: root/components
AgeCommit message (Collapse)Author
2020-09-08v4l2_codec2: Improve log statements in V4L2EncodeComponent.David Staessens
This CL reduces the verbosity of some log statements, makes some log statements more descriptive, and fixes an incorrect log statement. Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_192p_i420_vm on hatch-arc-r Change-Id: If852b112d60ad51f576aeda86bb55f1e4ef36823
2020-09-08v4l2_codec2: Don't use BufferUsage::VIDEO_ENCODER for input buffers.David Staessens
This CL removes the BufferUsage::VIDEO_ENCODER flag from input buffers. Currently the format convertor is always enabled as the encoder on Chrome side only supports the NV12 format. This means it's not useful to add the VIDEO_ENCODER buffer flag to input buffers. Currently zero-copy is not supported yet, so when using that flag an additional buffer will be allocated on host side and a copy will be performed between the guest and host buffer to keep them in sync. This is wasteful as the buffer is only used on guest side by the format convertor which converts and copies the buffer into another buffer. Additionally this causes issues on hatch as the YV12 format is used which is not supported by minigbm on hatch. (see b/162796596) Bug: 162796596 Test: tast run $HOST arc.VideoEncodeAccel.h264_360p_i420_vm on hatch-arc-r and verified encoded video Change-Id: Iffcaafbe12fa1f9af53ac7c4e88ee98ec40aedec
2020-09-03Make VideoFramePool and C2VdaBqBlockPool non-blocking when fetchingChih-Yu Huang
Originally, when C2VdaBqBlockPool timed out to fetch a block, the method is blocking to wait for buffer released. If this blocking waiting also timed out, then VideoFramePool would retry again with exponential backoff. We have 2 retry mechanisms for timed out in both VideoFramePool and C2VdaBqBlockPool, which is redundant. In this CL, the C2VdaBqBlockPool method return C2_TIMED_OUT directly when there is no available block. Then VideoFramePool set a callback to C2VdaBqBlockPool. When there is an available block, C2VdaBqBlockPool will notify VideoFramePool via the callback. Bug: 166072201 Test: pass tast.arc.VideoDecodeAccel.h264_vm Change-Id: I27380f144a496457349799cf5ad15c5f8986e307
2020-09-03Merge "VideoFramePool: Only accept one request at the same time" into rvc-devChih-yu Huang
2020-09-02VideoFramePool: Only accept one request at the same timeChih-Yu Huang
Originally, VideoFramePool can accept multiple requests in parallel. However, it increases the code complexity. Also, currently the caller only request one frame at the same time. This CL changes the VideoFramePool to accept one request at the same time. Bug: 166072201 Test: pass tast.arc.VideoDecodeAccel.h264_vm Change-Id: I16811e1d004dcaf8baeb70efb4a1cb5d2a3daacf
2020-08-31v4l2_codec2: Fixes to V4L2EncodeComponent drain logic.David Staessens
The V4L2EncodeComponent expects all buffers queued on the v4l2 device input queue to be returned before an EOS is received. This is however not always the case, so this CL makes changes to the encoder to account for this fact. Bug: 143333813 Test: tast run $HOST arc.VideoDecodeAccel.h264_vm on hatch-arc-r Change-Id: I2e1cb20a20bda6ed92035c974cec370b81f6c33c
2020-08-31v4l2_codec2: Mark V4L2EncodeComponent buffers as BufferUsage::VIDEO_ENCODER.David Staessens
This CL adds the BufferUsage::VIDEO_ENCODER flag to the V4L2EncodeComponent's input and output buffers so they are properly synced between the encoder and crosvm. Bug: 162371919 Test: tast run $HOST arc.VideoEncodeAccel.h264_vm on hatch-arc-r Change-Id: I9179c556e77718d2c9af7584bfa3540d82db07ac
2020-08-31v4l2_codec2: Remove duplicated HalPixelFormat and InputCodec types.David Staessens
This CL removes the duplicate HalPixelFormat and InputCodec types in common.h that are also present in VideoTypes.h. VideoTypes.h is moved to the common/ folder so it can also be used by other classes. note: Submit together with ag/12467730 Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_vm on hatch-arc-r Change-Id: I93bca14a3b2f0c4c49104149d5683193554ba3eb
2020-08-31v4l2_codec2: Change output buffer memory type to DMABuf.David Staessens
This CL adapts the V4L2VideEncodeComponent to import output buffers directly as V4L2_MEMORY_DMABUF into the v4l2 output queue, rather than using V4L2_MEMORY_USERPTR. This eliminates a copy of the encoded output data as we encode directly into the DMAbuf. Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_192p_i420_vm Change-Id: I4d60a943869566362a55cd47d0bb9e1f7a97cf28
2020-08-28v4l2_codec2: Remove code that prepends SPS/PPS to IDR frames.David Staessens
This CL removes the code that prepends SPS/PPS to IDR frames, as this is already handled by the Chrome video encoder. Note: When we upstream this code we might want this functionality, but as ag/12208262 makes changes that would require us to rewrite this logic we can reintroduce it when we decide it's necessary. Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_192p_i420_vm Change-Id: Ib0f7fac6ac23fca1b88c3a026989338ca2aaf95f
2020-08-28v4l2_codec2: Deprecate use of ::base::ScopedFD.David Staessens
This CL removes the use of ::base::ScopedFD in the VideoFrame and BitstreamBuffer classes. The use of ScopedFD forces us to duplicate the file descriptor, while this is not necessary. Bug: 143333813 Test: tast run $HOST arc.VideoDecodeAccel.h264_vm on hatch-arc-r Change-Id: I7e6fccbd142889f779f409947784568d89f0d13e
2020-08-27Merge "Reduce the verbosity of some logs" into rvc-devDavid Stevens
2020-08-26Reduce the verbosity of some logsDavid Stevens
This reduces the verbosity of logs that appear very often during execution of the c2_e2e_test. Bug: 166401871 Test: Run c2_e2e_test and verify there is no logspam Change-Id: Ie21c54f50b52c6062f8e7b6c9bc02ef226d3451d
2020-08-26V4L2DecodeInterface: Add the comment for C2_PARAMKEY_PICTURE_SIZEChih-Yu Huang
This CL adds the comment that we forgot to mention in ag/12444944. Bug: 165826281 Test: None Change-Id: I27c592ea1aa946e51c7c3075100c0e67761c1dee
2020-08-26V4L2DecodeInterface: Use fixed number for C2_PARAMKEY_PICTURE_SIZEChih-Yu Huang
Every C2ComponentInterface would be initiated at Android bootup time. We want to avoid heavy action in the interface initialization. This CL relaxes the parameter check by using the maximum fixed number instead of querying the capability from V4L2 device. Bug: 165826281 Test: pass tast.arc.VideoDecodeAccel.h264_vm Change-Id: Id15deb2715f88dca3618c571087aa6d08410b7e3
2020-08-25Merge "V4L2Decoder: Clear mFrameAtDevice when streamoff the output queue" ↵Chih-yu Huang
into rvc-dev
2020-08-25V4L2Decoder: Clear mFrameAtDevice when streamoff the output queueChih-Yu Huang
|mFrameAtDevice| is to track the buffers enqueued in the V4L2 output queue. When we streamoff the V4L2 queue, all of the enqueued buffers are dropped immediately. Therefore we should also clear |mFrameAtDevice| at the same time. Bug: 166072201 Test: Run gts.DashTest#testWidevineVp9AdaptiveWithRendererDisabling and check the error message added by this CL doesn't appear. Change-Id: Ibda5949710e66e78a6f49c80c57e94c93fe69afc
2020-08-25Merge "V4L2Decoder: Skip fetching VideoFrame when no free V4L2 output slot" ↵Chih-yu Huang
into rvc-dev
2020-08-24V4L2Decoder: Skip fetching VideoFrame when no free V4L2 output slotChih-Yu Huang
We should only fetch buffers when there are free V4L2 output slots. This CL adds the check to avoid unnecessary buffer fetching. Bug: 160110407 Test: Run e2e test and confirm that buffer fetching is skipped when no free V4L2 slot Change-Id: If50752964155ba65d8cc7ec0805507c053716294
2020-08-20V4L2DecodeComponent: Limit the resolution of the output buffersChih-Yu Huang
Malicious video playback might set extremely large resolution during decoding, to exhaust the system memory. In this CL, V4L2DecodeComponent checks if the resolution of the output buffers are larger than the maximum supported size 4096x4096. If so, V4L2DecodeComponent will notify the Codec2 framework that error occurs and exit gracefully. Bug: 157113946 Test: pass tast.arc.VideoDecodeAccel.h264_vm Change-Id: I94a5223d7d3d734ffca06064cf375944e28f68b1
2020-08-06Merge changes I3c8e1054,I5efe9cdf into rvc-devTreeHugger Robot
* changes: v4l2_codec2: Move BitstreamBuffer class to BitstreamBuffer.h. v4l2_codec2: Change input buffer memory type to DMABuf.
2020-08-06v4l2_codec2: Move BitstreamBuffer class to BitstreamBuffer.h.David Staessens
This CL extracts and moves the BitstreamBuffer class into BitstreamBuffer.h, to allow it to be reused. Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_vm on hatch-arc-r Change-Id: I3c8e1054929878bd5a0a3d3a894c0e766874a532
2020-08-06v4l2_codec2: Change input buffer memory type to DMABuf.David Staessens
This CL adapts the V4L2VideEncodeComponent to import input buffers directly as V4L2_MEMORY_DMABUF into the v4l2 input queue, rather than using V4L2_MEMORY_USERPTR. Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_192p_i420_vm Change-Id: I5efe9cdf50505a74e1fc97a8b48c94870e224e38
2020-08-05V4L2Decoder: use map to associate block IDs to V4L2 buffersAlexandre Courbot
Block IDs can be arbitrarily large, but we only have a limited number of V4L2 buffers. Keep an association between the block IDs received from VideoFramePool and a V4L2 buffer slot to use with them instead of assuming that block IDs can be used as valid V4L2 buffer indices. Bug: 161323057 Test: arc.VideoDecodeAccel.h264_vm fully passes on Kukui. Change-Id: Id6a1013795d85cc08e3dca9308442db4921ddae0
2020-08-04V4L2Decoder: pass the same output buffer to V4L2 Queue slotChih-Yu Huang
Originally we pass arbitrary output buffers to V4L2 Queue. However, the V4L2 stateful API requires the caller pass the same buffers to the output queue slot. This CL implement this requirement. Bug: 161770200 Bug: 161323057 Test: arc.VideoDecodeAccel.h264_vm runs first test successfully. Change-Id: I8f6c8871997f310425571b3983ae86f05c0c37c6
2020-08-04VideoFramePool: use exponential backoff for obtaining framesAlexandre Courbot
The VideoFramePool needs to poll its backing block pool until a buffer becomes available. The current strategy is to sleep and repeat a number of times before giving up, but this carries the risk that some slower platforms will fail to receive buffers in the alloted time and introduce flakyness. Also the constant time between requests results in many requests to the block pool when it is empty, a situation that typically corresponds to the decoder having plenty of buffers at its disposal and thus not being in a particular hurry for a new buffer. Switch to an exponential backoff strategy for the block pool polling, and remove the time boundary. The exponential backoff limits the number of queries that are done to the block pool, and the absence of time makes the whole process safer. In case of a real error, the backing block pool is supposed to return a proper error code that we will propagate anyway. Bug: 161323057 Test: arc.VideoDecodeAccel.h264_vm does not time out waiting for buffers on Kukui. Change-Id: Ic3b9915926680cfd263352a7922658ec9a60b5cf
2020-07-30plugin_store: Switch to use C2VdaPooledBlockPoolChih-Yu Huang
The V4L2 stateful API requires the caller pass the same buffers to the output queue slot. Originally we use C2PooledBlockPool for byte buffer mode, but C2PooledBlockPool cannot get buffer identifier. This CL switches to use C2VdaPooledBlockPool, which guarantees to return a fixed set of buffers and could query the buffer index. Bug: 161770200 Test: pass e2e test Change-Id: Ief2bdd9ceb6655cd47627ccf6c239a1e6d73482e
2020-07-27Merge changes I7961c1e9,I59ba52e8 into rvc-devTreeHugger Robot
* changes: v4l2_codec2: Ignore unsupported controls in V4L2EncodeComponent. v4l2_codec2: Implement Codec2 V4L2 encode component.
2020-07-22v4l2_codec2: Ignore unsupported controls in V4L2EncodeComponent.David Staessens
The virtio driver doesn't support all of the controls currently used by the V4L2EncodeComponent. As these controls are not essential for the correct functioning of the encoder, this CL makes changes to treat these unsupported controls as warnings rather than errors. Bug: 143333813 Test: tast run $HOST arc.VideoEncodeAccel.h264_vm on rammus Change-Id: I7961c1e95c807de1d4df064fb869c01ba793f2c4
2020-07-22v4l2_codec2: Implement Codec2 V4L2 encode component.David Staessens
This CL introduces the first version of the new codec2 V4L2 encoder. The V4L2EncodeComponent currently only supports H264, support for additional formats will introduced later. The encode component is developed and tested on ARC++ and the initial version is not functional yet on ARCVM. The changes required to fully enable the encoder on ARCVM (such as support for DMABufs) will be introduced in follow-up CLs. Currently the component makes heavy use of Chromium helpers as it's based on the Chromium V4L2VideoEncodeAccelerator, but in the future the amount of dependencies will be reduced. The new V4L2 encoder is currently not enabled by default, which requires additional changes in media_codecs_c2.xml. Bug: 143333813 Test: mmm external/v4l2_codec2 Change-Id: I59ba52e8f85aa40c8d23a451fb2842a7a421412a
2020-07-16Merge "v4l2_codec2: Enable thread safety checks." into rvc-devandroid11-devTreeHugger Robot
2020-07-09V4L2DecodeComponent: Support protected playback.Chih-Yu Huang
In this CL, V4L2DecodeComponent supports the protected playback by using C2VdaBqBlockPool. To use C2VdaBqBlockPool, there are 2 specific requirements compared to a normal C2BlockPool: 1. Call C2VdaBqBlockPool::requestNewBufferSet() before fetching blocks 2. Call MarkBlockPoolDataAsShared() after creating C2ConstGraphicBlock Bug: 153608694 Test: Run ExoPlayer Demo apk: Widevine dash policy tests Change-Id: Idce298d13cb2fb7f9dd88ae43cd4c8f0cb18dffb
2020-07-09v4l2_codec2: Enable thread safety checks.David Staessens
This CL adds the -Wthread-safety flag to the codec2 components build file, so thread annotation such as GUARDED_BY can be used. Bug: 160110407 Test: m -j32 Change-Id: If39ae7694598d81076e18d5332fc759b74787a5d
2020-07-03components: Polish some logs.Chih-Yu Huang
This CL adds or fixes some information at logging, not changing the code logic. Bug: 160110407 Test: m -j32 Change-Id: I97d2cd43a526e56000abcc16886b1f0f6e0f6b71
2020-06-05components: VideoFramePool uses dedicated thread to fetch GraphicBlockChih-Yu Huang
Originally VideoFramePool shared the same thread with V4L2Decoder. It turned out the performance is pretty bad, many frames were dropped. In this CL, VideoFramePool creates a dedicated thread and fetch GraphicBlock on this thread. Bug: 146406514 Test: pass e2e test Change-Id: I3c51cf1ce1d8e40fb52ad947d779e8c0ad2f754c
2020-06-03V4L2DecodeInterface: add C2_PARAMKEY_OUTPUT_DELAY for H264Chih-Yu Huang
C2_PARAMKEY_OUTPUT_DELAY is the number of additional output frames that needs to be generated before an output can be released by the component. H264 may reorder the output frames, so we set C2_PARAMKEY_OUTPUT_DELAY to the possible maximum number of reoder frames. Bug: 153403351 Test: pass E2E test TestSimpleDecode for H264 Change-Id: I13ad1dc60bb8674e09250163ec6c6b186fec26a4
2020-06-02components: Implement Codec2.0 V4L2 decode componentChih-Yu Huang
This CL implements V4L2DecodeComponent, a decode C2Component via V4L2 API. It mainly contains these parts: - VideoDecoder: An interface for video decoding, similar to media::VideoDecoder at Chromium project. - V4L2Decoder: An implementation of VideoDecoder via V4L2 stateful API. We wrap all V4L2-related logic in this class - VideoFrame The data structure to represent the output buffer of VideoDecoder. It encapsulates a C2GraphicBlock and only exposes the essential information of physical buffers. - VideoFramePool: The buffer pool used by VideoDecoder. It encapsulates C2BlockPool and provides asynchronous method to fetch buffers. - V4L2DecodeComponent, V4L2DecodeInterface: The C2Component implementation that delegates the decode request to V4L2Decoder. - V4L2ComponentFactory: The C2ComponentFactory that creates V4L2DecodeComponent. Bug: 152714603 Test: mmm external/v4l2_codec2/ Test: Run e2e test and make sure the V4L2DecodeComponent is running Change-Id: I23e9b3553b62dd6c83d943d7787297305372c37d