From patchwork Sat Feb 10 04:45:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 10210305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 638EE60247 for ; Sat, 10 Feb 2018 04:56:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AB522993E for ; Sat, 10 Feb 2018 04:56:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F8C5299D8; Sat, 10 Feb 2018 04:56:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C58D52993E for ; Sat, 10 Feb 2018 04:56:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A7EA6E23C; Sat, 10 Feb 2018 04:55:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id DD42E6E006; Sat, 10 Feb 2018 04:55:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 94A773F211BF; Fri, 9 Feb 2018 20:45:18 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ILul7HF5ibDp; Fri, 9 Feb 2018 20:45:18 -0800 (PST) Received: from keithp.com (unknown [65.158.186.241]) by elaine.keithp.com (Postfix) with ESMTPSA id 685513F210F2; Fri, 9 Feb 2018 20:45:17 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 1EA2F15829EB; Fri, 9 Feb 2018 20:45:17 -0800 (PST) From: Keith Packard To: mesa-dev@lists.freedesktop.org Subject: [PATCH 2/7] vulkan: Add EXT_direct_mode_display Date: Fri, 9 Feb 2018 20:45:11 -0800 Message-Id: <20180210044516.16944-3-keithp@keithp.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180210044516.16944-1-keithp@keithp.com> References: <20180210044516.16944-1-keithp@keithp.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Packard , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add support for the EXT_direct_mode_display extension. This just provides the vkReleaseDisplayEXT function. Signed-off-by: Keith Packard --- src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_wsi_display.c | 11 +++++++++++ src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_wsi_display.c | 11 +++++++++++ src/vulkan/wsi/wsi_common_display.c | 17 +++++++++++++++++ src/vulkan/wsi/wsi_common_display.h | 5 +++++ 6 files changed, 46 insertions(+) diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 24cab8cbb39..f784681ff57 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -82,6 +82,7 @@ EXTENSIONS = [ Extension('VK_KHR_xcb_surface', 6, 'VK_USE_PLATFORM_XCB_KHR'), Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'), Extension('VK_KHR_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), + Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_KHX_multiview', 1, '!ANDROID'), Extension('VK_EXT_debug_report', 9, True), Extension('VK_EXT_discard_rectangles', 1, True), diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c index b0a4db0344b..0051f5ac865 100644 --- a/src/amd/vulkan/radv_wsi_display.c +++ b/src/amd/vulkan/radv_wsi_display.c @@ -141,3 +141,14 @@ radv_CreateDisplayPlaneSurfaceKHR(VkInstance _instanc return wsi_create_display_surface(_instance, alloc, create_info, surface); } + +VkResult +radv_ReleaseDisplayEXT(VkPhysicalDevice physical_device, + VkDisplayKHR display) +{ + RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device); + + return wsi_release_display(physical_device, + &pdevice->wsi_device, + display); +} diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 978a219e2b2..633e378e605 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -84,6 +84,7 @@ EXTENSIONS = [ Extension('VK_KHR_xcb_surface', 6, 'VK_USE_PLATFORM_XCB_KHR'), Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'), Extension('VK_KHR_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), + Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_KHX_multiview', 1, True), Extension('VK_EXT_debug_report', 8, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), diff --git a/src/intel/vulkan/anv_wsi_display.c b/src/intel/vulkan/anv_wsi_display.c index 9b00d7f02e4..e6f67f7dec9 100644 --- a/src/intel/vulkan/anv_wsi_display.c +++ b/src/intel/vulkan/anv_wsi_display.c @@ -127,3 +127,14 @@ anv_CreateDisplayPlaneSurfaceKHR(VkInstance _instance return wsi_create_display_surface(_instance, alloc, create_info, surface); } + +VkResult +anv_ReleaseDisplayEXT(VkPhysicalDevice physical_device, + VkDisplayKHR display) +{ + ANV_FROM_HANDLE(anv_physical_device, pdevice, physical_device); + + return wsi_release_display(physical_device, + &pdevice->wsi_device, + display); +} diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 2732b1dd721..5c123e6465e 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -1366,3 +1366,20 @@ wsi_display_finish_wsi(struct wsi_device *wsi_device, vk_free(alloc, wsi); } } + +/* + * Implement vkReleaseDisplay + */ +VkResult +wsi_release_display(VkPhysicalDevice physical_device, + struct wsi_device *wsi_device, + VkDisplayKHR display) +{ + struct wsi_display *wsi = (struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY]; + + if (wsi->master_fd >= 0 && wsi->master_fd != wsi->render_fd) { + close(wsi->master_fd); + wsi->master_fd = -1; + } + return VK_SUCCESS; +} diff --git a/src/vulkan/wsi/wsi_common_display.h b/src/vulkan/wsi/wsi_common_display.h index b414a226293..5fbb6925e4a 100644 --- a/src/vulkan/wsi/wsi_common_display.h +++ b/src/vulkan/wsi/wsi_common_display.h @@ -69,4 +69,9 @@ wsi_create_display_surface(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, VkSurfaceKHR *pSurface); +VkResult +wsi_release_display(VkPhysicalDevice physical_device, + struct wsi_device *wsi_device, + VkDisplayKHR display); + #endif