[Mesa-dev] [PATCH 13/13] wayland: Add buffer handling and visuals for fp16 formats
Kevin Strasser
kevin.strasser at intel.com
Mon Jan 28 18:42:56 UTC 2019
Set loader caps indicating that wayland can handle both rgba ordering and
fp16 formats.
NOTE: This requries libwayland to provide definitions for
WL_SHM_FORMAT_XBGR16161616F and WL_SHM_FORMAT_ABGR16161616F
Signed-off-by: Kevin Strasser <kevin.strasser at intel.com>
---
src/egl/drivers/dri2/platform_wayland.c | 30 ++++++++++++++++++++++++++++-
src/egl/wayland/wayland-drm/wayland-drm.c | 6 ++++++
src/egl/wayland/wayland-drm/wayland-drm.xml | 2 ++
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 4b5f9b7..31734a3 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -64,6 +64,20 @@ static const struct dri2_wl_visual {
bool is_float;
} dri2_wl_visuals[] = {
{
+ "XBGR16161616F",
+ WL_DRM_FORMAT_XBGR16161616F, WL_SHM_FORMAT_XBGR16161616F,
+ __DRI_IMAGE_FORMAT_XBGR16161616F, 64,
+ { 0, 16, 32, -1 },
+ true
+ },
+ {
+ "ABGR16161616F",
+ WL_DRM_FORMAT_ABGR16161616F, WL_SHM_FORMAT_ABGR16161616F,
+ __DRI_IMAGE_FORMAT_ABGR16161616F, 64,
+ { 0, 16, 32, 48 },
+ true
+ },
+ {
"XRGB2101010",
WL_DRM_FORMAT_XRGB2101010, WL_SHM_FORMAT_XRGB2101010,
__DRI_IMAGE_FORMAT_XRGB2101010, 32,
@@ -755,12 +769,26 @@ dri2_wl_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
(void) loaderPrivate;
}
+static unsigned
+dri2_wl_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 const __DRIdri2LoaderExtension dri2_loader_extension = {
- .base = { __DRI_DRI2_LOADER, 3 },
+ .base = { __DRI_DRI2_LOADER, 4 },
.getBuffers = dri2_wl_get_buffers,
.flushFrontBuffer = dri2_wl_flush_front_buffer,
.getBuffersWithFormat = dri2_wl_get_buffers_with_format,
+ .getCapability = dri2_wl_get_capability,
};
static const __DRIimageLoaderExtension image_loader_extension = {
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 3c6696d..9dd7fd3 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -117,6 +117,8 @@ drm_create_buffer(struct wl_client *client, struct wl_resource *resource,
case WL_DRM_FORMAT_XRGB8888:
case WL_DRM_FORMAT_YUYV:
case WL_DRM_FORMAT_RGB565:
+ case WL_DRM_FORMAT_ABGR16161616F:
+ case WL_DRM_FORMAT_XBGR16161616F:
break;
default:
wl_resource_post_error(resource,
@@ -220,6 +222,10 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
WL_DRM_FORMAT_XRGB8888);
wl_resource_post_event(resource, WL_DRM_FORMAT,
WL_DRM_FORMAT_RGB565);
+ wl_resource_post_event(resource, WL_DRM_FORMAT,
+ WL_DRM_FORMAT_ABGR16161616F);
+ wl_resource_post_event(resource, WL_DRM_FORMAT,
+ WL_DRM_FORMAT_XBGR16161616F);
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV410);
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV411);
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV420);
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.xml b/src/egl/wayland/wayland-drm/wayland-drm.xml
index 83aa561..b180ded 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.xml
+++ b/src/egl/wayland/wayland-drm/wayland-drm.xml
@@ -80,6 +80,8 @@
<entry name="abgr2101010" value="0x30334241"/>
<entry name="rgba1010102" value="0x30334152"/>
<entry name="bgra1010102" value="0x30334142"/>
+ <entry name="xbgr16161616f" value="0x48344258" />
+ <entry name="abgr16161616f" value="0x48344241" />
<entry name="yuyv" value="0x56595559"/>
<entry name="yvyu" value="0x55595659"/>
<entry name="uyvy" value="0x59565955"/>
--
2.7.4
More information about the mesa-dev
mailing list