#include "anv_wsi.h"
+#include "vk_format_info.h"
#include <util/hash_table.h>
#define MIN_NUM_IMAGES 2
struct wsi_wl_display {
+ struct anv_physical_device *physical_device;
struct wl_display * display;
struct wl_drm * drm;
if (*f == format)
return;
- /* Don't add formats which aren't supported by the driver */
- if (anv_format_for_vk_format(format)->isl_format ==
- ISL_FORMAT_UNSUPPORTED) {
+ /* Don't add formats that aren't renderable. */
+ VkFormatProperties props;
+ anv_GetPhysicalDeviceFormatProperties(
+ anv_physical_device_to_handle(display->physical_device), format, &props);
+ if (!(props.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT))
return;
- }
f = anv_vector_add(&display->formats);
if (f)
memset(display, 0, sizeof(*display));
display->display = wl_display;
+ display->physical_device = wsi->physical_device;
if (!anv_vector_init(&display->formats, sizeof(VkFormat), 8))
goto fail;
return result;
image->image = anv_image_from_handle(vk_image);
- assert(anv_format_is_color(image->image->format));
+ assert(vk_format_is_color(image->image->vk_format));
struct anv_surface *surface = &image->image->color_surface;
chain->display = wsi_wl_get_display(&device->instance->physicalDevice,
surface->display);
- if (!chain->display)
+ if (!chain->display) {
+ result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
goto fail;
+ }
chain->queue = wl_display_create_queue(chain->display->display);
- if (!chain->queue)
+ if (!chain->queue) {
+ result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
goto fail;
+ }
for (uint32_t i = 0; i < chain->image_count; i++) {
result = wsi_wl_image_init(chain, &chain->images[i], pAllocator);