pixman: Branch 'master' - 2 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 24 16:27:48 UTC 2025
pixman/pixman-access.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++
pixman/pixman.h | 4 ++
test/stress-test.c | 1
test/utils/utils.c | 3 +
4 files changed, 89 insertions(+)
New commits:
commit 1a1e5720f40f7c4704384b9a8237be3c33a361a2
Author: Manuel Stoeckl <code at mstoeckl.com>
Date: Sat Oct 2 21:13:02 2021 -0400
test/stress-test: add a16b16g16r16
Signed-off-by: Manuel Stoeckl <code at mstoeckl.com>
diff --git a/test/stress-test.c b/test/stress-test.c
index a3cddc7..1a71f13 100644
--- a/test/stress-test.c
+++ b/test/stress-test.c
@@ -13,6 +13,7 @@ static const pixman_format_code_t image_formats[] =
{
PIXMAN_rgba_float,
PIXMAN_rgb_float,
+ PIXMAN_a16b16g16r16,
PIXMAN_a8r8g8b8,
PIXMAN_x8r8g8b8,
PIXMAN_r5g6b5,
commit c0d38585f14411db88ee0b824dd6ee9a2e182c2b
Author: Manuel Stoeckl <code at mstoeckl.com>
Date: Sat Oct 2 21:06:08 2021 -0400
Add a16b16g16r16 format
This format is necessary for Pixman to be able to use, without a
conversion step, high bit depth images from other libraries. On
little endian systems, notable equivalent formats are PNG's 16 bit
RGBA output (assuming png_set_swap), DRM_FORMAT_ABGR16161616,
GL_RGBA16, and QImage::Format_RGBA64_Premultiplied.
Signed-off-by: Manuel Stoeckl <code at mstoeckl.com>
diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 7bd7a5a..822bef6 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -710,6 +710,36 @@ fetch_scanline_rgbaf_float (bits_image_t *image,
}
#endif
+static void
+fetch_scanline_a16b16g16r16_float (bits_image_t * image,
+ int x,
+ int y,
+ int width,
+ uint32_t * b,
+ const uint32_t *mask)
+{
+ const uint64_t *bits = (uint64_t *)(image->bits + y * image->rowstride);
+ const uint64_t *pixel = bits + x;
+ const uint64_t *end = pixel + width;
+ argb_t *buffer = (argb_t *)b;
+
+ while (pixel < end)
+ {
+ uint64_t p = READ (image, pixel++);
+ uint64_t a = (p >> 48) & 0xffff;
+ uint64_t b = (p >> 32) & 0xffff;
+ uint64_t g = (p >> 16) & 0xffff;
+ uint64_t r = (p >> 0) & 0xffff;
+
+ buffer->a = pixman_unorm_to_float (a, 16);
+ buffer->r = pixman_unorm_to_float (r, 16);
+ buffer->g = pixman_unorm_to_float (g, 16);
+ buffer->b = pixman_unorm_to_float (b, 16);
+
+ buffer++;
+ }
+}
+
static void
fetch_scanline_x2r10g10b10_float (bits_image_t *image,
int x,
@@ -907,6 +937,27 @@ fetch_pixel_rgbaf_float (bits_image_t *image,
}
#endif
+static argb_t
+fetch_pixel_a16b16g16r16_float (bits_image_t *image,
+ int offset,
+ int line)
+{
+ uint64_t *bits = (uint64_t *)(image->bits + line * image->rowstride);
+ uint64_t p = READ (image, bits + offset);
+ uint64_t a = (p >> 48) & 0xffff;
+ uint64_t b = (p >> 32) & 0xffff;
+ uint64_t g = (p >> 16) & 0xffff;
+ uint64_t r = (p >> 0) & 0xffff;
+ argb_t argb;
+
+ argb.a = pixman_unorm_to_float (a, 16);
+ argb.r = pixman_unorm_to_float (r, 16);
+ argb.g = pixman_unorm_to_float (g, 16);
+ argb.b = pixman_unorm_to_float (b, 16);
+
+ return argb;
+}
+
static argb_t
fetch_pixel_x2r10g10b10_float (bits_image_t *image,
int offset,
@@ -1121,6 +1172,32 @@ store_scanline_rgbf_float (bits_image_t * image,
}
#endif
+static void
+store_scanline_a16b16g16r16_float (bits_image_t * image,
+ int x,
+ int y,
+ int width,
+ const uint32_t *v)
+{
+ uint64_t *bits = (uint64_t *)(image->bits + image->rowstride * y);
+ uint64_t *pixel = bits + x;
+ argb_t *values = (argb_t *)v;
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ uint64_t a, r, g, b;
+
+ a = pixman_float_to_unorm (values[i].a, 16);
+ r = pixman_float_to_unorm (values[i].r, 16);
+ g = pixman_float_to_unorm (values[i].g, 16);
+ b = pixman_float_to_unorm (values[i].b, 16);
+
+ WRITE (image, pixel++,
+ (a << 48) | (b << 32) | (g << 16) | (r << 0));
+ }
+}
+
static void
store_scanline_a2r10g10b10_float (bits_image_t * image,
int x,
@@ -1633,6 +1710,10 @@ static const format_info_t accessors[] =
fetch_pixel_generic_lossy_32, fetch_pixel_rgbf_float,
NULL, store_scanline_rgbf_float },
#endif
+ { PIXMAN_a16b16g16r16,
+ NULL, fetch_scanline_a16b16g16r16_float,
+ fetch_pixel_generic_lossy_32, fetch_pixel_a16b16g16r16_float,
+ NULL, store_scanline_a16b16g16r16_float },
{ PIXMAN_a2r10g10b10,
NULL, fetch_scanline_a2r10g10b10_float,
diff --git a/pixman/pixman.h b/pixman/pixman.h
index d697b53..12532fa 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -880,6 +880,10 @@ typedef enum {
/* 96bpp formats */
PIXMAN_rgb_float = PIXMAN_FORMAT_BYTE(96,PIXMAN_TYPE_RGBA_FLOAT,0,32,32,32),
+/* 64bpp formats */
+ /* [63:0] A:B:G:R 16:16:16:16 native endian */
+ PIXMAN_a16b16g16r16 = PIXMAN_FORMAT_BYTE(64,PIXMAN_TYPE_ABGR,16,16,16,16),
+
/* 32bpp formats */
PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
diff --git a/test/utils/utils.c b/test/utils/utils.c
index 23bf019..15d1491 100644
--- a/test/utils/utils.c
+++ b/test/utils/utils.c
@@ -1228,6 +1228,9 @@ static const format_entry_t format_list[] =
/* 96bpp formats */
ENTRY (rgb_float),
+/* 64bpp formats */
+ ENTRY (a16b16g16r16),
+
/* 32bpp formats */
ENTRY (a8r8g8b8),
ALIAS (a8r8g8b8, "8888"),
More information about the xorg-commit
mailing list