From patchwork Mon Sep 23 23:06:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Larumbe?= X-Patchwork-Id: 13810007 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66D4713A89A; Mon, 23 Sep 2024 23:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727132995; cv=pass; b=cqnrsoAS1QeI69kCqhWXqHUD9wTS8Xhe+Mvg4f2QLpK+1KykyJZ3DfhiYSogYE+A1qksjPKQBubFoODDCzxJGJmcgy1yNdyJ9+bu4S4oCiu47TJ7KqN/DTi8TX0I4vSe3uletdzndaaF/wJ/yhGiawDcxj7jCAiJlDfCJey+lrs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727132995; c=relaxed/simple; bh=tIFpVNDyc21xlXr9AysvdU3FO0rHAQ10Nyj/l2kixHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gWMLnCXfiT1vQEbfA3LNm1Hx5MXDpkW5DC5UXSbl2Uj/wGRQJ3Yq5fbyer2jJmW3dK5Eg13IQ//HrnZglvqRtq1ueTv5CRD7ayBcpYlUrezCyhMQM3QEfd7kC9NRkbNm0EvA7xzs84YMN8F6/iqEY0QNAfHE4sXHMS0b5Vi9/uI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=hUCbWs4L; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="hUCbWs4L" ARC-Seal: i=1; a=rsa-sha256; t=1727132978; cv=none; d=zohomail.com; s=zohoarc; b=OnWVvAk/AZxwk4g2fiuO4oMQXupWCihD4sBwq0WTzEJX3QSRm/e05HOyL0+YdBYDJaGSSXcLLu7AEbOX1YxLQurX8bjyTvqJcj7OZW6AX0d0vpAoX8ArS9rHnmIhNuGr+3BZY7gTs0lPDwa2c2K6DzwFrZ96r1TUechOLv8Um5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727132978; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=h+CEnwN7RG4Q8rPu3tiFv71mEVaf/Ddp1giVyFfwYDU=; b=EZiK7+2/ZmjG+0YnFdx3LeXhCkwNrjzvD6zZw0FBnlWeOE7noYqyYSmnkAZ5dr3qCAV5oe06HvOcncdB2T80Ybh8WcWUXfQJkkr5R8hRiPI6iKkhaab8ZoLXk6dc2VnBZlWTAyD3+thHoQbuDYGKI92c3QBPQMDImDvpQH48bhc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1727132978; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=h+CEnwN7RG4Q8rPu3tiFv71mEVaf/Ddp1giVyFfwYDU=; b=hUCbWs4LnwPOyvjtYp7ewurax3upxJjltc89rCxNDcZHmhbPZdkIhr2GTmqFBbjY yu6PFJlTNMsqdEJjb0hfj/XmGQ6IIoYFZh9GqpAPTlI1ee9RGj31JXC1fxW/GKCuCCh 5zg8qBIVWebEbmCYn9qWGgzvPHpvT7HYtIFSR2vU= Received: by mx.zohomail.com with SMTPS id 1727132976792434.27664731076175; Mon, 23 Sep 2024 16:09:36 -0700 (PDT) From: =?utf-8?q?Adri=C3=A1n_Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= Cc: kernel@collabora.com, =?utf-8?q?Adri=C3=A1n_Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v8 4/5] drm/panthor: enable fdinfo for memory stats Date: Tue, 24 Sep 2024 00:06:24 +0100 Message-ID: <20240923230912.2207320-5-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240923230912.2207320-1-adrian.larumbe@collabora.com> References: <20240923230912.2207320-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Implement drm object's status callback. Also, we consider a PRIME imported BO to be resident if its matching dma_buf has an open attachment, which means its backing storage had already been allocated. Signed-off-by: Adrián Larumbe Reviewed-by: Steven Price Reviewed-by: Liviu Dudau Reviewed-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_gem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c index 38f560864879..c60b599665d8 100644 --- a/drivers/gpu/drm/panthor/panthor_gem.c +++ b/drivers/gpu/drm/panthor/panthor_gem.c @@ -145,6 +145,17 @@ panthor_gem_prime_export(struct drm_gem_object *obj, int flags) return drm_gem_prime_export(obj, flags); } +static enum drm_gem_object_status panthor_gem_status(struct drm_gem_object *obj) +{ + struct panthor_gem_object *bo = to_panthor_bo(obj); + enum drm_gem_object_status res = 0; + + if (bo->base.base.import_attach || bo->base.pages) + res |= DRM_GEM_OBJECT_RESIDENT; + + return res; +} + static const struct drm_gem_object_funcs panthor_gem_funcs = { .free = panthor_gem_free_object, .print_info = drm_gem_shmem_object_print_info, @@ -154,6 +165,7 @@ static const struct drm_gem_object_funcs panthor_gem_funcs = { .vmap = drm_gem_shmem_object_vmap, .vunmap = drm_gem_shmem_object_vunmap, .mmap = panthor_gem_mmap, + .status = panthor_gem_status, .export = panthor_gem_prime_export, .vm_ops = &drm_gem_shmem_vm_ops, };