const struct wayland_drm_callbacks wl_drm_callbacks = {
.authenticate = (int(*)(void *, uint32_t)) dri2_dpy->vtbl->authenticate,
.reference_buffer = dri2_wl_reference_buffer,
- .release_buffer = dri2_wl_release_buffer
+ .release_buffer = dri2_wl_release_buffer,
+ .is_format_supported = dri2_wl_is_format_supported
};
int flags = 0;
uint64_t cap;
return -1;
}
+bool
+dri2_wl_is_format_supported(void* user_data, uint32_t format)
+{
+ _EGLDisplay *disp = (_EGLDisplay *) user_data;
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ int j = dri2_wl_visual_idx_from_fourcc(format);
+
+ if (j == -1)
+ return false;
+
+ for (int i = 0; dri2_dpy->driver_configs[i]; i++)
+ if (j == dri2_wl_visual_idx_from_config(dri2_dpy,
+ dri2_dpy->driver_configs[i]))
+ return true;
+
+ return false;
+}
+
static int
roundtrip(struct dri2_egl_display *dri2_dpy)
{
uint32_t stride, uint32_t format)
{
switch (format) {
+ case WL_DRM_FORMAT_ABGR2101010:
+ case WL_DRM_FORMAT_XBGR2101010:
case WL_DRM_FORMAT_ARGB2101010:
case WL_DRM_FORMAT_XRGB2101010:
case WL_DRM_FORMAT_ARGB8888:
wl_resource_set_implementation(resource, &drm_interface, data, NULL);
wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name);
- wl_resource_post_event(resource, WL_DRM_FORMAT,
- WL_DRM_FORMAT_ARGB2101010);
- wl_resource_post_event(resource, WL_DRM_FORMAT,
- WL_DRM_FORMAT_XRGB2101010);
+
+ if (drm->callbacks.is_format_supported(drm->user_data,
+ WL_DRM_FORMAT_ARGB2101010)) {
+ wl_resource_post_event(resource, WL_DRM_FORMAT,
+ WL_DRM_FORMAT_ARGB2101010);
+ }
+
+ if (drm->callbacks.is_format_supported(drm->user_data,
+ WL_DRM_FORMAT_XRGB2101010)) {
+ wl_resource_post_event(resource, WL_DRM_FORMAT,
+ WL_DRM_FORMAT_XRGB2101010);
+ }
+
+ if (drm->callbacks.is_format_supported(drm->user_data,
+ WL_DRM_FORMAT_ABGR2101010)) {
+ wl_resource_post_event(resource, WL_DRM_FORMAT,
+ WL_DRM_FORMAT_ABGR2101010);
+ }
+
+ if (drm->callbacks.is_format_supported(drm->user_data,
+ WL_DRM_FORMAT_XBGR2101010)) {
+ wl_resource_post_event(resource, WL_DRM_FORMAT,
+ WL_DRM_FORMAT_XBGR2101010);
+ }
+
wl_resource_post_event(resource, WL_DRM_FORMAT,
WL_DRM_FORMAT_ARGB8888);
wl_resource_post_event(resource, WL_DRM_FORMAT,