diff --git a/.gitlab-ci/expectations/host/piglit-virgl-gles-fails.txt b/.gitlab-ci/expectations/host/piglit-virgl-gles-fails.txt index f990052..a133039 100644 --- a/.gitlab-ci/expectations/host/piglit-virgl-gles-fails.txt +++ b/.gitlab-ci/expectations/host/piglit-virgl-gles-fails.txt @@ -20,6 +20,8 @@ spec@arb_color_buffer_float@gl_rgba8_snorm-render,Fail spec@arb_color_buffer_float@gl_rgba8_snorm-render-fog,Fail spec@arb_compute_shader@execution@min-dvec4-double-large-group-size,Fail spec@arb_copy_image@arb_copy_image-formats,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2,Crash +spec@arb_copy_image@arb_copy_image-formats --samples=4,Crash spec@arb_copy_image@arb_copy_image-formats@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail spec@arb_copy_image@arb_copy_image-formats@Source: GL_COMPRESSED_RED_RGTC1/Destination: GL_COMPRESSED_RED_RGTC1,Fail spec@arb_copy_image@arb_copy_image-formats@Source: GL_COMPRESSED_RED_RGTC1/Destination: GL_RGBA16_SNORM,Fail @@ -562,7 +564,7 @@ spec@ext_framebuffer_multisample@draw-buffers-alpha-to-coverage 2,Fail spec@ext_framebuffer_multisample@draw-buffers-alpha-to-one 2,Fail spec@ext_framebuffer_multisample@draw-buffers-alpha-to-one 4,Fail spec@ext_framebuffer_multisample@enable-flag,Fail -spec@ext_framebuffer_multisample@fast-clear,Fail +spec@ext_framebuffer_multisample@fast-clear,Crash spec@ext_framebuffer_multisample@formats 2,Fail spec@ext_framebuffer_multisample@formats 4,Fail spec@ext_framebuffer_multisample@formats all_samples,Fail @@ -2482,6 +2484,8 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gl srgb-fp@sRGB decode full spec@khr_texture_compression_astc@sliced-3d-miptree-gl srgb@sRGB decode,ExpectedFail spec@khr_texture_compression_astc@void-extent-dl-bug,Fail spec@nv_copy_image@nv_copy_image-formats,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2,Crash +spec@nv_copy_image@nv_copy_image-formats --samples=4,Crash spec@nv_copy_image@nv_copy_image-formats@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail spec@nv_copy_image@nv_copy_image-formats@Source: GL_COMPRESSED_RED_RGTC1/Destination: GL_COMPRESSED_RED_RGTC1,Fail spec@nv_copy_image@nv_copy_image-formats@Source: GL_COMPRESSED_RGBA_BPTC_UNORM/Destination: GL_COMPRESSED_RGBA_BPTC_UNORM,Fail diff --git a/.gitlab-ci/expectations/virt/piglit-virgl-gles-fails.txt b/.gitlab-ci/expectations/virt/piglit-virgl-gles-fails.txt index aea7efd..aa5dcee 100644 --- a/.gitlab-ci/expectations/virt/piglit-virgl-gles-fails.txt +++ b/.gitlab-ci/expectations/virt/piglit-virgl-gles-fails.txt @@ -21,6 +21,36 @@ spec@arb_color_buffer_float@gl_rgba8_snorm-render,Fail spec@arb_color_buffer_float@gl_rgba8_snorm-render-fog,Fail spec@arb_compute_shader@execution@min-dvec4-double-large-group-size,Fail spec@arb_copy_image@arb_copy_image-formats,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_ALPHA12/Destination: GL_ALPHA12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_INTENSITY/Destination: GL_INTENSITY,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_INTENSITY12/Destination: GL_INTENSITY12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_INTENSITY16/Destination: GL_INTENSITY16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_INTENSITY8/Destination: GL_INTENSITY8,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE/Destination: GL_LUMINANCE,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE12/Destination: GL_LUMINANCE12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE12_ALPHA12/Destination: GL_LUMINANCE12_ALPHA12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE16/Destination: GL_LUMINANCE16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE16_ALPHA16/Destination: GL_LUMINANCE16_ALPHA16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE8/Destination: GL_LUMINANCE8,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE8_ALPHA8/Destination: GL_LUMINANCE8_ALPHA8,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=2@Source: GL_LUMINANCE_ALPHA/Destination: GL_LUMINANCE_ALPHA,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_ALPHA12/Destination: GL_ALPHA12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_INTENSITY/Destination: GL_INTENSITY,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_INTENSITY12/Destination: GL_INTENSITY12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_INTENSITY16/Destination: GL_INTENSITY16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_INTENSITY8/Destination: GL_INTENSITY8,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE/Destination: GL_LUMINANCE,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE12/Destination: GL_LUMINANCE12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE12_ALPHA12/Destination: GL_LUMINANCE12_ALPHA12,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE16/Destination: GL_LUMINANCE16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE16_ALPHA16/Destination: GL_LUMINANCE16_ALPHA16,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE8/Destination: GL_LUMINANCE8,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE8_ALPHA8/Destination: GL_LUMINANCE8_ALPHA8,Fail +spec@arb_copy_image@arb_copy_image-formats --samples=4@Source: GL_LUMINANCE_ALPHA/Destination: GL_LUMINANCE_ALPHA,Fail spec@arb_copy_image@arb_copy_image-formats@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail spec@arb_copy_image@arb_copy_image-formats@Source: GL_COMPRESSED_RED_RGTC1/Destination: GL_COMPRESSED_RED_RGTC1,Fail spec@arb_copy_image@arb_copy_image-formats@Source: GL_COMPRESSED_RED_RGTC1/Destination: GL_RGBA16_SNORM,Fail @@ -321,11 +351,6 @@ spec@arb_shader_image_load_store@host-mem-barrier@Pixel/RaW/full barrier test/64 spec@arb_shader_image_load_store@host-mem-barrier@Pixel/RaW/one bit barrier test/16x16,Fail spec@arb_shader_image_load_store@host-mem-barrier@Pixel/RaW/one bit barrier test/4x4,Fail spec@arb_shader_image_load_store@host-mem-barrier@Pixel/RaW/one bit barrier test/64x64,Fail -spec@arb_shader_image_load_store@host-mem-barrier@Pixel/WaW/full barrier test/16x16,Fail -spec@arb_shader_image_load_store@host-mem-barrier@Pixel/WaW/full barrier test/4x4,Fail -spec@arb_shader_image_load_store@host-mem-barrier@Pixel/WaW/one bit barrier test/16x16,Fail -spec@arb_shader_image_load_store@host-mem-barrier@Pixel/WaW/one bit barrier test/4x4,Fail -spec@arb_shader_image_load_store@host-mem-barrier@Pixel/WaW/one bit barrier test/64x64,Fail spec@arb_shader_image_load_store@host-mem-barrier@Texture fetch/RaW/full barrier test/16x16,Fail spec@arb_shader_image_load_store@host-mem-barrier@Texture fetch/RaW/full barrier test/4x4,Fail spec@arb_shader_image_load_store@host-mem-barrier@Texture fetch/RaW/full barrier test/64x64,Fail @@ -2525,6 +2550,36 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gl srgb-fp@sRGB decode full spec@khr_texture_compression_astc@sliced-3d-miptree-gl srgb@sRGB decode,ExpectedFail spec@khr_texture_compression_astc@void-extent-dl-bug,Fail spec@nv_copy_image@nv_copy_image-formats,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_ALPHA12/Destination: GL_ALPHA12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_INTENSITY/Destination: GL_INTENSITY,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_INTENSITY12/Destination: GL_INTENSITY12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_INTENSITY16/Destination: GL_INTENSITY16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_INTENSITY8/Destination: GL_INTENSITY8,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE/Destination: GL_LUMINANCE,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE12/Destination: GL_LUMINANCE12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE12_ALPHA12/Destination: GL_LUMINANCE12_ALPHA12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE16/Destination: GL_LUMINANCE16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE16_ALPHA16/Destination: GL_LUMINANCE16_ALPHA16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE8/Destination: GL_LUMINANCE8,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE8_ALPHA8/Destination: GL_LUMINANCE8_ALPHA8,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=2@Source: GL_LUMINANCE_ALPHA/Destination: GL_LUMINANCE_ALPHA,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_ALPHA12/Destination: GL_ALPHA12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_INTENSITY/Destination: GL_INTENSITY,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_INTENSITY12/Destination: GL_INTENSITY12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_INTENSITY16/Destination: GL_INTENSITY16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_INTENSITY8/Destination: GL_INTENSITY8,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE/Destination: GL_LUMINANCE,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE12/Destination: GL_LUMINANCE12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE12_ALPHA12/Destination: GL_LUMINANCE12_ALPHA12,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE16/Destination: GL_LUMINANCE16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE16_ALPHA16/Destination: GL_LUMINANCE16_ALPHA16,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE8/Destination: GL_LUMINANCE8,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE8_ALPHA8/Destination: GL_LUMINANCE8_ALPHA8,Fail +spec@nv_copy_image@nv_copy_image-formats --samples=4@Source: GL_LUMINANCE_ALPHA/Destination: GL_LUMINANCE_ALPHA,Fail spec@nv_copy_image@nv_copy_image-formats@Source: GL_ALPHA16/Destination: GL_ALPHA16,Fail spec@nv_copy_image@nv_copy_image-formats@Source: GL_COMPRESSED_RED_RGTC1/Destination: GL_COMPRESSED_RED_RGTC1,Fail spec@nv_copy_image@nv_copy_image-formats@Source: GL_COMPRESSED_RGBA_BPTC_UNORM/Destination: GL_COMPRESSED_RGBA_BPTC_UNORM,Fail @@ -3379,7 +3434,6 @@ spec@!opengl 1.5@draw-vertices-user,Fail spec@!opengl 2.0@gl-2.0-edgeflag,Fail spec@!opengl 2.0@gl-2.0-edgeflag-immediate,Fail spec@!opengl 2.0@gl-2.0-large-point-fs,Fail -spec@!opengl 2.0@gl-2.0-vertexattribpointer,Fail spec@!opengl 2.0@occlusion-query-discard,Fail spec@!opengl 3.0@required-texture-attachment-formats,Fail spec@!opengl 3.0@sampler-cube-shadow,Fail diff --git a/meson.build b/meson.build index 5d34f1b..767c02c 100644 --- a/meson.build +++ b/meson.build @@ -74,7 +74,6 @@ endforeach prog_python = import('python').find_installation('python3') -libdrm_dep = dependency('libdrm', version : '>=2.4.50') thread_dep = dependency('threads') epoxy_dep = dependency('epoxy', version: '>= 1.5.4') m_dep = cc.find_library('m') @@ -210,8 +209,9 @@ endif if with_egl if cc.has_header('epoxy/egl.h', dependencies: epoxy_dep) and epoxy_dep.get_pkgconfig_variable('epoxy_has_egl') == '1' + libdrm_dep = dependency('libdrm', required: require_egl, version : '>=2.4.50') gbm_dep = dependency('gbm', version: '>= ' + _gbm_ver, required: require_egl) - have_egl = gbm_dep.found() + have_egl = libdrm_dep.found() and gbm_dep.found() if (have_egl) conf_data.set('HAVE_EPOXY_EGL_H', 1) else diff --git a/src/meson.build b/src/meson.build index a581ccb..1ee53fa 100644 --- a/src/meson.build +++ b/src/meson.build @@ -145,7 +145,6 @@ proxy_sources = [ virgl_depends = [ gallium_dep, epoxy_dep, - libdrm_dep, thread_dep, m_dep, ] @@ -162,7 +161,7 @@ virgl_sources += vrend_sources if have_egl virgl_sources += vrend_winsys_egl_sources - virgl_depends += [gbm_dep] + virgl_depends += [libdrm_dep, gbm_dep] endif if have_glx diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 29674b3..f3e5af4 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -453,8 +453,8 @@ void virgl_renderer_ctx_detach_resource(int ctx_id, int res_handle) ctx->detach_resource(ctx, res); } -int virgl_renderer_resource_get_info(int res_handle, - struct virgl_renderer_resource_info *info) +int virgl_renderer_borrow_texture_for_scanout(int res_handle, + struct virgl_renderer_texture_info *info) { TRACE_FUNC(); struct virgl_resource *res = virgl_resource_lookup(res_handle); @@ -464,8 +464,8 @@ int virgl_renderer_resource_get_info(int res_handle, if (!info) return EINVAL; - vrend_renderer_resource_get_info(res->pipe_resource, - (struct vrend_renderer_resource_info *)info); + vrend_renderer_borrow_texture_for_scanout(res->pipe_resource, + (struct vrend_renderer_texture_info *)info); info->handle = res_handle; if (state.winsys_initialized) { diff --git a/src/virglrenderer.h b/src/virglrenderer.h index cd3523a..3b52510 100644 --- a/src/virglrenderer.h +++ b/src/virglrenderer.h @@ -275,9 +275,9 @@ VIRGL_EXPORT void virgl_renderer_ctx_detach_resource(int ctx_id, int res_handle) VIRGL_EXPORT virgl_debug_callback_type virgl_set_debug_callback(virgl_debug_callback_type cb); -/* return information about a resource */ +/* borrow a texture for scanout */ -struct virgl_renderer_resource_info { +struct virgl_renderer_texture_info { uint32_t handle; uint32_t virgl_format; uint32_t width; @@ -289,8 +289,8 @@ struct virgl_renderer_resource_info { int drm_fourcc; }; -VIRGL_EXPORT int virgl_renderer_resource_get_info(int res_handle, - struct virgl_renderer_resource_info *info); +VIRGL_EXPORT int virgl_renderer_borrow_texture_for_scanout(int res_handle, + struct virgl_renderer_texture_info *info); VIRGL_EXPORT void virgl_renderer_cleanup(void *cookie); diff --git a/src/vrend_blitter.h b/src/vrend_blitter.h index 91e2435..7a03571 100644 --- a/src/vrend_blitter.h +++ b/src/vrend_blitter.h @@ -35,6 +35,12 @@ "%s" \ #define FS_HEADER_GLES \ + "#version 300 es\n" \ + "// Blitter\n" \ + "%s" \ + "precision mediump float;\n" \ + +#define FS_HEADER_GLES_MS \ "#version 310 es\n" \ "// Blitter\n" \ "%s" \ @@ -52,6 +58,11 @@ "// Blitter\n" \ #define HEADER_GLES \ + "#version 300 es\n" \ + "// Blitter\n" \ + "precision mediump float;\n" \ + +#define HEADER_GLES_MS \ "#version 310 es\n" \ "// Blitter\n" \ "precision mediump float;\n" \ @@ -145,7 +156,7 @@ "}\n" #define FS_TEXFETCH_COL_MSAA_GL FS_HEADER_GL FS_TEXFETCH_COL_MSAA_BODY -#define FS_TEXFETCH_COL_MSAA_GLES FS_HEADER_GLES FS_TEXFETCH_COL_MSAA_BODY +#define FS_TEXFETCH_COL_MSAA_GLES FS_HEADER_GLES_MS FS_TEXFETCH_COL_MSAA_BODY #define FS_TEXFETCH_COL_MSAA_ARRAY_GLES FS_HEADER_GLES_MS_ARRAY FS_TEXFETCH_COL_MSAA_BODY #define FS_TEXFETCH_DS_BODY \ @@ -178,7 +189,7 @@ struct vrend_context; struct vrend_resource; struct vrend_blit_info; #define FS_TEXFETCH_DS_MSAA_GL HEADER_GL FS_TEXFETCH_DS_MSAA_BODY -#define FS_TEXFETCH_DS_MSAA_GLES HEADER_GLES FS_TEXFETCH_DS_MSAA_BODY_GLES +#define FS_TEXFETCH_DS_MSAA_GLES HEADER_GLES_MS FS_TEXFETCH_DS_MSAA_BODY_GLES #define FS_TEXFETCH_DS_MSAA_ARRAY_GLES HEADER_GLES_MS_ARRAY FS_TEXFETCH_DS_MSAA_BODY_GLES /* implement blitting using OpenGL. */ diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index eb5adaa..8116fb6 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1981,6 +1981,9 @@ int vrend_create_surface(struct vrend_context *ctx, last_layer = 5; } + if (vrend_resource_has_24bpp_internal_format(res)) + internalformat = GL_RGB8; + VREND_DEBUG(dbg_tex, ctx, "Create texture view from %s for %s\n", util_format_name(res->base.format), util_format_name(surf->format)); @@ -11327,21 +11330,45 @@ void vrend_context_set_debug_flags(struct vrend_context *ctx, const char *flagst } } -void vrend_renderer_resource_get_info(struct pipe_resource *pres, - struct vrend_renderer_resource_info *info) +void vrend_renderer_borrow_texture_for_scanout(struct pipe_resource *pres, + struct vrend_renderer_texture_info *info) { - struct vrend_resource *res = (struct vrend_resource *)pres; + struct vrend_texture *tex = (struct vrend_texture *)pres; + struct vrend_format_table *tex_conv = &tex_conv_table[tex->base.base.format]; int elsize; - elsize = util_format_get_blocksize(res->base.format); + assert(tex->base.target == GL_TEXTURE_2D); + assert(!util_format_is_depth_or_stencil(tex->base.base.format)); + + elsize = util_format_get_blocksize(tex->base.base.format); + + glBindTexture(GL_TEXTURE_2D, tex->base.id); + + if (tex_conv->flags & VIRGL_TEXTURE_NEED_SWIZZLE) { + for (unsigned i = 0; i < ARRAY_SIZE(tex->cur_swizzle); ++i) { + GLint next_swizzle = to_gl_swizzle(tex_conv->swizzle[i]); + if (tex->cur_swizzle[i] != next_swizzle) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R + i, next_swizzle); + tex->cur_swizzle[i] = next_swizzle; + } + } + } + + if (tex->cur_srgb_decode != GL_DECODE_EXT && util_format_is_srgb(tex->base.base.format)) { + if (has_feature(feat_texture_srgb_decode)) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, + GL_DECODE_EXT); + tex->cur_srgb_decode = GL_DECODE_EXT; + } + } - info->tex_id = res->id; - info->width = res->base.width0; - info->height = res->base.height0; - info->depth = res->base.depth0; - info->format = res->base.format; - info->flags = res->y_0_top ? VIRGL_RESOURCE_Y_0_TOP : 0; - info->stride = util_format_get_nblocksx(res->base.format, u_minify(res->base.width0, 0)) * elsize; + info->tex_id = tex->base.id; + info->width = tex->base.base.width0; + info->height = tex->base.base.height0; + info->depth = tex->base.base.depth0; + info->format = tex->base.base.format; + info->flags = tex->base.y_0_top ? VIRGL_RESOURCE_Y_0_TOP : 0; + info->stride = util_format_get_nblocksx(tex->base.base.format, u_minify(tex->base.base.width0, 0)) * elsize; } void vrend_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver, diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index fbd3149..0bfb78f 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -447,7 +447,7 @@ void vrend_renderer_detach_res_ctx(struct vrend_context *ctx, struct vrend_context_tweaks *vrend_get_context_tweaks(struct vrend_context *ctx); -struct vrend_renderer_resource_info { +struct vrend_renderer_texture_info { uint32_t handle; uint32_t format; uint32_t width; @@ -473,8 +473,8 @@ struct vrend_blit_info { bool needs_manual_srgb_encode; }; -void vrend_renderer_resource_get_info(struct pipe_resource *pres, - struct vrend_renderer_resource_info *info); +void vrend_renderer_borrow_texture_for_scanout(struct pipe_resource *pres, + struct vrend_renderer_texture_info *info); void vrend_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver, uint32_t *max_size); diff --git a/src/vrend_winsys.c b/src/vrend_winsys.c index 9371e81..78d3b88 100644 --- a/src/vrend_winsys.c +++ b/src/vrend_winsys.c @@ -22,6 +22,7 @@ * **************************************************************************/ +#include "vrend_debug.h" #include "vrend_winsys.h" #ifdef HAVE_EPOXY_GLX_H @@ -30,6 +31,8 @@ #include +#include "util/macros.h" + enum { CONTEXT_NONE, CONTEXT_EGL, @@ -135,7 +138,7 @@ int vrend_winsys_init_external(void *egl_display) return 0; } -virgl_renderer_gl_context vrend_winsys_create_context(struct virgl_gl_ctx_param *param) +virgl_renderer_gl_context vrend_winsys_create_context(UNUSED struct virgl_gl_ctx_param *param) { #ifdef HAVE_EPOXY_EGL_H if (use_context == CONTEXT_EGL) @@ -148,7 +151,7 @@ virgl_renderer_gl_context vrend_winsys_create_context(struct virgl_gl_ctx_param return NULL; } -void vrend_winsys_destroy_context(virgl_renderer_gl_context ctx) +void vrend_winsys_destroy_context(UNUSED virgl_renderer_gl_context ctx) { #ifdef HAVE_EPOXY_EGL_H if (use_context == CONTEXT_EGL) { @@ -164,7 +167,7 @@ void vrend_winsys_destroy_context(virgl_renderer_gl_context ctx) #endif } -int vrend_winsys_make_context_current(virgl_renderer_gl_context ctx) +int vrend_winsys_make_context_current(UNUSED virgl_renderer_gl_context ctx) { #ifdef HAVE_EPOXY_EGL_H if (use_context == CONTEXT_EGL) diff --git a/src/vrend_winsys_gbm.h b/src/vrend_winsys_gbm.h index 84943fb..52b1544 100644 --- a/src/vrend_winsys_gbm.h +++ b/src/vrend_winsys_gbm.h @@ -25,7 +25,9 @@ #ifndef VIRGL_GBM_H #define VIRGL_GBM_H +#ifdef HAVE_EPOXY_EGL_H #include +#endif #include "vrend_iov.h" #include "virglrenderer.h" @@ -101,6 +103,8 @@ struct virgl_gbm { struct gbm_device *device; }; +#ifdef HAVE_EPOXY_EGL_H + struct virgl_gbm *virgl_gbm_init(int fd); void virgl_gbm_fini(struct virgl_gbm *gbm); @@ -124,3 +128,5 @@ bool virgl_gbm_external_allocation_preferred(uint32_t flags); bool virgl_gbm_gpu_import_required(uint32_t flags); #endif + +#endif