Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: JeffyChen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
To: Tomasz Figa <tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org
Cc: "open list:ARM/Rockchip SoC..."
	<linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	myy-tmjzNUIc0P1+EYZtW95mkQ@public.gmane.org,
	alpha.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org
Subject: Re: rockchip-vpu driver usability
Date: Fri, 25 May 2018 17:52:57 +0800	[thread overview]
Message-ID: <5B07DCF9.2090709@rock-chips.com> (raw)
In-Reply-To: <CAAFQd5Ap9v2-oyxZ8UK1bfsfEKd7K+=1erz+aK75SsLdd1SxHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi,

On 05/25/2018 02:10 PM, Tomasz Figa wrote:
> On Thu, May 24, 2018 at 9:18 PM Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org> wrote:
>
>> Hi Tomasz,
>
>> On Thu, May 24, 2018 at 08:46:35PM +0900, Tomasz Figa wrote:
>>> On Thu, May 24, 2018 at 7:34 PM Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org> wrote:
>>>> I'm trying to get the RK3288 VPU do h.264 encoding on the Tinkerboard
>>>> platform with latest mainline kernel. I found the v4l2 based
> rockchip-vpu
>>>> driver in the vendor kernel. But I could not get it work even in the
>>>> context of that kernel. Is this driver in usable state? If not, how
> far it
>>>> is from being usable?
>>>
>>> The driver in chromeos-3.14 kernel [1] is running in production on
> RK3288
>>> systems, while the one in chromeos-4.4 [2] on RK3399 systems.
>>>
>>> [1]
>>>
> https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-3.14/drivers/media/platform/rk3288-vpu/
>>> [2]
>>>
> https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/media/platform/rockchip-vpu/
>>>
>>> However, it doesn't implement a regular stateful V4L2 encoder API, since
>>> the hardware is stateless and does only part of the encoding. For other
>>> things, like bitstream generation and bitrate control, we have
> libv4l-based
>>> plugins for rk3288 [3] and rk3399 [4].
>>>
>>> [3]
>>>
> https://chromium.googlesource.com/chromiumos/third_party/libv4lplugins/+/master/libv4l-rockchip/
>>> [4]
>>>
> https://chromium.googlesource.com/chromiumos/third_party/libv4lplugins/+/master/libv4l-rockchip_v2/
>
>> This is interesting, thanks.
>
>> It looks like only v2 supports h.264 encoding. Does the v2 plugin work
> with
>> the rk3288?
>
> Hmm, looks like I missed the part about h264 in your original message (only
> noticed encoding). We didn't have a need to encode h264 on rk3288 devices.
> The need showed up only later when we were working on rk3399. This made
> both the driver and plugin for rk3288 lack h264 support.
>
> AFAICT the hardware programming interface differs between rk3288 and
> rk3399, so v2 might not work, but maybe you just need to reshuffle some
> registers.
>
> It's also possible that Rockchip has some code for it. Jeffy, do you know
> if there is h264 driver code and plugin for rk3288 available somewhere
> (based on the driver developed for Chrome OS 3.14 kernel)?
>

well, i do saw a h264e driver for rk3288 in cros kernel:
chromiumos/src/third_party/kernel/local/drivers/media/platform/rockchip-vpu# 
ls rk3288_vpu_hw_h264e.c

and the related struct defined in v2 plugin:
libv4l-rockchip_v2/libvepu/common/rk_venc.h:120:struct 
rk3288_h264e_reg_params {


>
>> A recent discussion on the linux-media list indicated that gstreamer and
>> libv4l2 are not a good match. Which application would you recommend for
> doing
>> h.264 encoding?
>
>>> Do you have any details on what was going wrong when you tried to "get
> it
>>> work even in the context of that kernel"?
>
>> I used the code from the 'develop' branch of the TinkerOS kernel source
>> tree[1]. I had to build the latest gstreamer version 1.14.0 to get the
>> v4l2h264enc plugin. On startup I got a lot of "must be set encoding output
>> size" error messages from try_fmt. Shortly after that I got a NULL
> dereference
>> BUG message.
>
>> But since you say that the driver does not implement the regular API, I
> can't
>> expect gstreamer native V4L2 code to work, right?
>
> Nope. GStreamer would be expecting the normal stateful encoder API.
>
>
>> [1] https://github.com/TinkerBoard/debian_kernel
>
>>>> Another option is to forward port the rockchip-vcodec shim driver for
> the
>>>> MPP
>>>> framework. I'm aware of Myy Miouyouyou's work[1] in this area. But
> this
>>>> driver
>>>> seems unusable as well. Testing v4.17-rc6, the PM code fails to
> enable the
>>>> video power domain (the hvec power domain enables correctly, though).
> The
>>>> error is:
>>>
>>>>     rockchip-pm-domain ff730000.power-management:power-controller:
> failed
>>> to get ack on domain 'pd_video', val=0x8021c
>>>
>>> Hmm, this looks like some problem with power domains. I don't think
> this is
>>> related to the codec driver itself. Could be something wrong with power
>>> domain driver or some data in device tree, such as power domain clocks.
>>>
>>>
>>>> With the TinkerOS provided kernel I managed to make the VPU encode to
>>> h.264
>>>> using the gstreamer MPP plugin. But I would rather not use that
> kernel if
>>>> possible, since that would mean backporting other v4l2 code that I
> need.
>>>
>>>> Do you have any other idea/direction for me to explore?
>>>
>>> I think you should be able to get our driver to work, but ideally we
> should
>>> create a proper stateless encoder API, based on V4L2 Request API,
> similar
>>> to what's being proposed for decoders.
>
>> Thanks for your detailed and helpful response.
>
> Well, not so helpful in the end. I feel like we could have done better with
> pushing this driver upstream. Hopefully the Request API finalizes soon and
> we can try to push this forward.
>
> Best regards,
> Tomasz
>
>
>

  parent reply	other threads:[~2018-05-25  9:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 10:34 rockchip-vpu driver usability Baruch Siach
2018-05-24 11:46 ` Tomasz Figa
     [not found]   ` <CAAFQd5DZkLoR3HCD74JdWQzg4XZ8Rmh9=DCgAhYX=7ue-iHDtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-24 12:18     ` Baruch Siach
2018-05-25  6:10       ` Tomasz Figa
     [not found]         ` <CAAFQd5Ap9v2-oyxZ8UK1bfsfEKd7K+=1erz+aK75SsLdd1SxHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-25  9:52           ` JeffyChen [this message]
     [not found]             ` <5B07DCF9.2090709-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-07-02  7:24               ` Baruch Siach
2018-07-02  7:30                 ` Tomasz Figa
     [not found]                   ` <CAAFQd5Ddc2w7GdzWcSPBKbpnkc2KLAXePBEbSNjbkt9aNjhOAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-02 14:57                     ` Baruch Siach
2018-07-03 14:29                       ` Tomasz Figa
     [not found]                         ` <CAAFQd5CytjMN1ZvX27TGuHbfywbQ3Lmqh6UV6YJdgSouqQ_+8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-04  8:55                           ` Baruch Siach
     [not found]                             ` <20180704085537.vglkza6bwllx3573-MwjkAAnuF3khR1HGirfZ1z4kX+cae0hd@public.gmane.org>
2018-07-04  9:04                               ` Tomasz Figa
     [not found]                                 ` <CAAFQd5AYQVY-MPVsGn4XeM6m+uTV+-MYdU4DwmxkGCPr0BQthw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-05 12:14                                   ` Baruch Siach
2018-07-18  5:44                                     ` Tomasz Figa
2018-05-24 12:02 ` Myy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B07DCF9.2090709@rock-chips.com \
    --to=jeffy.chen-tnx95d0mmh7dzftrwevzcw@public.gmane.org \
    --cc=alpha.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=myy-tmjzNUIc0P1+EYZtW95mkQ@public.gmane.org \
    --cc=tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox