summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-02-15 12:31:58 -0800
committerKeith Packard <keithp@keithp.com>2018-02-15 12:31:58 -0800
commitbdef448d5295cf3b63391e8478cd7996dda5b118 (patch)
tree4cc6b40a08e093d29db1c2e0dc3161de312f2001
parentb2bb51077460ec44ea972cd0418862c748509b09 (diff)
Remove support for prototype keithp extension
This isn't in the current mesa plans, so we'll leave it out of this code base for now. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--cube.c157
1 files changed, 10 insertions, 147 deletions
diff --git a/cube.c b/cube.c
index 6d962cc..255db56 100644
--- a/cube.c
+++ b/cube.c
@@ -61,8 +61,6 @@
#include <vulkan/vulkan.h>
#endif
-#include <vulkan/vulkan_keithp.h>
-
#include <vulkan/vk_sdk_platform.h>
#include "linmath.h"
@@ -353,7 +351,7 @@ struct demo {
void *window;
#endif
VkSurfaceKHR surface;
- VkKmsDisplayInfoKEITHP display_info;
+// VkKmsDisplayInfoKEITHP display_info;
bool prepared;
bool use_staging_buffer;
bool separate_present_queue;
@@ -1186,6 +1184,7 @@ static void demo_prepare_buffers(struct demo *demo) {
err = demo->fpGetPhysicalDeviceSurfacePresentModesKHR(
demo->gpu, demo->surface, &presentModeCount, presentModes);
assert(!err);
+ printf("%d present modes [0] = %d\n", presentModeCount, presentModes[0]);
VkExtent2D swapchainExtent;
// width and height are either both 0xFFFFFFFF, or both not 0xFFFFFFFF.
@@ -2909,6 +2908,8 @@ static VkResult demo_create_display_surface(struct demo *demo) {
exit(1);
}
+ printf("%d modes\n", mode_count);
+
mode_count = 1;
err = vkGetDisplayModePropertiesKHR(demo->gpu, display, &mode_count, &mode_props);
assert(!err || (err == VK_INCOMPLETE));
@@ -2953,6 +2954,8 @@ static VkResult demo_create_display_surface(struct demo *demo) {
err = vkGetDisplayPlaneSupportedDisplaysKHR(demo->gpu, plane_index, &supported_count, supported_displays);
assert(!err);
+ printf("%d supported displays\n", supported_count);
+
for (uint32_t i = 0; i < supported_count; i++) {
if (supported_displays[i] == display) {
found_plane = VK_TRUE;
@@ -3045,140 +3048,8 @@ static VkBool32 demo_check_layers(uint32_t check_count, char **check_names,
}
#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
-static VkBool32 get_keithp_info(struct demo *demo)
-{
- VkKmsDisplayInfoKEITHP *display_info = &demo->display_info;
-
- xcb_connection_t *connection;
- int screen = 0;
- int fd;
- const xcb_setup_t *setup;
- xcb_screen_iterator_t iter;
- Display *dpy = XOpenDisplay(NULL);
- int scr = DefaultScreen(dpy);
-
- demo->connection = XGetXCBConnection(dpy);
-
- if (xcb_connection_has_error(demo->connection) > 0) {
- printf("Cannot find a compatible Vulkan installable client driver "
- "(ICD).\nExiting ...\n");
- fflush(stdout);
- exit(1);
- }
-
- setup = xcb_get_setup(demo->connection);
- iter = xcb_setup_roots_iterator(setup);
- while (scr-- > 0)
- xcb_screen_next(&iter);
-
- demo->screen = iter.data;
-
- connection = demo->connection;
-
- xcb_randr_query_version_cookie_t rqv_c = xcb_randr_query_version(connection,
- XCB_RANDR_MAJOR_VERSION,
- XCB_RANDR_MINOR_VERSION);
- xcb_randr_query_version_reply_t *rqv_r = xcb_randr_query_version_reply(connection, rqv_c, NULL);
-
- if (!rqv_r || rqv_r->minor_version < 6) {
- printf("No new-enough RandR version\n");
- return 0;
- }
-
- xcb_screen_iterator_t s_i;
-
- int i_s = 0;
-
- for (s_i = xcb_setup_roots_iterator(xcb_get_setup(connection));
- s_i.rem;
- xcb_screen_next(&s_i), i_s++) {
- printf ("index %d screen %d\n", s_i.index, screen);
- if (i_s == screen)
- break;
- }
-
- xcb_window_t root = s_i.data->root;
-
- printf("root %x\n", root);
-
- xcb_randr_get_screen_resources_cookie_t gsr_c = xcb_randr_get_screen_resources(connection, root);
-
- xcb_randr_get_screen_resources_reply_t *gsr_r = xcb_randr_get_screen_resources_reply(connection, gsr_c, NULL);
-
- if (!gsr_r) {
- printf("get_screen_resources failed\n");
- return 0;
- }
-
- xcb_randr_output_t *ro = xcb_randr_get_screen_resources_outputs(gsr_r);
- int o, c;
-
- xcb_randr_output_t output = 0;
-
- /* Find a connected but idle output */
- for (o = 0; output == 0 && o < gsr_r->num_outputs; o++) {
- xcb_randr_get_output_info_cookie_t goi_c = xcb_randr_get_output_info(connection, ro[o], gsr_r->config_timestamp);
-
- xcb_randr_get_output_info_reply_t *goi_r = xcb_randr_get_output_info_reply(connection, goi_c, NULL);
-
- /* Find the first connected but unused output */
- if (goi_r->connection == XCB_RANDR_CONNECTION_CONNECTED &&
- goi_r->crtc == 0) {
- output = ro[o];
- }
-
- free(goi_r);
- }
-
- xcb_randr_crtc_t *rc = xcb_randr_get_screen_resources_crtcs(gsr_r);
-
- xcb_randr_crtc_t crtc = 0;
-
- /* Find an idle crtc */
- for (c = 0; crtc == 0 && c < gsr_r->num_crtcs; c++) {
- xcb_randr_get_crtc_info_cookie_t gci_c = xcb_randr_get_crtc_info(connection, rc[c], gsr_r->config_timestamp);
-
- xcb_randr_get_crtc_info_reply_t *gci_r = xcb_randr_get_crtc_info_reply(connection, gci_c, NULL);
-
- /* Find the first connected but unused crtc */
- if (gci_r->mode == 0)
- crtc = rc[c];
-
- free(gci_r);
- }
-
- free(gsr_r);
-
- printf("output %x crtc %x\n", output, crtc);
-
- xcb_randr_lease_t lease = xcb_generate_id(connection);
- xcb_randr_create_lease_cookie_t rcl_c = xcb_randr_create_lease(connection,
- root,
- lease,
- 1,
- 1,
- &crtc,
- &output);
- xcb_randr_create_lease_reply_t *rcl_r = xcb_randr_create_lease_reply(connection, rcl_c, NULL);
-
- if (!rcl_r) {
- printf("create_lease failed\n");
- return 0;
- }
-
- int *rcl_f = xcb_randr_create_lease_reply_fds(connection, rcl_r);
-
- fd = rcl_f[0];
-
- printf("fd %d\n", fd);
-
- display_info->sType = VK_STRUCTURE_TYPE_KMS_DISPLAY_INFO_KEITHP;
- display_info->pNext = NULL;
- display_info->fd = fd;
-}
-
-static VkBool32 fill_in_display_info(struct demo *demo)
+static VkBool32 get_x_lease(struct demo *demo)
{
xcb_connection_t *connection;
int screen = 0;
@@ -3445,6 +3316,7 @@ static void demo_init_vk(struct demo *demo) {
printf("found xlib display extension\n");
demo->extension_names[demo->enabled_extension_count++] = VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME;
}
+#if 0
if (!strcmp(VK_KEITHP_KMS_DISPLAY_EXTENSION_NAME,
instance_extensions[i].extensionName)) {
printf("found kms display extension\n");
@@ -3452,6 +3324,7 @@ static void demo_init_vk(struct demo *demo) {
demo->extension_names[demo->enabled_extension_count++] = VK_KEITHP_KMS_DISPLAY_EXTENSION_NAME;
}
#endif
+#endif
if (!strcmp(VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
instance_extensions[i].extensionName)) {
if (demo->validate) {
@@ -3586,15 +3459,6 @@ static void demo_init_vk(struct demo *demo) {
uint32_t gpu_count;
-#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
- if (kmsExtFound && getenv ("CUBE_NATIVE")) {
- if (get_keithp_info(demo)) {
- demo->display_info.pNext = inst_info.pNext;
- inst_info.pNext = &demo->display_info;
- }
- }
-#endif
-
err = vkCreateInstance(&inst_info, NULL, &demo->inst);
if (err == VK_ERROR_INCOMPATIBLE_DRIVER) {
ERR_EXIT("Cannot find a compatible Vulkan installable client driver "
@@ -3632,8 +3496,7 @@ static void demo_init_vk(struct demo *demo) {
}
#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
- if (!getenv("CUBE_NATIVE"))
- fill_in_display_info(demo);
+ get_x_lease(demo);
#endif
if (displayExtFound) {