Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 94742E00A7D; Tue, 28 Jul 2015 02:55:34 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [157.56.110.142 listed in list.dnswl.org] * -0.0 SPF_HELO_PASS SPF: HELO matches SPF record * 1.9 DATE_IN_FUTURE_06_12 Date: is 6 to 12 hours after Received: date * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0142.outbound.protection.outlook.com [157.56.110.142]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id ECBE7E00A53 for ; Tue, 28 Jul 2015 02:55:32 -0700 (PDT) Received: from DM2PR03CA0037.namprd03.prod.outlook.com (10.141.96.36) by CY1PR0301MB1178.namprd03.prod.outlook.com (10.160.165.21) with Microsoft SMTP Server (TLS) id 15.1.225.19; Tue, 28 Jul 2015 09:55:30 +0000 Received: from BN1BFFO11FD008.protection.gbl (2a01:111:f400:7c10::1:161) by DM2PR03CA0037.outlook.office365.com (2a01:111:e400:2428::36) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Tue, 28 Jul 2015 09:55:30 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD008.mail.protection.outlook.com (10.58.144.71) with Microsoft SMTP Server (TLS) id 15.1.231.11 via Frontend Transport; Tue, 28 Jul 2015 09:55:29 +0000 Received: from carol-OptiPlex-3020.ap.freescale.net (carol-OptiPlex-3020.ap.freescale.net [10.192.241.17]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t6S9tJnR013652; Tue, 28 Jul 2015 02:55:27 -0700 From: Yuqing Zhu To: Date: Wed, 29 Jul 2015 01:55:00 +0800 Message-ID: <1438106104-14871-4-git-send-email-b54851@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438106104-14871-1-git-send-email-b54851@freescale.com> References: <1438106104-14871-1-git-send-email-b54851@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD008; 1:ZQBY50418FZer6N+kVi/bywK1KxiQMMUhhAbksLJyJgBgiSOJfcIFT8MPKbfuh8vC5TqjNTCED8VHTuc8AwEIalc9bzjKfH/WucdZq3qe3NAMD+3KvTQh/TekLkH7sDHg8atz3RjgMlN1D8TUuSp9xtrgHtOAhoqo68oJN9NozsAdgQCyG6YaVO/EIHgwjnHLfDIWfwWjm3Y4X1ej0VxsUACQT9z9NKUZO455MSdh9EXgC9tEwwM5Jl54/EjiL1BeldpQyNX5wmHDCVqT9PAq4aqZNnsMUSKusys+EMHLyiJ3M2fNAvLvt1EoHYqt6miU9ESa6uQo9jkYr5DdUf3Dg== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(5890100001)(229853001)(2950100001)(33646002)(76176999)(92566002)(50986999)(50226001)(104016003)(86362001)(230783001)(575784001)(46102003)(5001960100002)(2351001)(62966003)(77096005)(77156002)(85426001)(19580395003)(50466002)(87936001)(48376002)(106466001)(19580405001)(6806004)(47776003)(36756003)(107886002)(189998001)(110136002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1178; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1178; 2:wmRKNr8Dh+wNWCWUfP8+BXenSt3TsV/oTzwBkO/CbnmtZDMxkp7uRqppMSoXuSsG71TskdIQQAHR4c9InFu/rqslsDtkDvYci5UtzfEaSaPCay6KNLIoDb7RIHXA3AGXq41cquWXKWRf+KMDCp0CJc9qxLgX/1uYytDYAmqrcAI=; 3:yQzEehhWd+vmcAvqf1nijjrxTLKepgT7qFmNAKtyyDNu4neaQYCUX24YkVlfpE/NO8OxucQvX7bp/d5hhdG7YDIibvNsdnQzrWDW/UKx363a1CWMvfgkQwEyIlqjIPOwptKcPf6jaddIfB/5yhTpIBEDkpzeN8SnlnWsIyZ+jnpsLihuC5pNkjOhwTpwaLpWW11xDYrwECJD1tJOBAFIgqYenzkna7hgW0tskJtnRR4=; 25:YtpgrVZfbltyKE7VAy79uASuoEiyGxSeY7KC2gHxdviCeO+6pfhrmuucXYHp0WnhMXdP6dyozkLhzKv267ZwNjOLLWf5MAboBHbFZGePpOqeE1s8lxViLQns8Iqd60fgStIc6bgrFiGSAYUuDfJ884AfiW6JAp8B+GMJE8o35eOHDQdpcksuOoYwWwuN2wPPxEBnrqpBMqnQHdR7Fe8MFajE/uz+8SFhO+7pFqAzSqhVNeUiAICzuZhctcoyw7plkYNG3L7UNCuhqayYWDwD7g== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1178; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1178; 20:bcOHnV0Lcg2PoAATAB1VEzaYi+20ky9DwzMxosSmhzb0eppEnKfP+6ILCyWdOVY6jBv3GuK6vKJsBjgIzHN2Qd+Mk0oqqgF5tH/L8I9WQIVNBbIkXWWDZSXnsewWNQs6pGPf1lOddHnhmmv4RL+4q7O0F4MBMSvIBwdOacMBsAxEJFsyfdu6NeIHNXDa35SDb0vUNobkqoW8ijuP32Ze/Hmlcs2yCZb9ubHVRZF+Az9rvF++rpGxanY/wDy38ke3RmxbUqJiXANXaYA5bEk1JG38qmoUQVvZXc/tY6tVWVw6F2hkbyGbsKy4m51o0A+AcDJigONYl+sjW99zD6U6wJnJcUphysN10AqwPfrd0qI=; 4:oStyq+hSvnZ3sPUQLW7PbxYjv0RpLrtA0qWf+uOzR+9nabEHeXkzK8iaOFwGy4INeE6D4gzJiPRlVNaxCU1+mT2eKxbsFNKOcbH5TmK53zkz+I/BR7hIddGpUkqDYZ/luUFWenj+DwipQQSjYBmXod0I8Z1PM3frDG06h5snMmabIpqXhWyjEkAkCt3xRMkzIO8H2QKl8uSaaSTmHfkgVf1RMFyuVrwvEzjh+dJnkGxR9R8kd/4ZtXOuVTH2n5h4WBeSv9OCiHau+Np0j5XqxMzjA3NT+l7IHUp0hq9WVAs= CY1PR0301MB1178: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:CY1PR0301MB1178; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1178; X-Forefront-PRVS: 06515DA04B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1178; 23:awQ9IdtevPXvnI4xqDjM+nZW58zR2lLgP1/g4Wb?= =?us-ascii?Q?X7+62X/5v5fYNZxmc26Q4ij04IUxm3KcJoPpeIVZNXVvGkmw7TTSpAq+MnB8?= =?us-ascii?Q?j+E+j1yBaUqM7PDMaYJpuFVSgNWItMMcfPEv1YIlL8en04u4fkNNd236Tydt?= =?us-ascii?Q?BD7xq7JMCENhgO+7UY27dKJ1hwQtscYEIQvzOg2kqhxRKs+MHCVdEbE9QX+3?= =?us-ascii?Q?1TV54QkCFga6qtOSTI8fBDzxWeLEALA9yMiUC6howqICVIqzfolGIZBmjAuz?= =?us-ascii?Q?iL/xt0GpINLN96EkqzjNtq4rTeYJOd1U8YQk2CdiQYGq0pGcFV2ConSbWDGM?= =?us-ascii?Q?AJQvDMu/Ou3V4bAUHLEOKJTa96M9RKiSL+yuU/VIc1Df9/+Qr9DCLYO7K7SO?= =?us-ascii?Q?1McmYfA1rHi276eAVUkAYOE9hg/xU8aDjtMusi+8gP6fG8qDNQ7hqr1ihUw4?= =?us-ascii?Q?imc7t7GMKFAaVXYJltZx+SBO02zKSrQhGDPofHT6nWhMfgNH1LrwHczli9hc?= =?us-ascii?Q?n9N1At0PjgdIRMxOGm6ddyGy8MQ+pE6ytJb/+XbHtIT6/eaFBCEukR3PV0e4?= =?us-ascii?Q?KYdJVANQPaMB0g/6Gq3gsDi94wXOT3gZH4F/9cfvgHCfCmi6X0XFXbXO/0zY?= =?us-ascii?Q?5SU/JmlCTovfMRQD0t5QyV8TpZH9NKcVVUON2WtSNq2VBSVaBcjllQfqbqRK?= =?us-ascii?Q?FEhICOEttCyWAMME3MQth5q2UKMeTZ7vVk+dFzhtS+jZpK7+mj/QTQQVQvp+?= =?us-ascii?Q?A2xTFK58wGUUq+9e17YX9khVHABVhR+OMc9AZVlacxo0Blr4h4yzua+XEyQg?= =?us-ascii?Q?JV7P3KbQ7jx0soZJC+3UnhthM3+3T8XVrCLTUTaRgNKlQmzy8UuFEETnraT1?= =?us-ascii?Q?3AW6YrwvWRL2aiRmPjydubuyJJGlYOH0z8gZduWu0uFzTo6HXbN6m2IcsLNn?= =?us-ascii?Q?N274/kAihxFWLukC53aVTgOe6NRS2pMkP3htAe24BU13pX4cgoctL/DzD8Q4?= =?us-ascii?Q?fC6c=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1178; 5:A5HwxEuLRYCyM/KV3JR+IP66o832S9BuI2BmJitbEYbSyuov9uknAC/y/8+UC5e2cTUSfFQA5WQbuLUTHyI0HKiEWkNogkAnJKzqOfLi+sJ55XUjGWPRUixSennSFBRX+PKs6yJFmt+xF/2K1wUYZg==; 24:cmG8kAdVi2eNQ2O2Ti/Lo6x81VCYvO+ELqMLM/cI51LSJD2ENxlvLPbI/8Ny2Uu7GhmhQ+J3+MpNHomM5BijJJo/++Cjk/v3iPi/syy4r48=; 20:J5JWkiazN1bYqs31vrhIFaLTdf259mIZAtNF83ir0lfT0+PpPWhOdq60aK030UyjOXvpvinP0hm/AEC+AOIsAg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2015 09:55:29.7328 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1178 Subject: [meta-fsl-arm][PATCH v3 3/7] gstreamer1.0-plugins-base: Add basetextoverlay related patch X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:55:34 -0000 Content-Type: text/plain Make memory copy when video buffer's memory is read only Signed-off-by: Yuqing Zhu --- ...rlay-make-memory-copy-when-video-buffer-s.patch | 129 +++++++++++++++++++++ .../gstreamer/gstreamer1.0-plugins-base_%.bbappend | 1 + 2 files changed, 130 insertions(+) create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch new file mode 100644 index 0000000..ba30509 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch @@ -0,0 +1,129 @@ +From 3781d40940d46d7e6a502092d24aac7997f6da5b Mon Sep 17 00:00:00 2001 +From: Mingke Wang +Date: Thu, 5 Mar 2015 12:06:23 +0800 +Subject: [PATCH 1/4] basetextoverlay: make memory copy when video buffer's + memory is ready only + +1. since gst_buffer_make_writable just lookup the refcount to determine if + a buffer is writable, and it will use _gst_buffer_copy() which don't + perform a deep memory copy even if the flag of a memory is set to + GST_MEMORY_FLAG_READONLY. So, we detect the memory flag and use + gst_buffer_copy_region with GST_BUFFER_COPY_DEEP parameter to perform + deep memory copy. if the allocator of a memory don't support mem_copy + interface, the it will return NULL, if this case, we can use + gst_buffer_make_writable() to get a shared memory buffer or the orignal + buffer if the buffer's refcount is 1. +2. new feature is no added if caps has no feature during caps negotiation + +Upstream-Status: Inappropriate [i.MX specific] + +Signed-off-by: Mingke Wang + +diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c +index c919861..3c0a1d7 100755 +--- a/ext/pango/gstbasetextoverlay.c ++++ b/ext/pango/gstbasetextoverlay.c +@@ -747,6 +747,7 @@ gst_base_text_overlay_negotiate (GstBaseTextOverlay * overlay, GstCaps * caps) + if (f == NULL) { + f = gst_caps_features_new + (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, NULL); ++ gst_caps_set_features(overlay_caps, 0, f); + } else { + gst_caps_features_add (f, + GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); +@@ -1890,16 +1891,71 @@ gst_base_text_overlay_push_frame (GstBaseTextOverlay * overlay, + if (gst_pad_check_reconfigure (overlay->srcpad)) + gst_base_text_overlay_negotiate (overlay, NULL); + +- video_frame = gst_buffer_make_writable (video_frame); +- + if (overlay->attach_compo_to_buffer) { + GST_DEBUG_OBJECT (overlay, "Attaching text overlay image to video buffer"); ++ video_frame = gst_buffer_make_writable (video_frame); + gst_buffer_add_video_overlay_composition_meta (video_frame, + overlay->composition); + /* FIXME: emulate shaded background box if want_shading=true */ + goto done; + } + ++ gint m = gst_buffer_n_memory(video_frame); ++ gboolean mem_rdonly = FALSE; ++ GstMemory *mem; ++ GstBuffer *orig = video_frame; ++ ++ while (--m>=0) { ++ mem = gst_buffer_get_memory(video_frame, m); ++ if (GST_MEMORY_IS_READONLY(mem)) { ++ mem_rdonly = TRUE; ++ gst_memory_unref (mem); ++ break; ++ } ++ gst_memory_unref (mem); ++ } ++ ++ if (mem_rdonly) { ++ // since gst_buffer_make_writable just lookup the refcount to determine if ++ // a buffer is writable, and it will use _gst_buffer_copy() which don't ++ // perform a deep memory copy even if the flag of a memory is set to ++ // GST_MEMORY_FLAG_READONLY. So, we detect the memory flag and use ++ // gst_buffer_copy_region with GST_BUFFER_COPY_DEEP parameter to perform ++ // deep memory copy. if the allocator of a memory don't support mem_copy ++ // interface, the it will return NULL, if this case, we can use ++ // gst_buffer_make_writable() to get a shared memory buffer or the orignal ++ // buffer if the buffer's refcount is 1. ++ GstBuffer *new_buf = gst_buffer_copy_region (video_frame, ++ GST_BUFFER_COPY_ALL | GST_BUFFER_COPY_DEEP, 0, -1); ++ ++ GST_DEBUG_OBJECT (overlay, "copy %s video frame buffer %p -> %p", ++ g_type_name (GST_MINI_OBJECT_TYPE (video_frame)), video_frame, new_buf); ++ ++ if (!new_buf) { ++ //maybe the allocator don't support mem_copy interface, the we just use ++ //gst_buffer_make_writable() to get a writable buffer. ++ video_frame = gst_buffer_make_writable (video_frame); ++ } else { ++ gst_mini_object_unref (video_frame); ++ GST_BUFFER_FLAG_UNSET (new_buf, GST_BUFFER_FLAG_TAG_MEMORY); ++ video_frame = new_buf; ++ } ++ ++ if (!video_frame) { ++ GST_WARNING_OBJECT (overlay, "make writable buffer failed"); ++ return GST_FLOW_OK; ++ } ++ ++ m = gst_buffer_n_memory(video_frame); ++ while (--m>=0) { ++ mem = gst_buffer_get_memory(video_frame, m); ++ GST_MEMORY_FLAG_UNSET (mem, GST_MEMORY_FLAG_READONLY); ++ gst_memory_unref (mem); ++ } ++ } else { ++ video_frame = gst_buffer_make_writable (video_frame); ++ } ++ + if (!gst_video_frame_map (&frame, &overlay->info, video_frame, + GST_MAP_READWRITE)) + goto invalid_frame; +@@ -1918,6 +1974,18 @@ gst_base_text_overlay_push_frame (GstBaseTextOverlay * overlay, + + gst_video_frame_unmap (&frame); + ++ if (mem_rdonly && orig == video_frame) { ++ //if we used the original buffer and it's mem is set to read only, ++ //recover the memory ready only flag since we unset it before ++ // gst_video_frame_map () ++ m = gst_buffer_n_memory(video_frame); ++ while (--m>=0) { ++ mem = gst_buffer_get_memory(video_frame, m); ++ GST_MEMORY_FLAGS(mem) |= (GST_MEMORY_FLAG_READONLY); ++ gst_memory_unref (mem); ++ } ++ } ++ + done: + + return gst_pad_push (overlay->srcpad, video_frame); +-- +1.7.9.5 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend index 7b9bfed..cf88fe1 100644 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend @@ -5,6 +5,7 @@ SRC_URI_append_mx5 = " file://gstplaybin-remove-flag-deinterlace.patch" IMX_PATCHES = " file://gstplaybin-remove-flag-deinterlace.patch \ file://do-not-change-eos-event-to-gap-event2.patch \ file://do-not-change-eos-event-to-gap-event3.patch \ + file://0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch \ " -- 1.9.1