Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi 4 B #169

Open
techgunk opened this issue Jan 16, 2020 · 14 comments
Open

Raspberry Pi 4 B #169

techgunk opened this issue Jan 16, 2020 · 14 comments

Comments

@techgunk
Copy link

I'm trying to get this working on some Rpi 4 B to use at a gallery, is the Rpi 4 not supported?

@kr15h
Copy link
Owner

kr15h commented Jan 16, 2020 via email

@eshkrab
Copy link

eshkrab commented Apr 29, 2020

Hello!

Considering using this on a project and I'd love to use RPI4, happy to help with the porting effort if I can.

Would you mind briefly summarising what would be necessary for the port if you know? OF has been ported to RPI4 now, so is there a lot that needs to be done on top of that?

@magdesign
Copy link
Contributor

@eshkrab
Why don't you test it and report what is not working.....

@eshkrab
Copy link

eshkrab commented Apr 29, 2020

@magdesign I'm not at the stage of this project where it's appropriate to test solutions, especially when they're known to not be working.
I just asked the dev if they happen to know any of the big-picture problems since they said rpi4 is definitely not supported and I've helped the oF rpi4 porting efforts in the past, didn't mean for that to come off as lazy or to upset anyone.

@magdesign
Copy link
Contributor

It takes a lot of time to test things, if someone can tell: I installed this, compiled this, that was working but stuck here, its much easier for a dev to fix the issue. That's how opensource works.

So why not installing OF on your RPI4, compile PiMapper and test if it works or what errors you get... the community will help.

@eshkrab
Copy link

eshkrab commented Apr 29, 2020

Thank you for your input, I'll post if I end up using this and have issues I can't fix myself

@sxy2069
Copy link

sxy2069 commented May 7, 2020

It takes a lot of time to test things, if someone can tell: I installed this, compiled this, that was working but stuck here, its much easier for a dev to fix the issue. That's how opensource works.

So why not installing OF on your RPI4, compile PiMapper and test if it works or what errors you get... the community will help.

1588835685(1)
when I compile example_basic in ofxPimapper addon on Raspberry 4B, I get this error ,who can help me to solve this problem

@kr15h
Copy link
Owner

kr15h commented May 7, 2020 via email

@jvcleave
Copy link

jvcleave commented May 7, 2020

unlikely to have texture mode support on the RPI4
jvcleave/ofxOMXPlayer#157

@mysticcircuits
Copy link

mysticcircuits commented May 8, 2020

Hey so the odd thing is that I seem to be getting the exact same error on a Pi 3B+. Did a fresh install of the latest stable version of Noobs and open frameworks today to make sure everything was installed correctly and I got the same error. Any idea what I might have done wrong? I had no issue getting ofxOMXPlayer working in the past.

@jvcleave
Copy link

jvcleave commented May 8, 2020

I don't have an Pi 3B+ to test but it looks like maybe eglCreateImageKHR has been moved in Buster

If that is the case, there was a new way I was using to access it on the RPI4 that may work. See this commit

jvcleave/ofxOMXPlayer@94178e6

the important parts are in this block

static PFNEGLCREATEIMAGEKHRPROC createImageProc = NULL;
EGLImageKHR createImage(EGLDisplay dpy, EGLContext ctx, EGLenum target,
                        EGLClientBuffer buffer, const EGLint *attrib_list)
{
    if (!createImageProc)
    {
        createImageProc = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
    }
    
    return createImageProc(dpy, ctx, target, buffer, attrib_list);
}
static PFNEGLDESTROYIMAGEKHRPROC destroyImageProc = NULL;

EGLBoolean destroyImage(EGLDisplay dpy, EGLImageKHR image)
{
    if (!destroyImageProc)
    {
        destroyImageProc = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");
    }
    
    return destroyImageProc(dpy, image);
}

bool ofxOMXPlayerEngine::generateEGLImage()
{
    bool success = false;
    bool needsRegeneration = false;
    
    if (!texture.isAllocated())
    {
        needsRegeneration = true;
    }
    else
    {
        if (texture.getWidth() != videoWidth && texture.getHeight() != videoHeight)
        {
            needsRegeneration = true;
        }
    }
    
    if (!fbo.isAllocated())
    {
        needsRegeneration = true;
    }
    else
    {
        if (fbo.getWidth() != videoWidth && fbo.getHeight() != videoHeight)
        {
            needsRegeneration = true;
        }
    }
    
    if(!needsRegeneration)
    {
        //ofLogVerbose(__func__) << "NO CHANGES NEEDED - RETURNING EARLY";
        return true;
    }
    
    if (appEGLWindow == NULL)
    {
        appEGLWindow = (ofAppEGLWindow *) ofGetWindowPtr();
    }
    
    if (appEGLWindow == NULL)
    {
        ofLogError(__func__) << "appEGLWindow is NULL - RETURNING";
        return false;
    }
    if (display == NULL)
    {
        display = appEGLWindow->getEglDisplay();
    }
    if (context == NULL)
    {
        context = appEGLWindow->getEglContext();
    }
    
    if (display == NULL)
    {
        ofLogError(__func__) << "display is NULL - RETURNING";
        return false;
    }
    if (context == NULL)
    {
        ofLogError(__func__) << "context is NULL - RETURNING";
        return false;
    }
    
    if (needsRegeneration)
    {
        
        fbo.allocate(videoWidth, videoHeight, GL_RGBA);
        texture.allocate(videoWidth, videoHeight, GL_RGBA);
        texture.setTextureWrap(GL_REPEAT, GL_REPEAT);
        textureID = texture.getTextureData().textureID;
    }
    
    ofLog() << "textureID: " << textureID;
    ofLog() << "tex.isAllocated(): " << texture.isAllocated();
    ofLog() << "videoWidth: " << videoWidth;
    ofLog() << "videoHeight: " << videoHeight;
    ofLog() << "pixels: " << videoHeight;
    
    // setup first texture
    int dataSize = videoWidth * videoHeight * 4;
    
    if (pixels && needsRegeneration)
    {
        delete[] pixels;
        pixels = NULL;
    }
    
    if (pixels == NULL)
    {
        pixels = new unsigned char[dataSize];
    }
    ofLog() << "dataSize: " << dataSize;
    
    //memset(pixels, 0xff, dataSize);  // white texture, opaque
    
    glBindTexture(GL_TEXTURE_2D, textureID);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, videoWidth, videoHeight, 0,
                 GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    
    
    if (eglImage && needsRegeneration)
    {
        destroyEGLImage();
    }
    
    // Create EGL Image
    eglImage = createImage(display, context, EGL_GL_TEXTURE_2D_KHR, (EGLClientBuffer)textureID, NULL);

    if (eglImage == EGL_NO_IMAGE_KHR)
    {
        ofLog()    << "Create EGLImage FAIL <---------------- :(";
        
    }
    else
    {
        success = true;
        ofLog()  << "Create EGLImage PASS <---------------- :)";
    }
    return success;
    
}

void ofxOMXPlayerEngine::destroyEGLImage()
{
    
    
    if (eglImage)
    {
        if (appEGLWindow == NULL)
        {
            appEGLWindow = (ofAppEGLWindow *) ofGetWindowPtr();
        }
        
        if (display == NULL)
        {
            display = appEGLWindow->getEglDisplay();
        }
        
        if (!destroyImage(display, eglImage))
        {
            ofLog() << __func__ << " FAIL <---------------- :(";
        }else
        {
            ofLog() << __func__ << " PASS <---------------- :)";
        }
        eglImage = NULL;
    }
    
}

@pietrondo
Copy link

news about pi 4?
thx

@kr15h
Copy link
Owner

kr15h commented May 29, 2020

Nope. I have the feeling that one has to make a new Pi Mapper for Pi 4 actually.

@Brumeux
Copy link

Brumeux commented Sep 1, 2021

Anything new @kr15h ? Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants