summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Strasser <[email protected]>2019-01-24 17:32:36 -0800
committerAdam Jackson <[email protected]>2019-08-21 18:36:57 +0000
commit4861d2a3956fd7394fa2da6337a0418cbb00dc82 (patch)
treee1996e4f697f7905722c276c95340dcc285c108a
parenta427c200801d8f0b3b15f3238e0767504d5bc4c0 (diff)
gbm: Add buffer handling and visuals for fp16 formats
Define and set a new loader cap DRI_LOADER_CAP_FP16, indicating that gbm can handle fp16 formats. Signed-off-by: Kevin Strasser <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
-rw-r--r--include/GL/internal/dri_interface.h1
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c2
-rw-r--r--src/gbm/backends/dri/gbm_dri.c27
-rw-r--r--src/gbm/main/gbm.c3
-rw-r--r--src/gbm/main/gbm.h9
5 files changed, 41 insertions, 1 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 60bb9f84ffc..4b5583820ed 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1100,6 +1100,7 @@ enum dri_loader_cap {
* only BGRA ordering can be exposed.
*/
DRI_LOADER_CAP_RGBA_ORDERING,
+ DRI_LOADER_CAP_FP16,
};
struct __DRIdri2LoaderExtensionRec {
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a7c0f33f948..526cb1969c1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2422,6 +2422,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 8f1668d476b..30fb0b1288e 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -110,6 +110,18 @@ 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_FP16:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
static int
image_get_buffers(__DRIdrawable *driDrawable,
unsigned int format,
@@ -207,11 +219,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 = {
@@ -536,6 +549,18 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
{ 0, 10, 20, 30 },
{ 10, 10, 10, 2 },
},
+ {
+ GBM_FORMAT_XBGR16161616F, __DRI_IMAGE_FORMAT_XBGR16161616F,
+ { 0, 16, 32, -1 },
+ { 16, 16, 16, 0 },
+ true,
+ },
+ {
+ GBM_FORMAT_ABGR16161616F, __DRI_IMAGE_FORMAT_ABGR16161616F,
+ { 0, 16, 32, 48 },
+ { 16, 16, 16, 16 },
+ true,
+ },
};
static int
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 38480ca966c..ceeed5082e9 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 9b5288710a5..4c6ab377699 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 */