[Mesa-dev] [PATCH 12/13] gbm: Add buffer handling and visuals for fp16 formats
Kevin Strasser
kevin.strasser at intel.com
Mon Jan 28 18:42:55 UTC 2019
Set loader caps indicating that gbm can handle both rgba ordering and fp16
formats.
Signed-off-by: Kevin Strasser <kevin.strasser at intel.com>
---
src/egl/drivers/dri2/egl_dri2.c | 2 ++
src/gbm/backends/dri/gbm_dri.c | 26 +++++++++++++++++++++++++-
src/gbm/main/gbm.c | 3 +++
src/gbm/main/gbm.h | 9 +++++++++
4 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d1c9f9c..31bd88a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2303,6 +2303,8 @@ dri2_num_fourcc_format_planes(EGLint format)
case DRM_FORMAT_ABGR2101010:
case DRM_FORMAT_RGBA1010102:
case DRM_FORMAT_BGRA1010102:
+ case DRM_FORMAT_XBGR16161616F:
+ case DRM_FORMAT_ABGR16161616F:
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index f80e4c7..3688259 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -118,6 +118,19 @@ dri_get_buffers_with_format(__DRIdrawable * driDrawable,
count, out_count, surf->dri_private);
}
+static unsigned
+dri_get_capability(void *loaderPrivate, enum dri_loader_cap cap)
+{
+ /* Note: loaderPrivate is _EGLDisplay* */
+ switch (cap) {
+ case DRI_LOADER_CAP_RGBA_ORDERING:
+ case DRI_LOADER_CAP_FP16:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
static int
image_get_buffers(__DRIdrawable *driDrawable,
unsigned int format,
@@ -215,11 +228,12 @@ static const __DRIimageLookupExtension image_lookup_extension = {
};
static const __DRIdri2LoaderExtension dri2_loader_extension = {
- .base = { __DRI_DRI2_LOADER, 3 },
+ .base = { __DRI_DRI2_LOADER, 4 },
.getBuffers = dri_get_buffers,
.flushFrontBuffer = dri_flush_front_buffer,
.getBuffersWithFormat = dri_get_buffers_with_format,
+ .getCapability = dri_get_capability,
};
static const __DRIimageLoaderExtension image_loader_extension = {
@@ -544,6 +558,16 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
{ 0, 10, 20, 30 },
false,
},
+ {
+ GBM_FORMAT_XBGR16161616F, __DRI_IMAGE_FORMAT_XBGR16161616F,
+ { 0, 16, 32, -1},
+ true,
+ },
+ {
+ GBM_FORMAT_ABGR16161616F, __DRI_IMAGE_FORMAT_ABGR16161616F,
+ { 0, 16, 32, 48},
+ true,
+ },
};
static int
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 2501518..28e9237 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -271,6 +271,9 @@ gbm_bo_get_bpp(struct gbm_bo *bo)
case GBM_FORMAT_RGBA1010102:
case GBM_FORMAT_BGRA1010102:
return 32;
+ case GBM_FORMAT_XBGR16161616F:
+ case GBM_FORMAT_ABGR16161616F:
+ return 64;
}
}
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index 9b52887..4c6ab37 100644
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -150,6 +150,15 @@ enum gbm_bo_format {
#define GBM_FORMAT_RGBA1010102 __gbm_fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
#define GBM_FORMAT_BGRA1010102 __gbm_fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
+/*
+ * Floating point 64bpp RGB
+ * IEEE 754-2008 binary16 half-precision float
+ * [15:0] sign:exponent:mantissa 1:5:10
+ */
+#define GBM_FORMAT_XBGR16161616F __gbm_fourcc_code('X', 'B', '4', 'H') /* [63:0] x:B:G:R 16:16:16:16 little endian */
+
+#define GBM_FORMAT_ABGR16161616F __gbm_fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */
+
/* packed YCbCr */
#define GBM_FORMAT_YUYV __gbm_fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
#define GBM_FORMAT_YVYU __gbm_fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
--
2.7.4
More information about the mesa-dev
mailing list