From patchwork Tue Jun 13 10:48:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "LongChair ." X-Patchwork-Id: 3962 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp282150vsw; Tue, 13 Jun 2017 03:48:51 -0700 (PDT) X-Received: by 10.28.54.40 with SMTP id d40mr11050762wma.70.1497350931693; Tue, 13 Jun 2017 03:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497350931; cv=none; d=google.com; s=arc-20160816; b=rGw+wyB/iBYAZZkSSiX5hgjVBRWLLbXF5jSuiUknFUZw1+aR/bPAph/nZBrlzHaF38 QxlUXtxIRXwNhQRSlAp1w0SCZbHhgEVToNn8/u+LkYf6/8zUWT+0AoI6VWkahULQgylM yK7xZkvYPZS91upQytencuh8UdPEKKNLkAxZ+LcTP5UBuLlGDEHg81IHaTf8O36N8VdY RLQYqKkC1dCqnTv5VPQOzxNvc5DZs11fEdvWmhqAQKdlF6DKCYLVtCR34AooysoYsaMY KUZl8MkHtl1HME8yxEmWrCXfzy8XCPpvGEmmf9KLZ/YWCwSvK3If2bEpz0XvuDLoLo2b PeJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=Uu4N8vwfQiSkBAKKl4JaSgBp4sPY4ncs2+qGXaV/uUg=; b=OqBoo316/htLFPFi81+4q0A91uNCKcXR8b5H5LI7dHLHWcYzZDFJPwjZLHHEX7qLpw J+rZ3QSCVt4GZ9rGxWKclJcO3i7wFqThEdm3FaBmJBxK1OYUPtNTV54/nwp/VKSGThAH OADUq+FoXHJgWQHLjtNuFhm3vO+cASUW6pbv49kDQdjbWw56AOFm7poBl6R1m8AE+BCG 6M8lVv9oUY+esoeXI3tmiFD2WeE7ivXFJXsnWrFU/88wJQRo8e4b0/mD7t7bNlZpaKRO 2dIzbvc4WK5pWaSxEE8fHmsjojfndDehM7lVZiYJ1t46r+ayEPdxKVcC3hqG4PFqixnr kcJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@hotmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r139si10920228wmb.66.2017.06.13.03.48.50; Tue, 13 Jun 2017 03:48:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@hotmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A669468A07A; Tue, 13 Jun 2017 13:48:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-oln040092008099.outbound.protection.outlook.com [40.92.8.99]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DFCA68A000 for ; Tue, 13 Jun 2017 13:48:38 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lXwFoxmPrR+Vfqp2SVTzrsH0uDTHq8hXpkJreb+cHbE=; b=uEvAMMMk0OaHHdagSuQ0+lwZCCFPng2RS/6BbWM0g8NHSSIuatEeqJShPnDQvWK+Qybwo/JTiSNUDx22sV0KhDqUsyGeHdHR9R1Ei9djb9Qyg66gFBSeY9+upsPulOYVc3vjl8J5wjL7ozoFm6qa30i8RaSw+3yR7VegJGQuaWx8am0ss9bXVRgkY8y66md0UdhH83fK9iBlK1f3fzBvE9nK+G3/LLwxD29QQYqOEVp+gJi0BQovkI2H8CfVQ/XWqRbkQ9pPMnvvBxPonLufl9K3WoOFKhdqlwV/GKOU5DBNRJ0tYzEisOXkuLAjMbGvVHJwLYMEbMVL2jwOO4w/XQ== Received: from DM3NAM03FT006.eop-NAM03.prod.protection.outlook.com (10.152.82.51) by DM3NAM03HT019.eop-NAM03.prod.protection.outlook.com (10.152.83.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1157.12; Tue, 13 Jun 2017 10:48:38 +0000 Received: from CY4PR1701MB1782.namprd17.prod.outlook.com (10.152.82.59) by DM3NAM03FT006.mail.protection.outlook.com (10.152.82.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12 via Frontend Transport; Tue, 13 Jun 2017 10:48:38 +0000 Received: from CY4PR1701MB1782.namprd17.prod.outlook.com ([10.171.211.141]) by CY4PR1701MB1782.namprd17.prod.outlook.com ([10.171.211.141]) with mapi id 15.01.1157.017; Tue, 13 Jun 2017 10:48:38 +0000 From: "LongChair ." To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform Thread-Index: AQHS5A1Y0q0vXe6ur0ixOniUeaZO1qIilHKAgAAIqAA= Date: Tue, 13 Jun 2017 10:48:38 +0000 Message-ID: References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: ffmpeg.org; dkim=none (message not signed) header.d=none; ffmpeg.org; dmarc=none action=none header.from=hotmail.com; x-incomingtopheadermarker: OriginalChecksum:786B41046FFD59F0BEE13DD67E0220BD21A58C64D2A97EC8CABAF36DCB863075; UpperCasedChecksum:E9C408CF7F55879509F0C2136966935D815EF36BBCB31FE1E3452DE248CDA962; SizeAsReceived:7465; Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Mk2GHOkMUBfhkCbYSp4guwtn2vc4ZF9e] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM3NAM03HT019; 7:zmFH6JMOSh4skC8+S2MUdDC2bLq3Cvp+vFKjNKFtJ2ycca/96yeW29IkSbVE7FvzNn3IJa+yPZZmTtm6xluzSyHbudUBSw0k9EHOfKtoEyWdeTlmGvnRZRKZR2kebXGhW4MeyFm5EvCIF/JpXihNAy9i2NZ0YffYtPbboPAGMlE4jTiOPGfHJFw/oFH6a07EnE+20xfrx4tdfKabZ+pvNPF6FetICij5t8c2gM6BKz5RbWr2LmhtO4Ru3FvETX0+TWJlb2IrA2Eid7rWBgF6/FKXatClXLaISuMnnuQv608MQ/bgu1HD7n8SApdMs8KiaTMkO/eyMjGFACGnKIXxZMg9yjCo3g93alSCpX+Zq9QALOUmk+C7p1NxUOoJPnURLtRacx+FwGz/0xoD35BoXPcuwuWxZh0R2EEl1fQqwsYIWY8eXf4t6pu3OCiEujdUJwNkhZEVE1IUA0XPtUzodaY7/8F+pFIKgXxOgEHkRrWoYDd/IuUmYGrEgJFD9Znth7ALM4UJp6Wq3pXpB/kn+dwOrMcE1Z5T4WrtxMo5FzqJlTAusc46xEcAODQZYe7+gcqLaVleLfl+QxwKI6grAwQjz7boUrldRKYRsRJ0gh5d0aAoXoelygKw/t/AuP2JAVKIhQ+ORkMqCp3DIL5iSgmDlrYPEcsOx/kZIRw175P4iH0hgjel6e/7xjee/PJoYbQu6J4uARyjZYYFsRjlJn4b4pFSXa1SLr8vuV1oKisYupo7My2gy5OGZDffItFh0h0lYEtHyAOA9gMURQ4EMA== x-incomingheadercount: 45 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:DM3NAM03HT019; H:CY4PR1701MB1782.namprd17.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-traffictypediagnostic: DM3NAM03HT019: x-ms-office365-filtering-correlation-id: 674c313d-0fe4-4261-ebda-08d4b249bf26 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322274)(1601125374)(1603101448)(1701031045); SRVR:DM3NAM03HT019; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031); SRVR:DM3NAM03HT019; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM3NAM03HT019; x-forefront-prvs: 0337AFFE9A spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2017 10:48:38.1063 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3NAM03HT019 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH] Add support for RockChip Media Process Platform X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hello, The use case for this is mostly on embedded devices that can use drm to display video with zerocopy. Most devices i have played with that can use such implementation will allow to create a drm overlay from that drmprime information with drmModeAddFB2: Here is a sample usage for it https://github.com/LongChair/mpv/blob/rockchip/video/out/opengl/hwdec_drmprime_drm.c#L103-L137 Also that allows some other egl / dmabuf implementation : https://github.com/LongChair/mpv/blob/rockchip/video/out/opengl/hwdec_drmprime_egl.c#L162-L215 The idea behind making this a non rockchip specific hwdec was that on embedded devices, most maufacturers are heading towards V4L2 harwadre decoding implementations. from what i have seen such v4L2 decoding coudl as well make sue of such a format, which would allow to have only one renderer that is hwdec agnostic for the rendering part. Now of course, I am not 100% sure that this would fit all the possible implementations, If you feel like this should be rockchip specific, then i'll get back to it which was the version 1 of this patch. Lionel. Le 13/06/2017 à 12:17, Mark Thompson a écrit : On 13/06/17 07:21, LongChair . wrote: From: LongChair This adds hardware decoding for h264 / HEVC / VP8 using MPP Rockchip API. Will return frames holding a av_drmprime struct in buf[3} that allows drm / dmabuf usage. Was tested on RK3288 (TinkerBoard) and RK3328. Additions from patch v1 - Change AV_PIX_FMT_RKMPP to AV_PIX_FMT_DRMPRIME as any decoder able to output drmprime structures could use that pixel format. --- Changelog | 1 + configure | 12 ++ libavcodec/Makefile | 5 + libavcodec/allcodecs.c | 6 + libavcodec/drmprime.h | 17 ++ libavcodec/rkmppdec.c | 523 +++++++++++++++++++++++++++++++++++++++++++++++++ libavutil/pixdesc.c | 4 + libavutil/pixfmt.h | 5 + 8 files changed, 573 insertions(+) create mode 100644 libavcodec/drmprime.h create mode 100644 libavcodec/rkmppdec.c I'm not sure that a structure like this should be baked into the API/ABI now as a generic thing. Are you confident that it is sufficient to represent any picture in a DRM object which might be used in future? (Including things like tiling modes, field splitting, other craziness that GPU makers dream up?) Can you explain the cases you are using this in? Are you intending to make other components with input / output in this format? With just this decoder in isolation, it would seem preferable to me to make a structure specific to the API for now (or use the existing one - is MppFrame sufficient?). If later there are multiple implementations and need for a common structure like this then it will be clearer what the requirements are. Compare VAAPI and QSV (possibly also CUDA, CUVID, VDPAU?) - they can expose DRM objects, but don't currently in the ffmpeg API because any consumers which want them in that form generally prefer the wrapping object including the relevant metadata anyway. Also, zero is a valid file descriptor. Thanks, - Mark _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel diff --git a/Changelog b/Changelog index 3533bdc..498e433 100644 --- a/Changelog +++ b/Changelog @@ -52,6 +52,7 @@ version 3.3: - Removed asyncts filter (use af_aresample instead) - Intel QSV-accelerated VP8 video decoding - VAAPI-accelerated deinterlacing +- Addition of Rockchip MPP harware decoding version 3.2: diff --git a/configure b/configure index 4ec8f21..883fc84 100755 --- a/configure +++ b/configure @@ -304,6 +304,7 @@ External library support: --disable-nvenc disable Nvidia video encoding code [autodetect] --enable-omx enable OpenMAX IL code [no] --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no] + --enable-rkmpp enable Rockchip Media Process Platform code [no] --disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect] --disable-vda disable Apple Video Decode Acceleration code [autodetect] --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect] @@ -1607,6 +1608,7 @@ HWACCEL_LIBRARY_LIST=" libmfx mmal omx + rkmpp " DOCUMENT_LIST=" @@ -2616,6 +2618,7 @@ h264_dxva2_hwaccel_select="h264_decoder" h264_mediacodec_hwaccel_deps="mediacodec" h264_mmal_hwaccel_deps="mmal" h264_qsv_hwaccel_deps="libmfx" +h264_rkmpp_hwaccel_deps="rkmpp" h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" h264_vda_hwaccel_deps="vda" @@ -2634,6 +2637,7 @@ hevc_mediacodec_hwaccel_deps="mediacodec" hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_qsv_hwaccel_deps="libmfx" +hevc_rkmpp_hwaccel_deps="rkmpp" hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" hevc_vaapi_hwaccel_select="hevc_decoder" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" @@ -2696,6 +2700,7 @@ vp9_cuvid_hwaccel_deps="cuda cuvid" vp9_cuvid_hwaccel_select="vp9_cuvid_decoder" vp8_mediacodec_hwaccel_deps="mediacodec" vp8_qsv_hwaccel_deps="libmfx" +vp8_rkmpp_hwaccel_deps="rkmpp" vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9" vp9_d3d11va_hwaccel_select="vp9_decoder" vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" Why do these hwaccels exist? They don't appear to do anything, since you only have hardware surface output anyway. ... diff --git a/libavcodec/drmprime.h b/libavcodec/drmprime.h new file mode 100644 index 0000000..44816db --- /dev/null +++ b/libavcodec/drmprime.h @@ -0,0 +1,17 @@ +#ifndef AVCODEC_DRMPRIME_H +#define AVCODEC_DRMPRIME_H + +#include + +#define AV_DRMPRIME_NUM_PLANES 4 // maximum number of planes + +typedef struct av_drmprime { + + int strides[AV_DRMPRIME_NUM_PLANES]; // stride in byte of the according plane + int offsets[AV_DRMPRIME_NUM_PLANES]; // offset from start in byte of the according plane + int fds[AV_DRMPRIME_NUM_PLANES]; // file descriptor for the plane, (0) if unused. + uint32_t format; // FOURC_CC drm format for the image + +} av_drmprime; + +#endif // AVCODEC_DRMPRIME_H