1From 7c618559ef24672f101f805c470a38969fd1f30f Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Sat, 9 Oct 2021 12:32:24 +0800
4Subject: [PATCH 6/6] HACK: pixman: Support using dma fd for RGA accel
5
6Usage:
7pixman_image_set_destroy_function(image, NULL, (void *)(ptrdiff_t)dma_fd)
8
9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
10---
11 pixman/pixman.c | 12 ++++++++++--
12 1 file changed, 10 insertions(+), 2 deletions(-)
13
14diff --git a/pixman/pixman.c b/pixman/pixman.c
15index 371e421..d216a88 100644
16--- a/pixman/pixman.c
17+++ b/pixman/pixman.c
18@@ -715,11 +715,19 @@ pixman_composite_try_rga (pixman_composite_info_t * info,
19     if (!pixman_transform_to_rga_rotate (transform, &src_info.rotation))
20 	return FALSE;
21
22+#define pixman_image_get_dma_fd(image) \
23+    (image)->common.destroy_func ? -1 : \
24+	((intptr_t)(image)->common.destroy_data ?: -1)
25+
26     src_info.mmuFlag = 1;
27-    src_info.virAddr = src->bits.bits;
28+    src_info.fd = pixman_image_get_dma_fd(src);
29+    if (src_info.fd < 0)
30+	src_info.virAddr = src->bits.bits;
31
32     dst_info.mmuFlag = 1;
33-    dst_info.virAddr = dest->bits.bits;
34+    dst_info.fd = pixman_image_get_dma_fd(dest);
35+    if (dst_info.fd < 0)
36+	dst_info.virAddr = dest->bits.bits;
37
38     switch (src->bits.format) {
39     case PIXMAN_yv12:
40--
412.20.1
42
43