egl: update mesa_dma_buf_img_export usage

macos/master
Marc-André Lureau 10 years ago committed by Dave Airlie
parent 5d17df15a6
commit 814f638d42
  1. 12
      src/virgl_egl_context.c

@ -260,14 +260,13 @@ virgl_renderer_gl_context virgl_egl_get_current_context(struct virgl_egl *ve)
int virgl_egl_get_fourcc_for_texture(struct virgl_egl *ve, uint32_t tex_id, uint32_t format, int *fourcc) int virgl_egl_get_fourcc_for_texture(struct virgl_egl *ve, uint32_t tex_id, uint32_t format, int *fourcc)
{ {
int ret; int ret = EINVAL;
#ifndef EGL_MESA_image_dma_buf_export #ifndef EGL_MESA_image_dma_buf_export
ret = 0; ret = 0;
goto fallback; goto fallback;
#else #else
EGLImageKHR image; EGLImageKHR image;
EGLint stride;
EGLBoolean b; EGLBoolean b;
if (!ve->have_mesa_dma_buf_img_export) if (!ve->have_mesa_dma_buf_img_export)
@ -278,8 +277,7 @@ int virgl_egl_get_fourcc_for_texture(struct virgl_egl *ve, uint32_t tex_id, uint
if (!image) if (!image)
return EINVAL; return EINVAL;
ret = EINVAL; b = eglExportDMABUFImageQueryMESA(ve->egl_display, image, fourcc, NULL, NULL);
b = eglExportDMABUFImageQueryMESA(ve->egl_display, image, fourcc, NULL);
if (!b) if (!b)
goto out_destroy; goto out_destroy;
ret = 0; ret = 0;
@ -298,6 +296,9 @@ int virgl_egl_get_fd_for_texture(struct virgl_egl *ve, uint32_t tex_id, int *fd)
{ {
EGLImageKHR image; EGLImageKHR image;
EGLint stride; EGLint stride;
#ifdef EGL_MESA_image_dma_buf_export
EGLint offset;
#endif
EGLBoolean b; EGLBoolean b;
int ret; int ret;
image = eglCreateImageKHR(ve->egl_display, eglGetCurrentContext(), EGL_GL_TEXTURE_2D_KHR, (EGLClientBuffer)(unsigned long)tex_id, NULL); image = eglCreateImageKHR(ve->egl_display, eglGetCurrentContext(), EGL_GL_TEXTURE_2D_KHR, (EGLClientBuffer)(unsigned long)tex_id, NULL);
@ -311,7 +312,8 @@ int virgl_egl_get_fd_for_texture(struct virgl_egl *ve, uint32_t tex_id, int *fd)
b = eglExportDMABUFImageMESA(ve->egl_display, b = eglExportDMABUFImageMESA(ve->egl_display,
image, image,
fd, fd,
&stride); &stride,
&offset);
#else #else
goto out_destroy; goto out_destroy;
#endif #endif

Loading…
Cancel
Save