vrend: add VIRGL_RENDERER_UNSTABLE_APIS

This conditionally compiles the GL4.5 changes so
development can be moved into master.

Suggested-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Gurchetan Singh 5 years ago
parent 7ad2eeced9
commit df5b73115d
  1. 1
      config.h.meson
  2. 6
      meson.build
  3. 7
      meson_options.txt
  4. 7
      src/virglrenderer.c
  5. 12
      src/virglrenderer.h

@ -7,3 +7,4 @@
#mesondefine HAVE_FUNC_ATTRIBUTE_VISIBILITY
#mesondefine HAVE_EVENTFD_H
#mesondefine HAVE_DLFCN_H
#mesondefine VIRGL_RENDERER_UNSTABLE_APIS

@ -147,6 +147,11 @@ if with_glx
endif
endif
with_unstable_apis = get_option('unstable_apis')
if with_unstable_apis
conf_data.set('VIRGL_RENDERER_UNSTABLE_APIS', 1)
endif
if cc.compiles('void __attribute__((hidden)) func() {}')
conf_data.set('HAVE_FUNC_ATTRIBUTE_VISIBILITY', 1)
endif
@ -198,6 +203,7 @@ lines += 'minigbm_alloc: ' + (with_minigbm_allocation ? 'yes' : 'no' )
lines += ''
lines += 'tests: ' + (with_tests ? 'yes' : 'no' )
lines += 'fuzzer: ' + (with_fuzzer ? 'yes' : 'no' )
lines += 'unstable apis: ' + (with_unstable_apis ? 'yes' : 'no' )
indent = ' '
summary = indent + ('\n' + indent).join(lines)

@ -58,3 +58,10 @@ option(
value : 'false',
description : 'enable running unit tests with valgrind'
)
option(
'unstable_apis',
type : 'boolean',
value : 'false',
description : 'enable unstable apis'
)

@ -538,8 +538,10 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks
if (flags & VIRGL_RENDERER_THREAD_SYNC)
renderer_flags |= VREND_USE_THREAD_SYNC;
#ifdef VIRGL_RENDERER_UNSTABLE_APIS
if (flags & VIRGL_RENDERER_USE_EXTERNAL_BLOB)
renderer_flags |= VREND_USE_EXTERNAL_BLOB;
#endif /* VIRGL_RENDERER_UNSTABLE_APIS */
return vrend_renderer_init(&virgl_cbs, renderer_flags);
}
@ -636,8 +638,11 @@ int virgl_renderer_execute(void *execute_args, uint32_t execute_size)
}
}
#ifdef VIRGL_RENDERER_UNSTABLE_APIS
int virgl_renderer_resource_create_blob(const struct virgl_renderer_resource_create_blob_args *args)
{
int ret;
uint32_t blob_mem = args->blob_mem;
uint64_t blob_id = args->blob_id;
@ -705,3 +710,5 @@ int virgl_renderer_resource_get_map_info(uint32_t res_handle, uint32_t *map_info
return vrend_renderer_resource_get_map_info(res->pipe_resource, map_info);
}
#endif /* VIRGL_RENDERER_UNSTABLE_APIS */

@ -69,6 +69,8 @@ struct virgl_renderer_callbacks {
#define VIRGL_RENDERER_USE_GLX (1 << 2)
#define VIRGL_RENDERER_USE_SURFACELESS (1 << 3)
#define VIRGL_RENDERER_USE_GLES (1 << 4)
#ifdef VIRGL_RENDERER_UNSTABLE_APIS
/*
* Blob resources used with the 3D driver must be able to be represented as file descriptors.
* The typical use case is the virtual machine manager (or vtest) is running in a multiprocess
@ -80,6 +82,8 @@ struct virgl_renderer_callbacks {
*/
#define VIRGL_RENDERER_USE_EXTERNAL_BLOB (1 << 5)
#endif /* VIRGL_RENDERER_UNSTABLE_APIS */
VIRGL_EXPORT int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks *cb);
VIRGL_EXPORT void virgl_renderer_poll(void); /* force fences */
@ -246,6 +250,12 @@ VIRGL_EXPORT int virgl_renderer_get_poll_fd(void);
VIRGL_EXPORT int virgl_renderer_execute(void *execute_args, uint32_t execute_size);
/*
* These are unstable APIs for development only. Use these for development/testing purposes
* only, not in production
*/
#ifdef VIRGL_RENDERER_UNSTABLE_APIS
#define VIRGL_RENDERER_BLOB_MEM_GUEST 0x0001
#define VIRGL_RENDERER_BLOB_MEM_HOST3D 0x0002
#define VIRGL_RENDERER_BLOB_MEM_HOST3D_GUEST 0x0003
@ -281,4 +291,6 @@ VIRGL_EXPORT int virgl_renderer_resource_unmap(uint32_t res_handle);
VIRGL_EXPORT int virgl_renderer_resource_get_map_info(uint32_t res_handle, uint32_t *map_info);
#endif /* VIRGL_RENDERER_UNSTABLE_APIS */
#endif

Loading…
Cancel
Save