Re: [Mesa-dev] [PATCH] gallium/winsys/kms: Add support for multi-planes (v2)
Thanks for reviewing, just back from vacation and send out V3 for review. I split it to 2 patches now and I removed lazy unmap since it's unnecessary. On Wed, Feb 21, 2018 at 7:42 AM, Emil Velikovwrote: > HI Lepton, > > It seems that this has fallen through the cracks. > > There's one important functionality change which should be split out > and documented. > The rest is just style nitpicks. > > On 28 December 2017 at 07:35, Lepton Wu wrote: >> v2: address comments from Tomasz Figa >>a) Add more check for plane size. >>b) Avoid duplicated mapping and leaked mapping. >>c) Other minor changes. > Normally I omit saying "other minor changes" since it don't mean anything. > > >> @@ -105,6 +114,42 @@ kms_sw_is_displaytarget_format_supported( struct >> sw_winsys *ws, >> return TRUE; >> } >> >> +static struct kms_sw_plane *get_plane(struct kms_sw_displaytarget >> *kms_sw_dt, >> + enum pipe_format format, >> + unsigned width, unsigned height, >> + unsigned stride, unsigned offset) { > Opening bracket should be at the start of next line. > >> + struct kms_sw_plane * tmp, * plane = NULL; > Through the patch: no space between * and variable name - example: s/* > tmp/*tmp/ > > Add empty line between declarations and code. > >> + if (offset + util_format_get_2d_size(format, stride, height) > >> + kms_sw_dt->size) { >> + DEBUG_PRINT("KMS-DEBUG: plane too big. format: %d stride: %d height: >> %d " >> + "offset: %d size:%d\n", format, stride, height, offset, >> + kms_sw_dt->size); >> + return NULL; >> + } >> + LIST_FOR_EACH_ENTRY(tmp, _sw_dt->planes, link) { >> + if (tmp->offset == offset) { >> + plane = tmp; >> + break; >> + } >> + } >> + if (plane) { >> + assert(plane->width == width); >> + assert(plane->height == height); >> + assert(plane->stride == stride); >> + assert(plane->dt == kms_sw_dt); > The only way to hit this if there's serious corruption happening. I'd > just drop it and "return tmp;" in the loop above. > >> + } else { >> + plane = CALLOC_STRUCT(kms_sw_plane); >> + if (plane == NULL) return NULL; > The return statement should be on separate line. > > Thorough the patch: swap "foo == NULL" with "!foo" > >> @@ -138,17 +182,19 @@ kms_sw_displaytarget_create(struct sw_winsys *ws, > >> - *stride = kms_sw_dt->stride; >> - return (struct sw_displaytarget *)kms_sw_dt; >> - >> + *stride = create_req.pitch; >> + return (struct sw_displaytarget *) plane; > Swap the cast with an inline wrapper analogous to the kms_sw_plane() one. > > >> @@ -163,13 +209,19 @@ kms_sw_displaytarget_destroy(struct sw_winsys *ws, >> struct sw_displaytarget *dt) >> { >> struct kms_sw_winsys *kms_sw = kms_sw_winsys(ws); >> - struct kms_sw_displaytarget *kms_sw_dt = kms_sw_displaytarget(dt); >> + struct kms_sw_plane *plane = kms_sw_plane(dt); >> + struct kms_sw_displaytarget *kms_sw_dt = plane->dt; >> struct drm_mode_destroy_dumb destroy_req; >> >> kms_sw_dt->ref_count --; >> if (kms_sw_dt->ref_count > 0) >>return; >> >> + if (kms_sw_dt->ro_mapped) >> + munmap(kms_sw_dt->ro_mapped, kms_sw_dt->size); >> + if (kms_sw_dt->mapped) >> + munmap(kms_sw_dt->mapped, kms_sw_dt->size); >> + > This hunk moves the munmap from dt_unmap to dt_destroy. > It should be safe, although it is a subtle functionality change that > should be split out. > A commit message should explain why it's needed, etc. > > Ideally, the ro_mapped introduction will be another patch. > Alternatively the commit message should mention it. > > >> @@ -198,16 +255,20 @@ kms_sw_displaytarget_map(struct sw_winsys *ws, >>return NULL; >> >> prot = (flags == PIPE_TRANSFER_READ) ? PROT_READ : (PROT_READ | >> PROT_WRITE); >> - kms_sw_dt->mapped = mmap(0, kms_sw_dt->size, prot, MAP_SHARED, >> -kms_sw->fd, map_req.offset); >> - >> - if (kms_sw_dt->mapped == MAP_FAILED) >> - return NULL; >> + void **ptr = (flags == PIPE_TRANSFER_READ) ? _sw_dt->ro_mapped : >> _sw_dt->mapped; >> + if (*ptr == NULL) { > To prevent interment breakage, this NULL check must be part of the > delayer munmap patch. > > HTH > Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 1/2] gallium/winsys/kms: Fix possible leak in map/unmap.
If user calls map twice for kms_sw_displaytarget, the first mapped buffer could get leaked. Instead of calling mmap every time, just reuse previous mapping. Since user could map same displaytarget with different flags, we have to keep two different pointers, one for rw mapping and one for ro mapping. Change-Id: I65308f0ff2640bd57b2577c6a3469540c9722859 Signed-off-by: Lepton Wu--- .../winsys/sw/kms-dri/kms_dri_sw_winsys.c | 26 ++- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c index 22e1c936ac5..30343222470 100644 --- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c +++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c @@ -70,6 +70,7 @@ struct kms_sw_displaytarget uint32_t handle; void *mapped; + void *ro_mapped; int ref_count; struct list_head link; @@ -170,6 +171,11 @@ kms_sw_displaytarget_destroy(struct sw_winsys *ws, if (kms_sw_dt->ref_count > 0) return; + if (kms_sw_dt->ro_mapped) + munmap(kms_sw_dt->ro_mapped, kms_sw_dt->size); + if (kms_sw_dt->mapped) + munmap(kms_sw_dt->mapped, kms_sw_dt->size); + memset(_req, 0, sizeof destroy_req); destroy_req.handle = kms_sw_dt->handle; drmIoctl(kms_sw->fd, DRM_IOCTL_MODE_DESTROY_DUMB, _req); @@ -198,16 +204,19 @@ kms_sw_displaytarget_map(struct sw_winsys *ws, return NULL; prot = (flags == PIPE_TRANSFER_READ) ? PROT_READ : (PROT_READ | PROT_WRITE); - kms_sw_dt->mapped = mmap(0, kms_sw_dt->size, prot, MAP_SHARED, -kms_sw->fd, map_req.offset); - - if (kms_sw_dt->mapped == MAP_FAILED) - return NULL; + void **ptr = (flags == PIPE_TRANSFER_READ) ? _sw_dt->ro_mapped : _sw_dt->mapped; + if (!*ptr) { + void *tmp = mmap(0, kms_sw_dt->size, prot, MAP_SHARED, + kms_sw->fd, map_req.offset); + if (tmp == MAP_FAILED) + return NULL; + *ptr = tmp; + } DEBUG_PRINT("KMS-DEBUG: mapped buffer %u (size %u) at %p\n", - kms_sw_dt->handle, kms_sw_dt->size, kms_sw_dt->mapped); + kms_sw_dt->handle, kms_sw_dt->size, *ptr); - return kms_sw_dt->mapped; + return *ptr; } static struct kms_sw_displaytarget * @@ -278,9 +287,12 @@ kms_sw_displaytarget_unmap(struct sw_winsys *ws, struct kms_sw_displaytarget *kms_sw_dt = kms_sw_displaytarget(dt); DEBUG_PRINT("KMS-DEBUG: unmapped buffer %u (was %p)\n", kms_sw_dt->handle, kms_sw_dt->mapped); + DEBUG_PRINT("KMS-DEBUG: unmapped buffer %u (was %p)\n", kms_sw_dt->handle, kms_sw_dt->ro_mapped); munmap(kms_sw_dt->mapped, kms_sw_dt->size); kms_sw_dt->mapped = NULL; + munmap(kms_sw_dt->ro_mapped, kms_sw_dt->size); + kms_sw_dt->ro_mapped = NULL; } static struct sw_displaytarget * -- 2.16.2.395.g2e18187dfd-goog ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/56] anv: Add support for Vulkan 1.1
Excellent work and congratulations to everyone! This IS an awesome community and I’m very proud of you. Annie Matheson From: Jason Ekstrand [mailto:ja...@jlekstrand.net] Sent: Wednesday, March 7, 2018 3:09 PM To: ML mesa-devCc: Ekstrand, Jason ; Chema Casanova ; Iago Toral ; Samuel Iglesias Gonsálvez ; Alejandro Piñeiro ; Juan A. Suarez Romero ; Lionel Landwerlin ; Eduardo Lima Mitev ; Kenneth Graunke ; Connor Abbott ; Dave Airlie ; Chris Wilson ; Christian König ; Francisco Jerez ; Jordan Justen ; Matt Turner ; Dylan Baker ; Mark Janes ; Chery, Nanley G ; Matheson, Annie J Subject: Re: [PATCH 00/56] anv: Add support for Vulkan 1.1 Hi all, I just wanted to give a shout out and a huge "Thank You!" to all of the people who made this release possible. There were a large number of features packed into the 1.1 release and implementing it all was a hugely collaborative effort. I want to specially thank our friends at Igalia. They implemented the VK_KHR_16bit_storage extension which was initially 45 patches which ended up going through multiple review cycles and getting expanded a bit. Less visibly, however, they've also been hard at work on the CTS. They've implemented quite a few tests for things such as VK_KHR_16bit_storage, VK_KHR_image_format_list, and others I've forgotten about. They also kept on top of the CTS as new tests were being developed and did most of the triage and bug fixing work in anv. I seriously don't know what we would have done without them. I think it's fair to say that, while we may have managed a skeleton 1.1 implementation, we wouldn't have been able to ship a full-featured 1.1 without them! Also, I probably would have gone insane. I also want to thank Lionel Landwerlin on my team. He implemented a bunch of the smaller features as well as VK_KHR_sampler_ycbcr_conversion. He also did a large amount of code review. Finally, I want to thank everyone else who was involved in helping with the 1.1 effort in any way. We in Linux graphics have an awesome community and I don't know what we'd do without you all. I tried to include everyone I can think of who helped with the 1.1 effort in the Cc. I'm sorry if I missed anyone. Thanks for all your help and hard work, --Jason Ekstrand On Wed, Mar 7, 2018 at 6:34 AM, Jason Ekstrand > wrote: This patch series adds full support for Vulkan 1.1 to the Intel Linux Vulkan driver. As with the initial Vulkan 1.0 drop two years ago, this driver is 100% Vulkan 1.1 conformant on all shipping Intel hardware gen8 and above. Unlike our initial Vulkan 1.0 drop two years ago which was missing piles of features, the Vulkan 1.1 implementation is nearly feature- complete. With the exception of 16-bit shader I/O (we have patches but they are awaiting better testing), every optional feature which was added to core in Vulkan 1.1 and which can reasonably be reasonably supported by shipping hardware has been implemented. The only significant feature implemented by this series is subgroups. It is part of Vulkan 1.1 core but there is no corresponding Vulkan extension. All of the other significant features in Vulkan 1.1 have already been ratified and released as extension and we have already landed support for them. In order to actually advertise support for Vulkan 1.1, we must be able to advertise VK_KHR_external_fence which requires the SYNCOBJ_WAIT ioctl which landed in Linux 4.14. Users may need to update their kernel before they will get full 1.1 support. There are also quite a few patches in here to the entrypoints generator and some of the other generators to handle various things required for reporting a Vulkan version higher than 1.0. In particular, we need to handle name aliasing for entrypoints and enums. All of the patches in this series have already been reviewed by people at Intel or Igalia. Unless there are any complaints, I plan to land the patches this afternoon. Dave and Bas also have some 1.1 patches and we're going to have to work together to land them so that neither driver breaks when we land the 1.1 XML. Iago Toral Quiroga (2): anv/device: GetDeviceQueue2 should only return queues with matching flags anv/device: fail to initialize device if we have queues with unsupported flags Jason Ekstrand (54): spirv: Add a vtn_constant_value helper spirv: Rework barriers vulkan: Rename multiview from KHX to KHR anv/entrypoints: Generalize the string map a
[Mesa-dev] [PATCH v3 2/2] gallium/winsys/kms: Add support for multi-planes
Add a new struct kms_sw_plane which delegate a plane and use it in place of sw_displaytarget. Multiple planes share same underlying kms_sw_displaytarget. Change-Id: I0e9ca1d0ba0aa78c27dfdb50c30dc0c424fec172 Signed-off-by: Lepton Wu--- .../winsys/sw/kms-dri/kms_dri_sw_winsys.c | 162 +- 1 file changed, 122 insertions(+), 40 deletions(-) diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c index 30343222470..d191d5c4987 100644 --- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c +++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c @@ -59,13 +59,22 @@ #define DEBUG_PRINT(msg, ...) #endif +struct kms_sw_displaytarget; -struct kms_sw_displaytarget +struct kms_sw_plane { - enum pipe_format format; unsigned width; unsigned height; unsigned stride; + unsigned offset; + int mapped; + struct kms_sw_displaytarget *dt; + struct list_head link; +}; + +struct kms_sw_displaytarget +{ + enum pipe_format format; unsigned size; uint32_t handle; @@ -74,6 +83,7 @@ struct kms_sw_displaytarget int ref_count; struct list_head link; + struct list_head planes; }; struct kms_sw_winsys @@ -84,10 +94,16 @@ struct kms_sw_winsys struct list_head bo_list; }; -static inline struct kms_sw_displaytarget * -kms_sw_displaytarget( struct sw_displaytarget *dt ) +static inline struct kms_sw_plane * +kms_sw_plane( struct sw_displaytarget *dt ) { - return (struct kms_sw_displaytarget *)dt; + return (struct kms_sw_plane *)dt; +} + +static inline struct sw_displaytarget * +sw_displaytarget( struct kms_sw_plane *pl) +{ + return (struct sw_displaytarget *)pl; } static inline struct kms_sw_winsys * @@ -106,6 +122,39 @@ kms_sw_is_displaytarget_format_supported( struct sw_winsys *ws, return TRUE; } +static struct kms_sw_plane *get_plane(struct kms_sw_displaytarget *kms_sw_dt, + enum pipe_format format, + unsigned width, unsigned height, + unsigned stride, unsigned offset) +{ + struct kms_sw_plane *plane = NULL; + + if (offset + util_format_get_2d_size(format, stride, height) > + kms_sw_dt->size) { + DEBUG_PRINT("KMS-DEBUG: plane too big. format: %d stride: %d height: %d " + "offset: %d size:%d\n", format, stride, height, offset, + kms_sw_dt->size); + return NULL; + } + + LIST_FOR_EACH_ENTRY(plane, _sw_dt->planes, link) { + if (plane->offset == offset) + return plane; + } + + plane = CALLOC_STRUCT(kms_sw_plane); + if (!plane) + return NULL; + + plane->width = width; + plane->height = height; + plane->stride = stride; + plane->offset = offset; + plane->dt = kms_sw_dt; + list_add(>link, _sw_dt->planes); + return plane; +} + static struct sw_displaytarget * kms_sw_displaytarget_create(struct sw_winsys *ws, unsigned tex_usage, @@ -125,11 +174,10 @@ kms_sw_displaytarget_create(struct sw_winsys *ws, if (!kms_sw_dt) goto no_dt; + list_inithead(_sw_dt->planes); kms_sw_dt->ref_count = 1; kms_sw_dt->format = format; - kms_sw_dt->width = width; - kms_sw_dt->height = height; memset(_req, 0, sizeof(create_req)); create_req.bpp = 32; @@ -139,16 +187,19 @@ kms_sw_displaytarget_create(struct sw_winsys *ws, if (ret) goto free_bo; - kms_sw_dt->stride = create_req.pitch; kms_sw_dt->size = create_req.size; kms_sw_dt->handle = create_req.handle; + struct kms_sw_plane *plane = get_plane(kms_sw_dt, format, width, height, + create_req.pitch, 0); + if (!plane) + goto free_bo; list_add(_sw_dt->link, _sw->bo_list); DEBUG_PRINT("KMS-DEBUG: created buffer %u (size %u)\n", kms_sw_dt->handle, kms_sw_dt->size); - *stride = kms_sw_dt->stride; - return (struct sw_displaytarget *)kms_sw_dt; + *stride = create_req.pitch; + return sw_displaytarget(plane); free_bo: memset(_req, 0, sizeof destroy_req); @@ -164,7 +215,8 @@ kms_sw_displaytarget_destroy(struct sw_winsys *ws, struct sw_displaytarget *dt) { struct kms_sw_winsys *kms_sw = kms_sw_winsys(ws); - struct kms_sw_displaytarget *kms_sw_dt = kms_sw_displaytarget(dt); + struct kms_sw_plane *plane = kms_sw_plane(dt); + struct kms_sw_displaytarget *kms_sw_dt = plane->dt; struct drm_mode_destroy_dumb destroy_req; kms_sw_dt->ref_count --; @@ -184,6 +236,11 @@ kms_sw_displaytarget_destroy(struct sw_winsys *ws, DEBUG_PRINT("KMS-DEBUG: destroyed buffer %u\n", kms_sw_dt->handle); + struct kms_sw_plane *tmp; + LIST_FOR_EACH_ENTRY_SAFE(plane, tmp, _sw_dt->planes, link) { + FREE(plane); + } + FREE(kms_sw_dt); } @@ -193,7 +250,8 @@ kms_sw_displaytarget_map(struct sw_winsys *ws,
Re: [Mesa-dev] [PATCH] dri2: Sync i965_pci_ids.h from Mesa.
On Wed, 2018-03-07 at 07:46 -0800, Rodrigo Vivi wrote: > Copied from Mesa with no modifications. > > Gives us Geminilake and Kaby Lake platform names updates and > sync on Coffee Lake PCI IDs. > > Cc: Timo Aaltonen> Signed-off-by: Rodrigo Vivi Merged, thanks: remote: I: patch #208689 updated using rev 90e0cdd42dfda2accfadffa5c550712696902e14. remote: I: 1 patch(es) updated to state Accepted. To ssh://git.freedesktop.org/git/xorg/xserver 43576b901..90e0cdd42 master -> master - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 21/21] radv: Add VK_GOOGLE_display_timing extension to radv driver
This adds support for the VK_GOOGLE_display timing extension. Signed-off-by: Keith Packard--- src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_wsi.c | 33 - 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index e7bbf12fb69..f2bd8500307 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -100,6 +100,7 @@ EXTENSIONS = [ Extension('VK_AMD_rasterization_order', 1, 'device->rad_info.chip_class >= VI && device->rad_info.max_se >= 2'), Extension('VK_AMD_shader_info', 1, True), Extension('VK_MESA_query_timestamp', 1, True), +Extension('VK_GOOGLE_display_timing', 1, True), ] class VkVersion: diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index 20484177135..b5e75e98176 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -248,7 +248,6 @@ VkResult radv_QueuePresentKHR( pPresentInfo); } - VkResult radv_GetDeviceGroupPresentCapabilitiesKHR( VkDevicedevice, VkDeviceGroupPresentCapabilitiesKHR*pCapabilities) @@ -270,3 +269,35 @@ VkResult radv_GetDeviceGroupSurfacePresentModesKHR( return VK_SUCCESS; } + +/* VK_GOOGLE_display_timing */ +VkResult +radv_GetRefreshCycleDurationGOOGLE( + VkDevice _device, + VkSwapchainKHRswapchain, + VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties) +{ + RADV_FROM_HANDLE(radv_device, device, _device); + struct radv_physical_device *pdevice = device->physical_device; + + return wsi_common_get_refresh_cycle_duration(>wsi_device, +_device, +swapchain, +pDisplayTimingProperties); +} + +VkResult +radv_GetPastPresentationTimingGOOGLE(VkDevice _device, +VkSwapchainKHR swapchain, +uint32_t *pPresentationTimingCount, +VkPastPresentationTimingGOOGLE *pPresentationTimings) +{ + RADV_FROM_HANDLE(radv_device, device, _device); + struct radv_physical_device *pdevice = device->physical_device; + + return wsi_common_get_past_presentation_timing(>wsi_device, + _device, + swapchain, + pPresentationTimingCount, + pPresentationTimings); +} -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 08/21] anv: Add EXT_acquire_xlib_display to anv driver [v2]
This extension adds the ability to borrow an X RandR output for temporary use directly by a Vulkan application to the anv driver. v2: Simplify addition of VK_USE_PLATFORM_XLIB_XRANDR_KHR to vulkan_wsi_args Suggested-by: Eric EngestromSigned-off-by: Keith Packard --- src/intel/Makefile.vulkan.am| 7 +++ src/intel/vulkan/anv_entrypoints_gen.py | 5 - src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_extensions_gen.py | 10 +- src/intel/vulkan/anv_wsi_display.c | 30 ++ src/intel/vulkan/meson.build| 5 + 6 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am index 9b6b68abef9..d4e36e8e36b 100644 --- a/src/intel/Makefile.vulkan.am +++ b/src/intel/Makefile.vulkan.am @@ -200,6 +200,13 @@ VULKAN_CPPFLAGS += \ VULKAN_SOURCES += $(VULKAN_WSI_DISPLAY_FILES) endif +if HAVE_XLIB_LEASE +VULKAN_CPPFLAGS += \ + -DVK_USE_PLATFORM_XLIB_XRANDR_EXT \ + $(XCB_RANDR_CFLAGS) +VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS) +endif + noinst_LTLIBRARIES += vulkan/libvulkan_common.la vulkan_libvulkan_common_la_SOURCES = $(VULKAN_SOURCES) vulkan_libvulkan_common_la_CFLAGS = $(VULKAN_CFLAGS) diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 485c6cfe8d7..3c2ebd74379 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -507,7 +507,10 @@ def get_entrypoints_defines(doc): for extension in doc.findall('./extensions/extension[@platform]'): platform = extension.attrib['platform'] -define = 'VK_USE_PLATFORM_' + platform.upper() + '_KHR' +ext = '_KHR' +if platform.upper() == 'XLIB_XRANDR': +ext = '_EXT' +define = 'VK_USE_PLATFORM_' + platform.upper() + ext for entrypoint in extension.findall('./require/command'): fullname = entrypoint.attrib['name'] diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 0c29e00c2fe..79fbec7b859 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -109,6 +109,7 @@ EXTENSIONS = [ Extension('VK_KHR_multiview', 1, True), Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), +Extension('VK_EXT_acquire_xlib_display', 1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'), Extension('VK_EXT_debug_report', 8, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), Extension('VK_EXT_global_priority', 1, diff --git a/src/intel/vulkan/anv_extensions_gen.py b/src/intel/vulkan/anv_extensions_gen.py index 180e6842357..33d95e53119 100644 --- a/src/intel/vulkan/anv_extensions_gen.py +++ b/src/intel/vulkan/anv_extensions_gen.py @@ -113,12 +113,12 @@ _TEMPLATE_C = Template(COPYRIGHT + """ #include "vk_util.h" /* Convert the VK_USE_PLATFORM_* defines to booleans */ -%for platform in ['ANDROID', 'WAYLAND', 'XCB', 'XLIB', 'DISPLAY']: -#ifdef VK_USE_PLATFORM_${platform}_KHR -# undef VK_USE_PLATFORM_${platform}_KHR -# define VK_USE_PLATFORM_${platform}_KHR true +%for platform in ['ANDROID_KHR', 'WAYLAND_KHR', 'XCB_KHR', 'XLIB_KHR', 'DISPLAY_KHR', 'XLIB_XRANDR_EXT']: +#ifdef VK_USE_PLATFORM_${platform} +# undef VK_USE_PLATFORM_${platform} +# define VK_USE_PLATFORM_${platform} true #else -# define VK_USE_PLATFORM_${platform}_KHR false +# define VK_USE_PLATFORM_${platform} false #endif %endfor diff --git a/src/intel/vulkan/anv_wsi_display.c b/src/intel/vulkan/anv_wsi_display.c index e6f67f7dec9..e87aed49f7d 100644 --- a/src/intel/vulkan/anv_wsi_display.c +++ b/src/intel/vulkan/anv_wsi_display.c @@ -138,3 +138,33 @@ anv_ReleaseDisplayEXT(VkPhysicalDevice physical_device, >wsi_device, display); } + +#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +VkResult +anv_AcquireXlibDisplayEXT(VkPhysicalDevice physical_device, + Display *dpy, + VkDisplayKHR display) +{ + ANV_FROM_HANDLE(anv_physical_device, pdevice, physical_device); + + return wsi_acquire_xlib_display(physical_device, + >wsi_device, + dpy, + display); +} + +VkResult +anv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device, + Display *dpy, + RROutput output, + VkDisplayKHR *display) +{ + ANV_FROM_HANDLE(anv_physical_device, pdevice, physical_device); + + return
[Mesa-dev] [PATCH mesa 12/21] radv: Add VK_EXT_display_surface_counter to radv driver
This extension is required to support EXT_display_control as it offers a way to query whether the vblank counter is supported. Signed-off-by: Keith Packard--- src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_wsi.c | 12 2 files changed, 13 insertions(+) diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index b4ad760c55d..0fa0a22155f 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -88,6 +88,7 @@ EXTENSIONS = [ Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_acquire_xlib_display', 1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'), +Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_debug_report', 9, True), Extension('VK_EXT_discard_rectangles',1, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index 2840b666727..20484177135 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -103,6 +103,18 @@ VkResult radv_GetPhysicalDeviceSurfaceCapabilities2KHR( pSurfaceCapabilities); } +VkResult radv_GetPhysicalDeviceSurfaceCapabilities2EXT( + VkPhysicalDevicephysicalDevice, + VkSurfaceKHRsurface, + VkSurfaceCapabilities2EXT* pSurfaceCapabilities) +{ + RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice); + + return wsi_common_get_surface_capabilities2ext(>wsi_device, + surface, + pSurfaceCapabilities); +} + VkResult radv_GetPhysicalDeviceSurfaceFormatsKHR( VkPhysicalDevicephysicalDevice, VkSurfaceKHRsurface, -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 13/21] vulkan: add VK_EXT_display_control [v4]
This extension provides fences and frame count information to direct display contexts. It uses new kernel ioctls to provide 64-bits of vblank sequence and nanosecond resolution. v2: Remove DRM_CRTC_SEQUENCE_FIRST_PIXEL_OUT flag. This has been removed from the proposed kernel API. Add NULL parameter to drmCrtcQueueSequence ioctl as we don't care what sequence the event was actually queued to. v3: Adapt to pthread clock switch to MONOTONIC v4: Fix scope for wsi_display_mode andwsi_display_connector allocs Suggested-by: Jason EkstrandSigned-off-by: Keith Packard --- src/vulkan/wsi/wsi_common.h | 9 ++ src/vulkan/wsi/wsi_common_display.c | 288 +++- src/vulkan/wsi/wsi_common_display.h | 29 3 files changed, 325 insertions(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index 486c1fc46d1..341d2262ef7 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -66,6 +66,15 @@ struct wsi_format_modifier_properties_list { struct wsi_format_modifier_properties *modifier_properties; }; +struct wsi_fence { + VkDevice device; + const struct wsi_device *wsi_device; + VkDisplayKHR display; + const VkAllocationCallbacks *alloc; + bool (*wait)(struct wsi_fence *fence, bool absolute, uint64_t timeout); + void (*destroy)(struct wsi_fence *fence); +}; + struct wsi_interface; #define VK_ICD_WSI_PLATFORM_MAX 6 diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 0a12c9ee04c..55f86a6c774 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -79,6 +79,7 @@ typedef struct wsi_display_connector { struct list_head display_modes; wsi_display_mode *current_mode; drmModeModeInfo current_drm_mode; + uint32_t dpms_property; #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT xcb_randr_output_t output; #endif @@ -124,6 +125,15 @@ struct wsi_display_swapchain { struct wsi_display_image images[0]; }; +struct wsi_display_fence { + struct wsi_fence base; + bool event_received; + bool destroyed; + uint64_t sequence; +}; + +static uint64_t fence_sequence; + ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_mode, VkDisplayModeKHR) ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_connector, VkDisplayKHR) @@ -267,6 +277,7 @@ wsi_display_get_connector(struct wsi_device *wsi_device, drmModeConnectorPtr drm_connector; VkResult result; int m; + int p; if (wsi->fd < 0) return NULL; @@ -288,6 +299,18 @@ wsi_display_get_connector(struct wsi_device *wsi_device, connector->connected = drm_connector->connection != DRM_MODE_DISCONNECTED; + /* Look for a DPMS property */ + for (p = 0; p < drm_connector->count_props; p++) { + drmModePropertyPtr prop = drmModeGetProperty(wsi->fd, drm_connector->props[p]); + if (!prop) + continue; + if (prop->flags & DRM_MODE_PROP_ENUM) { + if (!strcmp(prop->name, "DPMS")) +connector->dpms_property = drm_connector->props[p]; + } + drmModeFreeProperty(prop); + } + /* Mark all connector modes as invalid */ wsi_display_invalidate_connector_modes(wsi_device, connector); @@ -634,7 +657,7 @@ wsi_display_surface_get_capabilities2ext(VkIcdSurfaceBase *icd_surface, caps->currentTransform = khr_caps.currentTransform; caps->supportedCompositeAlpha = khr_caps.supportedCompositeAlpha; caps->supportedUsageFlags = khr_caps.supportedUsageFlags; - caps->supportedSurfaceCounters = 0; + caps->supportedSurfaceCounters = VK_SURFACE_COUNTER_VBLANK_EXT; return ret; } @@ -864,12 +887,20 @@ static void wsi_display_page_flip_handler(int fd, unsigned int frame, wsi_display_page_flip_handler2(fd, frame, sec, usec, 0, data); } +static void wsi_display_vblank_handler(int fd, unsigned int frame, + unsigned int sec, unsigned int usec, void *data); + +static void wsi_display_sequence_handler(int fd, uint64_t frame, + uint64_t ns, uint64_t user_data); + static drmEventContext event_context = { .version = DRM_EVENT_CONTEXT_VERSION, .page_flip_handler = wsi_display_page_flip_handler, #if DRM_EVENT_CONTEXT_VERSION >= 3 .page_flip_handler2 = wsi_display_page_flip_handler2, #endif + .vblank_handler = wsi_display_vblank_handler, + .sequence_handler = wsi_display_sequence_handler, }; static void * @@ -1133,6 +1164,135 @@ bail: } +static bool +wsi_display_fence_wait(struct wsi_fence *fence_wsi, +
[Mesa-dev] [PATCH mesa 07/21] vulkan: Add EXT_acquire_xlib_display [v2]
This extension adds the ability to borrow an X RandR output for temporary use directly by a Vulkan application. For DRM, we use the Linux resource leasing mechanism. v2: Clean up xlib_lease detection * Use separate temporary '_xlib_lease' variable to hold the option value to avoid changin the type of a variable. * Use boolean expressions instead of additional if statements to compute resulting with_xlib_lease value. * Simplify addition of VK_USE_PLATFORM_XLIB_XRANDR_KHR to vulkan_wsi_args Suggested-by: Eric EngestromMove mode list from wsi_display to wsi_display_connector Fix scope for wsi_display_mode and wsi_display_connector allocs Suggested-by: Jason Ekstrand Signed-off-by: Keith Packard --- configure.ac| 32 +++ meson.build | 11 + meson_options.txt | 7 + src/vulkan/Makefile.am | 5 + src/vulkan/wsi/meson.build | 5 + src/vulkan/wsi/wsi_common_display.c | 470 src/vulkan/wsi/wsi_common_display.h | 17 ++ 7 files changed, 547 insertions(+) diff --git a/configure.ac b/configure.ac index 7fcb3220eaa..bf649f9fed7 100644 --- a/configure.ac +++ b/configure.ac @@ -1560,6 +1560,7 @@ AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = x AM_CONDITIONAL(HAVE_LMSENSORS, test "x$enable_lmsensors" = xyes ) AM_CONDITIONAL(HAVE_GALLIUM_EXTRA_HUD, test "x$enable_gallium_extra_hud" = xyes ) AM_CONDITIONAL(HAVE_WINDOWSDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xwindows ) +AM_CONDITIONAL(HAVE_XLEASE, test "x$have_xlease" = xyes ) AC_ARG_ENABLE([shared-glapi], [AS_HELP_STRING([--enable-shared-glapi], @@ -1853,6 +1854,18 @@ if test x"$enable_dri3" = xyes; then PKG_CHECK_MODULES([XCB_DRI3], [$dri3_modules]) fi + +if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 'drm'; then +have_xlease=yes +else +have_xlease=no +fi + +if test x"$have_xlease" = xyes; then +randr_modules="x11-xcb xcb-randr" +PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules]) +fi + AM_CONDITIONAL(HAVE_PLATFORM_X11, echo "$platforms" | grep -q 'x11') AM_CONDITIONAL(HAVE_PLATFORM_WAYLAND, echo "$platforms" | grep -q 'wayland') AM_CONDITIONAL(HAVE_PLATFORM_DRM, echo "$platforms" | grep -q 'drm') @@ -1860,6 +1873,25 @@ AM_CONDITIONAL(HAVE_PLATFORM_DISPLAY, echo "$platforms" | grep -q 'drm') AM_CONDITIONAL(HAVE_PLATFORM_SURFACELESS, echo "$platforms" | grep -q 'surfaceless') AM_CONDITIONAL(HAVE_PLATFORM_ANDROID, echo "$platforms" | grep -q 'android') +AC_ARG_ENABLE(xlib-lease, +[AS_HELP_STRING([--enable-xlib-lease] +[enable VK_acquire_xlib_display using X leases])], +[enable_xlib_lease=$enableval], [enable_xlib_lease=auto]) +case "x$enable_xlib_lease" in +xyes) +;; +xno) +;; +*) +if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 'drm'; then +enable_xlib_lease=yes +else +enable_xlib_lease=no +fi +esac + +AM_CONDITIONAL(HAVE_XLIB_LEASE, test "x$enable_xlib_lease" = xyes) + dnl dnl More DRI setup dnl diff --git a/meson.build b/meson.build index 788aed6e159..68081e9fcc3 100644 --- a/meson.build +++ b/meson.build @@ -265,6 +265,13 @@ if _platforms != '' egl_native_platform = _split[0] endif +_xlib_lease = get_option('xlib-lease') +if _xlib_lease == 'auto' + with_xlib_lease = with_platform_x11 and with_platform_display +else + with_xlib_lease = _xlib_lease == 'true' +endif + with_glx = get_option('glx') if with_glx == 'auto' if with_dri @@ -1202,6 +1209,7 @@ dep_xcb_present = [] dep_xcb_sync = [] dep_xcb_xfixes = [] dep_xshmfence = [] +dep_xcb_xrandr = [] if with_platform_x11 if with_glx == 'xlib' or with_glx == 'gallium-xlib' dep_x11 = dependency('x11') @@ -1241,6 +1249,9 @@ if with_platform_x11 if with_egl dep_xcb_xfixes = dependency('xcb-xfixes') endif + if with_xlib_lease +dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.12') + endif endif if get_option('gallium-extra-hud') diff --git a/meson_options.txt b/meson_options.txt index a573290b774..70318e1041f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -286,3 +286,10 @@ option( value : '', description : 'Comma delimited list of tools to build. choices : freedreno,glsl,intel,nir,nouveau or all' ) +option( + 'xlib-lease', + type : 'combo', + value : 'auto', + choices : ['auto', 'true', 'false'], + description : 'Enable VK_EXT_acquire_xlib_display.' +) diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am index 075eb58c82c..c8f425f286a 100644 --- a/src/vulkan/Makefile.am +++ b/src/vulkan/Makefile.am @@ -65,6 +65,11 @@ AM_CPPFLAGS += \ VULKAN_WSI_SOURCES += $(VULKAN_WSI_DISPLAY_FILES) endif +if HAVE_XLIB_LEASE +AM_CPPFLAGS += \ +
[Mesa-dev] [PATCH mesa 14/21] anv: add VK_EXT_display_control to anv driver
This extension provides fences and frame count information to direct display contexts. It uses new kernel ioctls to provide 64-bits of vblank sequence and nanosecond resolution. Signed-off-by: Keith Packard--- src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_private.h | 4 ++ src/intel/vulkan/anv_queue.c | 59 ++--- src/intel/vulkan/anv_wsi_display.c | 103 + 4 files changed, 160 insertions(+), 7 deletions(-) diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 14a76830cfb..219919f11b8 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -115,6 +115,7 @@ EXTENSIONS = [ Extension('VK_EXT_global_priority', 1, 'device->has_context_priority'), Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), +Extension('VK_EXT_display_control', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), ] class VkVersion: diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index b2d42e1313d..6eedc0a25ff 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1983,6 +1983,7 @@ enum anv_fence_type { ANV_FENCE_TYPE_NONE = 0, ANV_FENCE_TYPE_BO, ANV_FENCE_TYPE_SYNCOBJ, + ANV_FENCE_TYPE_WSI, }; enum anv_bo_fence_state { @@ -2017,6 +2018,9 @@ struct anv_fence_impl { /** DRM syncobj handle for syncobj-based fences */ uint32_t syncobj; + + /** WSI fence */ + struct wsi_fence *fence_wsi; }; }; diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c index b9ca189fddc..ff3d6c75757 100644 --- a/src/intel/vulkan/anv_queue.c +++ b/src/intel/vulkan/anv_queue.c @@ -320,6 +320,10 @@ anv_fence_impl_cleanup(struct anv_device *device, case ANV_FENCE_TYPE_SYNCOBJ: anv_gem_syncobj_destroy(device, impl->syncobj); return; + + case ANV_FENCE_TYPE_WSI: + impl->fence_wsi->destroy(impl->fence_wsi); + return; } unreachable("Invalid fence type"); @@ -465,11 +469,32 @@ anv_wait_for_syncobj_fences(struct anv_device *device, uint32_t *syncobjs = vk_zalloc(>alloc, sizeof(*syncobjs) * fenceCount, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + uint32_t syncobjCount = 0; if (!syncobjs) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); for (uint32_t i = 0; i < fenceCount; i++) { ANV_FROM_HANDLE(anv_fence, fence, pFences[i]); + + if (fence->permanent.type == ANV_FENCE_TYPE_WSI) { + struct anv_fence_impl *impl = >permanent; + bool expired = impl->fence_wsi->wait(impl->fence_wsi, true, _timeout); + + VkResult result; + + if (!expired) { +result = VK_TIMEOUT; +goto done; + } + if (!waitAll) { +result = VK_SUCCESS; +goto done; + } + continue; + done: + vk_free(>alloc, syncobjs); + return result; + } assert(fence->permanent.type == ANV_FENCE_TYPE_SYNCOBJ); struct anv_fence_impl *impl = @@ -477,7 +502,7 @@ anv_wait_for_syncobj_fences(struct anv_device *device, >temporary : >permanent; assert(impl->type == ANV_FENCE_TYPE_SYNCOBJ); - syncobjs[i] = impl->syncobj; + syncobjs[syncobjCount++] = impl->syncobj; } int64_t abs_timeout_ns = 0; @@ -499,7 +524,7 @@ anv_wait_for_syncobj_fences(struct anv_device *device, */ int ret; do { - ret = anv_gem_syncobj_wait(device, syncobjs, fenceCount, + ret = anv_gem_syncobj_wait(device, syncobjs, syncobjCount, abs_timeout_ns, waitAll); } while (ret == -1 && errno == ETIME && gettime_ns() < abs_timeout_ns); @@ -545,14 +570,33 @@ anv_wait_for_bo_fences(struct anv_device *device, for (uint32_t i = 0; i < fenceCount; i++) { ANV_FROM_HANDLE(anv_fence, fence, pFences[i]); - /* This function assumes that all fences are BO fences and that they - * have no temporary state. Since BO fences will never be exported, - * this should be a safe assumption. + /* This function assumes that all fences have no temporary + * state.Since BO fences will never be exported, this should be a + * safe assumption. */ - assert(fence->permanent.type == ANV_FENCE_TYPE_BO); assert(fence->temporary.type == ANV_FENCE_TYPE_NONE); struct anv_fence_impl *impl = >permanent; + /* This function assumes that all fences are either BO fences or WSI + * fences + */ + + if (impl->type == ANV_FENCE_TYPE_WSI) { +bool expired = impl->fence_wsi->wait(impl->fence_wsi, true, timeout); + +if (!expired) { + result = VK_TIMEOUT; +
[Mesa-dev] [PATCH mesa 17/21] anv: Add new VK_MESA_query_timestamp extension to anv driver
This extension adds a single function to query the current GPU timestamp, just like glGetInteger64v(GL_TIMESTAMP, ). This function is needed to complete the implementation of GOOGLE_display_timing, which needs to be able to correlate GPU and CPU timestamps. Signed-off-by: Keith Packard--- src/intel/Makefile.vulkan.am | 7 +++ src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_gem.c | 13 + src/intel/vulkan/anv_private.h | 2 ++ src/intel/vulkan/genX_query.c | 15 +++ src/intel/vulkan/meson.build | 12 ++-- 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am index d4e36e8e36b..7d9646e40a7 100644 --- a/src/intel/Makefile.vulkan.am +++ b/src/intel/Makefile.vulkan.am @@ -24,36 +24,43 @@ # out and we'll fail at `make dist' vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml vk_android_native_buffer_xml = $(top_srcdir)/src/vulkan/registry/vk_android_native_buffer.xml +vk_mesa_query_timestamp_xml = $(top_srcdir)/src/vulkan/registry/vk_mesa_query_timestamp.xml vulkan/anv_entrypoints.c: vulkan/anv_entrypoints_gen.py \ vulkan/anv_extensions.py \ $(vulkan_api_xml) \ + $(vk_mesa_query_timestamp_xml) \ $(vk_android_native_buffer_xml) $(MKDIR_GEN) $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py \ --xml $(vulkan_api_xml) \ --xml $(vk_android_native_buffer_xml) \ + --xml $(vk_mesa_query_timestamp_xml) \ --outdir $(builddir)/vulkan vulkan/anv_entrypoints.h: vulkan/anv_entrypoints.c vulkan/anv_extensions.c: vulkan/anv_extensions_gen.py \ vulkan/anv_extensions.py \ $(vulkan_api_xml) \ +$(vk_mesa_query_timestamp_xml) \ $(vk_android_native_buffer_xml) $(MKDIR_GEN) $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_extensions_gen.py \ --xml $(vulkan_api_xml) \ --xml $(vk_android_native_buffer_xml) \ + --xml $(vk_mesa_query_timestamp_xml) \ --out-c $@ vulkan/anv_extensions.h: vulkan/anv_extensions_gen.py \ vulkan/anv_extensions.py \ $(vulkan_api_xml) \ +$(vk_mesa_query_timestamp_xml) \ $(vk_android_native_buffer_xml) $(MKDIR_GEN) $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_extensions_gen.py \ --xml $(vulkan_api_xml) \ --xml $(vk_android_native_buffer_xml) \ + --xml $(vk_mesa_query_timestamp_xml) \ --out-h $@ BUILT_SOURCES += $(VULKAN_GENERATED_FILES) diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 219919f11b8..508811ebd24 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -116,6 +116,7 @@ EXTENSIONS = [ 'device->has_context_priority'), Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_display_control', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), +Extension('VK_MESA_query_timestamp', 1, True), ] class VkVersion: diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c index 2a8f8b14b7e..a7eb5cf4366 100644 --- a/src/intel/vulkan/anv_gem.c +++ b/src/intel/vulkan/anv_gem.c @@ -441,6 +441,19 @@ anv_gem_fd_to_handle(struct anv_device *device, int fd) return args.handle; } +int +anv_gem_reg_read(struct anv_device *device, uint32_t offset, uint64_t *result) +{ + struct drm_i915_reg_read args = { + .offset = offset + }; + + int ret = anv_ioctl(device->fd, DRM_IOCTL_I915_REG_READ, ); + + *result = args.val; + return ret; +} + #ifndef SYNC_IOC_MAGIC /* duplicated from linux/sync_file.h to avoid build-time dependency * on new (v4.7) kernel headers. Once distro's are mostly using diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 6eedc0a25ff..0b2380b2876 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -70,6 +70,7 @@ struct gen_l3_config; #include #include #include +#include #include "anv_entrypoints.h" #include "anv_extensions.h" @@ -960,6 +961,7 @@ bool anv_gem_supports_48b_addresses(int fd); int anv_gem_gpu_get_reset_stats(struct anv_device *device, uint32_t *active, uint32_t *pending); int anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle); +int anv_gem_reg_read(struct anv_device *device, uint32_t offset, uint64_t *result); uint32_t anv_gem_fd_to_handle(struct anv_device *device, int fd); int anv_gem_set_caching(struct anv_device *device,
[Mesa-dev] [PATCH mesa 05/21] anv: Add EXT_direct_mode_display to anv driver
Add support for the EXT_direct_mode_display extension. This just provides the vkReleaseDisplayEXT function. Signed-off-by: Keith Packard--- src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_wsi_display.c | 11 +++ 2 files changed, 12 insertions(+) diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index c23c0a87bb9..0c29e00c2fe 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -108,6 +108,7 @@ EXTENSIONS = [ Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'), Extension('VK_KHR_multiview', 1, True), Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), +Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_debug_report', 8, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), Extension('VK_EXT_global_priority', 1, 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, + >wsi_device, + display); +} -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 15/21] radv: add VK_EXT_display_control to radv driver
This extension provides fences and frame count information to direct display contexts. It uses new kernel ioctls to provide 64-bits of vblank sequence and nanosecond resolution. Signed-off-by: Keith Packard--- src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_private.h | 11 +++- src/amd/vulkan/radv_wsi_display.c | 109 ++ 3 files changed, 120 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 0fa0a22155f..7c77bf11669 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -89,6 +89,7 @@ EXTENSIONS = [ Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_acquire_xlib_display', 1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'), Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), +Extension('VK_EXT_display_control', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_debug_report', 9, True), Extension('VK_EXT_discard_rectangles',1, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 5d2ec515b4a..da5354160fc 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1668,8 +1668,17 @@ void radv_initialise_cmask(struct radv_cmd_buffer *cmd_buffer, void radv_initialize_dcc(struct radv_cmd_buffer *cmd_buffer, struct radv_image *image, uint32_t value); +enum radv_fence_type { + RADV_FENCE_TYPE_WINSYS = 0, + RADV_FENCE_TYPE_WSI = 1 +}; + struct radv_fence { - struct radeon_winsys_fence *fence; + enum radv_fence_type type; + union { + struct radeon_winsys_fence *fence; + struct wsi_fence*fence_wsi; + }; bool submitted; bool signalled; diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c index d7a5956ad97..92d8936bba0 100644 --- a/src/amd/vulkan/radv_wsi_display.c +++ b/src/amd/vulkan/radv_wsi_display.c @@ -182,3 +182,112 @@ radv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device, display); } #endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ + +/* VK_EXT_display_control */ + +VkResult +radv_DisplayPowerControlEXT(VkDevice_device, + VkDisplayKHRdisplay, + const VkDisplayPowerInfoEXT *display_power_info) +{ + RADV_FROM_HANDLE(radv_device, device, _device); + + return wsi_display_power_control(_device, +>physical_device->wsi_device, +display, +display_power_info); +} + +VkResult +radv_RegisterDeviceEventEXT(VkDevice_device, + const VkDeviceEventInfoEXT *device_event_info, + const VkAllocationCallbacks *allocator, + VkFence *_fence) +{ + RADV_FROM_HANDLE(radv_device, device, _device); + const VkAllocationCallbacks *alloc; + struct radv_fence*fence; + VkResult ret; + + if (allocator) + alloc = allocator; + else + alloc = >instance->alloc; + + fence = vk_alloc(alloc, sizeof (*fence), 8, +VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + if (!fence) + return VK_ERROR_OUT_OF_HOST_MEMORY; + + fence->type = RADV_FENCE_TYPE_WSI; + fence->submitted = true; + fence->signalled = false; + + ret = wsi_register_device_event(_device, + >physical_device->wsi_device, + device_event_info, + alloc, + >fence_wsi); + if (ret == VK_SUCCESS) + *_fence = radv_fence_to_handle(fence); + else + vk_free(alloc, fence); + return ret; +} + +VkResult +radv_RegisterDisplayEventEXT(VkDevice _device, +VkDisplayKHR display, +const VkDisplayEventInfoEXT *display_event_info, +const VkAllocationCallbacks*allocator, +VkFence*_fence) +{ + RADV_FROM_HANDLE(radv_device, device, _device); + + const VkAllocationCallbacks *alloc; + struct radv_fence*fence; + VkResult ret; + + if (allocator) + alloc = allocator; +
[Mesa-dev] [PATCH mesa 01/21] vulkan: Add KHR_display extension using DRM [v4]
This adds support for the KHR_display extension support to the vulkan WSI layer. Driver support will be added separately. v2: * fix double ;; in wsi_common_display.c * Move mode list from wsi_display to wsi_display_connector * Fix scope for wsi_display_mode andwsi_display_connector allocs * Switch all allocations to vk_zalloc instead of vk_alloc. * Fix DRM failure in wsi_display_get_physical_device_display_properties When DRM fails, or when we don't have a master fd (presumably due to application errors), just return 0 properties from this function, which is at least a valid response. * Use vk_outarray for all property queries This is a bit less error-prone than open-coding the same stuff. * Remove VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR from surface caps Until we have multi-plane support, we shouldn't pretend to have any multi-plane semantics, even if undefined. Suggested-by: Jason Ekstrand* Simplify addition of VK_USE_PLATFORM_DISPLAY_KHR to vulkan_wsi_args Suggested-by: Eric Engestrom v3: Add separate 'display_fd' and 'render_fd' arguments to wsi_device_init API. This allows drivers to use different FDs for the different aspects of the device. Use largest mode as display size when no preferred mode. If the display doesn't provide a preferred mode, we'll assume that the largest supported mode is the "physical size" of the device and report that. v4: Make wsi_image_state enumeration values uppercase. Follow more common mesa conventions. Remove 'render_fd' from wsi_device_init API. The wsi_common_display code doesn't use this fd at all, so stop passing it in. This avoids any potential confusion over which fd to use when creating display-relative object handles. Remove call to wsi_create_prime_image which would never have been reached as the necessary condition (use_prime_blit) is never set. whitespace cleanups in wsi_common_display.c Suggested-by: Jason Ekstrand Add depth/bpp info to available surface formats. Instead of hard-coding depth 24 bpp 32 in the drmModeAddFB call, use the requested format to find suitable values. Destroy kernel buffers and FBs when swapchain is destroyed. We were leaking both of these kernel objects across swapchain destruction. Note that wsi_display_wait_for_event waits for anything to happen. wsi_display_wait_for_event is simply a yield so that the caller can then check to see if the desired state change has occurred. Record swapchain failures in chain for later return. If some asynchronous swapchain activity fails, we need to tell the application eventually. Record the failure in the swapchain and report it at the next acquire_next_image or queue_present call. Fix error returns from wsi_display_setup_connector. If a malloc failed, then the result should be VK_ERROR_OUT_OF_HOST_MEMORY. Otherwise, the associated ioctl failed and we're either VT switched away, or our lease has been revoked, in which case we should return VK_ERROR_OUT_OF_DATE_KHR. Make sure both sides of if/else brace use matches Note that we assume drmModeSetCrtc is synchronous. Add a comment explaining why we can idle any previous displayed image as soon as the mode set returns. Note that EACCES from drmModePageFlip means VT inactive. When vt switched away drmModePageFlip returns EACCES. Poll once a second waiting until we get some other return value back. Clean up after alloc failure in wsi_display_surface_create_swapchain. Destroy any created images, free the swapchain. Remove physical_device from wsi_display_init_wsi. We never need this value, so remove it from the API and from the internal wsi_display structure. Use drmModeAddFB2 in wsi_display_image_init. This takes a drm format instead of depth/bpp, which provides more control over the format of the data. Signed-off-by: Keith Packard --- configure.ac|1 + meson.build |4 +- src/amd/vulkan/radv_device.c|8 + src/amd/vulkan/radv_private.h |1 + src/amd/vulkan/radv_wsi.c |3 +- src/intel/vulkan/anv_device.c |4 + src/intel/vulkan/anv_private.h |1 + src/intel/vulkan/anv_wsi.c |3 +- src/vulkan/Makefile.am |7 + src/vulkan/Makefile.sources |4 +
[Mesa-dev] [PATCH mesa 00/21] Add direct display extensions [update]
Here's a new clean version of all of the direct display patches with fixes suggested by Jason integrated, instead of being made on top of the patch series. I've also rebased all of these patches on current master, which includes the WSI changes to support multiple buffers per image, but I'm not sure how to compute the correct modifiers yet, so I didn't do that for the display backend. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 10/21] vulkan: Add VK_EXT_display_surface_counter [v3]
This extension is required to support EXT_display_control as it offers a way to query whether the vblank counter is supported. v2: Thanks to kisak Fix spelling of VkSurfaceCapabilities2EXT in wsi_common_wayland.c, it was using ext instead of EXT. Fix spelling of VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT v3: Fix wayland WSI, regularize spelling Misspelled 'surface' in get_capabilities2ext Remove extra _ from get_capabilities_2ext in a couple of places Signed-off-by: Keith Packard--- src/vulkan/wsi/wsi_common.c | 11 +++ src/vulkan/wsi/wsi_common.h | 5 + src/vulkan/wsi/wsi_common_display.c | 27 +++ src/vulkan/wsi/wsi_common_private.h | 2 ++ src/vulkan/wsi/wsi_common_wayland.c | 27 +++ src/vulkan/wsi/wsi_common_x11.c | 27 +++ 6 files changed, 99 insertions(+) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 655fe59ab0f..f902950078a 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -716,6 +716,17 @@ wsi_common_get_surface_capabilities2(struct wsi_device *wsi_device, pSurfaceCapabilities); } +VkResult +wsi_common_get_surface_capabilities2ext(struct wsi_device *wsi_device, +VkSurfaceKHR _surface, +VkSurfaceCapabilities2EXT *pSurfaceCapabilities) +{ + ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface); + struct wsi_interface *iface = wsi_device->wsi[surface->platform]; + + return iface->get_capabilities2ext(surface, pSurfaceCapabilities); +} + VkResult wsi_common_get_surface_formats(struct wsi_device *wsi_device, VkSurfaceKHR _surface, diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index b8bbf4b80c4..486c1fc46d1 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -178,6 +178,11 @@ wsi_common_get_surface_present_modes(struct wsi_device *wsi_device, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes); +VkResult +wsi_common_get_surface_capabilities2ext(struct wsi_device *wsi_device, +VkSurfaceKHR surface, +VkSurfaceCapabilities2EXT *pSurfaceCapabilities); + VkResult wsi_common_get_images(VkSwapchainKHR _swapchain, uint32_t *pSwapchainImageCount, diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 087e8d18dba..0a12c9ee04c 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -612,6 +612,32 @@ wsi_display_surface_get_capabilities2(VkIcdSurfaceBase *icd_surface, return wsi_display_surface_get_capabilities(icd_surface, >surfaceCapabilities); } +static VkResult +wsi_display_surface_get_capabilities2ext(VkIcdSurfaceBase *icd_surface, + VkSurfaceCapabilities2EXT *caps) +{ + VkSurfaceCapabilitiesKHR khr_caps; + VkResult ret; + + assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT); + ret = wsi_display_surface_get_capabilities(icd_surface, _caps); + if (ret) + return ret; + + caps->minImageCount = khr_caps.minImageCount; + caps->maxImageCount = khr_caps.maxImageCount; + caps->currentExtent = khr_caps.currentExtent; + caps->minImageExtent = khr_caps.minImageExtent; + caps->maxImageExtent = khr_caps.maxImageExtent; + caps->maxImageArrayLayers = khr_caps.maxImageArrayLayers; + caps->supportedTransforms = khr_caps.supportedTransforms; + caps->currentTransform = khr_caps.currentTransform; + caps->supportedCompositeAlpha = khr_caps.supportedCompositeAlpha; + caps->supportedUsageFlags = khr_caps.supportedUsageFlags; + caps->supportedSurfaceCounters = 0; + return ret; +} + static const struct { VkFormat format; uint32_t drm_format; @@ -1357,6 +1383,7 @@ wsi_display_init_wsi(struct wsi_device *wsi_device, wsi->base.get_support = wsi_display_surface_get_support; wsi->base.get_capabilities = wsi_display_surface_get_capabilities; wsi->base.get_capabilities2 = wsi_display_surface_get_capabilities2; + wsi->base.get_capabilities2ext = wsi_display_surface_get_capabilities2ext; wsi->base.get_formats = wsi_display_surface_get_formats; wsi->base.get_formats2 = wsi_display_surface_get_formats2; wsi->base.get_present_modes = wsi_display_surface_get_present_modes; diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index 6993750aac4..a69f574bacd 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -108,6 +108,8 @@ struct wsi_interface { VkResult (*get_capabilities2)(VkIcdSurfaceBase *surface,
[Mesa-dev] [PATCH mesa 02/21] anv: Add KHR_display extension to anv [v4]
This adds support for the KHR_display extension to the anv Vulkan driver. The driver now attempts to open the master DRM node when the KHR_display extension is requested so that the common winsys code can perform the necessary operations. v2: Make sure primary fd is usable When KHR_display is selected, we try to open the primary node instead of the render node in case the user wants to use KHR_display for presentation. However, if we're actually going to end up using RandR leases, then we don't care if the resulting fd can't be used for display, but the kernel also prevents us from using it for drawing when someone else has master. v3: Simplify addition of VK_USE_PLATFORM_DISPLAY_KHR to vulkan_wsi_args Suggested-by: Eric Engestromv4: Adapt primary node usage to new wsi_device_init API Signed-off-by: Keith Packard --- src/intel/Makefile.sources | 3 + src/intel/Makefile.vulkan.am | 7 ++ src/intel/vulkan/anv_device.c | 21 ++ src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_extensions_gen.py | 5 +- src/intel/vulkan/anv_wsi_display.c | 129 + src/intel/vulkan/meson.build | 5 ++ 7 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 src/intel/vulkan/anv_wsi_display.c diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources index 91c71a8dfaf..6c6b57c603d 100644 --- a/src/intel/Makefile.sources +++ b/src/intel/Makefile.sources @@ -250,6 +250,9 @@ VULKAN_WSI_WAYLAND_FILES := \ VULKAN_WSI_X11_FILES := \ vulkan/anv_wsi_x11.c +VULKAN_WSI_DISPLAY_FILES := \ + vulkan/anv_wsi_display.c + VULKAN_GEM_FILES := \ vulkan/anv_gem.c diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am index 6b71df6319a..9b6b68abef9 100644 --- a/src/intel/Makefile.vulkan.am +++ b/src/intel/Makefile.vulkan.am @@ -193,6 +193,13 @@ VULKAN_SOURCES += $(VULKAN_WSI_WAYLAND_FILES) VULKAN_LIB_DEPS += $(WAYLAND_CLIENT_LIBS) endif +if HAVE_PLATFORM_DISPLAY +VULKAN_CPPFLAGS += \ + -DVK_USE_PLATFORM_DISPLAY_KHR + +VULKAN_SOURCES += $(VULKAN_WSI_DISPLAY_FILES) +endif + noinst_LTLIBRARIES += vulkan/libvulkan_common.la vulkan_libvulkan_common_la_SOURCES = $(VULKAN_SOURCES) vulkan_libvulkan_common_la_CFLAGS = $(VULKAN_CFLAGS) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index ab61e0ce339..de1d5af2137 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -278,6 +278,7 @@ anv_physical_device_init_uuids(struct anv_physical_device *device) static VkResult anv_physical_device_init(struct anv_physical_device *device, struct anv_instance *instance, + const char *primary_path, const char *path) { VkResult result; @@ -444,6 +445,25 @@ anv_physical_device_init(struct anv_physical_device *device, anv_physical_device_get_supported_extensions(device, >supported_extensions); + if (instance->enabled_extensions.KHR_display) { + master_fd = open(path, O_RDWR | O_CLOEXEC); + if (master_fd >= 0) { + /* prod the device with a GETPARAM call which will fail if + * we don't have permission to even render on this device + */ + drm_i915_getparam_t gp; + memset(, '\0', sizeof(gp)); + int devid = 0; + gp.param = I915_PARAM_CHIPSET_ID; + gp.value = + int ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, ); + if (ret < 0) { +close(master_fd); +master_fd = -1; + } + } + } + device->local_fd = fd; device->master_fd = master_fd; return VK_SUCCESS; @@ -641,6 +661,7 @@ anv_enumerate_devices(struct anv_instance *instance) result = anv_physical_device_init(>physicalDevice, instance, +devices[i]->nodes[DRM_NODE_PRIMARY], devices[i]->nodes[DRM_NODE_RENDER]); if (result != VK_ERROR_INCOMPATIBLE_DRIVER) break; diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index d0b70a04055..c23c0a87bb9 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -107,6 +107,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_multiview', 1, True), +Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_debug_report', 8, True), Extension('VK_EXT_external_memory_dma_buf', 1, True),
[Mesa-dev] [PATCH mesa 18/21] radv: Add new VK_MESA_query_timestamp extension to radv driver
This extension adds a single function to query the current GPU timestamp, just like glGetInteger64v(GL_TIMESTAMP, ). This function is needed to complete the implementation of GOOGLE_display_timing, which needs to be able to correlate GPU and CPU timestamps. Signed-off-by: Keith Packard--- src/amd/vulkan/Makefile.am| 3 +++ src/amd/vulkan/meson.build| 8 src/amd/vulkan/radv_device.c | 8 src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_private.h | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am index 8328f9f0bd1..89c59d08fb7 100644 --- a/src/amd/vulkan/Makefile.am +++ b/src/amd/vulkan/Makefile.am @@ -129,12 +129,14 @@ libvulkan_radeon_la_SOURCES = $(VULKAN_GEM_FILES) vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml vk_android_native_buffer_xml = $(top_srcdir)/src/vulkan/registry/vk_android_native_buffer.xml +vk_mesa_query_timestamp_xml = $(top_srcdir)/src/vulkan/registry/vk_mesa_query_timestamp.xml radv_entrypoints.c: radv_entrypoints_gen.py radv_extensions.py $(vulkan_api_xml) $(MKDIR_GEN) $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_entrypoints_gen.py \ --xml $(vulkan_api_xml) \ --xml $(vk_android_native_buffer_xml) \ + --xml $(vk_mesa_query_timestamp_xml) \ --outdir $(builddir) radv_entrypoints.h: radv_entrypoints.c @@ -144,6 +146,7 @@ radv_extensions.c: radv_extensions.py \ $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_extensions.py \ --xml $(vulkan_api_xml) \ --xml $(vk_android_native_buffer_xml) \ + --xml $(vk_mesa_query_timestamp_xml) \ --out-c radv_extensions.c \ --out-h radv_extensions.h radv_extensions.h: radv_extensions.c diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build index afd1a5dad31..b0942a0f391 100644 --- a/src/amd/vulkan/meson.build +++ b/src/amd/vulkan/meson.build @@ -20,10 +20,10 @@ radv_entrypoints = custom_target( 'radv_entrypoints.[ch]', - input : ['radv_entrypoints_gen.py', vk_api_xml], + input : ['radv_entrypoints_gen.py', vk_api_xml, vk_android_native_buffer_xml, vk_mesa_query_timestamp_xml], output : ['radv_entrypoints.h', 'radv_entrypoints.c'], command : [ -prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--outdir', +prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@', '--xml', '@INPUT3@', '--outdir', meson.current_build_dir() ], depend_files : files('radv_extensions.py'), @@ -31,10 +31,10 @@ radv_entrypoints = custom_target( radv_extensions_c = custom_target( 'radv_extensions.c', - input : ['radv_extensions.py', vk_api_xml, vk_android_native_buffer_xml], + input : ['radv_extensions.py', vk_api_xml, vk_android_native_buffer_xml, vk_mesa_query_timestamp_xml], output : ['radv_extensions.c', 'radv_extensions.h'], command : [ -prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@', '--out-c', '@OUTPUT0@', +prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@', '--xml', '@INPUT3@', '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@' ], ) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index e9476777b45..4e1aca57af8 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -4357,3 +4357,11 @@ radv_GetDeviceGroupPeerMemoryFeatures( VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT | VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT; } + +VkResult radv_QueryCurrentTimestampMESA(VkDevice _device, uint64_t *timestamp) +{ + RADV_FROM_HANDLE(radv_device, device, _device); + + *timestamp = device->ws->query_value(device->ws, RADEON_TIMESTAMP); + return VK_SUCCESS; +} diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 7c77bf11669..e7bbf12fb69 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -99,6 +99,7 @@ EXTENSIONS = [ Extension('VK_AMD_gcn_shader',1, True), Extension('VK_AMD_rasterization_order', 1, 'device->rad_info.chip_class >= VI && device->rad_info.max_se >= 2'), Extension('VK_AMD_shader_info', 1, True), +Extension('VK_MESA_query_timestamp', 1, True), ] class VkVersion: diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index da5354160fc..7a70c5515d1 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -72,6 +72,7 @@ typedef uint32_t xcb_window_t; #include #include #include +#include #include "radv_entrypoints.h" -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 20/21] anv: Add VK_GOOGLE_display_timing extension to anv driver
This adds support for the VK_GOOGLE_display timing extension. Signed-off-by: Keith Packard--- src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_wsi.c | 29 + 2 files changed, 30 insertions(+) diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 508811ebd24..b39b27be81c 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -117,6 +117,7 @@ EXTENSIONS = [ Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_display_control', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_MESA_query_timestamp', 1, True), +Extension('VK_GOOGLE_display_timing', 1, True), ] class VkVersion: diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index 1403601e9c0..4246de324e3 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -277,3 +277,32 @@ VkResult anv_GetDeviceGroupSurfacePresentModesKHR( return VK_SUCCESS; } + +/* VK_GOOGLE_display_timing */ +VkResult +anv_GetRefreshCycleDurationGOOGLE(VkDevice _device, + VkSwapchainKHRswapchain, + VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + + return wsi_common_get_refresh_cycle_duration(>instance->physicalDevice.wsi_device, +_device, +swapchain, +pDisplayTimingProperties); +} + +VkResult +anv_GetPastPresentationTimingGOOGLE(VkDevice _device, +VkSwapchainKHR swapchain, +uint32_t *pPresentationTimingCount, +VkPastPresentationTimingGOOGLE *pPresentationTimings) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + + return wsi_common_get_past_presentation_timing(>instance->physicalDevice.wsi_device, + _device, + swapchain, + pPresentationTimingCount, + pPresentationTimings); +} -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 11/21] anv: Add VK_EXT_display_surface_counter to anv driver [v4]
This extension is required to support EXT_display_control as it offers a way to query whether the vblank counter is supported. v4: Add anv support Signed-off-by: Keith Packard--- src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_wsi.c | 12 2 files changed, 13 insertions(+) diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py index 79fbec7b859..14a76830cfb 100644 --- a/src/intel/vulkan/anv_extensions.py +++ b/src/intel/vulkan/anv_extensions.py @@ -114,6 +114,7 @@ EXTENSIONS = [ Extension('VK_EXT_external_memory_dma_buf', 1, True), Extension('VK_EXT_global_priority', 1, 'device->has_context_priority'), +Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), ] class VkVersion: diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index a7efb1416fa..1403601e9c0 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -120,6 +120,18 @@ VkResult anv_GetPhysicalDeviceSurfaceCapabilities2KHR( pSurfaceCapabilities); } +VkResult anv_GetPhysicalDeviceSurfaceCapabilities2EXT( + VkPhysicalDevicephysicalDevice, + VkSurfaceKHRsurface, + VkSurfaceCapabilities2EXT* pSurfaceCapabilities) +{ + ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice); + + return wsi_common_get_surface_capabilities2ext(>wsi_device, + surface, + pSurfaceCapabilities); +} + VkResult anv_GetPhysicalDeviceSurfaceFormatsKHR( VkPhysicalDevicephysicalDevice, VkSurfaceKHRsurface, -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 16/21] vulkan: Define new VK_MESA_query_timestamp extension
This extension adds a single function to query the current GPU timestamp, just like glGetInteger64v(GL_TIMESTAMP, ). This function is needed to complete the implementation of GOOGLE_display_timing, which needs to be able to correlate GPU and CPU timestamps. Signed-off-by: Keith Packard--- include/vulkan/vk_mesa_query_timestamp.h| 41 + src/Makefile.am | 1 + src/vulkan/meson.build | 1 + src/vulkan/registry/vk_mesa_query_timestamp.xml | 22 + 4 files changed, 65 insertions(+) create mode 100644 include/vulkan/vk_mesa_query_timestamp.h create mode 100644 src/vulkan/registry/vk_mesa_query_timestamp.xml diff --git a/include/vulkan/vk_mesa_query_timestamp.h b/include/vulkan/vk_mesa_query_timestamp.h new file mode 100644 index 000..20b53446e04 --- /dev/null +++ b/include/vulkan/vk_mesa_query_timestamp.h @@ -0,0 +1,41 @@ +/* + * Copyright © 2018 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef __VK_MESA_QUERY_TIMESTAMP_H__ +#define __VK_MESA_QUERY_TIMESTAMP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef VkResult (VKAPI_PTR *PFN_vkQueryCurrentTimestampMESA)(VkDevice device, uint64_t *timestamp); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueryCurrentTimestampMESA( +VkDevice_device, +uint64_t*timestamp); + +#ifdef __cplusplus +} +#endif + +#endif /* __VK_MESA_QUERY_TIMESTAMP_H__ */ + diff --git a/src/Makefile.am b/src/Makefile.am index 014ffaf3e29..74ff305d7c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -68,6 +68,7 @@ endif EXTRA_DIST += vulkan/registry/vk.xml EXTRA_DIST += vulkan/registry/vk_android_native_buffer.xml +EXTRA_DIST += vulkan/registry/vk_mesa_query_timestamp.xml if HAVE_AMD_DRIVERS SUBDIRS += amd diff --git a/src/vulkan/meson.build b/src/vulkan/meson.build index 3908005b8a0..6ab0966b7c5 100644 --- a/src/vulkan/meson.build +++ b/src/vulkan/meson.build @@ -20,6 +20,7 @@ vk_api_xml = files('registry/vk.xml') vk_android_native_buffer_xml = files('registry/vk_android_native_buffer.xml') +vk_mesa_query_timestamp_xml = files('registry/vk_mesa_query_timestamp.xml') inc_vulkan_util = include_directories('util') inc_vulkan_wsi = include_directories('wsi') diff --git a/src/vulkan/registry/vk_mesa_query_timestamp.xml b/src/vulkan/registry/vk_mesa_query_timestamp.xml new file mode 100644 index 000..7fd4d974872 --- /dev/null +++ b/src/vulkan/registry/vk_mesa_query_timestamp.xml @@ -0,0 +1,22 @@ + + + + +VkResult vkQueryCurrentTimestampMESA +VkDevice device +uint64_t* pTimestamp + + + + + + + + + + + + -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 19/21] vulkan: Add VK_GOOGLE_display_timing extension (x11 and display backends) [v2]
This adds support for the VK_GOOGLE_display timing extension, which provides two things: 1) Detailed information about when frames are displayed, including slack time between GPU execution and display frame. 2) Absolute time control over swapchain queue processing. This allows the application to request frames be displayed at specific absolute times, using the same timebase as that provided in vblank events. Support for this extension has been implemented for the x11 and display backends; adding support to other backends should be reasonable straightforward for one familiar with those systems and should not require any additional device-specific code. v2: Adjust GOOGLE_display_timing earliest value. The earliestPresentTime for an image cannot be before the previous image was displayed, or even a frame later (in FIFO mode). Make GOOGLE_display_timing use render completed time. Switch from VK_PIPELINE_TOP_OF_PIPE_BIT to VK_PIPELINE_STAGE_ALL_COMMANDS_BIT so that the time reported to applications as the end of rendering reflects the latest possible value to ensure that applications don't underestimate the amount of work done in the frame. Signed-off-by: Keith Packard--- src/vulkan/wsi/wsi_common.c | 276 +++- src/vulkan/wsi/wsi_common.h | 25 src/vulkan/wsi/wsi_common_display.c | 147 +-- src/vulkan/wsi/wsi_common_private.h | 35 + src/vulkan/wsi/wsi_common_x11.c | 69 - 5 files changed, 538 insertions(+), 14 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index f902950078a..d78d79325d5 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -45,11 +45,16 @@ wsi_device_init(struct wsi_device *wsi, PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func) WSI_GET_CB(GetPhysicalDeviceMemoryProperties); WSI_GET_CB(GetPhysicalDeviceQueueFamilyProperties); + WSI_GET_CB(GetPhysicalDeviceProperties); #undef WSI_GET_CB GetPhysicalDeviceMemoryProperties(pdevice, >memory_props); GetPhysicalDeviceQueueFamilyProperties(pdevice, >queue_family_count, NULL); + VkPhysicalDeviceProperties properties; + GetPhysicalDeviceProperties(pdevice, ); + wsi->timestamp_period = properties.limits.timestampPeriod; + #define WSI_GET_CB(func) \ wsi->func = (PFN_vk##func)proc_addr(pdevice, "vk" #func) WSI_GET_CB(AllocateMemory); @@ -58,14 +63,18 @@ wsi_device_init(struct wsi_device *wsi, WSI_GET_CB(BindImageMemory); WSI_GET_CB(BeginCommandBuffer); WSI_GET_CB(CmdCopyImageToBuffer); + WSI_GET_CB(CmdResetQueryPool); + WSI_GET_CB(CmdWriteTimestamp); WSI_GET_CB(CreateBuffer); WSI_GET_CB(CreateCommandPool); WSI_GET_CB(CreateFence); WSI_GET_CB(CreateImage); + WSI_GET_CB(CreateQueryPool); WSI_GET_CB(DestroyBuffer); WSI_GET_CB(DestroyCommandPool); WSI_GET_CB(DestroyFence); WSI_GET_CB(DestroyImage); + WSI_GET_CB(DestroyQueryPool); WSI_GET_CB(EndCommandBuffer); WSI_GET_CB(FreeMemory); WSI_GET_CB(FreeCommandBuffers); @@ -73,10 +82,14 @@ wsi_device_init(struct wsi_device *wsi, WSI_GET_CB(GetImageMemoryRequirements); WSI_GET_CB(GetImageSubresourceLayout); WSI_GET_CB(GetMemoryFdKHR); + WSI_GET_CB(GetPhysicalDeviceProperties); WSI_GET_CB(GetPhysicalDeviceFormatProperties); WSI_GET_CB(GetPhysicalDeviceFormatProperties2KHR); + WSI_GET_CB(GetPhysicalDeviceQueueFamilyProperties); + WSI_GET_CB(GetQueryPoolResults); WSI_GET_CB(ResetFences); WSI_GET_CB(QueueSubmit); + WSI_GET_CB(QueryCurrentTimestampMESA); WSI_GET_CB(WaitForFences); #undef WSI_GET_CB @@ -142,6 +155,8 @@ wsi_swapchain_init(const struct wsi_device *wsi, chain->device = device; chain->alloc = *pAllocator; chain->use_prime_blit = false; + chain->timing_insert = 0; + chain->timing_count = 0; chain->cmd_pools = vk_zalloc(pAllocator, sizeof(VkCommandPool) * wsi->queue_family_count, 8, @@ -215,6 +230,60 @@ align_u32(uint32_t v, uint32_t a) return (v + a - 1) & ~(a - 1); } +static VkResult +wsi_image_init_timestamp(const struct wsi_swapchain *chain, + struct wsi_image *image) +{ + const struct wsi_device *wsi = chain->wsi; + VkResult result; + /* Set up command buffer to get timestamp info */ + + result = wsi->CreateQueryPool(chain->device, + &(const VkQueryPoolCreateInfo) { +.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, + .queryType = VK_QUERY_TYPE_TIMESTAMP, + .queryCount = 1, + }, + NULL, + >query_pool); + + if (result != VK_SUCCESS) + goto fail; + + result =
[Mesa-dev] [PATCH mesa 09/21] radv: Add EXT_acquire_xlib_display to radv driver [v2]
This extension adds the ability to borrow an X RandR output for temporary use directly by a Vulkan application to the radv driver. v2: Simplify addition of VK_USE_PLATFORM_XLIB_XRANDR_KHR to vulkan_wsi_args Suggested-by: Eric EngestromSigned-off-by: Keith Packard --- src/amd/vulkan/Makefile.am | 7 +++ src/amd/vulkan/meson.build | 5 + src/amd/vulkan/radv_entrypoints_gen.py | 5 - src/amd/vulkan/radv_extensions.py | 11 ++- src/amd/vulkan/radv_wsi_display.c | 30 ++ 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am index f793dc2fa46..8328f9f0bd1 100644 --- a/src/amd/vulkan/Makefile.am +++ b/src/amd/vulkan/Makefile.am @@ -81,7 +81,14 @@ AM_CPPFLAGS += \ -DVK_USE_PLATFORM_DISPLAY_KHR VULKAN_SOURCES += $(VULKAN_WSI_DISPLAY_FILES) +endif + +if HAVE_XLIB_LEASE +AM_CPPFLAGS += \ + -DVK_USE_PLATFORM_XLIB_XRANDR_EXT \ + $(XCB_RANDR_CFLAGS) +VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS) endif if HAVE_PLATFORM_X11 diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build index 7db2d9f6c21..afd1a5dad31 100644 --- a/src/amd/vulkan/meson.build +++ b/src/amd/vulkan/meson.build @@ -118,6 +118,11 @@ if with_platform_display libradv_files += files('radv_wsi_display.c') endif +if with_xlib_lease + radv_deps += dep_xcb_xrandr + radv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT' +endif + libvulkan_radeon = shared_library( 'vulkan_radeon', [libradv_files, radv_entrypoints, radv_extensions_c, vk_format_table_c], diff --git a/src/amd/vulkan/radv_entrypoints_gen.py b/src/amd/vulkan/radv_entrypoints_gen.py index 8eb18e64b64..efef0592a61 100644 --- a/src/amd/vulkan/radv_entrypoints_gen.py +++ b/src/amd/vulkan/radv_entrypoints_gen.py @@ -449,7 +449,10 @@ def get_entrypoints_defines(doc): for extension in doc.findall('./extensions/extension[@platform]'): platform = extension.attrib['platform'] -define = 'VK_USE_PLATFORM_' + platform.upper() + '_KHR' +ext = '_KHR' +if platform.upper() == 'XLIB_XRANDR': +ext = '_EXT' +define = 'VK_USE_PLATFORM_' + platform.upper() + ext for entrypoint in extension.findall('./require/command'): fullname = entrypoint.attrib['name'] diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index d4783d33ee9..b4ad760c55d 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -87,6 +87,7 @@ EXTENSIONS = [ Extension('VK_KHR_multiview', 1, True), Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), +Extension('VK_EXT_acquire_xlib_display', 1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'), Extension('VK_EXT_debug_report', 9, True), Extension('VK_EXT_discard_rectangles',1, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), @@ -218,12 +219,12 @@ _TEMPLATE_C = Template(COPYRIGHT + """ #include "vk_util.h" /* Convert the VK_USE_PLATFORM_* defines to booleans */ -%for platform in ['ANDROID', 'WAYLAND', 'XCB', 'XLIB', 'DISPLAY']: -#ifdef VK_USE_PLATFORM_${platform}_KHR -# undef VK_USE_PLATFORM_${platform}_KHR -# define VK_USE_PLATFORM_${platform}_KHR true +%for platform in ['ANDROID_KHR', 'WAYLAND_KHR', 'XCB_KHR', 'XLIB_KHR', 'DISPLAY_KHR', 'XLIB_XRANDR_EXT']: +#ifdef VK_USE_PLATFORM_${platform} +# undef VK_USE_PLATFORM_${platform} +# define VK_USE_PLATFORM_${platform} true #else -# define VK_USE_PLATFORM_${platform}_KHR false +# define VK_USE_PLATFORM_${platform} false #endif %endfor diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c index deaf61ce0df..d7a5956ad97 100644 --- a/src/amd/vulkan/radv_wsi_display.c +++ b/src/amd/vulkan/radv_wsi_display.c @@ -152,3 +152,33 @@ radv_ReleaseDisplayEXT(VkPhysicalDevice physical_device, >wsi_device, display); } + +#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +VkResult +radv_AcquireXlibDisplayEXT(VkPhysicalDevice physical_device, + Display *dpy, + VkDisplayKHR display) +{ + RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device); + + return wsi_acquire_xlib_display(physical_device, + >wsi_device, + dpy, + display); +} + +VkResult +radv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device, + Display *dpy, + RROutput
[Mesa-dev] [PATCH mesa 04/21] vulkan: Add EXT_direct_mode_display
Add support for the EXT_direct_mode_display extension. This just provides the vkReleaseDisplayEXT function. Signed-off-by: Keith Packard--- src/vulkan/wsi/wsi_common_display.c | 17 + src/vulkan/wsi/wsi_common_display.h | 5 + 2 files changed, 22 insertions(+) diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index be31043f3de..45626541022 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -1399,3 +1399,20 @@ wsi_display_finish_wsi(struct wsi_device *wsi_device, vk_free(alloc, wsi); } } + +/* + * Implement vkReleaseDisplay + */ +VkResult +wsi_release_display(VkPhysicalDevicephysical_device, +struct wsi_device *wsi_device, +VkDisplayKHRdisplay) +{ + struct wsi_display *wsi = (struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY]; + + if (wsi->fd >= 0) { + close(wsi->fd); + wsi->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(VkPhysicalDevicephysical_device, +struct wsi_device *wsi_device, +VkDisplayKHRdisplay); + #endif -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 06/21] radv: Add EXT_direct_mode_display to radv driver
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 +++ 2 files changed, 12 insertions(+) diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 169cace577e..d4783d33ee9 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -86,6 +86,7 @@ EXTENSIONS = [ Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'), Extension('VK_KHR_multiview', 1, True), Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), +Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_debug_report', 9, True), Extension('VK_EXT_discard_rectangles',1, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c index f98a071513d..deaf61ce0df 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, + >wsi_device, + display); +} -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH mesa 03/21] radv: Add KHR_display extension to radv [v3]
This adds support for the KHR_display extension to the radv Vulkan driver. The driver now attempts to open the master DRM node when the KHR_display extension is requested so that the common winsys code can perform the necessary operations. v2: * Simplify addition of VK_USE_PLATFORM_DISPLAY_KHR to vulkan_wsi_args Suggested-by: Eric Engestromv3: Adapt to new wsi_device_init API (added display_fd) Signed-off-by: Keith Packard --- src/amd/vulkan/Makefile.am| 8 +++ src/amd/vulkan/Makefile.sources | 3 + src/amd/vulkan/meson.build| 5 ++ src/amd/vulkan/radv_device.c | 17 + src/amd/vulkan/radv_extensions.py | 7 +- src/amd/vulkan/radv_private.h | 1 + src/amd/vulkan/radv_wsi_display.c | 143 ++ 7 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 src/amd/vulkan/radv_wsi_display.c diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am index 80937e38d38..f793dc2fa46 100644 --- a/src/amd/vulkan/Makefile.am +++ b/src/amd/vulkan/Makefile.am @@ -76,6 +76,14 @@ VULKAN_LIB_DEPS = \ $(DLOPEN_LIBS) \ -lm +if HAVE_PLATFORM_DISPLAY +AM_CPPFLAGS += \ + -DVK_USE_PLATFORM_DISPLAY_KHR + +VULKAN_SOURCES += $(VULKAN_WSI_DISPLAY_FILES) + +endif + if HAVE_PLATFORM_X11 AM_CPPFLAGS += \ $(XCB_DRI3_CFLAGS) \ diff --git a/src/amd/vulkan/Makefile.sources b/src/amd/vulkan/Makefile.sources index a510d88d965..618a6cdaed0 100644 --- a/src/amd/vulkan/Makefile.sources +++ b/src/amd/vulkan/Makefile.sources @@ -78,6 +78,9 @@ VULKAN_WSI_WAYLAND_FILES := \ VULKAN_WSI_X11_FILES := \ radv_wsi_x11.c +VULKAN_WSI_DISPLAY_FILES := \ + radv_wsi_display.c + VULKAN_GENERATED_FILES := \ radv_entrypoints.c \ radv_entrypoints.h \ diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build index 98051560a52..7db2d9f6c21 100644 --- a/src/amd/vulkan/meson.build +++ b/src/amd/vulkan/meson.build @@ -113,6 +113,11 @@ if with_platform_wayland libradv_files += files('radv_wsi_wayland.c') endif +if with_platform_display + radv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR' + libradv_files += files('radv_wsi_display.c') +endif + libvulkan_radeon = shared_library( 'vulkan_radeon', [libradv_files, radv_entrypoints, radv_extensions_c, vk_format_table_c], diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 35fd1ef6b29..e9476777b45 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -257,6 +257,23 @@ radv_physical_device_init(struct radv_physical_device *device, goto fail; } + if (instance->enabled_extensions.KHR_display) { + master_fd = open(drm_device->nodes[DRM_NODE_PRIMARY], O_RDWR | O_CLOEXEC); + if (master_fd >= 0) { + uint32_t accel_working = 0; + struct drm_amdgpu_info request = { + .return_pointer = (uintptr_t)_working, + .return_size = sizeof(accel_working), + .query = AMDGPU_INFO_ACCEL_WORKING + }; + + if (drmCommandWrite(master_fd, DRM_AMDGPU_INFO, , sizeof (struct drm_amdgpu_info)) < 0 || !accel_working) { + close(master_fd); + master_fd = -1; + } + } + } + device->master_fd = master_fd; device->local_fd = fd; device->ws->query_info(device->ws, >rad_info); diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 469b09a160d..169cace577e 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -85,6 +85,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_multiview', 1, True), +Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_debug_report', 9, True), Extension('VK_EXT_discard_rectangles',1, True), Extension('VK_EXT_external_memory_dma_buf', 1, True), @@ -216,7 +217,7 @@ _TEMPLATE_C = Template(COPYRIGHT + """ #include "vk_util.h" /* Convert the VK_USE_PLATFORM_* defines to booleans */ -%for platform in ['ANDROID', 'WAYLAND', 'XCB', 'XLIB']: +%for platform in ['ANDROID', 'WAYLAND', 'XCB', 'XLIB', 'DISPLAY']: #ifdef VK_USE_PLATFORM_${platform}_KHR # undef VK_USE_PLATFORM_${platform}_KHR # define VK_USE_PLATFORM_${platform}_KHR true @@ -235,7 +236,9 @@ _TEMPLATE_C = Template(COPYRIGHT + """ #define RADV_HAS_SURFACE (VK_USE_PLATFORM_WAYLAND_KHR || \\
[Mesa-dev] [Bug 105171] performance regression (3x slower) running glamor with PutImage workload (radeonsi)
https://bugs.freedesktop.org/show_bug.cgi?id=105171 --- Comment #5 from Dieter Nützel--- Marek, any ideas? My Polaris 20 is somewhat faster, but by no means like Nvidia blob. git revert xxx do NOT work, clean. Someone on Phoronix mentioned that fglrx was even much faster then Mesa git before your commit. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Make gl_vertex_array contain pointers to first order VAO members.
Hi Emil, On Tuesday, 6 March 2018 12:13:07 CET Emil Velikov wrote: > Just putting forward some suggestions. Please take them with a pinch of salt. You are welcome! > Wondering if one cannot split this up somehow. Perhaps introduce > gl_vertex_array::VertexAttrib first and the gl_vertex_buffer_binding > struct as 2/2? > It's a big thing to suggest, yet it would make it easier to catch all > the subtleties. Hmm, yes I was playing with several steps and variants as I also dont like this huge changes. Initially I had just mechanic changes, like done with sed. Easier to review, but made about any 80 column wrapping void. And that series just touched all the files multiple times. Which did not look better to me. May be this was only my taste for the series, but finally I ended with this blob as the first public attempt. And luckily I already got some review! The most brittle part for me is the classic nvidia backend as I have nothing to thest that. All tnl based drivers should be well coverd with testing on classic swrast, so I don't expect surprises with these changes there. Gallium type drivers I can test with radeonsi. And the intel drivers get testing with my notebook. May be I am also pushing without special treatment of classic nvidia but any help there not to recieve bugzilla entries at my side is apprecheated. > > @@ -462,21 +459,8 @@ void > > _mesa_update_vao_derived_arrays(struct gl_context *ctx, > > struct gl_vertex_array_object *vao) > > { > > - GLbitfield arrays = vao->NewArrays; > > - > > /* Make sure we do not run into problems with shared objects */ > > assert(!vao->SharedAndImmutable || vao->NewArrays == 0); > > - > > - while (arrays) { > > - const int attrib = u_bit_scan(); > > - struct gl_vertex_array *array = >_VertexArray[attrib]; > > - const struct gl_array_attributes *attribs = > > - >VertexAttrib[attrib]; > > - const struct gl_vertex_buffer_binding *buffer_binding = > > - >BufferBinding[attribs->BufferBindingIndex]; > > - > > - _mesa_update_vertex_array(ctx, array, attribs, buffer_binding); > > - } > ... and we can drop _mesa_update_vao_derived_arrays() with a follow-up patch? Not that, but to repopulate that function with a not so distant change :-) I will establish some unique binding information in the VAO and that must be done at exactly that entry points. I can remove that but it will reappear again in a hand full of weeks at most ... > > +/** > > + * Vertex array information which is derived from gl_array_attributes > > + * and gl_vertex_buffer_binding information. Used by the VBO module and > > + * device drivers. > > + */ > > +struct gl_vertex_array > > +{ > > + /** Vertex attribute array */ > > + const struct gl_array_attributes *VertexAttrib; > > + /** Vertex buffer binding */ > > + const struct gl_vertex_buffer_binding *BufferBinding; > > Worth expanding the documentation to cover the const-ness or lifetime? > AKA why were we coping all of the data before, and we don't need to now. > > Mildly related: > AEarray and AEattrib look surprisingly similar to gl_vertex_array now. > I'm guessing that you're heading there next? Probably not. The ae things are much closer to vbo_loopback*. The anticipated future for struct gl_vertex_array is to basically get rid of it entirely in modern drivers and the uppermost gl layers. Probably it will still survive in the classic tnl driver path, so it probably gets pushed there and renamed to tnl_vertex_array... > > +/** > > + * Copy one vertex array to another. > > + */ > > +static inline void > > +_mesa_copy_vertex_array(struct gl_vertex_array *dst, > > +const struct gl_vertex_array *src) > > +{ > > + dst->VertexAttrib = src->VertexAttrib; > > + dst->BufferBinding = src->BufferBinding; > > +} > > + > Say "Shallow copy" in the inline comment? Will to ... best Mathias ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Make gl_vertex_array contain pointers to first order VAO members.
Hi Brian, > Looks good to me. Definitely seems like another step in the right > direction. > > Just two minor comments: > > 1. A lot of local vars are named "glarray" and "glbinding". I'd suggest > dropping the "gl" part since it doesn't really help with readability > (everything's "gl" in this code :-) ). Will do! It initially helped me to grep for this kind of stuff. The i965 parts do so with the 'struct gl_vertex_array *glarray' probably to distinguish from intel driver internal array/attrib/binding structs. But yes, may be I can then also get rid of some newlines ... > 2. In a future patch you could probably simplify st_pipe_vertex_format() > to be: > > enum pipe_format > st_pipe_vertex_format(const struct gl_array_attributes *attribs) Definitely. The next lower layer parts will get some cleanup once all the surrounding stuff is in place. Expecially the gallium backends gain from direct _DrawVAO use as in some next step I will scan for duplicate bindings in the VAO and do only use the net information about that unique binding set when translating to gallium. I am still experimenting with this to see what fits best for gallium and i965. I also had one attempt to factor out a struct gl_vertex_format that only describes exactly that. That could then be fed into st_pipe_vertex_format and the equivalent brw_get_vertex_surface_type in the i965 driver. But lets finish at first the complete switch to _DrawVAO. This current patch aims to mostly prepare those current well cpu optimized backend drivers to not use gl_vertex_array anymore and for that the current values must be represented as aequivalent structs as they appear in the VAO. > Reviewed-by: Brian PaulThanks for the review!! best Mathias ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 105171] performance regression (3x slower) running glamor with PutImage workload (radeonsi)
https://bugs.freedesktop.org/show_bug.cgi?id=105171 --- Comment #4 from Clemens Eisserer--- just some unrelated, interesting numbers: Sync time adjustment is 0.0355 msecs. 800 reps @ 0.0012 msec (816000.0/sec): ShmPutImage 10x10 square 800 reps @ 0.0012 msec (818000.0/sec): ShmPutImage 10x10 square These are the results achieved by a Geforce-8800GTS (11 years old dGPU) using the proprietary driver in the same system. Confirms my subjective experience - the glamor based open-source driver stack is really slow for some operations. It seems the proprietary nvidia driver has way lower driver overhead (considering the 10x10 putimage won't saturate the GPU). -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] squash! i965/fs: Merge CMP and SEL into CSEL on Gen8+
Looks good to me. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri_util: when overriding, always reset the core version
On 03/07/2018 04:29 PM, Emil Velikov wrote: On 7 March 2018 at 06:02, Tapani Pälliwrote: On 03/07/2018 12:36 AM, Marek Olšák wrote: On Mon, Mar 5, 2018 at 7:33 AM, Tapani Pälli wrote: Hi; On 03/02/2018 03:25 PM, Andres Gomez wrote: This way we won't fail when validating just because we may have a non overriden core version that is lower than the requested one, even when the compat version is high enough. Do I understand correctly that this happens because when version asked is 3.2 then we always do core context, even when overriding to compat profile? No. 3.2COMPAT will set both core and compat version limits to 3.2. I see, I was trying to understand why core version matters when using compat profile but I'm not sure I get it, it probably should not matter. In some cases you'd get a program using third party middle-ware. For many instances of those one component is using a core while the other a compat profile. Right, that makes sense. Thanks Emil! Admittedly the whole extension overriding is a bit of a band-aid (hack) and it's not worth spending much too time on it ;-) -Emil // Tapani ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 103852] Rendering errors when running dolphin-emu with Vulkan backend, radv (Super Smash Bros. Melee)
https://bugs.freedesktop.org/show_bug.cgi?id=103852 --- Comment #4 from Ben Clapp--- Bug(s) still present as of 17.3.6. (The issues related to frame drops/frame presentation don't seem to be an issue at this point, but crop setting still results in black screen, incorrect colors, etc. persist) -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 69682] mesa-9.2.0 and glamor-0.5.1 crash X - (?) _mesa_GetVertexAttribdv (?)
https://bugs.freedesktop.org/show_bug.cgi?id=69682 Timothy Arcerichanged: What|Removed |Added CC||aux...@gmail.com --- Comment #9 from Timothy Arceri --- *** Bug 66359 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 66359] Mesa crashes in _mesa_VertexAttrib2dvNV on starting KDE 4.11
https://bugs.freedesktop.org/show_bug.cgi?id=66359 Timothy Arcerichanged: What|Removed |Added Resolution|--- |DUPLICATE Status|NEW |RESOLVED --- Comment #9 from Timothy Arceri --- *** This bug has been marked as a duplicate of bug 69682 *** -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 17/22] nir: Narrow some dot product operations
On 03/05/2018 04:35 PM, Matt Turner wrote: > On Fri, Feb 23, 2018 at 3:56 PM, Ian Romanickwrote: >> From: Ian Romanick >> >> On vector platforms, this helps elide some constant loads. >> >> No changes on Broadwell or Skylake. >> >> Haswell >> total instructions in shared programs: 13093793 -> 13060163 (-0.26%) >> instructions in affected programs: 1277532 -> 1243902 (-2.63%) >> helped: 13216 >> HURT: 95 > > What's going on in the hurt shaders? I'm not completely sure. All of these shaders are negatively affected by the DPH transformation. Only one of the shaders is small enough (19 instructions) to easily examine. In that case, it looks like a couple things end up not getting loaded via VF. Only one of those is the DPH operand. There are appear to be changes in the constant loading in the others as well, which causes the shaders to diverge slightly after about 5 instruction making comparisons between the 70+ instruction shaders frustrating at best. Many of the shorter shaders had flow control, so that exacerbated the issue. I tried a couple modifications to the DPH pattern including 'vec4(is_used_once)' and 'c(is_not_const)'. These had missed results in cycles, and didn't consistently help the instruction counts in the 95. I did discover that I should have listed the transformations in the opposite order. As is, code that matches the last fdot4 pattern will never become a multiply (speculation) because the previous transformations will gradually convert it to a fdot2. Flipping the order helped instructions in 1 program but hurt cycles. Looking at the changed shader, it appears that flipping the order allows an fdot4 to be converted to and fdot2 instead of an fdot3. This allows CSE to eliminate the (new) fdot2. Oddly, flipping the order made a shader-db slightly slower... 1.113±0.711 seconds (0.429%±0.274%) at n=10 for a HSW run on my quadcore HSW desktop. I would have expected it to be slightly faster. *shrug* ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 12652] RV370 [FireGL V3100 (PCIE)] Xorg Crash with Option "DRI" "false"
https://bugs.freedesktop.org/show_bug.cgi?id=12652 Timothy Arcerichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #6 from Timothy Arceri --- No response. Closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 21/22] i965/vec4: Allow CSE on subset VF constant loads
On 03/05/2018 04:53 PM, Kenneth Graunke wrote: > On Friday, February 23, 2018 3:56:06 PM PST Ian Romanick wrote: >> From: Ian Romanick>> >> No changes on other platforms. >> >> Haswell, Ivy Bridge, and Sandy Bridge had similar results. (Haswell shown) >> total instructions in shared programs: 13059891 -> 13059884 (<.01%) >> instructions in affected programs: 431 -> 424 (-1.62%) >> helped: 7 >> HURT: 0 >> helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 >> helped stats (rel) min: 1.19% max: 5.26% x̄: 2.05% x̃: 1.49% >> 95% mean confidence interval for instructions value: -1.00 -1.00 >> 95% mean confidence interval for instructions %-change: -3.39% -0.71% >> Instructions are helped. >> >> total cycles in shared programs: 409260032 -> 409260018 (<.01%) >> cycles in affected programs: 4228 -> 4214 (-0.33%) >> helped: 7 >> HURT: 0 >> helped stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2 >> helped stats (rel) min: 0.28% max: 2.04% x̄: 0.54% x̃: 0.28% >> 95% mean confidence interval for cycles value: -2.00 -2.00 >> 95% mean confidence interval for cycles %-change: -1.15% 0.07% >> >> Inconclusive result (%-change mean confidence interval includes 0). >> >> Signed-off-by: Ian Romanick >> --- >> src/intel/compiler/brw_vec4_cse.cpp | 21 + >> 1 file changed, 21 insertions(+) >> >> diff --git a/src/intel/compiler/brw_vec4_cse.cpp >> b/src/intel/compiler/brw_vec4_cse.cpp >> index aa2f127..3302939 100644 >> --- a/src/intel/compiler/brw_vec4_cse.cpp >> +++ b/src/intel/compiler/brw_vec4_cse.cpp >> @@ -104,6 +104,27 @@ operands_match(const vec4_instruction *a, const >> vec4_instruction *b) >>return xs[0].equals(ys[0]) && >> ((xs[1].equals(ys[1]) && xs[2].equals(ys[2])) || >>(xs[2].equals(ys[1]) && xs[1].equals(ys[2]))); >> + } else if (a->opcode == BRW_OPCODE_MOV && >> + xs[0].file == IMM && >> + xs[0].type == BRW_REGISTER_TYPE_VF) { >> + src_reg tmp_x = xs[0]; >> + src_reg tmp_y = ys[0]; >> + >> + /* Smash out the values that are not part of the writemask. Otherwise >> + * the equals and negative_equals operators will fail due to >> mismatches >> + * in unused components. >> + */ >> + static const uint32_t mask[] = { >> + 0x, 0x00ff, 0xff00, 0x, >> + 0x00ff, 0x00ff00ff, 0x0000, 0x00ff, >> + 0xff00, 0xffff, 0xff00ff00, 0xff00, >> + 0x, 0x00ff, 0xff00, 0x >> + }; > > This looks a bit crazy at first glance...it isn't though, it's just a > mapping from WRITEMASK_* to the proper byte masks. But I think it might > be clearer to write it with an explicit formula: > > unsigned ab_writemask = a->dst.writemask & b->dst.writemask; > uint32_t mask = ((ab_writemask & WRITEMASK_X) ? 0x00ff : 0) | > ((ab_writemask & WRITEMASK_Y) ? 0xff00 : 0) | > ((ab_writemask & WRITEMASK_Z) ? 0x00ff : 0) | > ((ab_writemask & WRITEMASK_W) ? 0xff00 : 0); > tmp_x.ud &= mask; > tmp_y.ud &= mask; I was going to complain that this would be bigger / less efficient / something. However, in a release build this is actually 48 bytes smaller. :) > This makes it pretty obvious what's going on. > > Either way (though I prefer mine), > Reviewed-by: Kenneth Graunke > >> + >> + tmp_x.ud &= mask[a->dst.writemask & b->dst.writemask]; >> + tmp_y.ud &= mask[a->dst.writemask & b->dst.writemask]; >> + >> + return tmp_x.equals(tmp_y); >> } else if (!a->is_commutative()) { >>return xs[0].equals(ys[0]) && xs[1].equals(ys[1]) && >> xs[2].equals(ys[2]); >> } else { >> > signature.asc Description: OpenPGP digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/56] anv/entrypoints: Generalize the string map a bit
Yes, that is what happened. That said, wrote that patch in September and you've had about 6 months to look at it. The only particularly active Mesa contributor who hasn't had access is Ilia. On March 7, 2018 20:13:28 Dylan Bakerwrote: You sent out a 56 patch series and didn't even wait 12 hours before pushing it? Quoting Jason Ekstrand (2018-03-07 19:56:21) You're 4.5 hours too late, I'm afraid. I'd be happy to take some patches though. :-) On Wed, Mar 7, 2018 at 4:42 PM, Dylan Baker wrote: Quoting Jason Ekstrand (2018-03-07 06:34:52) > The original string map assumed that the mapping from strings to > entrypoints was a bijection. This will not be true the moment we > add entrypoint aliasing. This reworks things to be an arbitrary map > from strings to non-negative signed integers. The old one also had a > potential bug if we ever had a hash collision because it didn't do the > strcmp inside the lookup loop. While we're at it, we break things out > into a helpful class. > > Reviewed-by: Lionel Landwerlin > Reviewed-by: Samuel Iglesias Gonsálvez > --- > src/intel/vulkan/anv_entrypoints_gen.py | 188 +--- > 1 file changed, 103 insertions(+), 85 deletions(-) > > diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/ anv_entrypoints_gen.py > index 34ffedb..dc0f0e9 100644 > --- a/src/intel/vulkan/anv_entrypoints_gen.py > +++ b/src/intel/vulkan/anv_entrypoints_gen.py > @@ -115,9 +115,10 @@ TEMPLATE_C = Template(u"""\ > > #include "anv_private.h" > > -struct anv_entrypoint { > +struct string_map_entry { > uint32_t name; > uint32_t hash; > + uint32_t num; > }; > > /* We use a big string constant to avoid lots of reloctions from the entry > @@ -126,17 +127,60 @@ struct anv_entrypoint { > */ > > static const char strings[] = > -% for e in entrypoints: > - "${e.name}\\0" > +% for s in strmap.sorted_strings: > + "${s.string}\\0" > % endfor > ; > > -static const struct anv_entrypoint entrypoints[] = { > -% for e in entrypoints: > - [${e.num}] = { ${offsets[e.num]}, ${'{:0=#8x}'.format(e.get_c_hash ())} }, /* ${e.name} */ > +static const struct string_map_entry string_map_entries[] = { > +% for s in strmap.sorted_strings: > + { ${s.offset}, ${'{:0=#8x}'.format(s.hash)}, ${s.num} }, /* $ {s.string} */ > % endfor > }; > > +/* Hash table stats: > + * size ${len(strmap.sorted_strings)} entries > + * collisions entries: > +% for i in xrange(10): > + * ${i}${'+' if i == 9 else ' '} ${strmap.collisions[i]} > +% endfor > + */ > + > +#define none 0x > +static const uint16_t string_map[${strmap.hash_size}] = { > +% for e in strmap.mapping: > + ${ '{:0=#6x}'.format(e) if e >= 0 else 'none' }, > +% endfor > +}; > + > +static int > +string_map_lookup(const char *str) > +{ > + static const uint32_t prime_factor = ${strmap.prime_factor}; > + static const uint32_t prime_step = ${strmap.prime_step}; > + const struct string_map_entry *e; > + uint32_t hash, h; > + uint16_t i; > + const char *p; > + > + hash = 0; > + for (p = str; *p; p++) > + hash = hash * prime_factor + *p; > + > + h = hash; > + while (1) { > + i = string_map[h & ${strmap.hash_mask}]; > + if (i == none) > + return -1; > + e = _map_entries[i]; > + if (e->hash == hash && strcmp(str, strings + e->name) == 0) > + return e->num; > + h += prime_step; > + } > + > + return -1; > +} > + > /* Weak aliases for all potential implementations. These will resolve to > * NULL if they're not defined, which lets the resolve_entrypoint() function > * either pick the correct entry point. > @@ -275,54 +319,10 @@ anv_resolve_entrypoint(const struct gen_device_info *devinfo, uint32_t index) > return anv_dispatch_table.entrypoints[index]; > } > > -/* Hash table stats: > - * size ${hash_size} entries > - * collisions entries: > -% for i in xrange(10): > - * ${i}${'+' if i == 9 else ''} ${collisions[i]} > -% endfor > - */ > - > -#define none ${'{:#x}'.format(none)} > -static const uint16_t map[] = { > -% for i in xrange(0, hash_size, 8): > - % for j in xrange(i, i + 8): > - ## This is 6 because the 0x is counted in the length > - % if mapping[j] & 0x == 0x: > - none, > - % else: > - ${'{:0=#6x}'.format(mapping[j] & 0x)}, > - % endif > -
Re: [Mesa-dev] [PATCH 04/56] anv/entrypoints: Generalize the string map a bit
You sent out a 56 patch series and didn't even wait 12 hours before pushing it? Quoting Jason Ekstrand (2018-03-07 19:56:21) > You're 4.5 hours too late, I'm afraid. I'd be happy to take some patches > though. :-) > > On Wed, Mar 7, 2018 at 4:42 PM, Dylan Bakerwrote: > > Quoting Jason Ekstrand (2018-03-07 06:34:52) > > The original string map assumed that the mapping from strings to > > entrypoints was a bijection. This will not be true the moment we > > add entrypoint aliasing. This reworks things to be an arbitrary map > > from strings to non-negative signed integers. The old one also had a > > potential bug if we ever had a hash collision because it didn't do the > > strcmp inside the lookup loop. While we're at it, we break things out > > into a helpful class. > > > > Reviewed-by: Lionel Landwerlin > > Reviewed-by: Samuel Iglesias Gonsálvez > > --- > > src/intel/vulkan/anv_entrypoints_gen.py | 188 > +--- > > 1 file changed, 103 insertions(+), 85 deletions(-) > > > > diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/ > anv_entrypoints_gen.py > > index 34ffedb..dc0f0e9 100644 > > --- a/src/intel/vulkan/anv_entrypoints_gen.py > > +++ b/src/intel/vulkan/anv_entrypoints_gen.py > > @@ -115,9 +115,10 @@ TEMPLATE_C = Template(u"""\ > > > > #include "anv_private.h" > > > > -struct anv_entrypoint { > > +struct string_map_entry { > > uint32_t name; > > uint32_t hash; > > + uint32_t num; > > }; > > > > /* We use a big string constant to avoid lots of reloctions from the > entry > > @@ -126,17 +127,60 @@ struct anv_entrypoint { > > */ > > > > static const char strings[] = > > -% for e in entrypoints: > > - "${e.name}\\0" > > +% for s in strmap.sorted_strings: > > + "${s.string}\\0" > > % endfor > > ; > > > > -static const struct anv_entrypoint entrypoints[] = { > > -% for e in entrypoints: > > - [${e.num}] = { ${offsets[e.num]}, ${'{:0=#8x}'.format(e.get_c_hash > ())} }, /* ${e.name} */ > > +static const struct string_map_entry string_map_entries[] = { > > +% for s in strmap.sorted_strings: > > + { ${s.offset}, ${'{:0=#8x}'.format(s.hash)}, ${s.num} }, /* $ > {s.string} */ > > % endfor > > }; > > > > +/* Hash table stats: > > + * size ${len(strmap.sorted_strings)} entries > > + * collisions entries: > > +% for i in xrange(10): > > + * ${i}${'+' if i == 9 else ' '} ${strmap.collisions[i]} > > +% endfor > > + */ > > + > > +#define none 0x > > +static const uint16_t string_map[${strmap.hash_size}] = { > > +% for e in strmap.mapping: > > + ${ '{:0=#6x}'.format(e) if e >= 0 else 'none' }, > > +% endfor > > +}; > > + > > +static int > > +string_map_lookup(const char *str) > > +{ > > + static const uint32_t prime_factor = ${strmap.prime_factor}; > > + static const uint32_t prime_step = ${strmap.prime_step}; > > + const struct string_map_entry *e; > > + uint32_t hash, h; > > + uint16_t i; > > + const char *p; > > + > > + hash = 0; > > + for (p = str; *p; p++) > > + hash = hash * prime_factor + *p; > > + > > + h = hash; > > + while (1) { > > + i = string_map[h & ${strmap.hash_mask}]; > > + if (i == none) > > + return -1; > > + e = _map_entries[i]; > > + if (e->hash == hash && strcmp(str, strings + e->name) == 0) > > + return e->num; > > + h += prime_step; > > + } > > + > > + return -1; > > +} > > + > > /* Weak aliases for all potential implementations. These will resolve > to > > * NULL if they're not defined, which lets the resolve_entrypoint() > function > > * either pick the correct entry point. > > @@ -275,54 +319,10 @@ anv_resolve_entrypoint(const struct > gen_device_info > *devinfo, uint32_t index) > > return anv_dispatch_table.entrypoints[index]; > > } > > > > -/* Hash table stats: > > - * size ${hash_size} entries > > - * collisions entries: > > -% for i in xrange(10): > > - * ${i}${'+' if i == 9 else ''} ${collisions[i]} > > -% endfor > > - */ > > - > > -#define none ${'{:#x}'.format(none)} > > -static const uint16_t map[] = { > > -% for i in xrange(0, hash_size, 8): > > - % for j in xrange(i, i + 8): > > - ## This is 6 because the 0x is counted in the length > > - % if mapping[j] & 0x == 0x: > > - none, > > - % else: > > - ${'{:0=#6x}'.format(mapping[j] & 0x)}, > > - % endif > >
Re: [Mesa-dev] [PATCH 04/56] anv/entrypoints: Generalize the string map a bit
You're 4.5 hours too late, I'm afraid. I'd be happy to take some patches though. :-) On Wed, Mar 7, 2018 at 4:42 PM, Dylan Bakerwrote: > Quoting Jason Ekstrand (2018-03-07 06:34:52) > > The original string map assumed that the mapping from strings to > > entrypoints was a bijection. This will not be true the moment we > > add entrypoint aliasing. This reworks things to be an arbitrary map > > from strings to non-negative signed integers. The old one also had a > > potential bug if we ever had a hash collision because it didn't do the > > strcmp inside the lookup loop. While we're at it, we break things out > > into a helpful class. > > > > Reviewed-by: Lionel Landwerlin > > Reviewed-by: Samuel Iglesias Gonsálvez > > --- > > src/intel/vulkan/anv_entrypoints_gen.py | 188 > +--- > > 1 file changed, 103 insertions(+), 85 deletions(-) > > > > diff --git a/src/intel/vulkan/anv_entrypoints_gen.py > b/src/intel/vulkan/anv_entrypoints_gen.py > > index 34ffedb..dc0f0e9 100644 > > --- a/src/intel/vulkan/anv_entrypoints_gen.py > > +++ b/src/intel/vulkan/anv_entrypoints_gen.py > > @@ -115,9 +115,10 @@ TEMPLATE_C = Template(u"""\ > > > > #include "anv_private.h" > > > > -struct anv_entrypoint { > > +struct string_map_entry { > > uint32_t name; > > uint32_t hash; > > + uint32_t num; > > }; > > > > /* We use a big string constant to avoid lots of reloctions from the > entry > > @@ -126,17 +127,60 @@ struct anv_entrypoint { > > */ > > > > static const char strings[] = > > -% for e in entrypoints: > > -"${e.name}\\0" > > +% for s in strmap.sorted_strings: > > +"${s.string}\\0" > > % endfor > > ; > > > > -static const struct anv_entrypoint entrypoints[] = { > > -% for e in entrypoints: > > -[${e.num}] = { ${offsets[e.num]}, ${'{:0=#8x}'.format(e.get_c_hash())} > }, /* ${e.name} */ > > +static const struct string_map_entry string_map_entries[] = { > > +% for s in strmap.sorted_strings: > > +{ ${s.offset}, ${'{:0=#8x}'.format(s.hash)}, ${s.num} }, /* > ${s.string} */ > > % endfor > > }; > > > > +/* Hash table stats: > > + * size ${len(strmap.sorted_strings)} entries > > + * collisions entries: > > +% for i in xrange(10): > > + * ${i}${'+' if i == 9 else ' '} ${strmap.collisions[i]} > > +% endfor > > + */ > > + > > +#define none 0x > > +static const uint16_t string_map[${strmap.hash_size}] = { > > +% for e in strmap.mapping: > > +${ '{:0=#6x}'.format(e) if e >= 0 else 'none' }, > > +% endfor > > +}; > > + > > +static int > > +string_map_lookup(const char *str) > > +{ > > +static const uint32_t prime_factor = ${strmap.prime_factor}; > > +static const uint32_t prime_step = ${strmap.prime_step}; > > +const struct string_map_entry *e; > > +uint32_t hash, h; > > +uint16_t i; > > +const char *p; > > + > > +hash = 0; > > +for (p = str; *p; p++) > > +hash = hash * prime_factor + *p; > > + > > +h = hash; > > +while (1) { > > +i = string_map[h & ${strmap.hash_mask}]; > > +if (i == none) > > + return -1; > > +e = _map_entries[i]; > > +if (e->hash == hash && strcmp(str, strings + e->name) == 0) > > +return e->num; > > +h += prime_step; > > +} > > + > > +return -1; > > +} > > + > > /* Weak aliases for all potential implementations. These will resolve to > > * NULL if they're not defined, which lets the resolve_entrypoint() > function > > * either pick the correct entry point. > > @@ -275,54 +319,10 @@ anv_resolve_entrypoint(const struct > gen_device_info *devinfo, uint32_t index) > >return anv_dispatch_table.entrypoints[index]; > > } > > > > -/* Hash table stats: > > - * size ${hash_size} entries > > - * collisions entries: > > -% for i in xrange(10): > > - * ${i}${'+' if i == 9 else ''} ${collisions[i]} > > -% endfor > > - */ > > - > > -#define none ${'{:#x}'.format(none)} > > -static const uint16_t map[] = { > > -% for i in xrange(0, hash_size, 8): > > - % for j in xrange(i, i + 8): > > -## This is 6 because the 0x is counted in the length > > -% if mapping[j] & 0x == 0x: > > - none, > > -% else: > > - ${'{:0=#6x}'.format(mapping[j] & 0x)}, > > -% endif > > - % endfor > > -% endfor > > -}; > > - > > int > > anv_get_entrypoint_index(const char *name) > > { > > - static const uint32_t prime_factor = ${prime_factor}; > > - static const uint32_t prime_step = ${prime_step}; > > - const struct anv_entrypoint *e; > > - uint32_t hash, h, i; > > - const char *p; > > - > > - hash = 0; > > - for (p = name; *p; p++) > > - hash = hash * prime_factor + *p; > > - > > - h = hash; > > - do { > > - i = map[h & ${hash_mask}]; > > - if (i == none) > > - return -1; > > - e = [i]; > > - h += prime_step; > > - } while (e->hash != hash); > > - > > - if
[Mesa-dev] [Bug 62046] [nouveau] Power Point Viewer crashed at start
https://bugs.freedesktop.org/show_bug.cgi?id=62046 Timothy Arcerichanged: What|Removed |Added Status|NEEDINFO|RESOLVED Resolution|--- |INVALID --- Comment #2 from Timothy Arceri --- No response. Closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 104625] semicolon after if
https://bugs.freedesktop.org/show_bug.cgi?id=104625 Timothy Arcerichanged: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #2 from Timothy Arceri --- Fixed by: author Thomas Hellstrom commit 80c31f7837cd319910d94d780f5048de6cce0adb svga: Fix a leftover debug hack Fix what appears to be a leftover debug hack. The hack would force the driver to take a different blit path; possibly, although unverified, reverting to software blits. Tested using piglit tests/quick. No related regressions. Cc: "17.2 17.3 18.0" Fixes: 9d81ab7376 (svga: Relax the format checks for copy_region_vgpu10 somewhat) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104625 Reported-by: Grazvydas Ignotas Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul -- You are receiving this mail because: You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 95083] ilo driver draws only the mouse cursor
https://bugs.freedesktop.org/show_bug.cgi?id=95083 Timothy Arcerichanged: What|Removed |Added Resolution|--- |INVALID Status|NEW |RESOLVED --- Comment #1 from Timothy Arceri --- The ilo driver is no longer active and has been dropped from Mesa. Closing. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 104302] Wolfenstein 2 (2017) under wine graphical artifacting on RADV
https://bugs.freedesktop.org/show_bug.cgi?id=104302 --- Comment #13 from gloriouseggr...@gmail.com --- (to clarify for other users -- use either the shoot "hack" patch for mesa, or the llvm patch to remove the weirdly blinding "shoot" bug and ring-lights etc on the submarine, not both) -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 80933] Fullscreen OpenGL programs (e.g. games) crash if focus lost then regained, something to do with automatic compositing suspension
https://bugs.freedesktop.org/show_bug.cgi?id=80933 Timothy Arcerichanged: What|Removed |Added Status|NEEDINFO|RESOLVED Resolution|--- |INVALID --- Comment #4 from Timothy Arceri --- I suspect the reporter might be misunderstanding what Mesa is. "I believe this is a bug within Mesa, and not my drivers ... " As per the other comments it seems like the reporter might have been using a closed driver. Closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 104302] Wolfenstein 2 (2017) under wine graphical artifacting on RADV
https://bugs.freedesktop.org/show_bug.cgi?id=104302 --- Comment #12 from gloriouseggr...@gmail.com --- Just thought I'd follow up and let you know the llvm "shoot" patch (https://reviews.llvm.org/D43831) you provided works very well! The hack patch for mesa works also. Thanks again! -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 65475] Inconsistent use of both stderr and stdout for debug output
https://bugs.freedesktop.org/show_bug.cgi?id=65475 Timothy Arcerichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #2 from Timothy Arceri --- Closing as wont fix as per the last line of comment 1. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 64386] [865G] White screen using Stellarium
https://bugs.freedesktop.org/show_bug.cgi?id=64386 Timothy Arcerichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |NOTOURBUG --- Comment #4 from Timothy Arceri --- The errors: OpenGL error detected at "drawWindow() start" : "GL_INVALID_VALUE" OpenGL error detected at "drawWindow() start" : "GL_INVALID_FRAMEBUFFER_OPERATION" OpenGL error detected at "drawWindow() start" : "GL_INVALID_FRAMEBUFFER_OPERATION" Suggest this is an app bug rather than a Mesa bug. Closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri_util: fallback to core with drivers not supporting compat for 3.1
On 03/02/2018 02:55 PM, Andres Gomez wrote: > 2599b92eb97 changed Mesa's behavior to allow Compatiblity profile with > 3.1, and fail when the driver doesn't implement it, if the Core > profile is not requested by applications. > > Formerly, when requesting a 3.1 Compatibility profile Mesa would > always fall back into a Core profile. We go back to that behavior now > so, if the specific driver is not supporting 3.1 with Compatibility > profile, we will keep falling back into 3.1 Core. > > Fixes: a0c8b49284e ("mesa: enable OpenGL 3.1 with ARB_compatibility") > > Cc: Marek Olšák> Cc: Ian Romanick > Cc: Kenneth Graunke > Cc: Eric Engestrom > Cc: Emil Velikov > Signed-off-by: Andres Gomez > --- > docs/features.txt | 4 ++-- > src/mesa/drivers/dri/common/dri_util.c | 10 ++ > 2 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/docs/features.txt b/docs/features.txt > index 5eae34bf0df..d53dd805b1d 100644 > --- a/docs/features.txt > +++ b/docs/features.txt > @@ -25,8 +25,8 @@ not started > # OpenGL Core and Compatibility context support > > Some drivers do not support the Compatibility profile or ARB_compatibility. > -Such drivers are limited to OpenGL 3.0 if the Core profile is not requested > -by applications. Some of the later GL features are exposed in the 3.0 context > +Such drivers are limited to use OpenGL 3.1 and later in Core > +profile. Some of the later GL features are exposed in the 3.0 context As I said in review of another patch, we need to stop saying OpenGL 3.1 {core,compatibility} profile. There is no such thing as a profile before OpenGL 3.2. Our use of that mechanism is merely an artifact of how we have implemented things to support multiple drivers in multiple APIs. I would suggest wording this as: Some drivers do not support the Compatibility profile or the ARB_compatibility extensions. If an application does not request a specific version without the forward-compatiblity flag, such drivers will be limited to OpenGL 3.0. If an application requests OpenGL 3.1, it will get a context that may or may not have the ARB_compatibility extension enabled. Some of the later GL features are exposed in the 3.0 context as extensions. > as extensions. > > > diff --git a/src/mesa/drivers/dri/common/dri_util.c > b/src/mesa/drivers/dri/common/dri_util.c > index a34f38d6114..53461dfb4e0 100644 > --- a/src/mesa/drivers/dri/common/dri_util.c > +++ b/src/mesa/drivers/dri/common/dri_util.c > @@ -381,6 +381,16 @@ driCreateContextAttribs(__DRIscreen *screen, int api, > } > } > > +/* The specific Mesa driver may not support the GL_ARB_compatibilty > + * extension or the compatibility profile. In that case, we treat an > + * API_OPENGL_COMPAT 3.1 as API_OPENGL_CORE. We reject API_OPENGL_COMPAT > + * 3.2+ in any case. > + */ > +if (mesa_api == API_OPENGL_COMPAT && > +ctx_config.major_version == 3 && ctx_config.minor_version == 1 && > +screen->max_gl_compat_version < 31) > + mesa_api = API_OPENGL_CORE; > + > if (mesa_api == API_OPENGL_COMPAT > && ((ctx_config.major_version > 3) > || (ctx_config.major_version == 3 && > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 41162] util/u_draw.c:71:util_draw_max_index: Assertion `buffer_size - buffer->buffer_offset <= buffer_size' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=41162 Timothy Arcerichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #3 from Timothy Arceri --- Assuming not and closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 33786] Wayland terminal garbage starting with 1dd8e2757852682af44b63193c89dff3c09c7703
https://bugs.freedesktop.org/show_bug.cgi?id=33786 Timothy Arcerichanged: What|Removed |Added Resolution|--- |INVALID Status|NEEDINFO|RESOLVED --- Comment #2 from Timothy Arceri --- Assuming not and closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 34361] Mesa needs a man-page or several
https://bugs.freedesktop.org/show_bug.cgi?id=34361 Timothy Arcerichanged: What|Removed |Added Resolution|--- |NOTABUG Status|NEW |RESOLVED -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 28433] Mesa DRI Intel 845G GEM Drivers returning artifacts in textures that can lockup PC on glxSwapBuffers.
https://bugs.freedesktop.org/show_bug.cgi?id=28433 Timothy Arcerichanged: What|Removed |Added Component|Other |Drivers/DRI/i915 Assignee|mesa-dev@lists.freedesktop. |dri-devel@lists.freedesktop |org |.org --- Comment #3 from Timothy Arceri --- Reassigning to i915. Probably needs to be retested. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 9/9] swr/rast: Refactor memory gather operations
--- src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h | 3 ++- src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp | 7 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h index b3a0e2b..a50ecc0 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h @@ -52,9 +52,10 @@ void Gather4(const SWR_FORMAT format, Value* pSrcBase, Value* byteOffsets, virtual Value* OFFSET_TO_NEXT_COMPONENT(Value* base, Constant *offset); virtual Value *GATHERPS(Value *src, Value *pBase, Value *indices, Value *mask, uint8_t scale = 1); + Value *GATHERPS_16(Value *src, Value *pBase, Value *indices, Value *mask, uint8_t scale = 1); -virtual void GATHER4PS(const SWR_FORMAT_INFO , Value* pSrcBase, Value* byteOffsets, +void GATHER4PS(const SWR_FORMAT_INFO , Value* pSrcBase, Value* byteOffsets, Value* mask, Value* vGatherComponents[], bool bPackedOutput); virtual Value *GATHERDD(Value* src, Value* pBase, Value* indices, Value* mask, uint8_t scale = 1); diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index f1dc002..2ffce1b 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -1333,7 +1333,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE , // But, we know that elements must be aligned for FETCH. :) // Right shift the offset by a bit and then scale by 2 to remove the sign extension. Value *shiftedOffsets16 = LSHR(vOffsets16, 1); -pVtxSrc2[currentVertexElement++] = GATHERPS_16(gatherSrc16, pStreamBase, shiftedOffsets16, vGatherMask16, 2); +pVtxSrc2[currentVertexElement++] = GATHERPS_16(gatherSrc16, pStreamBaseGFX, shiftedOffsets16, vGatherMask16, 2); } else { @@ -1350,9 +1350,6 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE , currentVertexElement = 0; } } - -// offset base to the next component in the vertex to gather -pStreamBase = GEP(pStreamBase, C((char)4)); #else if (isComponentEnabled(compMask, i)) { @@ -1383,11 +1380,11 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE , currentVertexElement = 0; } } +#endif // offset base to the next component in the vertex to gather pStreamBase = GEP(pStreamBase, C((char)4)); pStreamBaseGFX = ADD(pStreamBaseGFX, C((int64_t)4)); -#endif } } break; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/9] swr/rast: Add tracking for stream out topology
--- src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp | 6 +++--- src/gallium/drivers/swr/rasterizer/archrast/events.proto | 1 + src/gallium/drivers/swr/rasterizer/archrast/events_private.proto | 2 ++ src/gallium/drivers/swr/rasterizer/core/api.cpp | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index af18b16..1f87dba 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -87,8 +87,8 @@ namespace ArchRast { DrawInfoEvent e(event.data.drawId, ArchRast::Instanced, event.data.topology, event.data.numVertices, 0, 0, event.data.startVertex, event.data.numInstances, -event.data.startInstance, event.data.tsEnable, event.data.gsEnable, event.data.soEnable, event.data.splitId); - +event.data.startInstance, event.data.tsEnable, event.data.gsEnable, event.data.soEnable, event.data.soTopology, event.data.splitId); + EventHandlerFile::Handle(e); } @@ -96,7 +96,7 @@ namespace ArchRast { DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstanced, event.data.topology, 0, event.data.numIndices, event.data.indexOffset, event.data.baseVertex, event.data.numInstances, -event.data.startInstance, event.data.tsEnable, event.data.gsEnable, event.data.soEnable, event.data.splitId); +event.data.startInstance, event.data.tsEnable, event.data.gsEnable, event.data.soEnable, event.data.soTopology, event.data.splitId); EventHandlerFile::Handle(e); } diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index 45193a3..7d9a68d 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -51,6 +51,7 @@ event DrawInfoEvent uint32_t tsEnable; uint32_t gsEnable; uint32_t soEnable; +uint32_t soTopology; uint32_t splitId; // Split draw count or id. }; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto index 760f7aa..f0a9310 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto @@ -131,6 +131,7 @@ event DrawInstancedEvent uint32_t tsEnable; uint32_t gsEnable; uint32_t soEnable; +uint32_t soTopology; uint32_t splitId; // Split draw count or id. }; @@ -146,5 +147,6 @@ event DrawIndexedInstancedEvent uint32_t tsEnable; uint32_t gsEnable; uint32_t soEnable; +uint32_t soTopology; uint32_t splitId; // Split draw count or id. }; diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 86864f0..b252959 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -1221,7 +1221,7 @@ void DrawInstanced( QueueDraw(pContext); AR_API_EVENT(DrawInstancedEvent(pDC->drawId, topology, numVertsForDraw, startVertex, numInstances, -startInstance, pState->tsState.tsEnable, pState->gsState.gsEnable, pState->soState.soEnable, draw)); +startInstance, pState->tsState.tsEnable, pState->gsState.gsEnable, pState->soState.soEnable, pState->gsState.outputTopology, draw)); remainingVerts -= numVertsForDraw; draw++; @@ -1366,7 +1366,7 @@ void DrawIndexedInstance( QueueDraw(pContext); AR_API_EVENT(DrawIndexedInstancedEvent(pDC->drawId, topology, numIndicesForDraw, indexOffset, baseVertex, -numInstances, startInstance, pState->tsState.tsEnable, pState->gsState.gsEnable, pState->soState.soEnable, draw)); +numInstances, startInstance, pState->tsState.tsEnable, pState->gsState.gsEnable, pState->soState.soEnable, pState->gsState.outputTopology, draw)); pIB += maxIndicesPerDraw * indexSize; remainingIndices -= numIndicesForDraw; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/9] swr/rast: Add split draw and other state information to DrawInfoEvent.
Removed specific split draw events. --- .../drivers/swr/rasterizer/archrast/archrast.cpp | 22 ++ .../drivers/swr/rasterizer/archrast/events.proto | 4 .../swr/rasterizer/archrast/events_private.proto | 20 src/gallium/drivers/swr/rasterizer/core/api.cpp| 8 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index d5cffbb..af18b16 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -85,28 +85,18 @@ namespace ArchRast virtual void Handle(const DrawInstancedEvent& event) { -DrawInfoEvent e(event.data.drawId, ArchRast::Instanced, event.data.topology, event.data.numVertices, 0, 0, event.data.startVertex, event.data.numInstances, event.data.startInstance); +DrawInfoEvent e(event.data.drawId, ArchRast::Instanced, event.data.topology, +event.data.numVertices, 0, 0, event.data.startVertex, event.data.numInstances, +event.data.startInstance, event.data.tsEnable, event.data.gsEnable, event.data.soEnable, event.data.splitId); EventHandlerFile::Handle(e); } virtual void Handle(const DrawIndexedInstancedEvent& event) { -DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstanced, event.data.topology, 0, event.data.numIndices, event.data.indexOffset, event.data.baseVertex, event.data.numInstances, event.data.startInstance); - -EventHandlerFile::Handle(e); -} - -virtual void Handle(const DrawInstancedSplitEvent& event) -{ -DrawInfoEvent e(event.data.drawId, ArchRast::InstancedSplit, 0, 0, 0, 0, 0, 0, 0); - -EventHandlerFile::Handle(e); -} - -virtual void Handle(const DrawIndexedInstancedSplitEvent& event) -{ -DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstancedSplit, 0, 0, 0, 0, 0, 0, 0); +DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstanced, event.data.topology, 0, +event.data.numIndices, event.data.indexOffset, event.data.baseVertex, event.data.numInstances, +event.data.startInstance, event.data.tsEnable, event.data.gsEnable, event.data.soEnable, event.data.splitId); EventHandlerFile::Handle(e); } diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index ee5d75b..45193a3 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -48,6 +48,10 @@ event DrawInfoEvent int32_t baseVertex; uint32_t numInstances; uint32_t startInstance; +uint32_t tsEnable; +uint32_t gsEnable; +uint32_t soEnable; +uint32_t splitId; // Split draw count or id. }; event DispatchEvent diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto index a07c4a7..760f7aa 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto @@ -128,6 +128,10 @@ event DrawInstancedEvent int32_t startVertex; uint32_t numInstances; uint32_t startInstance; +uint32_t tsEnable; +uint32_t gsEnable; +uint32_t soEnable; +uint32_t splitId; // Split draw count or id. }; event DrawIndexedInstancedEvent @@ -139,16 +143,8 @@ event DrawIndexedInstancedEvent int32_t baseVertex; uint32_t numInstances; uint32_t startInstance; -}; - -///@brief API Stat: Split draw event for DrawInstanced. In certain cases, Rasty can split draws up into smaller draws. -event DrawInstancedSplitEvent -{ -uint32_t drawId; -}; - -///@brief API Stat: Split draw event for DrawIndexedInstanced. -event DrawIndexedInstancedSplitEvent -{ -uint32_t drawId; +uint32_t tsEnable; +uint32_t gsEnable; +uint32_t soEnable; +uint32_t splitId; // Split draw count or id. }; diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 99d3cd5..86864f0 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -1169,7 +1169,6 @@ void DrawInstanced( DRAW_CONTEXT* pDC = GetDrawContext(pContext); RDTSC_BEGIN(APIDraw, pDC->drawId); -AR_API_EVENT(DrawInstancedEvent(pDC->drawId, topology, numVertices, startVertex, numInstances, startInstance)); uint32_t maxVertsPerDraw = MaxVertsPerDraw(pDC, numVertices, topology); uint32_t primsPerDraw = GetNumPrims(topology, maxVertsPerDraw); @@ -1221,7 +1220,8 @@ void DrawInstanced( //enqueue DC
[Mesa-dev] [PATCH 7/9] swr/rast: Add VPOPCNT
Supports popcnt on vector masks (e.g. <8 x i1>) --- src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp | 8 src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index 0738d02..0148d8e 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -836,6 +836,14 @@ namespace SwrJit } // +/// @brief pop count on vector mask (e.g. <8 x i1>) +Value* Builder::VPOPCNT(Value* a) +{ +Value* b = BITCAST(VMASK(a), mSimdFP32Ty); +return POPCNT(VMOVMSKPS(b)); +} + +// /// @brief C functions called by LLVM IR // diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h index 50d7a1e..5195678 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h @@ -148,6 +148,7 @@ CallInst *PRINT(const std::string ); CallInst *PRINT(const std::string ,const std::initializer_list); Value* POPCNT(Value* a); +Value* VPOPCNT(Value* a); Value* DEBUGTRAP(); Value* INT3() { return DEBUGTRAP(); } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/9] swr/rast: Added comment
--- src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp index 67e415c..6fa60a1 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp @@ -137,6 +137,7 @@ namespace SwrJit } else { +// maskload intrinsic expects integer mask operand in llvm >= 3.8 mask = BITCAST(mask, VectorType::get(mInt32Ty, mVWidth)); Function *func = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::x86_avx_maskload_ps_256); vResult = BITCAST(CALL(func, { src,mask }), VectorType::get(mInt32Ty, mVWidth)); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/9] swr/rast: Rasterized Subspans stats support
--- src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp | 15 +++ src/gallium/drivers/swr/rasterizer/archrast/events.proto | 6 ++ .../drivers/swr/rasterizer/archrast/events_private.proto | 6 ++ src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h | 3 +++ 4 files changed, 30 insertions(+) diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index 8c09411..9186161 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -68,6 +68,11 @@ namespace ArchRast uint32_t vertsInput; }; +struct RastStats +{ +uint32_t rasterTiles = 0; +}; + // /// @brief Event handler that saves stat events to event files. This ///handler filters out unwanted events. @@ -227,12 +232,16 @@ namespace ArchRast EventHandlerFile::Handle(EarlyZNullPS(drawId, mDSNullPS.earlyZTestPassCount, mDSNullPS.earlyZTestFailCount)); EventHandlerFile::Handle(EarlyStencilNullPS(drawId, mDSNullPS.earlyStencilTestPassCount, mDSNullPS.earlyStencilTestFailCount)); +// Rasterized Subspans +EventHandlerFile::Handle(RasterTiles(drawId, rastStats.rasterTiles)); + //Reset Internal Counters mDSSingleSample = {}; mDSSampleRate = {}; mDSPixelRate = {}; mDSNullPS = {}; +rastStats = {}; mNeedFlush = false; } @@ -267,6 +276,11 @@ namespace ArchRast mTS.inputPrims += event.data.primCount; } +virtual void Handle(const RasterTileCount& event) +{ +rastStats.rasterTiles += event.data.rasterTiles; +} + protected: bool mNeedFlush; // Per draw stats @@ -278,6 +292,7 @@ namespace ArchRast CStats mClipper = {}; TEStats mTS = {}; GSStats mGS = {}; +RastStats rastStats = {}; }; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index 638dfd0..4a71e0d 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -256,6 +256,12 @@ event TessPrims uint64_t primCount; }; +event RasterTiles +{ +uint32_t drawId; +uint32_t rastTileCount; +}; + event ClipperEvent { uint32_t drawId; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto index 8970141..a07c4a7 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto @@ -95,6 +95,12 @@ event TessPrimCount uint64_t primCount; }; +event RasterTileCount +{ +uint32_t drawId; +uint64_t rasterTiles; +}; + event GSPrimInfo { uint64_t inputPrimCount; diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h b/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h index 62856cc..7f9b378 100644 --- a/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h +++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer_impl.h @@ -1268,6 +1268,9 @@ void RasterizeTriangle(DRAW_CONTEXT* pDC, uint32_t workerId, uint32_t macroTile, UnrollerL<1, RT::MT::numSamples, 1>::step(copyCoverage); } +// Track rasterized subspans +AR_EVENT(RasterTileCount(pDC->drawId, 1)); + RDTSC_BEGIN(BEPixelBackend, pDC->drawId); backendFuncs.pfnBackend(pDC, workerId, tileX << KNOB_TILE_X_DIM_SHIFT, tileY << KNOB_TILE_Y_DIM_SHIFT, triDesc, renderBuffers); RDTSC_END(BEPixelBackend, 0); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/9] swr/rast: Refactor api and worker event handlers.
In the API event handler we want to share information between the core layer and the API. Specifically, around associating various ids with different kinds of events. For example, associate render pass id with draw ids, or command buffer ids with draw ids. --- .../drivers/swr/rasterizer/archrast/archrast.cpp | 86 +- .../drivers/swr/rasterizer/archrast/eventmanager.h | 1 + 2 files changed, 52 insertions(+), 35 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index 0728a85..d5cffbb 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -74,12 +74,52 @@ namespace ArchRast }; // -/// @brief Event handler that saves stat events to event files. This -///handler filters out unwanted events. -class EventHandlerStatsFile : public EventHandlerFile +/// @brief Event handler that handles API thread events. This is shared +///between the API and its caller (e.g. driver shim) but typically +///there is only a single API thread per context. So you can save +///information in the class to be used for other events. +class EventHandlerApiStats : public EventHandlerFile { public: -EventHandlerStatsFile(uint32_t id) : EventHandlerFile(id), mNeedFlush(false) {} +EventHandlerApiStats(uint32_t id) : EventHandlerFile(id) {} + +virtual void Handle(const DrawInstancedEvent& event) +{ +DrawInfoEvent e(event.data.drawId, ArchRast::Instanced, event.data.topology, event.data.numVertices, 0, 0, event.data.startVertex, event.data.numInstances, event.data.startInstance); + +EventHandlerFile::Handle(e); +} + +virtual void Handle(const DrawIndexedInstancedEvent& event) +{ +DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstanced, event.data.topology, 0, event.data.numIndices, event.data.indexOffset, event.data.baseVertex, event.data.numInstances, event.data.startInstance); + +EventHandlerFile::Handle(e); +} + +virtual void Handle(const DrawInstancedSplitEvent& event) +{ +DrawInfoEvent e(event.data.drawId, ArchRast::InstancedSplit, 0, 0, 0, 0, 0, 0, 0); + +EventHandlerFile::Handle(e); +} + +virtual void Handle(const DrawIndexedInstancedSplitEvent& event) +{ +DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstancedSplit, 0, 0, 0, 0, 0, 0, 0); + +EventHandlerFile::Handle(e); +} +}; + +// +/// @brief Event handler that handles worker thread events. There is one +///event handler per thread. The python script will need to sum +///up counters across all of the threads. +class EventHandlerWorkerStats : public EventHandlerFile +{ +public: +EventHandlerWorkerStats(uint32_t id) : EventHandlerFile(id), mNeedFlush(false) {} virtual void Handle(const EarlyDepthStencilInfoSingleSample& event) { @@ -215,34 +255,6 @@ namespace ArchRast mClipper.trivialAcceptCount += _mm_popcnt_u32(event.data.validMask & ~event.data.clipMask); } -virtual void Handle(const DrawInstancedEvent& event) -{ -DrawInfoEvent e(event.data.drawId, ArchRast::Instanced, event.data.topology, event.data.numVertices, 0, 0, event.data.startVertex, event.data.numInstances, event.data.startInstance); - -EventHandlerFile::Handle(e); -} - -virtual void Handle(const DrawIndexedInstancedEvent& event) -{ -DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstanced, event.data.topology, 0, event.data.numIndices, event.data.indexOffset, event.data.baseVertex, event.data.numInstances, event.data.startInstance); - -EventHandlerFile::Handle(e); -} - -virtual void Handle(const DrawInstancedSplitEvent& event) -{ -DrawInfoEvent e(event.data.drawId, ArchRast::InstancedSplit, 0, 0, 0, 0, 0, 0, 0); - -EventHandlerFile::Handle(e); -} - -virtual void Handle(const DrawIndexedInstancedSplitEvent& event) -{ -DrawInfoEvent e(event.data.drawId, ArchRast::IndexedInstancedSplit, 0, 0, 0, 0, 0, 0, 0); - -EventHandlerFile::Handle(e); -} - // Flush cached events for this draw virtual void FlushDraw(uint32_t drawId) { @@ -354,20 +366,24 @@ namespace ArchRast uint32_t id = counter.fetch_add(1); EventManager* pManager = new EventManager(); -EventHandlerFile* pHandler = new EventHandlerStatsFile(id); -if (pManager &&
[Mesa-dev] [PATCH 3/9] swr/rast: Add support for generalized late and early z/stencil stats
--- .../drivers/swr/rasterizer/archrast/archrast.cpp | 45 ++ .../drivers/swr/rasterizer/archrast/events.proto | 28 ++ 2 files changed, 73 insertions(+) diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index 9186161..0728a85 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -90,6 +90,15 @@ namespace ArchRast //earlyStencil test compute mDSSingleSample.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSingleSample.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + +//earlyZ test single and multi sample +mDSCombined.earlyZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); +mDSCombined.earlyZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + +//earlyStencil test single and multi sample +mDSCombined.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); +mDSCombined.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -102,6 +111,15 @@ namespace ArchRast //earlyStencil test compute mDSSampleRate.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSampleRate.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + +//earlyZ test single and multi sample +mDSCombined.earlyZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); +mDSCombined.earlyZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + +//earlyStencil test single and multi sample +mDSCombined.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); +mDSCombined.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -126,6 +144,15 @@ namespace ArchRast //lateStencil test compute mDSSingleSample.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSingleSample.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + +//lateZ test single and multi sample +mDSCombined.lateZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); +mDSCombined.lateZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + +//lateStencil test single and multi sample +mDSCombined.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); +mDSCombined.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -138,6 +165,16 @@ namespace ArchRast //lateStencil test compute mDSSampleRate.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSampleRate.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + + +//lateZ test single and multi sample +mDSCombined.lateZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); +mDSCombined.lateZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + +//lateStencil test single and multi sample +mDSCombined.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); +mDSCombined.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -223,6 +260,12 @@ namespace ArchRast EventHandlerFile::Handle(EarlyStencilSampleRate(drawId, mDSSampleRate.earlyStencilTestPassCount, mDSSampleRate.earlyStencilTestFailCount)); EventHandlerFile::Handle(LateStencilSampleRate(drawId, mDSSampleRate.lateStencilTestPassCount, mDSSampleRate.lateStencilTestFailCount)); +//combined +EventHandlerFile::Handle(EarlyZ(drawId, mDSCombined.earlyZTestPassCount, mDSCombined.earlyZTestFailCount)); +EventHandlerFile::Handle(LateZ(drawId, mDSCombined.lateZTestPassCount, mDSCombined.lateZTestFailCount)); +EventHandlerFile::Handle(EarlyStencil(drawId, mDSCombined.earlyStencilTestPassCount, mDSCombined.earlyStencilTestFailCount)); +EventHandlerFile::Handle(LateStencil(drawId, mDSCombined.lateStencilTestPassCount, mDSCombined.lateStencilTestFailCount)); +
[Mesa-dev] [PATCH 8/9] swr/rast: Add KNOB_DISABLE_SPLIT_DRAW
This is useful for archrast data collection. This greatly speeds up the post processing script since there is significantly less events generated. Finally, this is a simpler option to communicate to users than having them directly adjust MAX_PRIMS_PER_DRAW and MAX_TESS_PRIMS_PER_DRAW. --- .../drivers/swr/rasterizer/codegen/knob_defs.py| 10 + src/gallium/drivers/swr/rasterizer/core/api.cpp| 24 ++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/codegen/knob_defs.py b/src/gallium/drivers/swr/rasterizer/codegen/knob_defs.py index 2c6946b..d4bf193 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/knob_defs.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/knob_defs.py @@ -270,4 +270,14 @@ KNOBS = [ 'category' : 'perf_adv', }], +['DISABLE_SPLIT_DRAW', { +'type' : 'bool', +'default' : 'false', +'desc' : ['Don\'t split large draws into smaller draws.,', + 'MAX_PRIMS_PER_DRAW and MAX_TESS_PRIMS_PER_DRAW can be used to control split size.', + '', + 'Useful to disable split draws for gathering archrast stats.'], +'category' : 'perf_adv', +}], + ] diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index b252959..53bd2d2 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -1077,13 +1077,27 @@ uint32_t MaxVertsPerDraw( { API_STATE& state = pDC->pState->state; -uint32_t vertsPerDraw = totalVerts; - +// We can not split draws that have streamout enabled because there is no practical way +// to support multiple threads generating SO data for a single set of buffers. if (state.soState.soEnable) { return totalVerts; } +// The Primitive Assembly code can only handle 1 RECT at a time. Specified with only 3 verts. +if (topology == TOP_RECT_LIST) +{ +return 3; +} + +// Is split drawing disabled? +if (KNOB_DISABLE_SPLIT_DRAW) +{ +return totalVerts; +} + +uint32_t vertsPerDraw = totalVerts; + switch (topology) { case TOP_POINT_LIST: @@ -1129,12 +1143,6 @@ uint32_t MaxVertsPerDraw( vertsPerDraw = vertsPerPrim * KNOB_MAX_TESS_PRIMS_PER_DRAW; } break; - -// The Primitive Assembly code can only handle 1 RECT at a time. -case TOP_RECT_LIST: -vertsPerDraw = 3; -break; - default: // We are not splitting up draws for other topologies. break; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 18/22 v4] squash! i965/fs: Add infrastructure for generating CSEL instructions.
From: Ian Romanickv4: Only set BRW_ALIGN_16 on Gen < 10 (suggested by Matt). Don't reset the access mode afterwards (suggested by Samuel and Matt). Add support for CSEL not modifying the flags to more places (requested by Matt). Reviewed-by: Matt Turner --- src/intel/compiler/brw_disasm.c | 1 + src/intel/compiler/brw_fs.cpp | 1 + src/intel/compiler/brw_fs_generator.cpp | 5 +++-- src/intel/compiler/brw_ir_vec4.h| 1 + src/intel/compiler/brw_vec4.cpp | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_disasm.c b/src/intel/compiler/brw_disasm.c index a9a108f..5f75c67 100644 --- a/src/intel/compiler/brw_disasm.c +++ b/src/intel/compiler/brw_disasm.c @@ -1508,6 +1508,7 @@ brw_disassemble_inst(FILE *file, const struct gen_device_info *devinfo, */ if (brw_inst_cond_modifier(devinfo, inst) && (devinfo->gen < 6 || (opcode != BRW_OPCODE_SEL && +opcode != BRW_OPCODE_CSEL && opcode != BRW_OPCODE_IF && opcode != BRW_OPCODE_WHILE))) { format(file, ".f%"PRIu64, diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index f532c2c..f4cc941 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -5544,6 +5544,7 @@ fs_visitor::dump_instruction(backend_instruction *be_inst, FILE *file) fprintf(file, "%s", conditional_modifier[inst->conditional_mod]); if (!inst->predicate && (devinfo->gen < 5 || (inst->opcode != BRW_OPCODE_SEL && +inst->opcode != BRW_OPCODE_CSEL && inst->opcode != BRW_OPCODE_IF && inst->opcode != BRW_OPCODE_WHILE))) { fprintf(file, ".f%d.%d", inst->flag_subreg / 2, diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp index 97d2357..85a6183 100644 --- a/src/intel/compiler/brw_fs_generator.cpp +++ b/src/intel/compiler/brw_fs_generator.cpp @@ -1876,9 +1876,10 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width) brw_SEL(p, dst, src[0], src[1]); break; case BRW_OPCODE_CSEL: - brw_set_default_access_mode(p, BRW_ALIGN_16); + assert(devinfo->gen >= 8); + if (devinfo->gen < 10) +brw_set_default_access_mode(p, BRW_ALIGN_16); brw_CSEL(p, dst, src[0], src[1], src[2]); - brw_set_default_access_mode(p, BRW_ALIGN_1); break; case BRW_OPCODE_BFREV: assert(devinfo->gen >= 7); diff --git a/src/intel/compiler/brw_ir_vec4.h b/src/intel/compiler/brw_ir_vec4.h index a0e6402..cbaff2f 100644 --- a/src/intel/compiler/brw_ir_vec4.h +++ b/src/intel/compiler/brw_ir_vec4.h @@ -329,6 +329,7 @@ public: bool writes_flag() { return (conditional_mod && (opcode != BRW_OPCODE_SEL && + opcode != BRW_OPCODE_CSEL && opcode != BRW_OPCODE_IF && opcode != BRW_OPCODE_WHILE)); } diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index ac6b997..e483814 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -1557,6 +1557,7 @@ vec4_visitor::dump_instruction(backend_instruction *be_inst, FILE *file) fprintf(file, "%s", conditional_modifier[inst->conditional_mod]); if (!inst->predicate && (devinfo->gen < 5 || (inst->opcode != BRW_OPCODE_SEL && +inst->opcode != BRW_OPCODE_CSEL && inst->opcode != BRW_OPCODE_IF && inst->opcode != BRW_OPCODE_WHILE))) { fprintf(file, ".f%d.%d", inst->flag_subreg / 2, inst->flag_subreg % 2); -- 2.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] squash! i965/fs: Merge CMP and SEL into CSEL on Gen8+
From: Ian Romanickv4: Report progress. This actually helps one more shader! --- src/intel/compiler/brw_fs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 7b51b1f..4937361 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -2900,8 +2900,10 @@ fs_visitor::opt_peephole_csel() csel_inst->src[1].abs = true; } -if (csel_inst != NULL) +if (csel_inst != NULL) { + progress = true; inst->remove(block); +} break; } -- 2.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 77449] Tracker bug for all bugs related to Steam titles
https://bugs.freedesktop.org/show_bug.cgi?id=77449 Bug 77449 depends on bug 98856, which changed state. Bug 98856 Summary: DIRT: Showdown broken graphics with Mesa built with -Ofast https://bugs.freedesktop.org/show_bug.cgi?id=98856 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |NOTABUG -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/56] anv/entrypoints: Generalize the string map a bit
Quoting Jason Ekstrand (2018-03-07 06:34:52) > The original string map assumed that the mapping from strings to > entrypoints was a bijection. This will not be true the moment we > add entrypoint aliasing. This reworks things to be an arbitrary map > from strings to non-negative signed integers. The old one also had a > potential bug if we ever had a hash collision because it didn't do the > strcmp inside the lookup loop. While we're at it, we break things out > into a helpful class. > > Reviewed-by: Lionel Landwerlin> Reviewed-by: Samuel Iglesias Gonsálvez > --- > src/intel/vulkan/anv_entrypoints_gen.py | 188 > +--- > 1 file changed, 103 insertions(+), 85 deletions(-) > > diff --git a/src/intel/vulkan/anv_entrypoints_gen.py > b/src/intel/vulkan/anv_entrypoints_gen.py > index 34ffedb..dc0f0e9 100644 > --- a/src/intel/vulkan/anv_entrypoints_gen.py > +++ b/src/intel/vulkan/anv_entrypoints_gen.py > @@ -115,9 +115,10 @@ TEMPLATE_C = Template(u"""\ > > #include "anv_private.h" > > -struct anv_entrypoint { > +struct string_map_entry { > uint32_t name; > uint32_t hash; > + uint32_t num; > }; > > /* We use a big string constant to avoid lots of reloctions from the entry > @@ -126,17 +127,60 @@ struct anv_entrypoint { > */ > > static const char strings[] = > -% for e in entrypoints: > -"${e.name}\\0" > +% for s in strmap.sorted_strings: > +"${s.string}\\0" > % endfor > ; > > -static const struct anv_entrypoint entrypoints[] = { > -% for e in entrypoints: > -[${e.num}] = { ${offsets[e.num]}, ${'{:0=#8x}'.format(e.get_c_hash())} > }, /* ${e.name} */ > +static const struct string_map_entry string_map_entries[] = { > +% for s in strmap.sorted_strings: > +{ ${s.offset}, ${'{:0=#8x}'.format(s.hash)}, ${s.num} }, /* ${s.string} > */ > % endfor > }; > > +/* Hash table stats: > + * size ${len(strmap.sorted_strings)} entries > + * collisions entries: > +% for i in xrange(10): > + * ${i}${'+' if i == 9 else ' '} ${strmap.collisions[i]} > +% endfor > + */ > + > +#define none 0x > +static const uint16_t string_map[${strmap.hash_size}] = { > +% for e in strmap.mapping: > +${ '{:0=#6x}'.format(e) if e >= 0 else 'none' }, > +% endfor > +}; > + > +static int > +string_map_lookup(const char *str) > +{ > +static const uint32_t prime_factor = ${strmap.prime_factor}; > +static const uint32_t prime_step = ${strmap.prime_step}; > +const struct string_map_entry *e; > +uint32_t hash, h; > +uint16_t i; > +const char *p; > + > +hash = 0; > +for (p = str; *p; p++) > +hash = hash * prime_factor + *p; > + > +h = hash; > +while (1) { > +i = string_map[h & ${strmap.hash_mask}]; > +if (i == none) > + return -1; > +e = _map_entries[i]; > +if (e->hash == hash && strcmp(str, strings + e->name) == 0) > +return e->num; > +h += prime_step; > +} > + > +return -1; > +} > + > /* Weak aliases for all potential implementations. These will resolve to > * NULL if they're not defined, which lets the resolve_entrypoint() function > * either pick the correct entry point. > @@ -275,54 +319,10 @@ anv_resolve_entrypoint(const struct gen_device_info > *devinfo, uint32_t index) >return anv_dispatch_table.entrypoints[index]; > } > > -/* Hash table stats: > - * size ${hash_size} entries > - * collisions entries: > -% for i in xrange(10): > - * ${i}${'+' if i == 9 else ''} ${collisions[i]} > -% endfor > - */ > - > -#define none ${'{:#x}'.format(none)} > -static const uint16_t map[] = { > -% for i in xrange(0, hash_size, 8): > - % for j in xrange(i, i + 8): > -## This is 6 because the 0x is counted in the length > -% if mapping[j] & 0x == 0x: > - none, > -% else: > - ${'{:0=#6x}'.format(mapping[j] & 0x)}, > -% endif > - % endfor > -% endfor > -}; > - > int > anv_get_entrypoint_index(const char *name) > { > - static const uint32_t prime_factor = ${prime_factor}; > - static const uint32_t prime_step = ${prime_step}; > - const struct anv_entrypoint *e; > - uint32_t hash, h, i; > - const char *p; > - > - hash = 0; > - for (p = name; *p; p++) > - hash = hash * prime_factor + *p; > - > - h = hash; > - do { > - i = map[h & ${hash_mask}]; > - if (i == none) > - return -1; > - e = [i]; > - h += prime_step; > - } while (e->hash != hash); > - > - if (strcmp(name, strings + e->name) != 0) > - return -1; > - > - return i; > + return string_map_lookup(name); > } > > void * > @@ -334,7 +334,6 @@ anv_lookup_entrypoint(const struct gen_device_info > *devinfo, const char *name) > return anv_resolve_entrypoint(devinfo, idx); > }""", output_encoding='utf-8') > > -NONE = 0x > HASH_SIZE = 256 > U32_MASK = 2**32 - 1 > HASH_MASK = HASH_SIZE - 1 > @@ -342,11 +341,54 @@
[Mesa-dev] [PATCH v4 20/20] clover: Implement clCreateProgramWithIL from OpenCL 2.1
Signed-off-by: Pierre Moreau--- Notes: v3: Remove the const from the length argument of clCreateProgramWithIL src/gallium/state_trackers/clover/api/dispatch.cpp | 2 +- src/gallium/state_trackers/clover/api/program.cpp | 8 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/api/dispatch.cpp b/src/gallium/state_trackers/clover/api/dispatch.cpp index 8be4d3cb26..f5f3248f26 100644 --- a/src/gallium/state_trackers/clover/api/dispatch.cpp +++ b/src/gallium/state_trackers/clover/api/dispatch.cpp @@ -162,7 +162,7 @@ namespace clover { NULL, // clSetKernelExecInfo NULL, // clGetKernelSubGroupInfoKHR NULL, // clCloneKernel - NULL, // clCreateProgramWithIL + clCreateProgramWithIL, NULL, // clEnqueueSVMMigrateMem NULL, // clGetDeviceAndHostTimer NULL, // clGetHostTimer diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index 2501d0bc07..25ee5faae2 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -212,6 +212,14 @@ clover::CreateProgramWithILKHR(cl_context d_ctx, const void *il, return NULL; } +CLOVER_API cl_program +clCreateProgramWithIL(cl_context d_ctx, + const void *il, + size_t length, + cl_int *r_errcode) { + return CreateProgramWithILKHR(d_ctx, il, length, r_errcode); +} + CLOVER_API cl_program clCreateProgramWithBuiltInKernels(cl_context d_ctx, cl_uint n, const cl_device_id *d_devs, -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 19/20] clover: Advertise cl_khr_il_program
Signed-off-by: Pierre Moreau--- Notes: Changes in v4: do not advertise SPIR-V support if CLOVER_ALLOW_SPIRV is not defined v3: Advertise cl_khr_il_program if if the device support NATIVE as IR src/gallium/state_trackers/clover/api/platform.cpp | 2 ++ src/gallium/state_trackers/clover/core/device.cpp | 8 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/api/platform.cpp b/src/gallium/state_trackers/clover/api/platform.cpp index 94d883c1f0..54a35c5dc5 100644 --- a/src/gallium/state_trackers/clover/api/platform.cpp +++ b/src/gallium/state_trackers/clover/api/platform.cpp @@ -111,6 +111,8 @@ clover::GetExtensionFunctionAddress(const char *p_name) { if (name == "clIcdGetPlatformIDsKHR") return reinterpret_cast(IcdGetPlatformIDsKHR); + else if (name == "clCreateProgramWithILKHR") + return reinterpret_cast(CreateProgramWithILKHR); else return NULL; } diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 21de0e3d61..b9a26e4eec 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -285,6 +285,11 @@ device::supports_ir(enum pipe_shader_ir ir) const { std::string device::supported_extensions() const { +#ifdef CLOVER_ALLOW_SPIRV + const bool supports_il_program = supports_ir(PIPE_SHADER_IR_NATIVE); +#else + const bool supports_il_program = false; +#endif return "cl_khr_byte_addressable_store" " cl_khr_global_int32_base_atomics" @@ -294,5 +299,6 @@ device::supported_extensions() const { + std::string(has_int64_atomics() ? " cl_khr_int64_base_atomics" : "") + std::string(has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "") + std::string(has_doubles() ? " cl_khr_fp64" : "") - + std::string(has_halves() ? " cl_khr_fp16" : ""); + + std::string(has_halves() ? " cl_khr_fp16" : "") + + std::string(supports_il_program ? " cl_khr_il_program" : ""); } -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 18/20] clover/api: Implement CL_DEVICE_IL_VERSION
Signed-off-by: Pierre Moreau--- Notes: Changes in v4: Use the core define instead of the extension one (Karol Herbst) v3: Throw an exception if the cl_khr_il_program extension is not supported (Francisco Jerez) src/gallium/state_trackers/clover/api/device.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp index 4e274c5005..ac6e4e0185 100644 --- a/src/gallium/state_trackers/clover/api/device.cpp +++ b/src/gallium/state_trackers/clover/api/device.cpp @@ -333,6 +333,13 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param, buf.as_string() = dev.supported_extensions(); break; + case CL_DEVICE_IL_VERSION: + if (dev.supported_extensions().find("cl_khr_il_program") == std::string::npos) + throw error(CL_INVALID_VALUE); + buf.as_string() = std::string("SPIR-V_1.0"); + + break; + case CL_DEVICE_PLATFORM: buf.as_scalar() = desc(dev.platform); break; -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 17/20] clover: Handle CL_PROGRAM_IL in clGetProgramInfo
Signed-off-by: Pierre Moreau--- Notes: Changes in v4: Use the core define instead of the extension one (Karol Herbst) v3: Switch from using a pointer attribute to a vector (Francisco Jerez) src/gallium/state_trackers/clover/api/program.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index cc37a008ad..2501d0bc07 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -456,6 +456,13 @@ clGetProgramInfo(cl_program d_prog, cl_program_info param, buf.as_string() = prog.source(); break; + case CL_PROGRAM_IL: + if (prog.has_il) + buf.as_vector() = prog.il(); + else if (r_size) + *r_size = 0u; + break; + case CL_PROGRAM_BINARY_SIZES: buf.as_vector() = map([&](const device ) { return prog.build(dev).binary.size(); -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 16/20] clover: Implement clCreateProgramWithILKHR
Signed-off-by: Pierre Moreau--- Notes: Changes in v4: guard parts of the code behind SPIR-V support v3: * Remove the const on the length argument to CreateProgramWithILKHR (Francisco Jerez); * Capitalize comment (Francisco Jerez); * Store the IL as a std::vector instead of a pointer + size (Francisco Jerez); * Remove the destructor, due to previous change; * Remove endianness conversion, as already performed later on (Francisco Jerez); * Introduce a free function for compile_program, which calls the right compile function based on the IR format (Francisco Jerez); * Add dependency on SPIRV-Tools, as we validate the SPIR-V module fed to clCreateProgramWithILKHR; * Introduce an enum for representing which IL is stored in program; * Correctly initialise the devices associated to a program created from clCreateProgramWithILKHR; * Introduce free functions for validating the SPIR-V binary, and detecting the IL used in the binary fed to clCreateProgramWithILKHR. src/gallium/state_trackers/clover/Makefile.am | 6 +- src/gallium/state_trackers/clover/api/dispatch.hpp | 4 + src/gallium/state_trackers/clover/api/program.cpp | 87 +- src/gallium/state_trackers/clover/core/program.cpp | 47 ++-- src/gallium/state_trackers/clover/core/program.hpp | 12 +++ src/gallium/state_trackers/clover/meson.build | 1 + 6 files changed, 146 insertions(+), 11 deletions(-) diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am index 35ee092f3f..9ae053ac5e 100644 --- a/src/gallium/state_trackers/clover/Makefile.am +++ b/src/gallium/state_trackers/clover/Makefile.am @@ -46,11 +46,15 @@ libclllvm_la_SOURCES = $(LLVM_SOURCES) libclover_la_CXXFLAGS = \ $(CXX11_CXXFLAGS) \ $(CLOVER_STD_OVERRIDE) \ - $(VISIBILITY_CXXFLAGS) + $(VISIBILITY_CXXFLAGS) \ + $(SPIRV_TOOLS_CFLAGS) libclover_la_LIBADD = \ libclllvm.la +libclover_la_LDFLAGS = \ + $(SPIRV_TOOLS_LIBS) + libclover_la_SOURCES = $(CPP_SOURCES) EXTRA_DIST = Doxyfile meson.build diff --git a/src/gallium/state_trackers/clover/api/dispatch.hpp b/src/gallium/state_trackers/clover/api/dispatch.hpp index 60fb75a146..3d5fc7bf47 100644 --- a/src/gallium/state_trackers/clover/api/dispatch.hpp +++ b/src/gallium/state_trackers/clover/api/dispatch.hpp @@ -974,6 +974,10 @@ namespace clover { cl_int IcdGetPlatformIDsKHR(cl_uint num_entries, cl_platform_id *rd_platforms, cl_uint *rnum_platforms); + + cl_program + CreateProgramWithILKHR(cl_context d_ctx, const void *il, + size_t length, cl_int *r_errcode); } #endif diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index 7d57d3f0e9..cc37a008ad 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -21,9 +21,15 @@ // #include "api/util.hpp" +#include "compiler/spirv/spirv.h" #include "core/program.hpp" +#include "util/u_math.h" #include "util/u_debug.h" +#ifdef CLOVER_ALLOW_SPIRV +#include +#endif + #include using namespace clover; @@ -46,6 +52,60 @@ namespace { }, objs(d_devs, num_devs))) throw error(CL_INVALID_DEVICE); } + +#ifdef CLOVER_ALLOW_SPIRV + bool + is_valid_spirv(const uint32_t *binary, size_t length, + const context::notify_action ) { + auto const validator_consumer = [](spv_message_level_t level, + const char * /* source */, + const spv_position_t , + const char *message) { + if (!notify) +return; + + std::string str_level; + switch (level) { +#define LVL2STR(lvl) case SPV_MSG_##lvl: str_level = std::string(#lvl) +LVL2STR(FATAL); +LVL2STR(INTERNAL_ERROR); +LVL2STR(ERROR); +LVL2STR(WARNING); +LVL2STR(INFO); +LVL2STR(DEBUG); +#undef LVL2STR + } + const std::string log = "[" + str_level + "] At word No." + + std::to_string(position.index) + ": \"" + + message + "\""; + notify(log.c_str()); + }; + + spvtools::SpirvTools spvTool(SPV_ENV_OPENCL_1_2); + spvTool.SetMessageConsumer(validator_consumer); + + return spvTool.Validate(binary, length); + } +#endif + + enum program::il_type + identify_and_validate_il(const void *il, size_t length, +const context::notify_action ) { + + enum program::il_type il_type = program::il_type::none; + +#ifdef CLOVER_ALLOW_SPIRV + const uint32_t *stream = reinterpret_cast(il); + if (stream[0] ==
[Mesa-dev] [PATCH v4 15/20] include/CL: Add cl_khr_il_program
Reviewed-by: Karol HerbstSigned-off-by: Pierre Moreau --- include/CL/cl_ext.h | 37 + 1 file changed, 37 insertions(+) diff --git a/include/CL/cl_ext.h b/include/CL/cl_ext.h index 5078e8f45f..5ea4968042 100644 --- a/include/CL/cl_ext.h +++ b/include/CL/cl_ext.h @@ -599,6 +599,43 @@ clSetKernelExecInfoARM(cl_kernel/* kernel */, #endif /* CL_VERSION_1_2 */ +/*** + * cl_khr_il_program extension * + ***/ + +#if defined(CL_VERSION_1_2) || defined(CL_VERSION_2_0) + +#ifndef cl_khr_il_program +#define cl_khr_il_program 1 + +/* New property to clGetDeviceInfo for retrieving supported intermediate + * languages + */ +#define CL_DEVICE_IL_VERSION_KHR0x105B + +/* New property to clGetProgramInfo for retrieving for retrieving the IL of a + * program + */ +#define CL_PROGRAM_IL_KHR 0x1169 + +extern CL_API_ENTRY cl_program + CL_API_CALL clCreateProgramWithILKHR( + cl_context /* context */, + const void * /* il */, + size_t /* length */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_program + (CL_API_CALL *clCreateProgramWithILKHR_fn)( + cl_context /* context */, + const void * /* il */, + size_t /* length */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 || CL_VERSION_2_0 */ + +#endif /* cl_khr_il_program */ + #ifdef __cplusplus } #endif -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 13/20] configure.ac, meson: Check for SPIRV-Tools and llvm-spirv
Signed-off-by: Pierre Moreau--- Notes: Changes in v4: * make SPIRV-Tools and llvm-spirv optional (Francisco Jerez); * bump requirement for llvm-spirv to version 0.2 v3: * Bump the required version of SPIRV-Tools to the latest release; * Add a dependency on llvm-spirv. configure.ac | 17 + meson.build | 7 +++ 2 files changed, 24 insertions(+) diff --git a/configure.ac b/configure.ac index 172da6b443..058f7ccbbd 100644 --- a/configure.ac +++ b/configure.ac @@ -2413,6 +2413,23 @@ AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes) AC_SUBST([OPENCL_LIBNAME]) AC_SUBST([CLANG_RESOURCE_DIR]) +AS_IF([test "x$enable_opencl" = xyes], [ +PKG_CHECK_MODULES([SPIRV_TOOLS], [SPIRV-Tools >= 2018.0], + [have_spirv_tools=yes], [have_spirv_tools=no])]) +AC_SUBST([SPIRV_TOOLS_CFLAGS]) +AC_SUBST([SPIRV_TOOLS_LIBS]) + +AS_IF([test "x$enable_opencl" = xyes], [ +PKG_CHECK_MODULES([LLVM_SPIRV], [llvm-spirv >= 0.2], + [have_llvm_spirv=yes], [have_llvm_spirv=no])]) +AC_SUBST([LLVM_SPIRV_CFLAGS]) +AC_SUBST([LLVM_SPIRV_LIBS]) + +if test "x$have_spirv_tools" = xyes -o \ +"x$have_llvm_spirv" = xyes; then +DEFINES="$DEFINES -DCLOVER_ALLOW_SPIRV" +fi + dnl dnl Gallium configuration dnl diff --git a/meson.build b/meson.build index 8a17d7f240..90021dd597 100644 --- a/meson.build +++ b/meson.build @@ -623,10 +623,17 @@ if _opencl != 'disabled' # TODO: alitvec? dep_clc = dependency('libclc') + dep_spirv_tools = dependency('SPIRV-Tools', required : false, version : '>= 2018.0') + dep_llvm_spirv = dependency('llvm-spirv', required : false, version : '>= 0.2') + if dep_spirv_tools.found() and dep_llvm_spirv.found() +pre_args += '-DCLOVER_ALLOW_SPIRV' + endif with_gallium_opencl = true with_opencl_icd = _opencl == 'icd' else dep_clc = [] + dep_spirv_tools = [] + dep_llvm_spirv = [] with_gallium_opencl = false with_gallium_icd = false endif -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 14/20] clover/llvm: Allow translating from SPIR-V to LLVM IR
Signed-off-by: Pierre Moreau--- Notes: Changes in v4: * guard the SPIR-V code; * use an istringstream instead of a bidirectional stringstream, and initialise it directly (Francisco Jerez). .../state_trackers/clover/llvm/invocation.cpp | 29 ++ .../state_trackers/clover/llvm/invocation.hpp | 6 + src/gallium/state_trackers/clover/meson.build | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp index 0bc06e..84043f3405 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp @@ -24,12 +24,17 @@ // OTHER DEALINGS IN THE SOFTWARE. // +#include + #include #include #include #include #include #include +#ifdef CLOVER_ALLOW_SPIRV +#include +#endif #include #include @@ -301,3 +306,27 @@ clover::llvm::link_program(const std::vector , unreachable("Unsupported IR."); } } + +#ifdef CLOVER_ALLOW_SPIRV +module +clover::llvm::compile_from_spirv(const std::vector , + const device , + std::string _log) { + auto ctx = create_context(r_log); + + ::llvm::Module *unsafe_mod; + std::string error_msg; + std::istringstream input({ binary.begin(), binary.end() }, std::ios_base::binary); + if (!::llvm::readSPIRV(*ctx, input, unsafe_mod, error_msg)) { + r_log += "Failed to convert SPIR-V to LLVM IR: " + error_msg + ".\n"; + throw error(CL_INVALID_VALUE); + } + + std::unique_ptr<::llvm::Module> mod(unsafe_mod); + + if (has_flag(debug::llvm)) + debug::log(".ll", print_module_bitcode(*mod)); + + return build_module_library(*mod, module::section::text_intermediate); +} +#endif diff --git a/src/gallium/state_trackers/clover/llvm/invocation.hpp b/src/gallium/state_trackers/clover/llvm/invocation.hpp index ff9caa457c..85b16f6c90 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.hpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.hpp @@ -40,6 +40,12 @@ namespace clover { const device , const std::string , std::string _log); + +#ifdef CLOVER_ALLOW_SPIRV + module compile_from_spirv(const std::vector , +const device , +std::string _log); +#endif } } diff --git a/src/gallium/state_trackers/clover/meson.build b/src/gallium/state_trackers/clover/meson.build index c52f0faa40..bffd0df11d 100644 --- a/src/gallium/state_trackers/clover/meson.build +++ b/src/gallium/state_trackers/clover/meson.build @@ -48,7 +48,7 @@ libclllvm = static_library( dep_llvm.get_configtool_variable('version'), 'include', )), ], - dependencies : [dep_llvm, dep_elf], + dependencies : [dep_llvm, dep_elf, dep_llvm_spirv], ) clover_files = files( -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 12/20] clover: Move platform extensions definitions to clover/platform.cpp
Reviewed-by: Francisco JerezReviewed-by: Aaron Watry Signed-off-by: Pierre Moreau --- src/gallium/state_trackers/clover/api/platform.cpp | 4 ++-- src/gallium/state_trackers/clover/core/platform.cpp | 5 + src/gallium/state_trackers/clover/core/platform.hpp | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/clover/api/platform.cpp b/src/gallium/state_trackers/clover/api/platform.cpp index 3b96b03fde..94d883c1f0 100644 --- a/src/gallium/state_trackers/clover/api/platform.cpp +++ b/src/gallium/state_trackers/clover/api/platform.cpp @@ -51,7 +51,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param, size_t size, void *r_buf, size_t *r_size) try { property_buffer buf { r_buf, size, r_size }; - obj(d_platform); + auto = obj(d_platform); switch (param) { case CL_PLATFORM_PROFILE: @@ -78,7 +78,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param, break; case CL_PLATFORM_EXTENSIONS: - buf.as_string() = "cl_khr_icd"; + buf.as_string() = platform.supported_extensions(); break; case CL_PLATFORM_ICD_SUFFIX_KHR: diff --git a/src/gallium/state_trackers/clover/core/platform.cpp b/src/gallium/state_trackers/clover/core/platform.cpp index 489e8dc5a8..ddd63fc5a0 100644 --- a/src/gallium/state_trackers/clover/core/platform.cpp +++ b/src/gallium/state_trackers/clover/core/platform.cpp @@ -39,3 +39,8 @@ platform::platform() : adaptor_range(evals(), devs) { } } } + +std::string +platform::supported_extensions() const { + return "cl_khr_icd"; +} diff --git a/src/gallium/state_trackers/clover/core/platform.hpp b/src/gallium/state_trackers/clover/core/platform.hpp index e849645bbe..b94434c983 100644 --- a/src/gallium/state_trackers/clover/core/platform.hpp +++ b/src/gallium/state_trackers/clover/core/platform.hpp @@ -40,6 +40,8 @@ namespace clover { platform & operator=(const platform ) = delete; + std::string supported_extensions() const; + protected: std::vector devs; }; -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 11/20] clover: Move device extensions definitions to core/device.cpp
Reviewed-by: Francisco JerezReviewed-by: Aaron Watry Signed-off-by: Pierre Moreau --- src/gallium/state_trackers/clover/api/device.cpp | 11 +-- src/gallium/state_trackers/clover/core/device.cpp | 14 ++ src/gallium/state_trackers/clover/core/device.hpp | 1 + 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp index 576555a9af..4e274c5005 100644 --- a/src/gallium/state_trackers/clover/api/device.cpp +++ b/src/gallium/state_trackers/clover/api/device.cpp @@ -330,16 +330,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param, break; case CL_DEVICE_EXTENSIONS: - buf.as_string() = - "cl_khr_byte_addressable_store" - " cl_khr_global_int32_base_atomics" - " cl_khr_global_int32_extended_atomics" - " cl_khr_local_int32_base_atomics" - " cl_khr_local_int32_extended_atomics" - + std::string(dev.has_int64_atomics() ? " cl_khr_int64_base_atomics" : "") - + std::string(dev.has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "") - + std::string(dev.has_doubles() ? " cl_khr_fp64" : "") - + std::string(dev.has_halves() ? " cl_khr_fp16" : ""); + buf.as_string() = dev.supported_extensions(); break; case CL_DEVICE_PLATFORM: diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index bd67bab5bc..21de0e3d61 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -282,3 +282,17 @@ device::supports_ir(enum pipe_shader_ir ir) const { return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, PIPE_SHADER_CAP_SUPPORTED_IRS) & (1 << ir); } + +std::string +device::supported_extensions() const { + return + "cl_khr_byte_addressable_store" + " cl_khr_global_int32_base_atomics" + " cl_khr_global_int32_extended_atomics" + " cl_khr_local_int32_base_atomics" + " cl_khr_local_int32_extended_atomics" + + std::string(has_int64_atomics() ? " cl_khr_int64_base_atomics" : "") + + std::string(has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "") + + std::string(has_doubles() ? " cl_khr_fp64" : "") + + std::string(has_halves() ? " cl_khr_fp16" : ""); +} diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp index ebe15f28e9..a7084e863f 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -83,6 +83,7 @@ namespace clover { std::string ir_target() const; enum pipe_endian endianness() const; bool supports_ir(enum pipe_shader_ir ir) const; + std::string supported_extensions() const; friend class command_queue; friend class root_resource; -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 10/20] clover: Track flags per module section
One flag that needs to be tracked is whether a library is allowed to received mathematics optimisations or not, as the authorisation is given when creating the library while the optimisations are specified when creating the executable. Reviewed-by: Aaron WatrySigned-off-by: Pierre Moreau --- Notes: Changes in v4: drop the modification to the tgsi backend, as already dropped (Aaron Watry) src/gallium/state_trackers/clover/core/module.cpp | 1 + src/gallium/state_trackers/clover/core/module.hpp | 13 + src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp | 3 ++- src/gallium/state_trackers/clover/llvm/codegen/common.cpp | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/clover/core/module.cpp b/src/gallium/state_trackers/clover/core/module.cpp index a6c5b98d8e..0e11506d0d 100644 --- a/src/gallium/state_trackers/clover/core/module.cpp +++ b/src/gallium/state_trackers/clover/core/module.cpp @@ -163,6 +163,7 @@ namespace { proc(S , QT ) { _proc(s, x.id); _proc(s, x.type); + _proc(s, x.flags); _proc(s, x.size); _proc(s, x.data); } diff --git a/src/gallium/state_trackers/clover/core/module.hpp b/src/gallium/state_trackers/clover/core/module.hpp index 2ddd26426f..ff7e9b6234 100644 --- a/src/gallium/state_trackers/clover/core/module.hpp +++ b/src/gallium/state_trackers/clover/core/module.hpp @@ -41,14 +41,19 @@ namespace clover { data_local, data_private }; + enum class flags_t { +none, +allow_link_options + }; - section(resource_id id, enum type type, size_t size, - const std::vector ) : - id(id), type(type), size(size), data(data) { } - section() : id(0), type(text_intermediate), size(0), data() { } + section(resource_id id, enum type type, flags_t flags, + size_t size, const std::vector ) : + id(id), type(type), flags(flags), size(size), data(data) { } + section() : id(0), type(text_intermediate), flags(flags_t::none), size(0), data() { } resource_id id; type type; + flags_t flags; size_t size; std::vector data; }; diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp index 40bb426218..8e9d4c7e85 100644 --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp @@ -84,7 +84,8 @@ clover::llvm::build_module_library(const ::llvm::Module , enum module::section::type section_type) { module m; const auto code = emit_code(mod); - m.secs.emplace_back(0, section_type, code.size(), code); + m.secs.emplace_back(0, section_type, module::section::flags_t::none, + code.size(), code); return m; } diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp index ddf2083f37..3a08f11fcc 100644 --- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp +++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp @@ -179,7 +179,7 @@ namespace { make_text_section(const std::vector ) { const pipe_llvm_program_header header { uint32_t(code.size()) }; module::section text { 0, module::section::text_executable, - header.num_bytes, {} }; + module::section::flags_t::none, header.num_bytes, {} }; text.data.insert(text.data.end(), reinterpret_cast(), reinterpret_cast() + sizeof(header)); -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 07/20] clover/api: Rework the validation of devices for building
Signed-off-by: Pierre Moreau--- Notes: Changes in v4: * validate_build_common no longer returns a list of devices (Francisco Jerez); * Dropped duplicate checks (Francisco Jerez). src/gallium/state_trackers/clover/api/program.cpp | 23 +- src/gallium/state_trackers/clover/core/program.cpp | 3 ++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index 9d59668f8f..e97b6400fe 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -32,6 +32,7 @@ namespace { void validate_build_common(const program , cl_uint num_devs, const cl_device_id *d_devs, + ref_vector _devs, void (*pfn_notify)(cl_program, void *), void *user_data) { if (!pfn_notify && user_data) @@ -41,7 +42,7 @@ namespace { throw error(CL_INVALID_OPERATION); if (any_of([&](const device ) { - return !count(dev, prog.context().devices()); + return !count(dev, valid_devs); }, objs(d_devs, num_devs))) throw error(CL_INVALID_DEVICE); } @@ -176,12 +177,13 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs, void (*pfn_notify)(cl_program, void *), void *user_data) try { auto = obj(d_prog); - auto devs = (d_devs ? objs(d_devs, num_devs) : -ref_vector(prog.context().devices())); + auto valid_devs = ref_vector(prog.devices()); + auto devs = (d_devs ? objs(d_devs, num_devs) : valid_devs); const auto opts = std::string(p_opts ? p_opts : "") + " " + debug_get_option("CLOVER_EXTRA_BUILD_OPTIONS", ""); - validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data); + validate_build_common(prog, num_devs, d_devs, valid_devs, pfn_notify, + user_data); if (prog.has_source) { prog.compile(devs, opts); @@ -202,13 +204,14 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs, void (*pfn_notify)(cl_program, void *), void *user_data) try { auto = obj(d_prog); - auto devs = (d_devs ? objs(d_devs, num_devs) : -ref_vector(prog.context().devices())); + auto valid_devs = ref_vector(prog.devices()); + auto devs = (d_devs ? objs(d_devs, num_devs) : valid_devs); const auto opts = std::string(p_opts ? p_opts : "") + " " + debug_get_option("CLOVER_EXTRA_COMPILE_OPTIONS", ""); header_map headers; - validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data); + validate_build_common(prog, num_devs, d_devs, valid_devs, pfn_notify, + user_data); if (bool(num_headers) != bool(header_names)) throw error(CL_INVALID_VALUE); @@ -280,11 +283,13 @@ clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs, debug_get_option("CLOVER_EXTRA_LINK_OPTIONS", ""); auto progs = objs(d_progs, num_progs); auto prog = create(ctx); + auto valid_devs = ref_vector(ctx.devices()); auto devs = validate_link_devices(progs, (d_devs ? objs(d_devs, num_devs) : - ref_vector(ctx.devices(; + valid_devs)); - validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data); + validate_build_common(prog, num_devs, d_devs, valid_devs, pfn_notify, + user_data); try { prog().link(devs, opts, progs); diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp index ec71d99b01..62fa13efbf 100644 --- a/src/gallium/state_trackers/clover/core/program.cpp +++ b/src/gallium/state_trackers/clover/core/program.cpp @@ -26,7 +26,8 @@ using namespace clover; program::program(clover::context , const std::string ) : - has_source(true), context(ctx), _source(source), _kernel_ref_counter(0) { + has_source(true), context(ctx), _devices(ctx.devices()), _source(source), + _kernel_ref_counter(0) { } program::program(clover::context , -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 06/20] clover/device: Replace usage of "1 << PIPE_SHADER_IR_*" with supports_ir
Reviewed-by: Aaron WatrySigned-off-by: Pierre Moreau --- src/gallium/state_trackers/clover/core/device.cpp | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 62d5221bf8..bd67bab5bc 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -244,11 +244,7 @@ device::vendor_name() const { enum pipe_shader_ir device::ir_format() const { - int supported_irs = - pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, - PIPE_SHADER_CAP_SUPPORTED_IRS); - - if (supported_irs & (1 << PIPE_SHADER_IR_NATIVE)) { + if (supports_ir(PIPE_SHADER_IR_NATIVE)) { return PIPE_SHADER_IR_NATIVE; } -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 08/20] clover/api: Fail if trying to build a non-executable binary
From the OpenCL 1.2 Specification, Section 5.6.2 (about clBuildProgram): > If program is created with clCreateProgramWithBinary, then the > program binary must be an executable binary (not a compiled binary or > library). Reviewed-by: Aaron WatrySigned-off-by: Pierre Moreau --- src/gallium/state_trackers/clover/api/program.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index e97b6400fe..134cebfdf7 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -188,6 +188,13 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs, if (prog.has_source) { prog.compile(devs, opts); prog.link(devs, opts, { prog }); + } else if (any_of([&](const device ){ + return prog.build(dev).binary_type() != CL_PROGRAM_BINARY_TYPE_EXECUTABLE; + }, devs)) { + // According to the OpenCL 1.2 specification, “if program is created + // with clCreateProgramWithBinary, then the program binary must be an + // executable binary (not a compiled binary or library).” + throw error(CL_INVALID_BINARY); } return CL_SUCCESS; -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 09/20] clover: Disallow creating libraries from other libraries
If creating a library, do not allow non-compiled object in it, as executables are not allowed, and libraries would make it really hard to enforce the "-enable-link-options" flag. Reviewed-by: Francisco JerezReviewed-by: Aaron Watry Signed-off-by: Pierre Moreau --- Notes: v3: Re-write the explanation as to why libraries can’t be created from other libraries (Francisco Jerez) src/gallium/state_trackers/clover/api/program.cpp | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index 134cebfdf7..7d57d3f0e9 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -253,8 +253,11 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs, namespace { ref_vector validate_link_devices(const ref_vector , - const ref_vector _devs) { + const ref_vector _devs, + const std::string ) { std::vector devs; + const bool create_library = + opts.find("-create-library") != std::string::npos; for (auto : all_devs) { const auto has_binary = [&](const program ) { @@ -263,10 +266,22 @@ namespace { t == CL_PROGRAM_BINARY_TYPE_LIBRARY; }; + // According to the OpenCL 1.2 specification, a library is made of + // “compiled binaries specified in input_programs argument to + // clLinkProgram“; compiled binaries does not refer to libraries: + // “input_programs is an array of program objects that are compiled + // binaries or libraries that are to be linked to create the program + // executable”. + if (create_library && any_of([&](const program ) { + const auto t = prog.build(dev).binary_type(); + return t != CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT; + }, progs)) +throw error(CL_INVALID_OPERATION); + // According to the CL 1.2 spec, when "all programs specified [..] // contain a compiled binary or library for the device [..] a link is // performed", - if (all_of(has_binary, progs)) + else if (all_of(has_binary, progs)) devs.push_back(); // otherwise if "none of the programs contain a compiled binary or @@ -293,7 +308,7 @@ clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs, auto valid_devs = ref_vector(ctx.devices()); auto devs = validate_link_devices(progs, (d_devs ? objs(d_devs, num_devs) : - valid_devs)); + valid_devs), opts); validate_build_common(prog, num_devs, d_devs, valid_devs, pfn_notify, user_data); -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 05/20] clover: Add an helper for checking if an IR is supported
Reviewed-by: Aaron WatrySigned-off-by: Pierre Moreau --- Notes: v3: * Dropped supported_irs() (Francisco Jerez) * Changed supports_ir() argument type to `enum pipe_shader_ir` (Francisco Jerez) src/gallium/state_trackers/clover/core/device.cpp | 6 ++ src/gallium/state_trackers/clover/core/device.hpp | 1 + 2 files changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 0d911e3751..62d5221bf8 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -280,3 +280,9 @@ device::device_clc_version() const { debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", "1.1"); return device_clc_version; } + +bool +device::supports_ir(enum pipe_shader_ir ir) const { + return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, + PIPE_SHADER_CAP_SUPPORTED_IRS) & (1 << ir); +} diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp index 85cd031676..ebe15f28e9 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -82,6 +82,7 @@ namespace clover { enum pipe_shader_ir ir_format() const; std::string ir_target() const; enum pipe_endian endianness() const; + bool supports_ir(enum pipe_shader_ir ir) const; friend class command_queue; friend class root_resource; -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 04/20] clover: Remove the TGSI backend as unused
Signed-off-by: Pierre Moreau--- src/gallium/state_trackers/clover/Makefile.am | 11 +- src/gallium/state_trackers/clover/Makefile.sources | 4 - src/gallium/state_trackers/clover/core/program.cpp | 13 +-- src/gallium/state_trackers/clover/meson.build | 9 +- .../state_trackers/clover/tgsi/compiler.cpp| 120 - .../state_trackers/clover/tgsi/invocation.hpp | 37 --- 6 files changed, 8 insertions(+), 186 deletions(-) delete mode 100644 src/gallium/state_trackers/clover/tgsi/compiler.cpp delete mode 100644 src/gallium/state_trackers/clover/tgsi/invocation.hpp diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am index a7befb4605..35ee092f3f 100644 --- a/src/gallium/state_trackers/clover/Makefile.am +++ b/src/gallium/state_trackers/clover/Makefile.am @@ -28,14 +28,7 @@ cl_HEADERS = \ $(top_srcdir)/include/CL/opencl.h endif -noinst_LTLIBRARIES = libclover.la libcltgsi.la libclllvm.la - -libcltgsi_la_CXXFLAGS = \ - $(CXX11_CXXFLAGS) \ - $(CLOVER_STD_OVERRIDE) \ - $(VISIBILITY_CXXFLAGS) - -libcltgsi_la_SOURCES = $(TGSI_SOURCES) +noinst_LTLIBRARIES = libclover.la libclllvm.la libclllvm_la_CXXFLAGS = \ $(CXX11_CXXFLAGS) \ @@ -56,7 +49,7 @@ libclover_la_CXXFLAGS = \ $(VISIBILITY_CXXFLAGS) libclover_la_LIBADD = \ - libcltgsi.la libclllvm.la + libclllvm.la libclover_la_SOURCES = $(CPP_SOURCES) diff --git a/src/gallium/state_trackers/clover/Makefile.sources b/src/gallium/state_trackers/clover/Makefile.sources index e9828b107b..5167ca75af 100644 --- a/src/gallium/state_trackers/clover/Makefile.sources +++ b/src/gallium/state_trackers/clover/Makefile.sources @@ -62,7 +62,3 @@ LLVM_SOURCES := \ llvm/invocation.hpp \ llvm/metadata.hpp \ llvm/util.hpp - -TGSI_SOURCES := \ - tgsi/compiler.cpp \ - tgsi/invocation.hpp diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp index 4e74fccd97..ec71d99b01 100644 --- a/src/gallium/state_trackers/clover/core/program.cpp +++ b/src/gallium/state_trackers/clover/core/program.cpp @@ -22,7 +22,6 @@ #include "core/program.hpp" #include "llvm/invocation.hpp" -#include "tgsi/invocation.hpp" using namespace clover; @@ -51,10 +50,9 @@ program::compile(const ref_vector , const std::string , std::string log; try { -const module m = (dev.ir_format() == PIPE_SHADER_IR_TGSI ? - tgsi::compile_program(_source, log) : - llvm::compile_program(_source, headers, dev, -opts, log)); +assert(dev.ir_format() == PIPE_SHADER_IR_NATIVE); +const module m = llvm::compile_program(_source, headers, dev, opts, + log); _builds[] = { m, opts, log }; } catch (...) { _builds[] = { module(), opts, log }; @@ -76,9 +74,8 @@ program::link(const ref_vector , const std::string , std::string log = _builds[].log; try { - const module m = (dev.ir_format() == PIPE_SHADER_IR_TGSI ? - tgsi::link_program(ms) : - llvm::link_program(ms, dev, opts, log)); + assert(dev.ir_format() == PIPE_SHADER_IR_NATIVE); + const module m = llvm::link_program(ms, dev, opts, log); _builds[] = { m, opts, log }; } catch (...) { _builds[] = { module(), opts, log }; diff --git a/src/gallium/state_trackers/clover/meson.build b/src/gallium/state_trackers/clover/meson.build index d1497e657e..c52f0faa40 100644 --- a/src/gallium/state_trackers/clover/meson.build +++ b/src/gallium/state_trackers/clover/meson.build @@ -25,13 +25,6 @@ if with_opencl_icd clover_cpp_args += '-DHAVE_CLOVER_ICD' endif -libcltgsi = static_library( - 'cltgsi', - files('tgsi/compiler.cpp', 'tgsi/invocation.hpp'), - include_directories : clover_incs, - cpp_args : [cpp_vis_args], -) - libclllvm = static_library( 'clllvm', files( @@ -118,5 +111,5 @@ libclover = static_library( clover_files, include_directories : clover_incs, cpp_args : [clover_cpp_args, cpp_vis_args], - link_with : [libcltgsi, libclllvm], + link_with : [libclllvm], ) diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp deleted file mode 100644 index e165311fa4..00 --- a/src/gallium/state_trackers/clover/tgsi/compiler.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// -// Copyright 2012 Francisco Jerez -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to
[Mesa-dev] [PATCH v4 03/20] clover/api: Fix tab indentation to spaces
Acked-by: Francisco JerezReviewed-by: Karol Herbst Reviewed-by: Aaron Watry Signed-off-by: Pierre Moreau --- src/gallium/state_trackers/clover/api/device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp index 3572bb0c92..576555a9af 100644 --- a/src/gallium/state_trackers/clover/api/device.cpp +++ b/src/gallium/state_trackers/clover/api/device.cpp @@ -326,7 +326,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param, #ifdef MESA_GIT_SHA1 " (" MESA_GIT_SHA1 ")" #endif - ; +; break; case CL_DEVICE_EXTENSIONS: -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 00/20] Introducing SPIR-V support to clover
Hello, This new version addresses the comments from the v3, making SPIRV-Tools and llvm-spirv dependencies optional among others. The series is also accessible at https://github.com/pierremoreau/mesa, on the branch clover_spirv_series_v4. llvm-spirv can be currently grabbed from https://github.com/pierremoreau/llvm-spirv, on the branch integrate_with_mesa. It seems this will be the current “master” repository, until it gets accepted as an external tool in LLVM. As an out-of-tree LLVM consumer, it should be relatively easy to package (especially compared to Khronos’ SPIRV_LLVM repository). The SPIR-V clover backend, that was previously part of this series, has been dropped out for now, and will instead be submitted in a separate series along with a consumer. So, what this series enable (besides fixing bugs), is to accept SPIR-V binaries for drivers that accept NATIVE as IR format, so all drivers currently supported by clover. Thanks in advance for the reviews and comments, Pierre v4: * Addressed comments in patch 7 and 14; * Dropped unneeded modification to the TGSI backend in patch 10, as the backend is now removed in patch 04; * Moved old patch 12 forward, to new patch 04; * Modified patches 13, 16 and 19 to make SPIRV-Tools and llvm-spirv optional; * Dropped old patch 21, as changes are part of new patch 17 and 18 now. Unchanged patches: * 01: “include/CL: Update to the latest OpenCL 2.2 headers” * 02: “clover: update ICD table to support everything up to 2.2” * 03: “clover/api: Fix tab indentation to spaces” * 04: “clover: Remove the TGSI backend as unused” * 05: “clover: Add an helper for checking if an IR is supported” * 06: “clover/device: Replace usage of "1 << PIPE_SHADER_IR_*" with supports_ir” * 08: “clover/api: Fail if trying to build a non-executable binary” * 09: “clover: Disallow creating libraries from other libraries” * 11: “clover: Move device extensions definitions to core/device.cpp” * 12: “clover: Move platform extensions definitions to clover/platform.cpp” * 15: “include/CL: Add cl_khr_il_program” * 20: “clover: Implement clCreateProgramWithIL from OpenCL 2.1” Karol Herbst (1): clover: update ICD table to support everything up to 2.2 Pierre Moreau (19): include/CL: Update to the latest OpenCL 2.2 headers clover/api: Fix tab indentation to spaces clover: Remove the TGSI backend as unused clover: Add an helper for checking if an IR is supported clover/device: Replace usage of "1 << PIPE_SHADER_IR_*" with supports_ir clover/api: Rework the validation of devices for building clover/api: Fail if trying to build a non-executable binary clover: Disallow creating libraries from other libraries clover: Track flags per module section clover: Move device extensions definitions to core/device.cpp clover: Move platform extensions definitions to clover/platform.cpp configure.ac,meson: Check for SPIRV-Tools and llvm-spirv clover/llvm: Allow translating from SPIR-V to LLVM IR include/CL: Add cl_khr_il_program clover: Implement clCreateProgramWithILKHR clover: Handle CL_PROGRAM_IL in clGetProgramInfo clover/api: Implement CL_DEVICE_IL_VERSION clover: Advertise cl_khr_il_program clover: Implement clCreateProgramWithIL from OpenCL 2.1 configure.ac | 17 + include/CL/cl.h| 472 - include/CL/cl_d3d10.h | 7 +- include/CL/cl_d3d11.h | 7 +- include/CL/cl_dx9_media_sharing.h | 9 +- include/CL/cl_dx9_media_sharing_intel.h| 182 include/CL/cl_egl.h| 9 +- include/CL/cl_ext.h| 338 ++- include/CL/cl_ext_intel.h | 429 +++ include/CL/cl_gl.h | 7 +- include/CL/cl_gl_ext.h | 7 +- include/CL/cl_platform.h | 328 ++ include/CL/cl_va_api_media_sharing_intel.h | 172 include/CL/opencl.h| 7 +- meson.build| 7 + src/gallium/state_trackers/clover/Makefile.am | 17 +- src/gallium/state_trackers/clover/Makefile.sources | 4 - src/gallium/state_trackers/clover/api/device.cpp | 20 +- src/gallium/state_trackers/clover/api/dispatch.cpp | 29 +- src/gallium/state_trackers/clover/api/dispatch.hpp | 194 + src/gallium/state_trackers/clover/api/platform.cpp | 6 +- src/gallium/state_trackers/clover/api/program.cpp | 151 ++- src/gallium/state_trackers/clover/core/device.cpp | 32 +- src/gallium/state_trackers/clover/core/device.hpp | 2 + src/gallium/state_trackers/clover/core/module.cpp | 1 + src/gallium/state_trackers/clover/core/module.hpp | 13 +- .../state_trackers/clover/core/platform.cpp| 5 +
[Mesa-dev] [PATCH v4 02/20] clover: update ICD table to support everything up to 2.2
From: Karol Herbstv2: add more prototypes Signed-off-by: Karol Herbst Reviewed-by: Aaron Watry Reviewed-by: Pierre Moreau --- src/gallium/state_trackers/clover/api/dispatch.cpp | 29 +++- src/gallium/state_trackers/clover/api/dispatch.hpp | 190 + 2 files changed, 218 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/clover/api/dispatch.cpp b/src/gallium/state_trackers/clover/api/dispatch.cpp index 8f4cfdc7fb..8be4d3cb26 100644 --- a/src/gallium/state_trackers/clover/api/dispatch.cpp +++ b/src/gallium/state_trackers/clover/api/dispatch.cpp @@ -142,6 +142,33 @@ namespace clover { NULL, // clEnqueueReleaseD3D11ObjectsKHR NULL, // clGetDeviceIDsFromDX9MediaAdapterKHR NULL, // clEnqueueAcquireDX9MediaSurfacesKHR - NULL // clEnqueueReleaseDX9MediaSurfacesKHR + NULL, // clEnqueueReleaseDX9MediaSurfacesKHR + NULL, // clCreateFromEGLImageKHR + NULL, // clEnqueueAcquireEGLObjectsKHR + NULL, // clEnqueueReleaseEGLObjectsKHR + NULL, // clCreateEventFromEGLSyncKHR + NULL, // clCreateCommandQueueWithProperties + NULL, // clCreatePipe + NULL, // clGetPipeInfo + NULL, // clSVMAlloc + NULL, // clSVMFree + NULL, // clEnqueueSVMFree + NULL, // clEnqueueSVMMemcpy + NULL, // clEnqueueSVMMemFill + NULL, // clEnqueueSVMMap + NULL, // clEnqueueSVMUnmap + NULL, // clCreateSamplerWithProperties + NULL, // clSetKernelArgSVMPointer + NULL, // clSetKernelExecInfo + NULL, // clGetKernelSubGroupInfoKHR + NULL, // clCloneKernel + NULL, // clCreateProgramWithIL + NULL, // clEnqueueSVMMigrateMem + NULL, // clGetDeviceAndHostTimer + NULL, // clGetHostTimer + NULL, // clGetKernelSubGroupInfo + NULL, // clSetDefaultDeviceCommandQueue + NULL, // clSetProgramReleaseCallback + NULL, // clSetProgramSpecializationConstant }; } diff --git a/src/gallium/state_trackers/clover/api/dispatch.hpp b/src/gallium/state_trackers/clover/api/dispatch.hpp index 0ec1b51fa6..60fb75a146 100644 --- a/src/gallium/state_trackers/clover/api/dispatch.hpp +++ b/src/gallium/state_trackers/clover/api/dispatch.hpp @@ -27,6 +27,7 @@ #include "CL/cl.h" #include "CL/cl_ext.h" +#include "CL/cl_egl.h" #include "CL/cl_gl.h" /// @@ -765,6 +766,195 @@ struct _cl_icd_dispatch { void *clGetDeviceIDsFromDX9MediaAdapterKHR; void *clEnqueueAcquireDX9MediaSurfacesKHR; void *clEnqueueReleaseDX9MediaSurfacesKHR; + + CL_API_ENTRY void (CL_API_CALL *clCreateFromEGLImageKHR)( + cl_context context, + CLeglDisplayKHR display, + CLeglImageKHR image, + cl_mem_flags flags, + const cl_egl_image_properties_khr *properties, + cl_int *errcode_ret); + + CL_API_ENTRY void (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem *mem_objects, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event); + + CL_API_ENTRY void (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem *mem_objects, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event); + + CL_API_ENTRY void (CL_API_CALL *clCreateEventFromEGLSyncKHR)( + cl_context context, + CLeglSyncKHR sync, + CLeglDisplayKHR display, + cl_int *errcode_ret); + + CL_API_ENTRY void (CL_API_CALL *clCreateCommandQueueWithProperties)( + cl_context context, + cl_device_id device, + const cl_queue_properties *properties, + cl_int *errcode_ret); + + CL_API_ENTRY void (CL_API_CALL *clCreatePipe)( + cl_context context, + cl_mem_flags flags, + cl_uint pipe_packet_size, + cl_uint pipe_max_packets, + const cl_pipe_properties *properties, + cl_int *errcode_ret); + + CL_API_ENTRY void (CL_API_CALL *clGetPipeInfo)( + cl_mem pipe, + cl_pipe_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret); + + CL_API_ENTRY void (CL_API_CALL *clSVMAlloc)( + cl_context context, + cl_svm_mem_flags flags, + size_t size, + unsigned int alignment); + + CL_API_ENTRY void (CL_API_CALL *clSVMFree)( + cl_context context, + void *svm_pointer); + + CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMFree)( + cl_command_queue command_queue, + cl_uint num_svm_pointers, + void **svm_pointers, + void (CL_CALLBACK *pfn_free_func)(cl_command_queue, cl_uint, void **, void *), + void *user_data, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event); + + CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMMemcpy)( + cl_command_queue command_queue, + cl_bool
[Mesa-dev] [PATCH] radv: drop assert on bindingDescriptorCount > 0
From: Dave AirlieThe spec is pretty clear that this can be 0, and that it operates as a reserved binding. Fixes: dEQP-VK.binding_model.descriptor_update.empty_descriptor.uniform_buffer Signed-off-by: Dave Airlie --- src/amd/vulkan/radv_descriptor_set.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index daff7b2fcd..3d56f8c217 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -137,7 +137,6 @@ VkResult radv_CreateDescriptorSetLayout( } set_layout->size = align(set_layout->size, alignment); - assert(binding->descriptorCount > 0); set_layout->binding[b].type = binding->descriptorType; set_layout->binding[b].array_size = binding->descriptorCount; set_layout->binding[b].offset = set_layout->size; -- 2.14.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] autotools: add vtn_amd.c to sources
Sorry for the noise. Rather than wait for others to trip over this, I've pushed my patch with a r-b from Bas. On 08/03/18 10:42, Timothy Arceri wrote: Look like I should have check the list before sending a patch. Please add the following to the commit message. Otherwise Reviewed-by: Timothy ArceriFixes: 68a6a3b51acc "spirv: handle AMD_gcn_shader extended instructions" On 08/03/18 10:13, Dylan Baker wrote: cc: Emil Veliov Signed-off-by: Dylan Baker --- src/compiler/Makefile.sources | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 841bc8fec91..37340ba809e 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -301,6 +301,7 @@ SPIRV_FILES = \ spirv/spirv_info.h \ spirv/spirv_to_nir.c \ spirv/vtn_alu.c \ + spirv/vtn_amd.c \ spirv/vtn_cfg.c \ spirv/vtn_glsl450.c \ spirv/vtn_private.h \ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] autotools: add vtn_amd.c to sources
Look like I should have check the list before sending a patch. Please add the following to the commit message. Otherwise Reviewed-by: Timothy ArceriFixes: 68a6a3b51acc "spirv: handle AMD_gcn_shader extended instructions" On 08/03/18 10:13, Dylan Baker wrote: cc: Emil Veliov Signed-off-by: Dylan Baker --- src/compiler/Makefile.sources | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 841bc8fec91..37340ba809e 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -301,6 +301,7 @@ SPIRV_FILES = \ spirv/spirv_info.h \ spirv/spirv_to_nir.c \ spirv/vtn_alu.c \ + spirv/vtn_amd.c \ spirv/vtn_cfg.c \ spirv/vtn_glsl450.c \ spirv/vtn_private.h \ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radv: fix autotools builds
Fixes: 68a6a3b51acc "spirv: handle AMD_gcn_shader extended instructions" Cc: Daniel SchürmannCc: Bas Nieuwenhuizen --- src/compiler/Makefile.sources | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 841bc8fec9..37340ba809 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -301,6 +301,7 @@ SPIRV_FILES = \ spirv/spirv_info.h \ spirv/spirv_to_nir.c \ spirv/vtn_alu.c \ + spirv/vtn_amd.c \ spirv/vtn_cfg.c \ spirv/vtn_glsl450.c \ spirv/vtn_private.h \ -- 2.14.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] ac/radeonsi: add emit_kill to the abi
For the series: Reviewed-by: Marek OlšákMarek On Wed, Mar 7, 2018 at 6:04 PM, Timothy Arceri wrote: > This should fix a regression with Rocket League grass rendering > on the NIR backend. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104717 > --- > src/amd/common/ac_nir_to_llvm.c | 9 - > src/amd/common/ac_shader_abi.h | 2 ++ > src/gallium/drivers/radeonsi/si_shader.c | 1 + > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c > index 425970e609..e70e0c5488 100644 > --- a/src/amd/common/ac_nir_to_llvm.c > +++ b/src/amd/common/ac_nir_to_llvm.c > @@ -3844,6 +3844,12 @@ static void emit_barrier(struct ac_llvm_context *ac, > gl_shader_stage stage) >ac->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT); > } > > +static void radv_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible) > +{ > + struct radv_shader_context *ctx = radv_shader_context_from_abi(abi); > + ac_build_kill_if_false(>ac, visible); > +} > + > static void emit_discard(struct ac_nir_context *ctx, > const nir_intrinsic_instr *instr) > { > @@ -3858,7 +3864,7 @@ static void emit_discard(struct ac_nir_context *ctx, > cond = LLVMConstInt(ctx->ac.i1, false, 0); > } > > - ac_build_kill_if_false(>ac, cond); > + ctx->abi->emit_kill(ctx->abi, cond); > } > > static LLVMValueRef > @@ -6888,6 +6894,7 @@ LLVMModuleRef > ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, > ctx.abi.lookup_interp_param = lookup_interp_param; > ctx.abi.load_sample_position = load_sample_position; > ctx.abi.load_sample_mask_in = load_sample_mask_in; > + ctx.abi.emit_kill = radv_emit_kill; > } > > if (i) > diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h > index ccf26648a2..4a29e0eb13 100644 > --- a/src/amd/common/ac_shader_abi.h > +++ b/src/amd/common/ac_shader_abi.h > @@ -86,6 +86,8 @@ struct ac_shader_abi { > void (*emit_primitive)(struct ac_shader_abi *abi, >unsigned stream); > > + void (*emit_kill)(struct ac_shader_abi *abi, LLVMValueRef visible); > + > LLVMValueRef (*load_inputs)(struct ac_shader_abi *abi, > unsigned location, > unsigned driver_location, > diff --git a/src/gallium/drivers/radeonsi/si_shader.c > b/src/gallium/drivers/radeonsi/si_shader.c > index 2e57eca6e5..306784aff4 100644 > --- a/src/gallium/drivers/radeonsi/si_shader.c > +++ b/src/gallium/drivers/radeonsi/si_shader.c > @@ -6058,6 +6058,7 @@ static bool si_compile_tgsi_main(struct > si_shader_context *ctx, > ctx->abi.lookup_interp_param = si_nir_lookup_interp_param; > ctx->abi.load_sample_position = load_sample_position; > ctx->abi.load_sample_mask_in = load_sample_mask_in; > + ctx->abi.emit_kill = si_llvm_emit_kill; > break; > case PIPE_SHADER_COMPUTE: > ctx->abi.load_local_group_size = get_block_size; > -- > 2.14.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] autotools: add -I/src/egl to tizonia
meson got the same fix. cc: Emil VeliovSigned-off-by: Dylan Baker --- I don't know hat the "right" fix is here Emil, I just picked one and applied it to both meson and autotools. src/gallium/state_trackers/omx/tizonia/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/state_trackers/omx/tizonia/Makefile.am b/src/gallium/state_trackers/omx/tizonia/Makefile.am index 3149afa7bbb..0eac85a319e 100644 --- a/src/gallium/state_trackers/omx/tizonia/Makefile.am +++ b/src/gallium/state_trackers/omx/tizonia/Makefile.am @@ -27,6 +27,7 @@ AM_CFLAGS = \ -I$(top_srcdir)/src/mesa \ -I$(top_builddir)/src/mesa/drivers/dri/common \ -I$(top_srcdir)/src/mesa/drivers/dri/common \ + -I$(top_srcdir)/src/egl \ -I$(top_srcdir)/src/egl/drivers/dri2 \ -I$(top_srcdir)/src/egl/wayland/wayland-egl \ -I$(top_srcdir)/src/egl/main \ -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] autotools: add vtn_amd.c to sources
cc: Emil VeliovSigned-off-by: Dylan Baker --- src/compiler/Makefile.sources | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 841bc8fec91..37340ba809e 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -301,6 +301,7 @@ SPIRV_FILES = \ spirv/spirv_info.h \ spirv/spirv_to_nir.c \ spirv/vtn_alu.c \ + spirv/vtn_amd.c \ spirv/vtn_cfg.c \ spirv/vtn_glsl450.c \ spirv/vtn_private.h \ -- 2.16.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/56] anv: Add support for Vulkan 1.1
Hi all, I just wanted to give a shout out and a huge "Thank You!" to all of the people who made this release possible. There were a large number of features packed into the 1.1 release and implementing it all was a hugely collaborative effort. I want to specially thank our friends at Igalia. They implemented the VK_KHR_16bit_storage extension which was initially 45 patches which ended up going through multiple review cycles and getting expanded a bit. Less visibly, however, they've also been hard at work on the CTS. They've implemented quite a few tests for things such as VK_KHR_16bit_storage, VK_KHR_image_format_list, and others I've forgotten about. They also kept on top of the CTS as new tests were being developed and did most of the triage and bug fixing work in anv. I seriously don't know what we would have done without them. I think it's fair to say that, while we may have managed a skeleton 1.1 implementation, we wouldn't have been able to ship a full-featured 1.1 without them! Also, I probably would have gone insane. I also want to thank Lionel Landwerlin on my team. He implemented a bunch of the smaller features as well as VK_KHR_sampler_ycbcr_conversion. He also did a large amount of code review. Finally, I want to thank everyone else who was involved in helping with the 1.1 effort in any way. We in Linux graphics have an awesome community and I don't know what we'd do without you all. I tried to include everyone I can think of who helped with the 1.1 effort in the Cc. I'm sorry if I missed anyone. Thanks for all your help and hard work, --Jason Ekstrand On Wed, Mar 7, 2018 at 6:34 AM, Jason Ekstrandwrote: > This patch series adds full support for Vulkan 1.1 to the Intel Linux > Vulkan driver. As with the initial Vulkan 1.0 drop two years ago, this > driver is 100% Vulkan 1.1 conformant on all shipping Intel hardware gen8 > and above. Unlike our initial Vulkan 1.0 drop two years ago which was > missing piles of features, the Vulkan 1.1 implementation is nearly feature- > complete. With the exception of 16-bit shader I/O (we have patches but > they are awaiting better testing), every optional feature which was added > to core in Vulkan 1.1 and which can reasonably be reasonably supported by > shipping hardware has been implemented. > > The only significant feature implemented by this series is subgroups. It > is part of Vulkan 1.1 core but there is no corresponding Vulkan extension. > All of the other significant features in Vulkan 1.1 have already been > ratified and released as extension and we have already landed support for > them. > > In order to actually advertise support for Vulkan 1.1, we must be able to > advertise VK_KHR_external_fence which requires the SYNCOBJ_WAIT ioctl which > landed in Linux 4.14. Users may need to update their kernel before they > will get full 1.1 support. > > There are also quite a few patches in here to the entrypoints generator > and some of the other generators to handle various things required for > reporting a Vulkan version higher than 1.0. In particular, we need to > handle name aliasing for entrypoints and enums. > > All of the patches in this series have already been reviewed by people at > Intel or Igalia. Unless there are any complaints, I plan to land the > patches this afternoon. Dave and Bas also have some 1.1 patches and we're > going to have to work together to land them so that neither driver breaks > when we land the 1.1 XML. > > > Iago Toral Quiroga (2): > anv/device: GetDeviceQueue2 should only return queues with matching > flags > anv/device: fail to initialize device if we have queues with > unsupported flags > > Jason Ekstrand (54): > spirv: Add a vtn_constant_value helper > spirv: Rework barriers > vulkan: Rename multiview from KHX to KHR > anv/entrypoints: Generalize the string map a bit > anv/entrypoints_gen: A bit of refactoring > anv/entrypoints_gen: Allow the string map to grow > anv/entrypoints: Add an is_device_entrypoint helper > anv/entrypoints: Allow an entrypoint to require multiple extensions > anv/entrypoints_gen: Add support for aliases in the XML > anv/extensions: Add support for multiple API versions > anv/entrypoints: Generate #ifdef guards from platform attributes > vulkan/enum_to_str: Add a add_value_from_xml helper to VkEnum > vulkan/enum_to_str: Add support for aliases and new Vulkan versions > vulkan: Update the XML and headers to 1.1.70 > spirv: Update the SPIR-V headers and json to 1.3.1 > anv: Add version 1.1.0 but leave it disabled > Get rid of a bunch of KHR suffixes > anv/entrypoints: Drop support for protect attributes > anv: Support VkPhysicalDeviceShaderDrawParameterFeatures > anv: Implement VK_KHR_maintenance3 > nir/spirv: Add support for device groups > anv: Implement vkCmdDispatchBase > anv: Trivially implement VK_KHR_device_group > anv: Implement GetDeviceQueue2 > anv: Support querying for
[Mesa-dev] [PATCH 1/2] radeonsi: add si_llvm_emit_kill() helper
--- src/gallium/drivers/radeonsi/si_shader_internal.h | 2 ++ src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 31 ++- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h index 92ab11d0af..a03fde2644 100644 --- a/src/gallium/drivers/radeonsi/si_shader_internal.h +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h @@ -260,6 +260,8 @@ LLVMValueRef si_llvm_emit_fetch(struct lp_build_tgsi_context *bld_base, enum tgsi_opcode_type type, unsigned swizzle); +void si_llvm_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible); + LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi, LLVMTypeRef type, LLVMValueRef vertex_index, diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c index 201e4988fa..854f7ec8a6 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c @@ -53,20 +53,10 @@ static void kill_if_fetch_args(struct lp_build_tgsi_context *bld_base, emit_data->args[0] = conds[0]; } -static void kil_emit(const struct lp_build_tgsi_action *action, -struct lp_build_tgsi_context *bld_base, -struct lp_build_emit_data *emit_data) +void si_llvm_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible) { - struct si_shader_context *ctx = si_shader_context(bld_base); + struct si_shader_context *ctx = si_shader_context_from_abi(abi); LLVMBuilderRef builder = ctx->ac.builder; - LLVMValueRef visible; - - if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL_IF) { - visible = emit_data->args[0]; - } else { - assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL); - visible = LLVMConstInt(ctx->i1, false, 0); - } if (ctx->shader->selector->force_correct_derivs_after_kill) { /* LLVM 6.0 can kill immediately while maintaining WQM. */ @@ -84,6 +74,23 @@ static void kil_emit(const struct lp_build_tgsi_action *action, ac_build_kill_if_false(>ac, visible); } +static void kil_emit(const struct lp_build_tgsi_action *action, +struct lp_build_tgsi_context *bld_base, +struct lp_build_emit_data *emit_data) +{ + struct si_shader_context *ctx = si_shader_context(bld_base); + LLVMValueRef visible; + + if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL_IF) { + visible = emit_data->args[0]; + } else { + assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL); + visible = LLVMConstInt(ctx->i1, false, 0); + } + + si_llvm_emit_kill(>abi, visible); +} + static void emit_icmp(const struct lp_build_tgsi_action *action, struct lp_build_tgsi_context *bld_base, struct lp_build_emit_data *emit_data) -- 2.14.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] ac/radeonsi: add emit_kill to the abi
This should fix a regression with Rocket League grass rendering on the NIR backend. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104717 --- src/amd/common/ac_nir_to_llvm.c | 9 - src/amd/common/ac_shader_abi.h | 2 ++ src/gallium/drivers/radeonsi/si_shader.c | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 425970e609..e70e0c5488 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3844,6 +3844,12 @@ static void emit_barrier(struct ac_llvm_context *ac, gl_shader_stage stage) ac->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT); } +static void radv_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible) +{ + struct radv_shader_context *ctx = radv_shader_context_from_abi(abi); + ac_build_kill_if_false(>ac, visible); +} + static void emit_discard(struct ac_nir_context *ctx, const nir_intrinsic_instr *instr) { @@ -3858,7 +3864,7 @@ static void emit_discard(struct ac_nir_context *ctx, cond = LLVMConstInt(ctx->ac.i1, false, 0); } - ac_build_kill_if_false(>ac, cond); + ctx->abi->emit_kill(ctx->abi, cond); } static LLVMValueRef @@ -6888,6 +6894,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm, ctx.abi.lookup_interp_param = lookup_interp_param; ctx.abi.load_sample_position = load_sample_position; ctx.abi.load_sample_mask_in = load_sample_mask_in; + ctx.abi.emit_kill = radv_emit_kill; } if (i) diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h index ccf26648a2..4a29e0eb13 100644 --- a/src/amd/common/ac_shader_abi.h +++ b/src/amd/common/ac_shader_abi.h @@ -86,6 +86,8 @@ struct ac_shader_abi { void (*emit_primitive)(struct ac_shader_abi *abi, unsigned stream); + void (*emit_kill)(struct ac_shader_abi *abi, LLVMValueRef visible); + LLVMValueRef (*load_inputs)(struct ac_shader_abi *abi, unsigned location, unsigned driver_location, diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 2e57eca6e5..306784aff4 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6058,6 +6058,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx, ctx->abi.lookup_interp_param = si_nir_lookup_interp_param; ctx->abi.load_sample_position = load_sample_position; ctx->abi.load_sample_mask_in = load_sample_mask_in; + ctx->abi.emit_kill = si_llvm_emit_kill; break; case PIPE_SHADER_COMPUTE: ctx->abi.load_local_group_size = get_block_size; -- 2.14.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 104836] Missing library link breaks mesa on Debian/ia64
https://bugs.freedesktop.org/show_bug.cgi?id=104836 Timothy Arcerichanged: What|Removed |Added Status|NEW |ASSIGNED Assignee|mesa-dev@lists.freedesktop. |emil.l.veli...@gmail.com |org | -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 53426] out-of-bounds access src/mesa/main/fbobject:222
https://bugs.freedesktop.org/show_bug.cgi?id=53426 Timothy Arcerichanged: What|Removed |Added Assignee|mesa-dev@lists.freedesktop. |v...@freedesktop.org |org | Status|NEW |ASSIGNED -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev