glamor_egl: Drop the has_gem flag.

We're using GBM, so we know we've got GEM.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Eric Anholt 2017-05-16 11:37:15 -07:00 committed by Adam Jackson
parent 32957d9fae
commit b1b71b7a8b

View File

@ -58,7 +58,6 @@ struct glamor_egl_screen_private {
int fd; int fd;
int cpp; int cpp;
struct gbm_device *gbm; struct gbm_device *gbm;
int has_gem;
int gl_context_depth; int gl_context_depth;
int dri3_capable; int dri3_capable;
@ -193,19 +192,6 @@ glamor_egl_create_textured_screen_ext(ScreenPtr screen,
return glamor_egl_create_textured_screen(screen, handle, stride); return glamor_egl_create_textured_screen(screen, handle, stride);
} }
static Bool
glamor_egl_check_has_gem(int fd)
{
struct drm_gem_flink flink;
flink.handle = 0;
ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
if (errno == ENOENT || errno == EINVAL)
return TRUE;
return FALSE;
}
static void static void
glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image) glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
{ {
@ -240,17 +226,13 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
glamor_egl = glamor_egl_get_screen_private(scrn); glamor_egl = glamor_egl_get_screen_private(scrn);
glamor_make_current(glamor_priv); glamor_make_current(glamor_priv);
if (glamor_egl->has_gem) { if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR,
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Couldn't flink pixmap handle\n");
"Couldn't flink pixmap handle\n"); glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); assert(0);
assert(0); return FALSE;
return FALSE;
}
} }
else
name = handle;
image = _glamor_egl_create_image(glamor_egl, image = _glamor_egl_create_image(glamor_egl,
pixmap->drawable.width, pixmap->drawable.width,
@ -419,8 +401,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
pixmap->devKind = gbm_bo_get_stride(bo); pixmap->devKind = gbm_bo_get_stride(bo);
if (want_name) { if (want_name) {
if (glamor_egl->has_gem) glamor_get_name_from_bo(glamor_egl->fd, bo, &fd);
glamor_get_name_from_bo(glamor_egl->fd, bo, &fd);
} }
else { else {
fd = gbm_bo_get_fd(bo); fd = gbm_bo_get_fd(bo);
@ -738,8 +719,6 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
goto error; goto error;
} }
glamor_egl->has_gem = glamor_egl_check_has_gem(fd);
if (!eglInitialize if (!eglInitialize
(glamor_egl->display, &glamor_egl->major, &glamor_egl->minor)) { (glamor_egl->display, &glamor_egl->major, &glamor_egl->minor)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglInitialize() failed\n"); xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglInitialize() failed\n");