Showing posts with label #GPU. Show all posts
Showing posts with label #GPU. Show all posts

2014-07-06

Raspberry Metalflake

 rpiplayground: Hacking the GPU for Fun and Profit (Part 1 of 4)
Fun for those rainy days... Says the author: 
"This series of posts will walk through the GPU architecture by designing and optimizing a non-trivial algorithm (parallel SHA-256) to run on the GPU.  Because this is a relatively advanced topic, some background knowledge must be assumed. [ … ] You should have some understanding of GPGPU concepts (Google can help) and you should read the Broadcom BCM2835 GPU Documentation. I’ll describe most Raspberry Pi GPU specific concepts but in case I miss some, the documentation is your friend."
[ed note: we will try to cover some of those assumed bits of background knowledge here as we find out what they are. kthx]
SHA-256 implementation on QPUs
Raspberry Pi Forum thread where the rpiplayground (see link above) blog showed up.
OpenVG™ – The Standard for Vector Graphics Acceleration
From the page:
"… royalty-free, cross-platform API that provides a low-level hardware acceleration interface for vector graphics libraries such as Flash and SVG. OpenVG is targeted primarily at handheld devices that require portable acceleration of high-quality vector graphics for compelling user interfaces and text on small screen devices - while enabling hardware acceleration to provide fluidly interactive performance at very low power levels."
hermanhermitage/videocoreiv
Tools and information for the Broadcom VideoCore IV (RaspberryPi)

Simon's accelerated X development thread
This thread at the Raspberry Pi Forum leads to quite a few interesting links – starting with the low level virtual machine code repository:  simonjhall/llvm_qpu – Low Level Virtual Machine
GitHub repository for the LLVM sources – this is a frequently updated mirror of the official site … note that this is not anything to do with the java virtual machines –
"This directory and its subdirectories contain source code for the Low Level Virtual Machine, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments."
other simonjhall repositories on github: 
My Robot Blog:  GPU Accelerated Camera Processing On The Raspberry Pi
am very actively trying to follow this work currently

2014-06-18

OpenVG™: Open Vector Graphics Standard

OpenVG™ official site
“ ...a royalty-free, cross-platform API that provides a low-level hardware acceleration interface for vector graphics libraries such as Flash and SVG.”

Broadcom Listed as OpenVG COnformant

… from OpenVG Conformant Products listing at Kronos Group:

Broadcom Corporation 2011-04-03 OpenVG_1_1
CPU: VideoCore IV, OS:Threadx,
Pipeline: Broadcom VideoCore IV HW/OpenVG 1.1,
Display: 64x64 32bpp

2014-06-17

ES/GLES Framebuffer code sighting

On Stackoverflow.com

This link is to an Android programming forum, but contains the first framebuffer ES/GLES example code I have seen (to draw triangles on the screen...

The article contains the statement:

Everything is rendered on screen correctly, but the performance are ruined just when I draw the FBO texture. Thank you very much for your help. I worked very hard on this and didn't find a solution.

... so perhaps the code isn't perfect, but it's a place to start. This does confirm what I suspected about library being the home of the GPU e.g. triangle-drawing routines.

Here is what the code looks like – this is C:

// Create a framebuffer and renderbuffer
GLES20.glGenFramebuffers(1, fb, offset);
GLES20.glGenRenderbuffers(1, depthRb, offset);

// Create a texture to hold the frame buffer
GLES20.glGenTextures(1, renderTex, offset);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, renderTex[offset]);

GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA,
                    screenWidth, screenHeight, 0,
                    GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE,
                    null);


GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,
                       GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,
                       GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER,
                       GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER,
                       GLES20.GL_LINEAR);

//bind renderbuffer
GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, depthRb[offset]);

GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16,
                             screenWidth, screenHeight);

// bind the framebuffer
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fb[offset]);

// specify texture as color attachment
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
                              GLES20.GL_TEXTURE_2D, renderTex[offset], 0);

// specify depth_renderbufer as depth attachment
GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT,
                                 GLES20.GL_RENDERBUFFER, depthRb[0]);

// Check FBO status.
int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);

if ( status == GLES20.GL_FRAMEBUFFER_COMPLETE )
{
    Log.d("GLGame framebuffer creation", "Framebuffer complete");
}


// set default framebuffer
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); 

On ZipForums.com

Android OpenGL.ES Texture/Image Drawing has more examples of ES/GLES code for Android.

public void onDrawFrame(GL10 gl) {
    checkGLError(gl);
    if (mContextSupportsFrameBufferObject) {
        GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl;
        if (DEBUG_RENDER_OFFSCREEN_ONSCREEN) {
            drawOffscreenImage(gl, mSurfaceWidth, mSurfaceHeight);
        } else {
            gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, mFramebuffer);
            drawOffscreenImage(gl, mFramebufferWidth, mFramebufferHeight);
            gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0);
            drawOnscreen(gl, mSurfaceWidth, mSurfaceHeight);
        }
    } else {
        // Current context doesn't support frame buffer objects.
        // Indicate this by drawing a red background.
        gl.glClearColor(1,0,0,0);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    }
}

From Google Code

This project is in Java: An OpenGL ES 2.0 example for Android

2014-06-14

What are Wayland graphics? #link

Overview

Case Studies from Collabora does a good job of providing a highlevel technical description of the Wayland graphics engine relative to e.g. existing X11 graphics engines.

Resources

  • Wayland at FreeDesktop.org

    • Wayland is intended as a simpler replacement for X
    • Wayland is a protocol for a compositor to talk to its clients as well as a C library implementation of that protocol.
  • See the links for more...

userland github #link

https://github.com/raspberrypi/userland

"This repository contains the source code for the ARM side libraries used on Raspberry Pi. These typically are installed in /opt/vc/lib and includes source for the ARM side code to interface to: EGL, mmal, GLESv2, vcos, openmaxil, vchiq_arm, bcm_host, WFC, OpenVG."
rPi Software Block Diagram
Image courtesy of The Raspberry Pi Foundation

Other Links

2014-05-28

Contact for GPU / Pi Internals

 Some contact points listed here: https://github.com/hermanhermitage/videocoreiv
"Active discussions take place on IRC (freenode) on #raspberrypi-internals, #raspberrypi-osdev, #raspberrypi-dev, and #raspberrypi.
There is a raspberrypi-internals mailing list, you can subscribe at mailing list page at freelists.org."

< source: http://www.raspberrypi.org/forums/viewtopic.php?f=33&t=6188&start=100 >

The rPi GPU Firmware code repository has the VideoCore IV library code.  Note that this code is compiled as a binary for the dual-core BroadCom GPU 

The BROADCOM BCM2835: High Definition 1080p Embedded Multimedia Applications Processor GPU (used in the Raspberry Pi)

Breakdown of the device

VideoCore IV BCM2835 Overview – block diagrams & functional descriptions