Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] accel/qaic: Add support to export dmabuf fd
@ 2025-10-07  5:38 Youssef Samir
  2025-10-07 15:20 ` Jeff Hugo
  2025-10-13 17:28 ` Jeff Hugo
  0 siblings, 2 replies; 3+ messages in thread
From: Youssef Samir @ 2025-10-07  5:38 UTC (permalink / raw)
  To: jeff.hugo, carl.vanderlip, troy.hanson, zachary.mckevitt
  Cc: ogabbay, linux-arm-msm, dri-devel, quic_pkanojiy

From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>

Add support to export BO as DMABUF to enable userspace to reuse buffers
and reduce number of copy.

Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Signed-off-by: Youssef Samir <youssef.abdulrahman@oss.qualcomm.com>
---
 drivers/accel/qaic/qaic_data.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
index 797289e9d780..63248c7215d2 100644
--- a/drivers/accel/qaic/qaic_data.c
+++ b/drivers/accel/qaic/qaic_data.c
@@ -643,8 +643,36 @@ static void qaic_free_object(struct drm_gem_object *obj)
 	kfree(bo);
 }
 
+static struct sg_table *qaic_get_sg_table(struct drm_gem_object *obj)
+{
+	struct qaic_bo *bo = to_qaic_bo(obj);
+	struct scatterlist *sg, *sg_in;
+	struct sg_table *sgt, *sgt_in;
+	int i;
+
+	sgt_in = bo->sgt;
+
+	sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
+	if (!sgt)
+		return ERR_PTR(-ENOMEM);
+
+	if (sg_alloc_table(sgt, sgt_in->orig_nents, GFP_KERNEL)) {
+		kfree(sgt);
+		return ERR_PTR(-ENOMEM);
+	}
+
+	sg = sgt->sgl;
+	for_each_sgtable_sg(sgt_in, sg_in, i) {
+		memcpy(sg, sg_in, sizeof(*sg));
+		sg = sg_next(sg);
+	}
+
+	return sgt;
+}
+
 static const struct drm_gem_object_funcs qaic_gem_funcs = {
 	.free = qaic_free_object,
+	.get_sg_table = qaic_get_sg_table,
 	.print_info = qaic_gem_print_info,
 	.mmap = qaic_gem_object_mmap,
 	.vm_ops = &drm_vm_ops,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] accel/qaic: Add support to export dmabuf fd
  2025-10-07  5:38 [PATCH] accel/qaic: Add support to export dmabuf fd Youssef Samir
@ 2025-10-07 15:20 ` Jeff Hugo
  2025-10-13 17:28 ` Jeff Hugo
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Hugo @ 2025-10-07 15:20 UTC (permalink / raw)
  To: Youssef Samir, carl.vanderlip, troy.hanson, zachary.mckevitt
  Cc: ogabbay, linux-arm-msm, dri-devel, quic_pkanojiy

On 10/6/2025 11:38 PM, Youssef Samir wrote:
> From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> 
> Add support to export BO as DMABUF to enable userspace to reuse buffers
> and reduce number of copy.
> 
> Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> Signed-off-by: Youssef Samir <youssef.abdulrahman@oss.qualcomm.com>
>

Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] accel/qaic: Add support to export dmabuf fd
  2025-10-07  5:38 [PATCH] accel/qaic: Add support to export dmabuf fd Youssef Samir
  2025-10-07 15:20 ` Jeff Hugo
@ 2025-10-13 17:28 ` Jeff Hugo
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Hugo @ 2025-10-13 17:28 UTC (permalink / raw)
  To: Youssef Samir, carl.vanderlip, troy.hanson, zachary.mckevitt
  Cc: ogabbay, linux-arm-msm, dri-devel, quic_pkanojiy

On 10/6/2025 11:38 PM, Youssef Samir wrote:
> From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> 
> Add support to export BO as DMABUF to enable userspace to reuse buffers
> and reduce number of copy.
> 
> Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> Signed-off-by: Youssef Samir <youssef.abdulrahman@oss.qualcomm.com>

Applied to drm-misc-next.

-Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-13 17:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-07  5:38 [PATCH] accel/qaic: Add support to export dmabuf fd Youssef Samir
2025-10-07 15:20 ` Jeff Hugo
2025-10-13 17:28 ` Jeff Hugo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox