diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:52:33 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:52:33 +0000 |
commit | 37bbf6a1792773f11c15a4da1588a7520ee2fb4e (patch) | |
tree | 64944d4aa665a1e479cfc004e446593062254550 /lib/mesa/src/gallium/winsys/virgl | |
parent | 6b139c2063623e9310025247cd966490b9aa57ea (diff) |
Merge Mesa 18.3.2
Diffstat (limited to 'lib/mesa/src/gallium/winsys/virgl')
6 files changed, 228 insertions, 67 deletions
diff --git a/lib/mesa/src/gallium/winsys/virgl/drm/Makefile.in b/lib/mesa/src/gallium/winsys/virgl/drm/Makefile.in index 73440d41e..f599e0433 100644 --- a/lib/mesa/src/gallium/winsys/virgl/drm/Makefile.in +++ b/lib/mesa/src/gallium/winsys/virgl/drm/Makefile.in @@ -79,10 +79,14 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @HAVE_LIBDRM_TRUE@am__append_1 = \ @HAVE_LIBDRM_TRUE@ $(LIBDRM_LIBS) -@HAVE_DRISW_TRUE@am__append_2 = \ +@HAVE_PLATFORM_ANDROID_TRUE@am__append_2 = \ +@HAVE_PLATFORM_ANDROID_TRUE@ $(ANDROID_LIBS) \ +@HAVE_PLATFORM_ANDROID_TRUE@ $(BACKTRACE_LIBS) + +@HAVE_DRISW_TRUE@am__append_3 = \ @HAVE_DRISW_TRUE@ $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la -@HAVE_DRISW_KMS_TRUE@am__append_3 = \ +@HAVE_DRISW_KMS_TRUE@am__append_4 = \ @HAVE_DRISW_KMS_TRUE@ $(top_builddir)/src/gallium/winsys/sw/kms-dri/libswkmsdri.la \ @HAVE_DRISW_KMS_TRUE@ $(LIBDRM_LIBS) @@ -169,6 +173,8 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BACKTRACE_CFLAGS = @BACKTRACE_CFLAGS@ +BACKTRACE_LIBS = @BACKTRACE_LIBS@ BSYMBOLIC = @BSYMBOLIC@ CC = @CC@ CCAS = @CCAS@ @@ -182,6 +188,7 @@ CLOVER_STD_OVERRIDE = @CLOVER_STD_OVERRIDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +CXX11_CXXFLAGS = @CXX11_CXXFLAGS@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -215,8 +222,6 @@ EXEEXT = @EXEEXT@ EXPAT_CFLAGS = @EXPAT_CFLAGS@ EXPAT_LIBS = @EXPAT_LIBS@ FGREP = @FGREP@ -FREEDRENO_CFLAGS = @FREEDRENO_CFLAGS@ -FREEDRENO_LIBS = @FREEDRENO_LIBS@ GALLIUM_PIPE_LOADER_DEFINES = @GALLIUM_PIPE_LOADER_DEFINES@ GBM_PC_LIB_PRIV = @GBM_PC_LIB_PRIV@ GBM_PC_REQ_PRIV = @GBM_PC_REQ_PRIV@ @@ -235,8 +240,8 @@ GL_LIB_DEPS = @GL_LIB_DEPS@ GL_PC_CFLAGS = @GL_PC_CFLAGS@ GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ +GL_PKGCONF_LIB = @GL_PKGCONF_LIB@ GREP = @GREP@ -HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@ I915_CFLAGS = @I915_CFLAGS@ I915_LIBS = @I915_LIBS@ INDENT = @INDENT@ @@ -248,6 +253,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LD_BUILD_ID = @LD_BUILD_ID@ LD_NO_UNDEFINED = @LD_NO_UNDEFINED@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -285,7 +291,7 @@ MSVC2013_COMPAT_CFLAGS = @MSVC2013_COMPAT_CFLAGS@ MSVC2013_COMPAT_CXXFLAGS = @MSVC2013_COMPAT_CXXFLAGS@ NINE_MAJOR = @NINE_MAJOR@ NINE_MINOR = @NINE_MINOR@ -NINE_TINY = @NINE_TINY@ +NINE_PATCH = @NINE_PATCH@ NINE_VERSION = @NINE_VERSION@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -298,6 +304,9 @@ OBJEXT = @OBJEXT@ OMX_BELLAGIO_CFLAGS = @OMX_BELLAGIO_CFLAGS@ OMX_BELLAGIO_LIBS = @OMX_BELLAGIO_LIBS@ OMX_BELLAGIO_LIB_INSTALL_DIR = @OMX_BELLAGIO_LIB_INSTALL_DIR@ +OMX_TIZONIA_CFLAGS = @OMX_TIZONIA_CFLAGS@ +OMX_TIZONIA_LIBS = @OMX_TIZONIA_LIBS@ +OMX_TIZONIA_LIB_INSTALL_DIR = @OMX_TIZONIA_LIB_INSTALL_DIR@ OPENCL_LIBNAME = @OPENCL_LIBNAME@ OPENCL_VERSION = @OPENCL_VERSION@ OSMESA_LIB = @OSMESA_LIB@ @@ -325,11 +334,16 @@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PWR8_CFLAGS = @PWR8_CFLAGS@ -PYTHON2 = @PYTHON2@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RADEON_CFLAGS = @RADEON_CFLAGS@ RADEON_LIBS = @RADEON_LIBS@ RANLIB = @RANLIB@ RM = @RM@ +SCANNER_ARG = @SCANNER_ARG@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ @@ -341,9 +355,10 @@ SSE41_CFLAGS = @SSE41_CFLAGS@ STRIP = @STRIP@ SWR_AVX2_CXXFLAGS = @SWR_AVX2_CXXFLAGS@ SWR_AVX_CXXFLAGS = @SWR_AVX_CXXFLAGS@ -SWR_CXX11_CXXFLAGS = @SWR_CXX11_CXXFLAGS@ SWR_KNL_CXXFLAGS = @SWR_KNL_CXXFLAGS@ SWR_SKX_CXXFLAGS = @SWR_SKX_CXXFLAGS@ +V3D_SIMULATOR_CFLAGS = @V3D_SIMULATOR_CFLAGS@ +V3D_SIMULATOR_LIBS = @V3D_SIMULATOR_LIBS@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VA_CFLAGS = @VA_CFLAGS@ @@ -351,8 +366,8 @@ VA_LIBS = @VA_LIBS@ VA_LIB_INSTALL_DIR = @VA_LIB_INSTALL_DIR@ VA_MAJOR = @VA_MAJOR@ VA_MINOR = @VA_MINOR@ -VC5_SIMULATOR_CFLAGS = @VC5_SIMULATOR_CFLAGS@ -VC5_SIMULATOR_LIBS = @VC5_SIMULATOR_LIBS@ +VC4_CFLAGS = @VC4_CFLAGS@ +VC4_LIBS = @VC4_LIBS@ VDPAU_CFLAGS = @VDPAU_CFLAGS@ VDPAU_LIBS = @VDPAU_LIBS@ VDPAU_LIB_INSTALL_DIR = @VDPAU_LIB_INSTALL_DIR@ @@ -366,7 +381,11 @@ VL_LIBS = @VL_LIBS@ VULKAN_ICD_INSTALL_DIR = @VULKAN_ICD_INSTALL_DIR@ WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_PROTOCOLS_CFLAGS = @WAYLAND_PROTOCOLS_CFLAGS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ +WAYLAND_PROTOCOLS_LIBS = @WAYLAND_PROTOCOLS_LIBS@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ @@ -376,16 +395,20 @@ WNO_OVERRIDE_INIT = @WNO_OVERRIDE_INIT@ X11_INCLUDES = @X11_INCLUDES@ XA_MAJOR = @XA_MAJOR@ XA_MINOR = @XA_MINOR@ -XA_TINY = @XA_TINY@ +XA_PATCH = @XA_PATCH@ XA_VERSION = @XA_VERSION@ XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@ XCB_DRI2_LIBS = @XCB_DRI2_LIBS@ XCB_DRI3_CFLAGS = @XCB_DRI3_CFLAGS@ XCB_DRI3_LIBS = @XCB_DRI3_LIBS@ -XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ -XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XCB_DRI3_MODIFIERS_CFLAGS = @XCB_DRI3_MODIFIERS_CFLAGS@ +XCB_DRI3_MODIFIERS_LIBS = @XCB_DRI3_MODIFIERS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ XLIBGL_CFLAGS = @XLIBGL_CFLAGS@ XLIBGL_LIBS = @XLIBGL_LIBS@ +XLIB_RANDR_CFLAGS = @XLIB_RANDR_CFLAGS@ +XLIB_RANDR_LIBS = @XLIB_RANDR_LIBS@ XVMC_CFLAGS = @XVMC_CFLAGS@ XVMC_LIBS = @XVMC_LIBS@ XVMC_LIB_INSTALL_DIR = @XVMC_LIB_INSTALL_DIR@ @@ -440,9 +463,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -511,7 +538,8 @@ GALLIUM_TARGET_CFLAGS = \ $(VISIBILITY_CFLAGS) GALLIUM_COMMON_LIB_DEPS = -lm $(LIBUNWIND_LIBS) $(LIBSENSORS_LIBS) \ - $(CLOCK_LIB) $(PTHREAD_LIBS) $(DLOPEN_LIBS) $(am__append_1) + $(CLOCK_LIB) $(PTHREAD_LIBS) $(DLOPEN_LIBS) $(am__append_1) \ + $(am__append_2) GALLIUM_WINSYS_CFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/include \ @@ -523,7 +551,7 @@ GALLIUM_WINSYS_CFLAGS = \ GALLIUM_PIPE_LOADER_WINSYS_LIBS = \ $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \ $(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \ - $(am__append_2) $(am__append_3) + $(am__append_3) $(am__append_4) AM_CFLAGS = \ -I$(top_srcdir)/src/gallium/drivers \ $(GALLIUM_WINSYS_CFLAGS) \ @@ -531,6 +559,7 @@ AM_CFLAGS = \ noinst_LTLIBRARIES = libvirgldrm.la libvirgldrm_la_SOURCES = $(C_SOURCES) +EXTRA_DIST = meson.build all: all-am .SUFFIXES: diff --git a/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index 7f542e7f1..98e0e99f6 100644 --- a/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -28,7 +28,7 @@ #include <sys/stat.h> #include "os/os_mman.h" -#include "os/os_time.h" +#include "util/os_time.h" #include "util/u_memory.h" #include "util/u_format.h" #include "util/u_hash_table.h" @@ -313,7 +313,7 @@ virgl_drm_winsys_resource_cache_create(struct virgl_winsys *qws, struct virgl_hw_res *res, *curr_res; struct list_head *curr, *next; int64_t now; - int ret; + int ret = 0; /* only store binds for vertex/index/const buffers */ if (bind != VIRGL_BIND_CONSTANT_BUFFER && bind != VIRGL_BIND_INDEX_BUFFER && @@ -398,7 +398,7 @@ virgl_drm_winsys_resource_create_handle(struct virgl_winsys *qws, mtx_lock(&qdws->bo_handles_mutex); - if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) { + if (whandle->type == WINSYS_HANDLE_TYPE_SHARED) { res = util_hash_table_get(qdws->bo_names, (void*)(uintptr_t)handle); if (res) { struct virgl_hw_res *r = NULL; @@ -407,7 +407,7 @@ virgl_drm_winsys_resource_create_handle(struct virgl_winsys *qws, } } - if (whandle->type == DRM_API_HANDLE_TYPE_FD) { + if (whandle->type == WINSYS_HANDLE_TYPE_FD) { int r; r = drmPrimeFDToHandle(qdws->fd, whandle->handle, &handle); if (r) { @@ -417,7 +417,6 @@ virgl_drm_winsys_resource_create_handle(struct virgl_winsys *qws, } res = util_hash_table_get(qdws->bo_handles, (void*)(uintptr_t)handle); - fprintf(stderr, "resource %p for handle %d, pfd=%d\n", res, handle, whandle->handle); if (res) { struct virgl_hw_res *r = NULL; virgl_drm_resource_reference(qdws, &r, res); @@ -428,10 +427,9 @@ virgl_drm_winsys_resource_create_handle(struct virgl_winsys *qws, if (!res) goto done; - if (whandle->type == DRM_API_HANDLE_TYPE_FD) { + if (whandle->type == WINSYS_HANDLE_TYPE_FD) { res->bo_handle = handle; } else { - fprintf(stderr, "gem open handle %d\n", handle); memset(&open_arg, 0, sizeof(open_arg)); open_arg.name = whandle->handle; if (drmIoctl(qdws->fd, DRM_IOCTL_GEM_OPEN, &open_arg)) { @@ -478,7 +476,7 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws, if (!res) return FALSE; - if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) { + if (whandle->type == WINSYS_HANDLE_TYPE_SHARED) { if (!res->flinked) { memset(&flink, 0, sizeof(flink)); flink.handle = res->bo_handle; @@ -494,9 +492,9 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws, mtx_unlock(&qdws->bo_handles_mutex); } whandle->handle = res->flink; - } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) { + } else if (whandle->type == WINSYS_HANDLE_TYPE_KMS) { whandle->handle = res->bo_handle; - } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) { + } else if (whandle->type == WINSYS_HANDLE_TYPE_FD) { if (drmPrimeHandleToFD(qdws->fd, res->bo_handle, DRM_CLOEXEC, (int*)&whandle->handle)) return FALSE; mtx_lock(&qdws->bo_handles_mutex); @@ -619,9 +617,26 @@ static void virgl_drm_add_res(struct virgl_drm_winsys *qdws, { unsigned hash = res->res_handle & (sizeof(cbuf->is_handle_added)-1); - if (cbuf->cres > cbuf->nres) { - fprintf(stderr,"failure to add relocation\n"); - return; + if (cbuf->cres >= cbuf->nres) { + unsigned new_nres = cbuf->nres + 256; + void *new_ptr = REALLOC(cbuf->res_bo, + cbuf->nres * sizeof(struct virgl_hw_buf*), + new_nres * sizeof(struct virgl_hw_buf*)); + if (!new_ptr) { + fprintf(stderr,"failure to add relocation %d, %d\n", cbuf->cres, new_nres); + return; + } + cbuf->res_bo = new_ptr; + + new_ptr = REALLOC(cbuf->res_hlist, + cbuf->nres * sizeof(uint32_t), + new_nres * sizeof(uint32_t)); + if (!new_ptr) { + fprintf(stderr,"failure to add hlist relocation %d, %d\n", cbuf->cres, cbuf->nres); + return; + } + cbuf->res_hlist = new_ptr; + cbuf->nres = new_nres; } cbuf->res_bo[cbuf->cres] = NULL; @@ -704,13 +719,31 @@ static int virgl_drm_get_caps(struct virgl_winsys *vws, { struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws); struct drm_virtgpu_get_caps args; + int ret; - memset(&args, 0, sizeof(args)); + virgl_ws_fill_new_caps_defaults(caps); - args.cap_set_id = 1; + memset(&args, 0, sizeof(args)); + if (vdws->has_capset_query_fix) { + /* if we have the query fix - try and get cap set id 2 first */ + args.cap_set_id = 2; + args.size = sizeof(union virgl_caps); + } else { + args.cap_set_id = 1; + args.size = sizeof(struct virgl_caps_v1); + } args.addr = (unsigned long)&caps->caps; - args.size = sizeof(union virgl_caps); - return drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_GET_CAPS, &args); + + ret = drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_GET_CAPS, &args); + if (ret == -1 && errno == EINVAL) { + /* Fallback to v1 */ + args.cap_set_id = 1; + args.size = sizeof(struct virgl_caps_v1); + ret = drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_GET_CAPS, &args); + if (ret == -1) + return ret; + } + return ret; } #define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x))) @@ -777,6 +810,15 @@ static struct virgl_winsys * virgl_drm_winsys_create(int drmFD) { struct virgl_drm_winsys *qdws; + int ret; + int gl = 0; + struct drm_virtgpu_getparam getparam = {0}; + + getparam.param = VIRTGPU_PARAM_3D_FEATURES; + getparam.value = (uint64_t)(uintptr_t)≷ + ret = drmIoctl(drmFD, DRM_IOCTL_VIRTGPU_GETPARAM, &getparam); + if (ret < 0 || !gl) + return NULL; qdws = CALLOC_STRUCT(virgl_drm_winsys); if (!qdws) @@ -811,6 +853,16 @@ virgl_drm_winsys_create(int drmFD) qdws->base.fence_reference = virgl_fence_reference; qdws->base.get_caps = virgl_drm_get_caps; + + uint32_t value = 0; + getparam.param = VIRTGPU_PARAM_CAPSET_QUERY_FIX; + getparam.value = (uint64_t)(uintptr_t)&value; + ret = drmIoctl(qdws->fd, DRM_IOCTL_VIRTGPU_GETPARAM, &getparam); + if (ret == 0) { + if (value == 1) + qdws->has_capset_query_fix = true; + } + return &qdws->base; } @@ -880,6 +932,10 @@ virgl_drm_screen_create(int fd) int dup_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3); vws = virgl_drm_winsys_create(dup_fd); + if (!vws) { + close(dup_fd); + goto unlock; + } pscreen = virgl_create_screen(vws); if (pscreen) { diff --git a/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h b/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h index f6772153a..b28e7127c 100644 --- a/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h +++ b/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h @@ -64,6 +64,7 @@ struct virgl_drm_winsys struct util_hash_table *bo_handles; struct util_hash_table *bo_names; mtx_t bo_handles_mutex; + bool has_capset_query_fix; }; struct virgl_drm_cmd_buf { diff --git a/lib/mesa/src/gallium/winsys/virgl/vtest/Makefile.in b/lib/mesa/src/gallium/winsys/virgl/vtest/Makefile.in index 562ac8786..1d9a5c6c0 100644 --- a/lib/mesa/src/gallium/winsys/virgl/vtest/Makefile.in +++ b/lib/mesa/src/gallium/winsys/virgl/vtest/Makefile.in @@ -79,10 +79,14 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @HAVE_LIBDRM_TRUE@am__append_1 = \ @HAVE_LIBDRM_TRUE@ $(LIBDRM_LIBS) -@HAVE_DRISW_TRUE@am__append_2 = \ +@HAVE_PLATFORM_ANDROID_TRUE@am__append_2 = \ +@HAVE_PLATFORM_ANDROID_TRUE@ $(ANDROID_LIBS) \ +@HAVE_PLATFORM_ANDROID_TRUE@ $(BACKTRACE_LIBS) + +@HAVE_DRISW_TRUE@am__append_3 = \ @HAVE_DRISW_TRUE@ $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la -@HAVE_DRISW_KMS_TRUE@am__append_3 = \ +@HAVE_DRISW_KMS_TRUE@am__append_4 = \ @HAVE_DRISW_KMS_TRUE@ $(top_builddir)/src/gallium/winsys/sw/kms-dri/libswkmsdri.la \ @HAVE_DRISW_KMS_TRUE@ $(LIBDRM_LIBS) @@ -169,6 +173,8 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BACKTRACE_CFLAGS = @BACKTRACE_CFLAGS@ +BACKTRACE_LIBS = @BACKTRACE_LIBS@ BSYMBOLIC = @BSYMBOLIC@ CC = @CC@ CCAS = @CCAS@ @@ -182,6 +188,7 @@ CLOVER_STD_OVERRIDE = @CLOVER_STD_OVERRIDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +CXX11_CXXFLAGS = @CXX11_CXXFLAGS@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -215,8 +222,6 @@ EXEEXT = @EXEEXT@ EXPAT_CFLAGS = @EXPAT_CFLAGS@ EXPAT_LIBS = @EXPAT_LIBS@ FGREP = @FGREP@ -FREEDRENO_CFLAGS = @FREEDRENO_CFLAGS@ -FREEDRENO_LIBS = @FREEDRENO_LIBS@ GALLIUM_PIPE_LOADER_DEFINES = @GALLIUM_PIPE_LOADER_DEFINES@ GBM_PC_LIB_PRIV = @GBM_PC_LIB_PRIV@ GBM_PC_REQ_PRIV = @GBM_PC_REQ_PRIV@ @@ -235,8 +240,8 @@ GL_LIB_DEPS = @GL_LIB_DEPS@ GL_PC_CFLAGS = @GL_PC_CFLAGS@ GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ +GL_PKGCONF_LIB = @GL_PKGCONF_LIB@ GREP = @GREP@ -HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@ I915_CFLAGS = @I915_CFLAGS@ I915_LIBS = @I915_LIBS@ INDENT = @INDENT@ @@ -248,6 +253,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LD_BUILD_ID = @LD_BUILD_ID@ LD_NO_UNDEFINED = @LD_NO_UNDEFINED@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -285,7 +291,7 @@ MSVC2013_COMPAT_CFLAGS = @MSVC2013_COMPAT_CFLAGS@ MSVC2013_COMPAT_CXXFLAGS = @MSVC2013_COMPAT_CXXFLAGS@ NINE_MAJOR = @NINE_MAJOR@ NINE_MINOR = @NINE_MINOR@ -NINE_TINY = @NINE_TINY@ +NINE_PATCH = @NINE_PATCH@ NINE_VERSION = @NINE_VERSION@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -298,6 +304,9 @@ OBJEXT = @OBJEXT@ OMX_BELLAGIO_CFLAGS = @OMX_BELLAGIO_CFLAGS@ OMX_BELLAGIO_LIBS = @OMX_BELLAGIO_LIBS@ OMX_BELLAGIO_LIB_INSTALL_DIR = @OMX_BELLAGIO_LIB_INSTALL_DIR@ +OMX_TIZONIA_CFLAGS = @OMX_TIZONIA_CFLAGS@ +OMX_TIZONIA_LIBS = @OMX_TIZONIA_LIBS@ +OMX_TIZONIA_LIB_INSTALL_DIR = @OMX_TIZONIA_LIB_INSTALL_DIR@ OPENCL_LIBNAME = @OPENCL_LIBNAME@ OPENCL_VERSION = @OPENCL_VERSION@ OSMESA_LIB = @OSMESA_LIB@ @@ -325,11 +334,16 @@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PWR8_CFLAGS = @PWR8_CFLAGS@ -PYTHON2 = @PYTHON2@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RADEON_CFLAGS = @RADEON_CFLAGS@ RADEON_LIBS = @RADEON_LIBS@ RANLIB = @RANLIB@ RM = @RM@ +SCANNER_ARG = @SCANNER_ARG@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ SELINUX_LIBS = @SELINUX_LIBS@ @@ -341,9 +355,10 @@ SSE41_CFLAGS = @SSE41_CFLAGS@ STRIP = @STRIP@ SWR_AVX2_CXXFLAGS = @SWR_AVX2_CXXFLAGS@ SWR_AVX_CXXFLAGS = @SWR_AVX_CXXFLAGS@ -SWR_CXX11_CXXFLAGS = @SWR_CXX11_CXXFLAGS@ SWR_KNL_CXXFLAGS = @SWR_KNL_CXXFLAGS@ SWR_SKX_CXXFLAGS = @SWR_SKX_CXXFLAGS@ +V3D_SIMULATOR_CFLAGS = @V3D_SIMULATOR_CFLAGS@ +V3D_SIMULATOR_LIBS = @V3D_SIMULATOR_LIBS@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ VALGRIND_LIBS = @VALGRIND_LIBS@ VA_CFLAGS = @VA_CFLAGS@ @@ -351,8 +366,8 @@ VA_LIBS = @VA_LIBS@ VA_LIB_INSTALL_DIR = @VA_LIB_INSTALL_DIR@ VA_MAJOR = @VA_MAJOR@ VA_MINOR = @VA_MINOR@ -VC5_SIMULATOR_CFLAGS = @VC5_SIMULATOR_CFLAGS@ -VC5_SIMULATOR_LIBS = @VC5_SIMULATOR_LIBS@ +VC4_CFLAGS = @VC4_CFLAGS@ +VC4_LIBS = @VC4_LIBS@ VDPAU_CFLAGS = @VDPAU_CFLAGS@ VDPAU_LIBS = @VDPAU_LIBS@ VDPAU_LIB_INSTALL_DIR = @VDPAU_LIB_INSTALL_DIR@ @@ -366,7 +381,11 @@ VL_LIBS = @VL_LIBS@ VULKAN_ICD_INSTALL_DIR = @VULKAN_ICD_INSTALL_DIR@ WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_PROTOCOLS_CFLAGS = @WAYLAND_PROTOCOLS_CFLAGS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ +WAYLAND_PROTOCOLS_LIBS = @WAYLAND_PROTOCOLS_LIBS@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ @@ -376,16 +395,20 @@ WNO_OVERRIDE_INIT = @WNO_OVERRIDE_INIT@ X11_INCLUDES = @X11_INCLUDES@ XA_MAJOR = @XA_MAJOR@ XA_MINOR = @XA_MINOR@ -XA_TINY = @XA_TINY@ +XA_PATCH = @XA_PATCH@ XA_VERSION = @XA_VERSION@ XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@ XCB_DRI2_LIBS = @XCB_DRI2_LIBS@ XCB_DRI3_CFLAGS = @XCB_DRI3_CFLAGS@ XCB_DRI3_LIBS = @XCB_DRI3_LIBS@ -XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ -XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XCB_DRI3_MODIFIERS_CFLAGS = @XCB_DRI3_MODIFIERS_CFLAGS@ +XCB_DRI3_MODIFIERS_LIBS = @XCB_DRI3_MODIFIERS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ XLIBGL_CFLAGS = @XLIBGL_CFLAGS@ XLIBGL_LIBS = @XLIBGL_LIBS@ +XLIB_RANDR_CFLAGS = @XLIB_RANDR_CFLAGS@ +XLIB_RANDR_LIBS = @XLIB_RANDR_LIBS@ XVMC_CFLAGS = @XVMC_CFLAGS@ XVMC_LIBS = @XVMC_LIBS@ XVMC_LIB_INSTALL_DIR = @XVMC_LIB_INSTALL_DIR@ @@ -440,9 +463,13 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -512,7 +539,8 @@ GALLIUM_TARGET_CFLAGS = \ $(VISIBILITY_CFLAGS) GALLIUM_COMMON_LIB_DEPS = -lm $(LIBUNWIND_LIBS) $(LIBSENSORS_LIBS) \ - $(CLOCK_LIB) $(PTHREAD_LIBS) $(DLOPEN_LIBS) $(am__append_1) + $(CLOCK_LIB) $(PTHREAD_LIBS) $(DLOPEN_LIBS) $(am__append_1) \ + $(am__append_2) GALLIUM_WINSYS_CFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/include \ @@ -524,13 +552,14 @@ GALLIUM_WINSYS_CFLAGS = \ GALLIUM_PIPE_LOADER_WINSYS_LIBS = \ $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \ $(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \ - $(am__append_2) $(am__append_3) + $(am__append_3) $(am__append_4) AM_CFLAGS = \ -I$(top_srcdir)/src/gallium/drivers \ $(GALLIUM_WINSYS_CFLAGS) noinst_LTLIBRARIES = libvirglvtest.la libvirglvtest_la_SOURCES = $(C_SOURCES) +EXTRA_DIST = meson.build all: all-am .SUFFIXES: diff --git a/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c index 404ba58b0..176d04388 100644 --- a/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c +++ b/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c @@ -24,7 +24,7 @@ #include "util/u_memory.h" #include "util/u_format.h" #include "util/u_inlines.h" -#include "os/os_time.h" +#include "util/os_time.h" #include "state_tracker/sw_winsys.h" #include "virgl_vtest_winsys.h" @@ -79,9 +79,19 @@ virgl_vtest_transfer_put(struct virgl_winsys *vws, size = vtest_get_transfer_size(res, box, stride, layer_stride, level, &valid_stride); - virgl_vtest_send_transfer_cmd(vtws, VCMD_TRANSFER_PUT, res->res_handle, + /* The size calculated above is the full box size, but if this box origin + * is not zero we may have to correct the transfer size to not read past the + * end of the resource. The correct adjustment depends on various factors + * that are not documented, so instead of going though all the hops to get + * the size right up-front, we just make sure we don't read past the end. + * FIXME: figure out what it takes to actually get this right. + */ + if (size + buf_offset > res->size) + size = res->size - buf_offset; + + virgl_vtest_send_transfer_put(vtws, res->res_handle, level, stride, layer_stride, - box, size); + box, size, buf_offset); ptr = virgl_vtest_resource_map(vws, res); virgl_vtest_send_transfer_put_data(vtws, ptr + buf_offset, size); virgl_vtest_resource_unmap(vws, res); @@ -102,15 +112,22 @@ virgl_vtest_transfer_get(struct virgl_winsys *vws, size = vtest_get_transfer_size(res, box, stride, layer_stride, level, &valid_stride); + /* Don't ask for more pixels than available (see above) */ + if (size + buf_offset > res->size) + size = res->size - buf_offset; - virgl_vtest_send_transfer_cmd(vtws, VCMD_TRANSFER_GET, res->res_handle, + virgl_vtest_send_transfer_get(vtws, res->res_handle, level, stride, layer_stride, - box, size); - + box, size, buf_offset); ptr = virgl_vtest_resource_map(vws, res); + + /* This functions seems to be using a specific transfer resource that + * has exactly the box size and hence its src stride is equal to the target + * stride */ virgl_vtest_recv_transfer_get_data(vtws, ptr + buf_offset, size, - valid_stride, box, res->format); + valid_stride, box, res->format, valid_stride); + virgl_vtest_resource_unmap(vws, res); return 0; } @@ -240,9 +257,10 @@ virgl_vtest_winsys_resource_create(struct virgl_winsys *vws, res->format = format; res->height = height; res->width = width; + res->size = size; virgl_vtest_send_resource_create(vtws, handle, target, format, bind, width, height, depth, array_size, - last_level, nr_samples); + last_level, nr_samples, size); res->res_handle = handle++; pipe_reference_init(&res->reference, 1); @@ -459,9 +477,18 @@ static void virgl_vtest_add_res(struct virgl_vtest_winsys *vtws, { unsigned hash = res->res_handle & (sizeof(cbuf->is_handle_added)-1); - if (cbuf->cres > cbuf->nres) { - fprintf(stderr,"failure to add relocation\n"); - return; + if (cbuf->cres >= cbuf->nres) { + unsigned new_nres = cbuf->nres + 256; + struct virgl_hw_res **new_re_bo = REALLOC(cbuf->res_bo, + cbuf->nres * sizeof(struct virgl_hw_buf*), + new_nres * sizeof(struct virgl_hw_buf*)); + if (!new_re_bo) { + fprintf(stderr,"failure to add relocation %d, %d\n", cbuf->cres, cbuf->nres); + return; + } + + cbuf->res_bo = new_re_bo; + cbuf->nres = new_nres; } cbuf->res_bo[cbuf->cres] = NULL; @@ -519,6 +546,8 @@ static int virgl_vtest_get_caps(struct virgl_winsys *vws, struct virgl_drm_caps *caps) { struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws); + + virgl_ws_fill_new_caps_defaults(caps); return virgl_vtest_send_get_caps(vtws, caps); } @@ -530,7 +559,7 @@ virgl_cs_create_fence(struct virgl_winsys *vws) res = virgl_vtest_winsys_resource_cache_create(vws, PIPE_BUFFER, PIPE_FORMAT_R8_UNORM, - PIPE_BIND_CUSTOM, + VIRGL_BIND_CUSTOM, 8, 1, 1, 0, 0, 0, 8); return (struct pipe_fence_handle *)res; @@ -602,10 +631,16 @@ static void virgl_vtest_flush_frontbuffer(struct virgl_winsys *vws, map = vtws->sws->displaytarget_map(vtws->sws, res->dt, 0); /* execute a transfer */ - virgl_vtest_send_transfer_cmd(vtws, VCMD_TRANSFER_GET, res->res_handle, - level, res->stride, 0, &box, size); + virgl_vtest_send_transfer_get(vtws, res->res_handle, + level, res->stride, 0, &box, size, offset); + + /* This functions gets the resource from the hardware backend that may have + * a hardware imposed stride that is different from the IOV stride used to + * get the data. */ virgl_vtest_recv_transfer_get_data(vtws, map + offset, size, valid_stride, - &box, res->format); + &box, res->format, + vtws->protocol_version == 0 ? valid_stride : util_format_get_stride(res->format, res->width)); + vtws->sws->displaytarget_unmap(vtws->sws, res->dt); vtws->sws->displaytarget_display(vtws->sws, res->dt, winsys_drawable_handle, diff --git a/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h b/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h index 031037b6b..e51582032 100644 --- a/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h +++ b/lib/mesa/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h @@ -49,6 +49,8 @@ struct virgl_vtest_winsys { int num_delayed; unsigned usecs; mtx_t mutex; + + unsigned protocol_version; }; struct virgl_hw_res { @@ -119,20 +121,29 @@ int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws, uint32_t depth, uint32_t array_size, uint32_t last_level, - uint32_t nr_samples); + uint32_t nr_samples, + uint32_t size); int virgl_vtest_send_resource_unref(struct virgl_vtest_winsys *vws, uint32_t handle); int virgl_vtest_submit_cmd(struct virgl_vtest_winsys *vtws, struct virgl_vtest_cmd_buf *cbuf); -int virgl_vtest_send_transfer_cmd(struct virgl_vtest_winsys *vws, - uint32_t vcmd, +int virgl_vtest_send_transfer_get(struct virgl_vtest_winsys *vws, + uint32_t handle, + uint32_t level, uint32_t stride, + uint32_t layer_stride, + const struct pipe_box *box, + uint32_t data_size, + uint32_t offset); + +int virgl_vtest_send_transfer_put(struct virgl_vtest_winsys *vws, uint32_t handle, uint32_t level, uint32_t stride, uint32_t layer_stride, const struct pipe_box *box, - uint32_t data_size); + uint32_t data_size, + uint32_t offset); int virgl_vtest_send_transfer_put_data(struct virgl_vtest_winsys *vws, void *data, @@ -142,7 +153,7 @@ int virgl_vtest_recv_transfer_get_data(struct virgl_vtest_winsys *vws, uint32_t data_size, uint32_t stride, const struct pipe_box *box, - uint32_t format); + uint32_t format, uint32_t res_width); int virgl_vtest_busy_wait(struct virgl_vtest_winsys *vws, int handle, int flags); |