struct vc4_bo * vc4_screen_bo_from_handle(struct pipe_screen *pscreen, struct winsys_handle *whandle, unsigned *out_stride) { struct vc4_screen *screen = vc4_screen(pscreen); struct vc4_bo *bo; if (whandle->type != DRM_API_HANDLE_TYPE_SHARED) { fprintf(stderr, "Attempt to import unsupported handle type %d\n", whandle->type); return NULL; } bo = vc4_bo_open_name(screen, whandle->handle, whandle->stride); if (!bo) { fprintf(stderr, "Open name %d failed\n", whandle->handle); return NULL; } *out_stride = whandle->stride; return bo; }
struct vc4_bo * vc4_screen_bo_from_handle(struct pipe_screen *pscreen, struct winsys_handle *whandle) { struct vc4_screen *screen = vc4_screen(pscreen); switch (whandle->type) { case DRM_API_HANDLE_TYPE_SHARED: return vc4_bo_open_name(screen, whandle->handle, whandle->stride); case DRM_API_HANDLE_TYPE_FD: return vc4_bo_open_dmabuf(screen, whandle->handle, whandle->stride); default: fprintf(stderr, "Attempt to import unsupported handle type %d\n", whandle->type); return NULL; } }