From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Harry Wentland <harry.wentland@amd.com>
Subject: [RFC v4 07/22] lib/igt_fb: Add copy_fb function
Date: Wed, 14 Feb 2024 12:09:38 +0530 [thread overview]
Message-ID: <20240214063953.1285495-8-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20240214063953.1285495-1-bhanuprakash.modem@intel.com>
From: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
lib/igt_fb.c | 34 ++++++++++++++++++++++++++++++++++
lib/igt_fb.h | 1 +
2 files changed, 35 insertions(+)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ee9cd1f35..13e9c29b1 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2154,6 +2154,40 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
fb, 0, 0);
}
+unsigned int igt_copy_fb(int fd, struct igt_fb *src, struct igt_fb *fb)
+{
+ char *in_ptr, *out_ptr;
+ int cpp = igt_drm_format_to_bpp(src->drm_format) / 8;
+
+ int fb_id = 0;
+ igt_assert(src);
+
+ /* TODO allow multiple planes */
+ if (src->num_planes != 1)
+ return -EINVAL;
+
+ /* TODO expand for other formats */
+ if (src->drm_format != DRM_FORMAT_XRGB8888)
+ return -EINVAL;
+
+ fb_id = igt_create_fb(fd, src->width, src->height, src->drm_format,
+ src->modifier, fb);
+
+ /* copy buffer contents */
+ /* TODO simplify :D */
+ in_ptr = igt_fb_map_buffer(fb->fd, src);
+ igt_assert(in_ptr);
+ out_ptr = igt_fb_map_buffer(fb->fd, fb);
+ igt_assert(out_ptr);
+
+ igt_memcpy_from_wc(out_ptr, in_ptr, fb->width * fb->height * cpp);
+
+ igt_fb_unmap_buffer(fb, out_ptr);
+ igt_fb_unmap_buffer(src, in_ptr);
+
+ return fb_id;
+}
+
/**
* igt_create_color_fb:
* @fd: open drm file descriptor
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index d2751c0bb..258a7669e 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -142,6 +142,7 @@ struct intel_buf *igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
const struct igt_fb *fb, const char *name);
unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
uint64_t modifier, struct igt_fb *fb);
+unsigned int igt_copy_fb(int fd, struct igt_fb *src, struct igt_fb *fb);
unsigned int igt_create_color_fb(int fd, int width, int height,
uint32_t format, uint64_t modifier,
double r, double g, double b,
--
2.43.0
next prev parent reply other threads:[~2024-02-14 6:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 6:39 [RFC v4 00/22] IGT tests for the KMS Color Pipeline API Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 01/22] lib/drmtest: Add is_vkms_device() Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 02/22] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 03/22] include/drm-uapi: Add COLOROP object Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 04/22] lib/igt_kms: Introduce drm_colorop and COLOR_PIPELINE Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 05/22] tests/kms_properties: Add colorop properties test Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 06/22] igt/color: Add SW color transform functionality Bhanuprakash Modem
2024-02-14 6:39 ` Bhanuprakash Modem [this message]
2024-02-14 6:39 ` [RFC v4 08/22] tests/kms_colorop: Add kms_colorop tests Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 09/22] drm-uapi: Add 3x4 CTM Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 10/22] lib/igt_kms: Add support for DATA colorop property Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 11/22] lib/igt_color: Add support for 3x4 matrices Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 12/22] tests/kms_colorop: Add 3x4 CTM tests Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 13/22] tests/kms_properties: Fix compilation errors Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 14/22] lib/igt_kms: Destroy colorops on exit Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 15/22] lib/colorops: Move few helpers to common place to reuse Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 16/22] drm-uapi: Add 3x3 CTM Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 17/22] drm-uapi: Add custom 1D LUT Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 18/22] lib/igt_color: Add support for 3x3 matrices Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 19/22] lib/colorops: Add support for Custom 1D LUT Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 20/22] lib/igt_kms: Increase the colorops count Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 21/22] tests/kms_color_helper: Add helpers to clear colorops data Bhanuprakash Modem
2024-02-14 6:39 ` [RFC v4 22/22] tests/kms_color: Add plane color pipeline tests for Intel hardware Bhanuprakash Modem
2024-02-14 7:21 ` ✓ CI.xeBAT: success for IGT tests for the KMS Color Pipeline API (rev4) Patchwork
2024-02-14 7:28 ` ✓ Fi.CI.BAT: " Patchwork
2024-02-14 9:38 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-20 20:28 ` [RFC v4 00/22] IGT tests for the KMS Color Pipeline API Harry Wentland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240214063953.1285495-8-bhanuprakash.modem@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=harry.wentland@amd.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox