Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4999895img; Tue, 26 Mar 2019 23:21:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMp282ABrDh3jB0CW5I2qOg0XkeY1aGtHaGDg3q2EwXXzY1+IF9O2K1M9r9e6YOCBqZ5S5 X-Received: by 2002:a17:902:bd96:: with SMTP id q22mr26816056pls.322.1553667690518; Tue, 26 Mar 2019 23:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667690; cv=none; d=google.com; s=arc-20160816; b=eANlynZRtom/oDHU32mO74T1Yp/uub9Ci6/uec+e5arLZY8q0Tqb/HtUJLSRWlG652 LY0toeqD9gzACsEN4P9TBpwz2YabDrcgAfK+IzzuzcZ/A6cuCjVUZQsfhic4B0P+M2uF jLltPSDs78qcTor4uATT91CAujNL0SxAYVHThTxDMkMa7w2w7GR8Bx/1jwiEsdMw46qv 22dBnMPDsTUonr/GIduIVdPQCs8G53mPLbin12w7xZwxMF6GxwKwbeodSQYg3eT8tBmc me68hkD2qojmLTL08wqD5kljauyiK2JmtkvSlcJiIugFh9kPgGEYfck4N0TSmOmAqz1q 6tqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=wl+64aQLgpoth3g3roVXPCafcRf1oFFKZqzCHbKdi+4=; b=XXQdElyqtRd0p/kGESdMvjBMosWDiiMPJJRQqGt8SnMTDfJap7IJQjNr6HfFZuCMQP XndHym53vibBs8clLyEovohbQgJEM0Ot3Fwzf4qtgqQUU4BYEH3kJ35tfufyW3Z+GXuc octvbGxvnbU8Mll5wjfMHttxZmFxuY94Nlll1BuBi38OMXY9TmS5HdkFHJb1phRdmR6N E+4EHPhqVhPtjCtA8uEaYoQAfURxHkAQxeN8eZEQ5PWoyR8sMcuc6H36y0q8iXMUlrTz UXiggEnS4P2jKYFYcksvQ7cS7G07mnzDthV57Qw9gQBWN13StslLNQabawEJ21HWDWRR gV8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k72si9316357pgc.362.2019.03.26.23.21.15; Tue, 26 Mar 2019 23:21:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387620AbfC0GUM (ORCPT + 99 others); Wed, 27 Mar 2019 02:20:12 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:50944 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387609AbfC0GUL (ORCPT ); Wed, 27 Mar 2019 02:20:11 -0400 X-UUID: 661bab8bb3574c0a9a3e67477f406a6b-20190327 X-UUID: 661bab8bb3574c0a9a3e67477f406a6b-20190327 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 563528550; Wed, 27 Mar 2019 14:20:04 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:57 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 14:19:56 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 24/25] drm/mediatek: respect page offset for PRIME mmap calls Date: Wed, 27 Mar 2019 14:19:20 +0800 Message-ID: <1553667561-25447-25-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Niu Respect page offset for PRIME mmap calls Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c index c230237..524e494 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c @@ -144,7 +144,6 @@ static int mtk_drm_gem_object_mmap(struct drm_gem_object *obj, * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap(). */ vma->vm_flags &= ~VM_PFNMAP; - vma->vm_pgoff = 0; ret = dma_mmap_attrs(priv->dma_dev, vma, mtk_gem->cookie, mtk_gem->dma_addr, obj->size, mtk_gem->dma_attrs); @@ -183,6 +182,12 @@ int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) obj = vma->vm_private_data; + /* + * Set vm_pgoff (used as a fake buffer offset by DRM) to 0 and map the + * whole buffer from the start. + */ + vma->vm_pgoff = 0; + return mtk_drm_gem_object_mmap(obj, vma); } -- 1.8.1.1.dirty