diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-11-02 04:53:47 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-11-02 04:53:47 +0000 |
commit | b44518130b33cadb5c1d619e9e936ae0e0dbf7cb (patch) | |
tree | 6069eb03c39fbc79808a7d94f857118cce75cbe3 /lib/mesa/src/gallium/winsys/svga | |
parent | 32aeb3c41fedbbd7b11aacfec48e8f699d16bff0 (diff) |
Merge Mesa 23.1.9
Diffstat (limited to 'lib/mesa/src/gallium/winsys/svga')
7 files changed, 38 insertions, 29 deletions
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c index f0179f96d..b754a066a 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c +++ b/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c @@ -34,9 +34,9 @@ */ -#include "pipe/p_config.h" +#include "util/detect.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) +#if DETECT_OS_LINUX || DETECT_OS_BSD || DETECT_OS_SOLARIS #include <unistd.h> #include <sched.h> #endif @@ -45,7 +45,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_defines.h" #include "util/u_debug.h" -#include "os/os_thread.h" +#include "util/u_thread.h" #include "util/u_memory.h" #include "util/list.h" @@ -796,7 +796,7 @@ fenced_bufmgr_destroy(struct pb_manager *mgr) /* Wait on outstanding fences */ while (fenced_mgr->num_fenced) { mtx_unlock(&fenced_mgr->mutex); -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) +#if DETECT_OS_LINUX || DETECT_OS_BSD || DETECT_OS_SOLARIS sched_yield(); #endif mtx_lock(&fenced_mgr->mutex); diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c index a31c3df0b..0981e7418 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c +++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c @@ -27,7 +27,7 @@ #include "util/u_memory.h" #include "util/u_atomic.h" #include "util/list.h" -#include "os/os_thread.h" +#include "util/u_thread.h" #include "pipebuffer/pb_buffer_fenced.h" diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c index 1451a96ca..8dd4f4dda 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c +++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c @@ -87,7 +87,7 @@ vmw_winsys_screen_deinit_mksstat(struct vmw_winsys_screen *vws) uint32_t expected = __atomic_load_n(&vws->mksstat_tls[i].pid, __ATOMIC_ACQUIRE); if (expected == -1U) { - fprintf(stderr, "%s encountered locked mksstat TLS entry at index %lu.\n", __FUNCTION__, i); + fprintf(stderr, "%s encountered locked mksstat TLS entry at index %lu.\n", __func__, i); continue; } @@ -103,12 +103,12 @@ vmw_winsys_screen_deinit_mksstat(struct vmw_winsys_screen *vws) assert(vws->mksstat_tls[i].stat_id != -1UL); if (drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_MKSSTAT_REMOVE, &arg, sizeof(arg))) { - fprintf(stderr, "%s could not ioctl: %s\n", __FUNCTION__, strerror(errno)); + fprintf(stderr, "%s could not ioctl: %s\n", __func__, strerror(errno)); } else if (munmap(vws->mksstat_tls[i].stat_pages, vmw_svga_winsys_stats_len())) { - fprintf(stderr, "%s could not munmap: %s\n", __FUNCTION__, strerror(errno)); + fprintf(stderr, "%s could not munmap: %s\n", __func__, strerror(errno)); } } else { - fprintf(stderr, "%s encountered volatile mksstat TLS entry at index %lu.\n", __FUNCTION__, i); + fprintf(stderr, "%s encountered volatile mksstat TLS entry at index %lu.\n", __func__, i); } } } diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h index 127ef16d6..75439c58a 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h +++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h @@ -40,7 +40,7 @@ #include "svga_winsys.h" #include "pipebuffer/pb_buffer_fenced.h" -#include <os/os_thread.h> +#include "util/u_thread.h" #include <sys/types.h> #define VMW_GMR_POOL_SIZE (16*1024*1024) diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c index 7b83cbce2..cc0a1e3eb 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c +++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c @@ -46,7 +46,7 @@ #include "svga3d_caps.h" #include "svga3d_reg.h" -#include "os/os_mman.h" +#include "util/os_mman.h" #include <errno.h> #include <unistd.h> @@ -153,7 +153,7 @@ vmw_ioctl_surface_create(struct vmw_winsys_screen *vws, uint32_t iMipLevel; int ret; - vmw_printf("%s flags %d format %d\n", __FUNCTION__, flags, format); + vmw_printf("%s flags %d format %d\n", __func__, flags, format); memset(&s_arg, 0, sizeof(s_arg)); req->flags = (uint32_t) flags; @@ -218,7 +218,7 @@ vmw_ioctl_gb_surface_create(struct vmw_winsys_screen *vws, struct vmw_region *region = NULL; int ret; - vmw_printf("%s flags %d format %d\n", __FUNCTION__, flags, format); + vmw_printf("%s flags %d format %d\n", __func__, flags, format); if (p_region) { region = CALLOC_STRUCT(vmw_region); @@ -478,7 +478,7 @@ vmw_ioctl_gb_surface_ref(struct vmw_winsys_screen *vws, *numMipLevels = rep->creq.mip_levels; } - vmw_printf("%s flags %d format %d\n", __FUNCTION__, *flags, *format); + vmw_printf("%s flags %d format %d\n", __func__, *flags, *format); if (needs_unref) vmw_ioctl_surface_destroy(vws, *handle); @@ -573,7 +573,7 @@ vmw_ioctl_command(struct vmw_winsys_screen *vws, int32_t cid, usleep(1000); } while(ret == -ERESTART || ret == -EBUSY); if (ret) { - vmw_error("%s error %s.\n", __FUNCTION__, strerror(-ret)); + vmw_error("%s error %s.\n", __func__, strerror(-ret)); abort(); } @@ -617,7 +617,7 @@ vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size) struct drm_vmw_dmabuf_rep *rep = &arg.rep; int ret; - vmw_printf("%s: size = %u\n", __FUNCTION__, size); + vmw_printf("%s: size = %u\n", __func__, size); region = CALLOC_STRUCT(vmw_region); if (!region) @@ -657,7 +657,7 @@ vmw_ioctl_region_destroy(struct vmw_region *region) { struct drm_vmw_unref_dmabuf_arg arg; - vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__, + vmw_printf("%s: gmrId = %u, offset = %u\n", __func__, region->ptr.gmrId, region->ptr.offset); if (region->data) { @@ -684,14 +684,14 @@ vmw_ioctl_region_map(struct vmw_region *region) { void *map; - vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__, + vmw_printf("%s: gmrId = %u, offset = %u\n", __func__, region->ptr.gmrId, region->ptr.offset); if (region->data == NULL) { map = os_mmap(NULL, region->size, PROT_READ | PROT_WRITE, MAP_SHARED, region->drm_fd, region->map_handle); if (map == MAP_FAILED) { - vmw_error("%s: Map failed.\n", __FUNCTION__); + vmw_error("%s: Map failed.\n", __func__); return NULL; } @@ -710,7 +710,7 @@ vmw_ioctl_region_map(struct vmw_region *region) void vmw_ioctl_region_unmap(struct vmw_region *region) { - vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__, + vmw_printf("%s: gmrId = %u, offset = %u\n", __func__, region->ptr.gmrId, region->ptr.offset); --region->map_count; @@ -794,7 +794,7 @@ vmw_ioctl_fence_unref(struct vmw_winsys_screen *vws, ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_FENCE_UNREF, &arg, sizeof(arg)); if (ret != 0) - vmw_error("%s Failed\n", __FUNCTION__); + vmw_error("%s Failed\n", __func__); } static inline uint32_t @@ -857,7 +857,7 @@ vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws, &arg, sizeof(arg)); if (ret != 0) - vmw_error("%s Failed\n", __FUNCTION__); + vmw_error("%s Failed\n", __func__); return 0; } @@ -1244,7 +1244,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) free(cap_buffer); drmFreeVersion(version); - vmw_printf("%s OK\n", __FUNCTION__); + vmw_printf("%s OK\n", __func__); return TRUE; out_no_caps: free(vws->ioctl.cap_3d); @@ -1254,7 +1254,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) drmFreeVersion(version); out_no_version: vws->ioctl.num_cap_3d = 0; - debug_printf("%s Failed\n", __FUNCTION__); + debug_printf("%s Failed\n", __func__); return FALSE; } diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c index 98b383229..b36b42e7f 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c +++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c @@ -227,7 +227,7 @@ vmw_svga_winsys_add_stats(struct vmw_winsys_screen *vws, int slot) void *area = mmap(NULL, area_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED | MAP_NORESERVE, -1, 0); if (area == MAP_FAILED) { - fprintf(stderr, "%s could not mmap memory: %s\n", __FUNCTION__, strerror(errno)); + fprintf(stderr, "%s could not mmap memory: %s\n", __func__, strerror(errno)); return -1; } @@ -237,13 +237,13 @@ vmw_svga_winsys_add_stats(struct vmw_winsys_screen *vws, int slot) pstatTime = vmw_mksstat_get_pstat_time(area, pg_size); if (mlock(area, area_size)) { - fprintf(stderr, "%s could not mlock memory: %s\n", __FUNCTION__, strerror(errno)); + fprintf(stderr, "%s could not mlock memory: %s\n", __func__, strerror(errno)); goto error; } /* Suppress pages copy-on-write; for MAP_SHARED this should not really matter; it would if we go MAP_PRIVATE */ if (madvise(area, area_size, MADV_DONTFORK)) { - fprintf(stderr, "%s could not madvise memory: %s\n", __FUNCTION__, strerror(errno)); + fprintf(stderr, "%s could not madvise memory: %s\n", __func__, strerror(errno)); goto error; } @@ -286,7 +286,7 @@ vmw_svga_winsys_add_stats(struct vmw_winsys_screen *vws, int slot) .id = -1U }; if (drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_MKSSTAT_ADD, &arg, sizeof(arg))) { - fprintf(stderr, "%s could not ioctl: %s\n", __FUNCTION__, strerror(errno)); + fprintf(stderr, "%s could not ioctl: %s\n", __func__, strerror(errno)); goto error; } id = arg.id; @@ -875,11 +875,20 @@ vmw_svga_winsys_stats_time_pop_noop(struct svga_winsys_screen *sws) /* noop */ } +static int +vmw_svga_winsys_get_fd(struct svga_winsys_screen *sws) +{ + struct vmw_winsys_screen *const vws = vmw_winsys_screen(sws); + + return vws->ioctl.drm_fd; +} + boolean vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws) { vws->base.destroy = vmw_svga_winsys_destroy; vws->base.get_hw_version = vmw_svga_winsys_get_hw_version; + vws->base.get_fd = vmw_svga_winsys_get_fd; vws->base.get_cap = vmw_svga_winsys_get_cap; vws->base.context_create = vmw_svga_winsys_context_create; vws->base.surface_create = vmw_svga_winsys_surface_create; diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h b/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h index b6cf63bb4..bfa1bd8fb 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h +++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h @@ -38,7 +38,7 @@ #include "pipe/p_compiler.h" #include "util/u_atomic.h" #include "util/u_inlines.h" -#include "os/os_thread.h" +#include "util/u_thread.h" #include "pipebuffer/pb_buffer.h" #define VMW_MAX_PRESENTS 3 |