Skip to content

Commit

Permalink
rbp: Support zero copy interface with hevc acceleration
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Apr 3, 2020
1 parent 1be60ea commit f69f40f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
if (m_decoderState == STATE_NONE)
{
m_decoderState = STATE_HW_SINGLE;
#ifdef TARGET_RASPBERRY_PI
int num_threads = CServiceBroker::GetCPUInfo()->GetCPUCount() * 3 / 2;
num_threads = std::max(1, std::min(num_threads, 16));
if (pCodec->id == AV_CODEC_ID_HEVC)
num_threads = 8;
m_pCodecContext->thread_count = num_threads;
m_pCodecContext->thread_safe_callbacks = 0;
CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - open frame threaded with %d threads", num_threads);
#endif
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,9 @@ CDVDVideoCodec::VCReturn CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame)

CGPUMEM *m_gmem = (CGPUMEM *)av_buffer_get_opaque(frame->buf[0]);
assert(m_gmem);
// need to flush ARM cache so GPU can see it
m_gmem->Flush();
// need to flush ARM cache so GPU can see it (HEVC will have already done this)
if (avctx->codec_id != AV_CODEC_ID_HEVC)
m_gmem->Flush();
m_renderBuffer = static_cast<CMMALYUVBuffer*>(m_gmem->m_opaque);
assert(m_renderBuffer && m_renderBuffer->mmal_buffer);
if (m_renderBuffer)
Expand Down

0 comments on commit f69f40f

Please sign in to comment.