vrend: add external blob flag

This is to tell virglrenderer that blob resources used with
the 3d driver must be able represented as file descriptors.
This affects the availability of certain features.

Suggested-by: Alexandros Frantzis <alexandros.frantzis@collabora.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 5dce0053e5
commit 7ad2eeced9
  1. 2
      src/virglrenderer.c
  2. 10
      src/virglrenderer.h
  3. 3
      src/vrend_renderer.c
  4. 1
      src/vrend_renderer.h

@ -538,6 +538,8 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks
if (flags & VIRGL_RENDERER_THREAD_SYNC) if (flags & VIRGL_RENDERER_THREAD_SYNC)
renderer_flags |= VREND_USE_THREAD_SYNC; renderer_flags |= VREND_USE_THREAD_SYNC;
if (flags & VIRGL_RENDERER_USE_EXTERNAL_BLOB)
renderer_flags |= VREND_USE_EXTERNAL_BLOB;
return vrend_renderer_init(&virgl_cbs, renderer_flags); return vrend_renderer_init(&virgl_cbs, renderer_flags);
} }

@ -69,6 +69,16 @@ struct virgl_renderer_callbacks {
#define VIRGL_RENDERER_USE_GLX (1 << 2) #define VIRGL_RENDERER_USE_GLX (1 << 2)
#define VIRGL_RENDERER_USE_SURFACELESS (1 << 3) #define VIRGL_RENDERER_USE_SURFACELESS (1 << 3)
#define VIRGL_RENDERER_USE_GLES (1 << 4) #define VIRGL_RENDERER_USE_GLES (1 << 4)
/*
* 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
* mode. In a standard Linux setup, that means the KVM process is different from the process that
* instantiated virglrenderer. For zero-copy capability to work, file descriptors must be used.
*
* VMMs that advertise support for the virtio-gpu feature VIRTIO_GPU_F_RESOURCE_BLOB and run in
* a multi-process mode *must* specify this flag.
*/
#define VIRGL_RENDERER_USE_EXTERNAL_BLOB (1 << 5)
VIRGL_EXPORT int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks *cb); VIRGL_EXPORT int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks *cb);
VIRGL_EXPORT void virgl_renderer_poll(void); /* force fences */ VIRGL_EXPORT void virgl_renderer_poll(void); /* force fences */

@ -282,6 +282,7 @@ struct global_renderer_state {
bool finishing; bool finishing;
bool use_gles; bool use_gles;
bool use_core_profile; bool use_core_profile;
bool use_external_blob;
bool features[feat_last]; bool features[feat_last];
@ -5965,6 +5966,8 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
if (flags & VREND_USE_THREAD_SYNC) { if (flags & VREND_USE_THREAD_SYNC) {
vrend_renderer_use_threaded_sync(); vrend_renderer_use_threaded_sync();
} }
if (flags & VREND_USE_EXTERNAL_BLOB)
vrend_state.use_external_blob = true;
return 0; return 0;
} }

@ -131,6 +131,7 @@ struct vrend_if_cbs {
}; };
#define VREND_USE_THREAD_SYNC 1 #define VREND_USE_THREAD_SYNC 1
#define VREND_USE_EXTERNAL_BLOB 2
int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags); int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags);

Loading…
Cancel
Save