コード例 #1
0
bool GLXInteropResource::map(const surface_ptr& surface, GLuint tex, int w, int h, int)
{
    Q_UNUSED(w);
    Q_UNUSED(h);

    surface_glx_ptr glx = glx_surfaces[tex];

    if(!surface.isNull() && (surface->width() != m_width || m_height != surface->height())) {
        m_width = surface->width();
        m_height = surface->height();
        m_regenerateGlx = true;
    }

    if(m_regenerateGlx || !glx) {

        if (glx) { glx.clear(); }

        glx = surface_glx_ptr(new surface_glx_t(surface->display()));

        if (!glx->create(tex))
            glx =  surface_glx_ptr();
        glx_surfaces[tex] = glx;
    }

    if (!glx) {
        qWarning("Fail to create vaapi glx surface");
        return false;
    }
    if (!glx->copy(surface))
        return false;
    VAWARN(vaSyncSurface(surface->vadisplay(), surface->get()));
    return true;
}
コード例 #2
0
surface_glx_ptr GLXInteropResource::surfaceGLX(const display_ptr &dpy, GLuint tex)
{
    surface_glx_ptr glx = glx_surfaces[tex];
    if (glx)
        return glx;
    glx = surface_glx_ptr(new surface_glx_t(dpy));
    if (!glx->create(tex))
        return surface_glx_ptr();
    glx_surfaces[tex] = glx;
    return glx;
}