title: Does beaglebone black support gpu hardware acceleration?
body: <p>thanks in advance.
  I'm trying to play video on beaglebone black (BBB) made by Texas Instrument.
  Since there are a lot of good tutorials about using ffmpeg and SDL, I've decided to use it.
  Get information about video and codec, decode frames using ffmpeg.
  Display decoded frames to monitor using SDL.</p>
  
  <p>I'm using SDL2 which uses renderer, texture to display image to screen.
  According to SDL wiki, renderer uses GPU acceleration. 
  But here's a problem. video is played too slow... about 0.5fps?</p>
  
  <p>So I turned to SDL1.2 which uses software rendering. 
  It displays yuv overlay through CPU RAM.</p>
  
  <p>I thought that maybe BBB doesn't support GPU acceleration and googled about it but couldn't get answer. Any help please?
   Here's my code using SDL2. </p>
  
  <pre><code> #include &lt;libavutil/frame.h&gt;
   #include &lt;libavutil/avutil.h&gt;
   #include &lt;libavcodec/avcodec.h&gt;
   #include &lt;libavformat/avformat.h&gt;
   #include &lt;libswscale/swscale.h&gt;
  
   #include &lt;SDL2/SDL.h&gt;
   #include &lt;SDL2/SDL_thread.h&gt;
  
   #ifdef __MINGW32__
   #undef main /* Prevents SDL from overriding main() */
   #endif
  
  #include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;sys/ioctl.h&gt;
  #include &lt;linux/fb.h&gt;
  #include &lt;errno.h&gt;
  
  int main(int argc, char *argv[]) {
  
  AVFormatContext *pFormatCtx = NULL;
  int             i, videoStream;
  AVCodecContext  *pCodecCtx = NULL;
  AVCodec         *pCodec = NULL;
  AVFrame         *pFrame = NULL;
  AVPacket        packet;
  int             frameFinished;
  
  SDL_Window    *window=NULL;
  SDL_Renderer    *renderer=NULL;
  SDL_Texture     *bmp=NULL;
  SDL_Event       event;
  
  int fbfd, ret;
  struct fb_var_screeninfo fbvar;
  
  if(argc &lt; 2) {
    fprintf(stderr, "Usage: test &lt;file&gt;\n");
    exit(1);
  }
  // Register all formats and codecs
  av_register_all();
  
  if(SDL_Init(SDL_INIT_VIDEO)) {
  fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
  exit(1);
  }
  
  // Open video file
  if(avformat_open_input(&amp;pFormatCtx, argv[1], NULL, NULL)!=0)
  return -1; // Couldn't open file
  
  // Retrieve stream information
  if(avformat_find_stream_info(pFormatCtx, NULL)&lt;0)
  return -1; // Couldn't find stream information
  
  // Dump information about file onto standard error
  av_dump_format(pFormatCtx, 0, argv[1], 0);
  
  // Find the first video stream
  videoStream=-1;
  for(i=0; i&lt;pFormatCtx-&gt;nb_streams; i++)
    if(pFormatCtx-&gt;streams[i]-&gt;codec-&gt;codec_type==AVMEDIA_TYPE_VIDEO) {
    videoStream=i;
    break;
  }
  if(videoStream==-1)
  return -1; // Didn't find a video stream
  
  // Get a pointer to the codec context for the video stream
  pCodecCtx=pFormatCtx-&gt;streams[videoStream]-&gt;codec;
  // Find the decoder for the video stream
  pCodec=avcodec_find_decoder(pCodecCtx-&gt;codec_id);
  if(pCodec==NULL) {
  fprintf(stderr, "Unsupported codec!\n");
  return -1; // Codec not found
  }
  
  
  // Open codec
  if( avcodec_open2(pCodecCtx, pCodec, NULL)&lt;0 )
  return -1; // Could not open codec
  
  // Allocate video frame
  pFrame=av_frame_alloc();
  
  
  int ctxW= pCodecCtx-&gt;width;
  int ctxH= pCodecCtx-&gt;height;
  
   window =
    SDL_CreateWindow("test",
      SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED, 0, 0,
      SDL_WINDOW_BORDERLESS  SDL_WINDOW_FULLSCREEN_DESKTOP);
  
   renderer = SDL_CreateRenderer(window, -1, 0);
  
   // Allocate a place to put our YUV image on that screen
   bmp = SDL_CreateTexture(renderer, 
          SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, 
          pCodecCtx-&gt;width, pCodecCtx-&gt;height);
  
   av_init_packet(&amp;packet);
  
   // Read frames and save first five frames to disk
   while(av_read_frame(pFormatCtx, &amp;packet)&gt;=0) {
    // Is this a packet from the video stream?
     if(packet.stream_index==videoStream) {
    // Decode video frame
      avcodec_decode_video2(pCodecCtx, pFrame, &amp;frameFinished, &amp;packet);
  
    // Did we get a video frame?
       if(frameFinished) {
         SDL_UpdateYUVTexture(bmp, NULL, pFrame-&gt;data[0], pFrame-&gt;linesize[0],
          pFrame-&gt;data[1], pFrame-&gt;linesize[1],
          pFrame-&gt;data[2], pFrame-&gt;linesize[2]);
        }
  
        SDL_RenderClear(renderer);
        SDL_RenderCopy(renderer, bmp, NULL, NULL);
        SDL_RenderPresent(renderer);
     }
    SDL_Delay(15);
  
  
  SDL_PollEvent(&amp;event);
  switch(event.type) {
  case SDL_QUIT:
    SDL_Quit();
    exit(0);
    break;
  default:
    break;
  }
  
  
  }
  
  // Free the packet that was allocated by av_read_frame
   av_free_packet(&amp;packet);
  
  // Free the YUV frame
  av_frame_free(&amp;pFrame);
  
  // Close the codec
  avcodec_close(pCodecCtx);
  
  // Close the video file
  avformat_close_input(&amp;pFormatCtx);
  
  return 0;
  }
  </code></pre>