Only require minimum gbm version when needed.

We only need a recent version of gbm when enable_gbm_allocation gets
set.

Close #134

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Lepton Wu <lepton@chromium.org>
macos/master
Lepton Wu 5 years ago
parent 6c7da17184
commit c162f33d5f
  1. 5
      configure.ac
  2. 15
      meson.build
  3. 2
      src/virgl_egl_context.c
  4. 25
      src/virgl_gbm.c

@ -137,7 +137,12 @@ AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
LIBDRM_REQUIRED=2.4.50
if test "x$enable_gbm_allocation" = xyes; then
LIBGBM_REQUIRED=18.0.0
else
LIBGBM_REQUIRED=0.0.0
fi
if test "x$os_win32" = xno && test "x$enable_egl" != "xno"; then
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])

@ -96,9 +96,17 @@ 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)
_gbm_ver = '18.0.0'
else
_gbm_ver = '0.0.0'
endif
if with_egl
if cc.has_header('epoxy/egl.h') and epoxy_dep.get_pkgconfig_variable('epoxy_has_egl') == '1'
gbm_dep = dependency('gbm', version: '>= 18.0.0', required: require_egl)
gbm_dep = dependency('gbm', version: '>= ' + _gbm_ver, required: require_egl)
have_egl = gbm_dep.found()
conf_data.set('HAVE_EPOXY_EGL_H', 1)
else
@ -122,11 +130,6 @@ if cc.compiles('void __attribute__((hidden)) func() {}')
conf_data.set('HAVE_FUNC_ATTRIBUTE_VISIBILITY', 1)
endif
with_gbm_allocation = get_option('gbm_allocation')
if with_gbm_allocation
conf_data.set('ENABLE_GBM_ALLOCATION', 1)
endif
configure_file(input : 'config.h.meson',
output : 'config.h',
configuration : conf_data)

@ -397,6 +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
void *virgl_egl_image_from_dmabuf(struct virgl_egl *egl, struct gbm_bo *bo)
{
int ret;
@ -510,6 +511,7 @@ void virgl_egl_image_destroy(struct virgl_egl *egl, void *image)
{
eglDestroyImageKHR(egl->egl_display, image);
}
#endif
bool virgl_egl_need_fence_and_wait_external(struct virgl_egl *egl)
{

@ -306,6 +306,7 @@ int virgl_gbm_convert_format(uint32_t *virgl_format, uint32_t *gbm_format)
return -1;
}
#ifdef ENABLE_GBM_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)
{
@ -391,17 +392,6 @@ uint32_t virgl_gbm_convert_flags(uint32_t virgl_bind_flags)
return flags;
}
int virgl_gbm_export_fd(struct gbm_device *gbm, uint32_t handle, int32_t *out_fd)
{
int ret;
ret = drmPrimeHandleToFD(gbm_device_get_fd(gbm), handle, DRM_CLOEXEC | DRM_RDWR, out_fd);
// Kernels with older DRM core versions block DRM_RDWR but give a
// read/write mapping anyway.
if (ret)
ret = drmPrimeHandleToFD(gbm_device_get_fd(gbm), handle, DRM_CLOEXEC, out_fd);
return ret;
}
int virgl_gbm_export_query(struct gbm_bo *bo, struct virgl_renderer_export_query *query)
{
@ -461,6 +451,19 @@ err_close:
query->out_num_fds = 0;
return ret;
}
#endif
int virgl_gbm_export_fd(struct gbm_device *gbm, uint32_t handle, int32_t *out_fd)
{
int ret;
ret = drmPrimeHandleToFD(gbm_device_get_fd(gbm), handle, DRM_CLOEXEC | DRM_RDWR, out_fd);
// Kernels with older DRM core versions block DRM_RDWR but give a
// read/write mapping anyway.
if (ret)
ret = drmPrimeHandleToFD(gbm_device_get_fd(gbm), handle, DRM_CLOEXEC, out_fd);
return ret;
}
int virgl_gbm_get_plane_width(struct gbm_bo *bo, int plane) {
uint32_t format = gbm_bo_get_format(bo);

Loading…
Cancel
Save