vrend: gbm_allocation --> minigbm allocation

This is currently only used with minigbm, and largely untested
elsewhere.  This will also allow us to use flags which are not
available in Mesa GBM.

Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
macos/master
Gurchetan Singh 5 years ago
parent 447108ec60
commit 1fcd27d021
  1. 2
      config.h.meson
  2. 8
      meson.build
  3. 4
      meson_options.txt
  4. 2
      src/virgl_egl_context.c
  5. 2
      src/virgl_gbm.c
  6. 23
      src/vrend_renderer.c

@ -3,7 +3,7 @@
#mesondefine HAVE_PTHREAD
#mesondefine HAVE_EPOXY_EGL_H
#mesondefine HAVE_EPOXY_GLX_H
#mesondefine ENABLE_GBM_ALLOCATION
#mesondefine ENABLE_MINIGBM_ALLOCATION
#mesondefine HAVE_FUNC_ATTRIBUTE_VISIBILITY
#mesondefine HAVE_EVENTFD_H
#mesondefine HAVE_DLFCN_H

@ -116,9 +116,9 @@ with_glx = require_glx or auto_egl_glx
have_egl = false
have_glx = false
with_gbm_allocation = get_option('gbm_allocation')
if with_gbm_allocation
conf_data.set('ENABLE_GBM_ALLOCATION', 1)
with_minigbm_allocation = get_option('minigbm_allocation')
if with_minigbm_allocation
conf_data.set('ENABLE_MINIGBM_ALLOCATION', 1)
_gbm_ver = '18.0.0'
else
_gbm_ver = '0.0.0'
@ -193,7 +193,7 @@ lines = [
lines += 'egl: ' + (have_egl ? 'yes' : 'no')
lines += 'glx: ' + (have_glx ? 'yes' : 'no')
lines += ''
lines += 'gbm_alloc: ' + (with_gbm_allocation ? 'yes' : 'no' )
lines += 'minigbm_alloc: ' + (with_minigbm_allocation ? 'yes' : 'no' )
lines += ''
lines += 'tests: ' + (with_tests ? 'yes' : 'no' )
lines += 'fuzzer: ' + (with_fuzzer ? 'yes' : 'no' )

@ -32,10 +32,10 @@ option(
)
option(
'gbm_allocation',
'minigbm_allocation',
type : 'boolean',
value : 'false',
description : 'enable support for gbm_allocations'
description : 'enable support for minigbm_allocations'
)
option(

@ -397,7 +397,7 @@ bool virgl_has_egl_khr_gl_colorspace(struct virgl_egl *egl)
return has_bit(egl->extension_bits, EGL_KHR_GL_COLORSPACE);
}
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
void *virgl_egl_image_from_dmabuf(struct virgl_egl *egl, struct gbm_bo *bo)
{
int ret;

@ -306,7 +306,7 @@ int virgl_gbm_convert_format(uint32_t *virgl_format, uint32_t *gbm_format)
return -1;
}
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
int virgl_gbm_transfer(struct gbm_bo *bo, uint32_t direction, struct iovec *iovecs,
uint32_t num_iovecs, const struct vrend_transfer_info *info)
{

@ -681,7 +681,7 @@ static inline bool vrend_format_can_sample(enum virgl_formats format)
if (tex_conv_table[format].bindings & VIRGL_BIND_SAMPLER_VIEW)
return true;
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
uint32_t gbm_format = 0;
if (virgl_gbm_convert_format(&format, &gbm_format))
return false;
@ -689,12 +689,7 @@ static inline bool vrend_format_can_sample(enum virgl_formats format)
if (!gbm || !gbm->device || !gbm_format)
return false;
#ifdef MINIGBM
uint32_t gbm_usage = GBM_BO_USE_TEXTURING;
#else
uint32_t gbm_usage = 0;
#endif
return gbm_device_is_format_supported(gbm->device, gbm_format, gbm_usage);
#else
return false;
@ -718,7 +713,7 @@ static inline bool vrend_format_is_ds(enum virgl_formats format)
static inline bool vrend_format_can_scanout(enum virgl_formats format)
{
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
uint32_t gbm_format = 0;
if (virgl_gbm_convert_format(&format, &gbm_format))
return false;
@ -6260,7 +6255,7 @@ static int check_resource_valid(struct vrend_renderer_resource_create_args *args
return -1;
}
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
if (!virgl_gbm_gpu_import_required(args->bind)) {
return 0;
}
@ -6383,7 +6378,7 @@ vrend_renderer_resource_copy_args(struct vrend_renderer_resource_create_args *ar
*/
static void vrend_resource_gbm_init(struct vrend_resource *gr, uint32_t format)
{
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
uint32_t gbm_flags = virgl_gbm_convert_flags(gr->base.bind);
uint32_t gbm_format = 0;
if (virgl_gbm_convert_format(&format, &gbm_format))
@ -6453,7 +6448,7 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr,
if (image_oes && !has_feature(feat_egl_image_storage))
gr->base.bind &= ~VIRGL_BIND_PREFER_EMULATED_BGRA;
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
if (virgl_gbm_external_allocation_preferred(gr->base.bind) &&
!has_feature(feat_egl_image_storage))
gr->base.bind &= ~VIRGL_BIND_PREFER_EMULATED_BGRA;
@ -6615,7 +6610,7 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr,
glBindTexture(gr->target, 0);
if (image_oes && gr->gbm_bo) {
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
if (!has_bit(gr->storage_bits, VREND_STORAGE_GL_BUFFER) &&
!vrend_format_can_texture_view(gr->base.format)) {
for (int i = 0; i < gbm_bo_get_plane_count(gr->gbm_bo); i++) {
@ -6744,7 +6739,7 @@ void vrend_renderer_resource_destroy(struct vrend_resource *res)
free(res->ptr);
}
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
if (res->egl_image) {
virgl_egl_image_destroy(egl, res->egl_image);
for (unsigned i = 0; i < ARRAY_SIZE(res->aux_plane_egl_image); i++) {
@ -7699,7 +7694,7 @@ int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info,
return EINVAL;
}
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
if (res->gbm_bo && (transfer_mode == VIRGL_TRANSFER_TO_HOST ||
!has_bit(res->storage_bits, VREND_STORAGE_EGL_IMAGE)))
return virgl_gbm_transfer(res->gbm_bo, transfer_mode, iov, num_iovs, info);
@ -10326,7 +10321,7 @@ static int vrend_renderer_export_query(void *execute_args, uint32_t execute_size
if (!res)
return -EINVAL;
#ifdef ENABLE_GBM_ALLOCATION
#ifdef ENABLE_MINIGBM_ALLOCATION
if (res->gbm_bo)
return virgl_gbm_export_query(res->gbm_bo, export_query);
#endif

Loading…
Cancel
Save