From patchwork Thu Jun 14 16:48:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhinav Kochhar X-Patchwork-Id: 9307 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5923F23E0C for ; Thu, 14 Jun 2012 16:48:10 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id EF64BA185EA for ; Thu, 14 Jun 2012 16:48:09 +0000 (UTC) Received: by yhpp61 with SMTP id p61so1813931yhp.11 for ; Thu, 14 Jun 2012 09:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:mime-version:in-reply-to:references:date:message-id :from:to:cc:subject:x-beenthere:x-mailman-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:sender:errors-to :x-gm-message-state; bh=J8Yupzt0eeiPHjzceivjrCJ99j95r7fL35Uu+NC+PF4=; b=b+o1IQjeIvjoWVmCABAo7XGgO9e8mcJUGCOAp6C1gk+WogLO5bHLX6iZpo424T7xnq eR5KByhGIY2Rx/V06hAvBGFQEv/imzHxlEG2zqXc71ach94JvVJCs+asEyEBlOBZyR9o 8VGX3lsp+CB7tDyehm+XpixPS45xKaHA+Ko2K/JkIvCiY5mFkZNHJCsK6400XnQNDDwD g0/FPuSn/74moBlAFbJam9TRYRAdKENQpfbBWhLWWUM07OFIAdzbtXPf4rPwLCCCPqED 6slPtQjDa/sThVP9lkHlt/IDpDOIetNqhpKdaP9p8DQj6sbFd6xbOLoMfNg3pQDU5HWE yqdw== Received: by 10.50.87.227 with SMTP id bb3mr1309439igb.57.1339692489152; Thu, 14 Jun 2012 09:48:09 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp94948ibb; Thu, 14 Jun 2012 09:48:07 -0700 (PDT) Received: by 10.180.106.137 with SMTP id gu9mr5841640wib.8.1339692487102; Thu, 14 Jun 2012 09:48:07 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id m60si8870953wee.64.2012.06.14.09.48.05; Thu, 14 Jun 2012 09:48:07 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SfDDG-00086N-MA; Thu, 14 Jun 2012 16:48:02 +0000 Received: from mail-yx0-f170.google.com ([209.85.213.170]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SfDDE-00086I-Rn for linaro-mm-sig@lists.linaro.org; Thu, 14 Jun 2012 16:48:01 +0000 Received: by yenl12 with SMTP id l12so2088637yen.1 for ; Thu, 14 Jun 2012 09:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=E/1GMgq79qqZAPsjIfgre5mz0fHDjc+0vwl4OMNHeXc=; b=ybRToX/BTXswolug2ke2V9m3C+DX/tZVOutS+arg4c1F28JNP+ozaAWxxdtVdBduhm /B+RiNTyo6myp8pWpKPSOGY/zaztIHaFLRXtX33EJGez5gmJr9E48hpyCs3/e3laYVmg 2YB9wx3OSKJnktoFoprua3Fj8WRVF8yE9Hau7kywqexfOtx8FQ8h1YbTZ29Yt254p+Ct 1qm5dYP6Sro3TNuodzUTrRL1CezsuLrTeOuWIpc1FSfQ8X8CQ6D5zo1ORdJgNXWs8WQJ oJgPbLEm2o3OMgQFDzmoIysRXAjbuJLh1CgizyPVOTqUp5I19TFWSxRhwu2LkhUmo5n0 NyZA== MIME-Version: 1.0 Received: by 10.236.185.167 with SMTP id u27mr3976053yhm.32.1339692480061; Thu, 14 Jun 2012 09:48:00 -0700 (PDT) Received: by 10.236.154.197 with HTTP; Thu, 14 Jun 2012 09:48:00 -0700 (PDT) In-Reply-To: <1339681069-8483-4-git-send-email-t.stanislaws@samsung.com> References: <1339681069-8483-1-git-send-email-t.stanislaws@samsung.com> <1339681069-8483-4-git-send-email-t.stanislaws@samsung.com> Date: Thu, 14 Jun 2012 09:48:00 -0700 Message-ID: From: Abhinav Kochhar To: linaro-mm-sig@lists.linaro.org Cc: Sunil Mazhavanchery , sumit.semwal@ti.com, pawel@osciak.com, anush@google.com, Prashanth G Subject: Re: [Linaro-mm-sig] [PATCHv7 03/15] v4l: vb2: add support for shared buffer (dma_buf) X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQl4KOpUJAyw/QaNHyydHlFdAXCDPWVEBIO5US6U10WsRzWt5oj7axgWUJbyVtj3z+0QaM6z Hi Tomasz,Sumit, We have been doing performance analysis for video playback scenarios. Could get significant improvement in FPS (33% or 8~10 fps) for full HD resolution when the map/unmap sequence is not called. This is a considerable improvement in performance and would be helpful to have some logical way using e.g. "dmabuf hint" to avoid what looks like a bottleneck (map/unmap sequence). For your reference I have I have copied the changes below. Please note this is a change for verification into the vb2 core to add an additional condition check for avoiding the calls to map/unmap if the buffer has been already mapped once. } @@ -1525,14 +1528,6 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) * really we want to do this just after DMA, not when the * buffer is dequeued.. */ - if (q->memory == V4L2_MEMORY_DMABUF) { - unsigned int i; - - for (i = 0; i < vb->num_planes; ++i) { - call_memop(q, unmap_dmabuf, vb->planes[i].mem_priv); - vb->planes[i].dbuf_mapped = 0; - } - } switch (vb->state) { case VB2_BUF_STATE_DONE: diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 1e0917d..e48a7fc 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -1098,12 +1098,15 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b) * really we want to do this just before the DMA, not while queueing * the buffer(s).. */ + for (plane = 0; plane < vb->num_planes; ++plane) { - ret = call_memop(q, map_dmabuf, vb->planes[plane].mem_priv); - if (ret) { - dprintk(1, "qbuf: failed mapping dmabuf " - "memory for plane %d\n", plane); - goto err; + if( vb->planes[plane].dbuf_mapped != 1) { + ret = call_memop(q, map_dmabuf, vb->planes[plane].mem_priv); + if (ret) { + dprintk(1, "qbuf: failed mapping dmabuf " + "memory for plane %d\n", plane); + goto err; + } } vb->planes[plane].dbuf_mapped = 1;