Example #1
0
		int Initialize()
		{
			fbfd = 0;
			fbp = 0;

			setlogmask(LOG_UPTO(LOG_DEBUG));
			openlog("fbcp", LOG_NDELAY | LOG_PID, LOG_USER);

			bcm_host_init();

			display = vc_dispmanx_display_open(0);
			if (!display) {
				syslog(LOG_ERR, "Unable to open primary display");
				return -1;
			}
			ret = vc_dispmanx_display_get_info(display, &display_info);
			if (ret) {
				syslog(LOG_ERR, "Unable to get primary display information");
				return -1;
			}
			syslog(LOG_INFO, "Primary display is %d x %d", display_info.width, display_info.height);


			fbfd = open("/dev/fb1", O_RDWR);
			if (!fbfd) {
				syslog(LOG_ERR, "Unable to open secondary display");
				return -1;
			}
			if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo)) {
				syslog(LOG_ERR, "Unable to get secondary display information");
				return -1;
			}
			if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) {
				syslog(LOG_ERR, "Unable to get secondary display information");
				return -1;
			}

			syslog(LOG_INFO, "Second display is %d x %d %dbps\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel);

			screen_resource = vc_dispmanx_resource_create(VC_IMAGE_RGB565, vinfo.xres, vinfo.yres, &image_prt);
			if (!screen_resource) {
				syslog(LOG_ERR, "Unable to create screen buffer");
				close(fbfd);
				vc_dispmanx_display_close(display);
				return -1;
			}

			fbp = (char*) mmap(0, finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
			if (fbp <= 0) {
				syslog(LOG_ERR, "Unable to create mamory mapping");
				close(fbfd);
				ret = vc_dispmanx_resource_delete(screen_resource);
				vc_dispmanx_display_close(display);
				return -1;
			}

			vc_dispmanx_rect_set(&rect1, 0, 0, vinfo.xres, vinfo.yres);
			return 1;
		}
Example #2
0
		void Dispose()
		{
			munmap(fbp, finfo.smem_len);
			close(fbfd);
			ret = vc_dispmanx_resource_delete(screen_resource);
			vc_dispmanx_display_close(display);
		}
Example #3
0
static void exit_func(void)
// Function to be passed to atexit().
{
   DISPMANX_UPDATE_HANDLE_T dispman_update;
   int s;
   // clear screen
   glClear( GL_COLOR_BUFFER_BIT );
   eglSwapBuffers(state->display, state->surface);

   glDeleteTextures(6, state->tex);
   eglDestroySurface( state->display, state->surface );

   dispman_update = vc_dispmanx_update_start( 0 );
   s = vc_dispmanx_element_remove(dispman_update, state->dispman_element);
   assert(s == 0);
   vc_dispmanx_update_submit_sync( dispman_update );
   s = vc_dispmanx_display_close(state->dispman_display);
   assert (s == 0);

   // Release OpenGL resources
   eglMakeCurrent( state->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
   eglDestroyContext( state->display, state->context );
   eglTerminate( state->display );

#ifndef __circle__
   // release texture buffers
   free(state->tex_buf1);
   free(state->tex_buf2);
   free(state->tex_buf3);
#endif

   printk("\ncube closed\n");
} // exit_func()
Example #4
0
static void rpi_uninit(MPGLContext *ctx)
{
    struct priv *p = ctx->priv;
    mp_egl_rpi_destroy(&p->egl);
    if (p->display)
        vc_dispmanx_display_close(p->display);
}
Example #5
0
// Release OpenGL resources
void closeGL() {
    #ifdef PLATFORM_RPI
    eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

    if (surface != EGL_NO_SURFACE && eglDestroySurface(display, surface)) {
        printf("Surface destroyed ok\n");
    }
    if (context !=  EGL_NO_CONTEXT && eglDestroyContext(display, context)) {
        printf("Main context destroyed ok\n");
    }
    if (display != EGL_NO_DISPLAY && eglTerminate(display)) {
        printf("Display terminated ok\n");
    }
    if (eglReleaseThread()) {
        printf("EGL thread resources released ok\n");
    }
    if (vc_dispmanx_display_close(dispman_display) == 0) {
        printf("Dispmanx display rleased ok\n");
    }
    bcm_host_deinit();

    #else
    //  ---------------------------------------- using GLFW
    //
    glfwTerminate();
    #endif
}
Example #6
0
void gp2x_deinit(void)
{
	int ret;

    gles2_destroy();
    // Release OpenGL resources
    eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
    eglDestroySurface( display, surface );
    eglDestroyContext( display, context );
    eglTerminate( display );

	dispman_update = vc_dispmanx_update_start( 0 );
	ret = vc_dispmanx_element_remove( dispman_update, dispman_element );
	ret = vc_dispmanx_element_remove( dispman_update, dispman_element_bg );
	ret = vc_dispmanx_update_submit_sync( dispman_update );
	ret = vc_dispmanx_resource_delete( resource0 );
	ret = vc_dispmanx_resource_delete( resource1 );
	ret = vc_dispmanx_resource_delete( resource_bg );
	ret = vc_dispmanx_display_close( dispman_display );

	if(gp2x_screen8) free(gp2x_screen8);
	if(gp2x_screen15) free(gp2x_screen15);
	gp2x_screen8=0;
	gp2x_screen15=0;
}
Example #7
0
void gr_close()
{
	ogl_brightness_r = ogl_brightness_g = ogl_brightness_b = 0;

	if (gl_initialized)
	{
		ogl_smash_texture_list_internal();
	}

	if (grd_curscreen)
	{
		if (grd_curscreen->sc_canvas.cv_bitmap.bm_data)
			d_free(grd_curscreen->sc_canvas.cv_bitmap.bm_data);
		d_free(grd_curscreen);
	}
	ogl_close_pixel_buffers();
#ifdef _WIN32
	if (ogl_rt_loaded)
		OpenGL_LoadLibrary(false);
#endif

#ifdef OGLES
	ogles_destroy();
#ifdef RPI
	con_printf(CON_DEBUG, "RPi: cleanuing up\n");
	if (dispman_display != DISPMANX_NO_HANDLE) {
		rpi_destroy_element();
		con_printf(CON_DEBUG, "RPi: closing display\n");
		vc_dispmanx_display_close(dispman_display);
		dispman_display = DISPMANX_NO_HANDLE;
	}
#endif
#endif
}
Example #8
0
static void dispmanx_gfx_free(void *data)
{
   int i;
   struct dispmanx_video *_dispvars = data;

   if (!_dispvars)
      return;

   dispmanx_free_main_resources(_dispvars);

   /* Close display and deinitialize. */
   vc_dispmanx_display_close(_dispvars->display);
   bcm_host_deinit();

   /* Destroy mutexes and conditions. */
   slock_free(_dispvars->pending_mutex);
   scond_free(_dispvars->vsync_condition);		

   for (i = 0; i < NUMPAGES; i++)
      slock_free(_dispvars->pages[i].page_used_mutex);

   if (_dispvars->pages)
      free (_dispvars->pages);
   _dispvars->pages = NULL;

   dispmanx_unblank_console(_dispvars);
}
Example #9
0
File: main.c Project: pzl/piwm
int main (int argc, char **argv) {
	(void) argc;
	(void) argv;

	// network
	int sock;
	int client;

	//GRAPHICS VARS
	Display screen;

	screen = setup_graphics();
	sock = setup_socket();


	// ----------------------

	// Network update vars and setup
	struct sockaddr_storage remote_addr;
	socklen_t addr_size = sizeof(remote_addr);


	while ( (client = accept(sock, (struct sockaddr *)&remote_addr, &addr_size)) > 0){
		on_connect(client, remote_addr, screen);
		//@todo: method to break here, or catch signals
		//and end up in code below, closing socket and cleaning up GPU
		//would need to close threads and clients
	}

	close(sock);
	vc_dispmanx_display_close(screen.display);


	return 0;
}
Example #10
0
/** Destroys the pools of buffers used by the GL renderer.
 * @param raspitex_state A pointer to the GL preview state.
 */
void raspitexutil_destroy_native_window(RASPITEX_STATE *raspitex_state)
{
   vcos_log_trace("%s", VCOS_FUNCTION);
   if (raspitex_state->disp != DISPMANX_NO_HANDLE)
   {
      vc_dispmanx_display_close(raspitex_state->disp);
      raspitex_state->disp = DISPMANX_NO_HANDLE;
   }
}
Example #11
0
unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool swap_red_blue)
{
  DISPMANX_DISPLAY_HANDLE_T display;
  DISPMANX_RESOURCE_HANDLE_T resource;
  VC_RECT_T rect;
  unsigned char *image = NULL;
  uint32_t vc_image_ptr;
  int stride;

  display = vc_dispmanx_display_open( 0 /*screen*/ );
  stride = ((width + 15) & ~15) * 4;
  image = new unsigned char [height * stride];

  if (image)
  {
    resource = vc_dispmanx_resource_create( VC_IMAGE_RGBA32, width, height, &vc_image_ptr );

    vc_dispmanx_snapshot(display, resource, (DISPMANX_TRANSFORM_T)0);

    vc_dispmanx_rect_set(&rect, 0, 0, width, height);
    vc_dispmanx_resource_read_data(resource, &rect, image, stride);
    vc_dispmanx_resource_delete( resource );
    vc_dispmanx_display_close(display );

    // we need to save in BGRA order so Swap RGBA -> BGRA
    if (swap_red_blue)
    {
      for (int y = 0; y < height; y++)
      {
        unsigned char *p = image + y * stride;
        for (int x = 0; x < width; x++, p+=4)
        {
          unsigned char t = p[0];
          p[0] = p[2];
          p[2] = t;
        }
      }
    }
    // assume we need to pack image if caller doesn't want stride
    if (!pstride && stride > width*4)
    {
      for (int y = 0; y < height; y++)
      {
        unsigned char *in  = image + y * stride;
        unsigned char *out = image + y * width * 4;
        memmove(out, in, width*4);
      }
    }
  }
  if (pstride)
    *pstride = stride;
  return image;
}
Example #12
0
void save_snapshot(void)
{
  DISPMANX_DISPLAY_HANDLE_T display;
  DISPMANX_MODEINFO_T info;
  DISPMANX_RESOURCE_HANDLE_T resource;
  VC_IMAGE_TYPE_T type = VC_IMAGE_RGB888;
  VC_IMAGE_TRANSFORM_T transform = 0;
  VC_RECT_T rect;
  void *image;
  uint32_t vc_image_ptr;
  int ret;
  uint32_t screen = 0;

  fprintf(stderr,"\nWriting snapshot...\n");
  //fprintf(stderr,"Open display[%i]...\n", screen );
  display = vc_dispmanx_display_open( screen );

  ret = vc_dispmanx_display_get_info(display, &info);
  assert(ret == 0);
  //fprintf(stderr,"Display is %d x %d\n", info.width, info.height );

  image = calloc( 1, info.width * 3 * info.height );

  assert(image);

  resource = vc_dispmanx_resource_create(type, info.width, info.height,&vc_image_ptr);

  vc_dispmanx_snapshot(display, resource, transform);

  vc_dispmanx_rect_set(&rect, 0, 0, info.width, info.height);
  vc_dispmanx_resource_read_data(resource, &rect, image, info.width*3);

  char* home = getenv("HOME");
  char filename[1024];
  if (!home)
    home = "/tmp";

  snprintf(filename,sizeof(filename),"%s/pidvbip-%u.ppm",home,(unsigned int)time(NULL));
  FILE *fp = fopen(filename, "wb");
  fprintf(fp, "P6\n%d %d\n255\n", info.width, info.height);
  fwrite(image, info.width*3*info.height, 1, fp);
  fclose(fp);

  fprintf(stderr,"\nSnapshot written to %s\n",filename);

  ret = vc_dispmanx_resource_delete( resource );
  assert( ret == 0 );
  ret = vc_dispmanx_display_close(display );
  assert( ret == 0 );

  free(image);
}
Example #13
0
static void frontend_deinit(void)
{
  fe_update = vc_dispmanx_update_start( 0 );
  vc_dispmanx_element_remove( fe_update, fe_element );
  vc_dispmanx_update_submit_sync( fe_update );
  vc_dispmanx_resource_delete( fe_resource );
  vc_dispmanx_display_close( fe_display );

  if(fe_screen) free(fe_screen);
  fe_screen=0;

  bcm_host_deinit();
}
int main(void)
{
    DISPMANX_DISPLAY_HANDLE_T   display;
    DISPMANX_MODEINFO_T         info;
    DISPMANX_RESOURCE_HANDLE_T  resource;
    VC_IMAGE_TYPE_T type = VC_IMAGE_RGB888;
    VC_IMAGE_TRANSFORM_T   transform = 0;
    VC_RECT_T         rect;

    void                       *image;
    uint32_t                    vc_image_ptr;

    int                   ret;

    uint32_t        screen = 0;

    bcm_host_init();

    printf("Open display[%i]...\n", screen );
    display = vc_dispmanx_display_open( screen );

    ret = vc_dispmanx_display_get_info(display, &info);
    assert(ret == 0);
    printf( "Display is %d x %d\n", info.width, info.height );

    image = calloc( 1, info.width * 3 * info.height );

    assert(image);

    resource = vc_dispmanx_resource_create( type,
                                                  info.width,
                                                  info.height,
                                                  &vc_image_ptr );

    vc_dispmanx_snapshot(display, resource, transform);

    vc_dispmanx_rect_set(&rect, 0, 0, info.width, info.height);
    vc_dispmanx_resource_read_data(resource, &rect, image, info.width*3); 

    FILE *fp = fopen("out.ppm", "wb");
    fprintf(fp, "P6\n%d %d\n255\n", info.width, info.height);
    fwrite(image, info.width*3*info.height, 1, fp);
    fclose(fp);

    ret = vc_dispmanx_resource_delete( resource );
    assert( ret == 0 );
    ret = vc_dispmanx_display_close(display );
    assert( ret == 0 );

    return 0;
}
Example #15
0
ViewBackend::~ViewBackend()
{
    ipcHost.deinitialize();

    WPE::LibinputServer::singleton().setClient(nullptr);

    if (updateSource)
        g_source_destroy(updateSource);
    if (updateFd != -1)
        close(updateFd);

    vc_dispmanx_display_close(displayHandle);
    bcm_host_deinit();
}
Example #16
0
//------------------------------------------------------------------------------
//
OsdGraphics::~OsdGraphics()
{
#if 0
    vars->update = vc_dispmanx_update_start( 10 );
    assert( vars->update );
    ret = vc_dispmanx_element_remove( vars->update, vars->element );
    assert( ret == 0 );
    ret = vc_dispmanx_update_submit_sync( vars->update );
    assert( ret == 0 );
    ret = vc_dispmanx_resource_delete( vars->resource );
    assert( ret == 0 );
    ret = vc_dispmanx_display_close( vars->display );
    assert( ret == 0 );
#endif
}
Example #17
0
void dispmanxtest() {
	DISPMANX_DISPLAY_HANDLE_T display;
	int ret;
	DISPMANX_MODEINFO_T displayinfo;
	DISPMANX_RESOURCE_HANDLE_T res;
	int width = 1024;
	int height = 576;
	uint32_t vc_image_ptr;
	DISPMANX_UPDATE_HANDLE_T update;
	VC_RECT_T dst_rect,src_rect;
	DISPMANX_ELEMENT_HANDLE_T element;

	
	bcm_host_init();
	display = vc_dispmanx_display_open(0);
	ret = vc_dispmanx_display_get_info( display, &displayinfo);
	assert(ret==0);
	printf("display is %dx%d\n",displayinfo.width,displayinfo.height);
	res = vc_dispmanx_resource_create(VC_IMAGE_YUV420,width,height,&vc_image_ptr);
	vc_image_ptr = vc_dispmanx_resource_get_image_handle(res);
	printf("vc_image_ptr %x\n",vc_image_ptr);
	assert(res);
	update = vc_dispmanx_update_start(10);
	assert(update);
	vc_dispmanx_rect_set(&src_rect,0,0,width<<16,height<<16);
	vc_dispmanx_rect_set(&dst_rect,0,(displayinfo.height - height)/2,width-32,height);
	element = vc_dispmanx_element_add(update,display,2000,&dst_rect,res,&src_rect,DISPMANX_PROTECTION_NONE,NULL,NULL,DISPMANX_NO_ROTATE);
	ret = vc_dispmanx_update_submit_sync(update);
	assert(ret==0);
	uint8_t *rawfb = (uint8_t*)mapmem(vc_image_ptr,0x1000);
	for (int i=0; i<0x100; i++) {
		printf("%02x ",rawfb[i]);
	}
	printf("\n");
	unmapmem(rawfb,0x1000);
	puts("sleeping");
	sleep(10);
	update = vc_dispmanx_update_start(10);
	assert(update);
	ret = vc_dispmanx_element_remove(update,element);
	assert(ret==0);
	ret = vc_dispmanx_update_submit_sync(update);
	assert(ret==0);
	ret = vc_dispmanx_resource_delete(res);
	assert(ret==0);
	ret = vc_dispmanx_display_close(display);
	assert(ret==0);
}
Example #18
0
void gp2x_frontend_deinit(void)
{
	int ret;
    
	dispman_update = vc_dispmanx_update_start( 0 );
	ret = vc_dispmanx_element_remove( dispman_update, dispman_element );
	ret = vc_dispmanx_update_submit_sync( dispman_update );
	ret = vc_dispmanx_resource_delete( resource0 );
	ret = vc_dispmanx_resource_delete( resource1 );
	ret = vc_dispmanx_display_close( dispman_display );
    
	if(gp2x_screen8) free(gp2x_screen8);
	if(gp2x_screen15) free(gp2x_screen15);
	gp2x_screen8=0;
	gp2x_screen15=0;
    
}
static void
gst_gl_window_dispmanx_egl_close (GstGLWindow * window)
{
  GstGLWindowDispmanxEGL *window_egl;
  DISPMANX_UPDATE_HANDLE_T dispman_update;

  window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);

  if (window_egl->native.element && window_egl->native.element != window_egl->foreign.element) {
    dispman_update = vc_dispmanx_update_start (0);
    vc_dispmanx_element_remove (dispman_update, window_egl->native.element);
    vc_dispmanx_update_submit_sync (dispman_update);
  }
  vc_dispmanx_display_close (window_egl->display);

  GST_GL_WINDOW_CLASS (parent_class)->close (window);
}
gboolean
platform_destroy_native_window (EGLNativeDisplayType display,
    EGLNativeWindowType window, gpointer * window_data)
{
  DISPMANX_DISPLAY_HANDLE_T dispman_display;
  DISPMANX_UPDATE_HANDLE_T dispman_update;
  RPIWindowData *data = *window_data;

  dispman_display = data->d;
  dispman_update = vc_dispmanx_update_start (0);
  vc_dispmanx_element_remove (dispman_update, data->w.element);
  vc_dispmanx_update_submit_sync (dispman_update);
  vc_dispmanx_display_close (dispman_display);

  g_slice_free (RPIWindowData, data);
  *window_data = NULL;
  return TRUE;
}
Example #21
0
void CRBP::GetDisplaySize(int &width, int &height)
{
  DISPMANX_DISPLAY_HANDLE_T display;
  DISPMANX_MODEINFO_T info;

  display = vc_dispmanx_display_open( 0 /*screen*/ );
  if (vc_dispmanx_display_get_info(display, &info) == 0)
  {
    width = info.width;
    height = info.height;
  }
  else
  {
    width = 0;
    height = 0;
  }
  vc_dispmanx_display_close(display );
}
static void
gst_gl_window_dispmanx_egl_close (GstGLWindow * window)
{
  GstGLWindowDispmanxEGL *window_egl;
  DISPMANX_UPDATE_HANDLE_T dispman_update;

  window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);

  if (window_egl->native.element) {
    dispman_update = vc_dispmanx_update_start (0);
    vc_dispmanx_element_remove (dispman_update, window_egl->native.element);
    vc_dispmanx_update_submit_sync (dispman_update);
  }
  vc_dispmanx_display_close (window_egl->display);

  g_main_loop_unref (window_egl->loop);
  window_egl->loop = NULL;
  g_main_context_unref (window_egl->main_context);
  window_egl->main_context = NULL;
}
Example #23
0
void pi_deinit(void) {
    gles2_destroy();
    // Release OpenGL resources
    eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    eglDestroySurface(display, surface);
    eglDestroyContext(display, context);
    eglTerminate(display);

    dispman_update = vc_dispmanx_update_start(0);
    vc_dispmanx_element_remove(dispman_update, dispman_element);
    vc_dispmanx_element_remove(dispman_update, dispman_element_bg);
    vc_dispmanx_update_submit_sync(dispman_update);
    vc_dispmanx_resource_delete(resource0);
    vc_dispmanx_resource_delete(resource1);
    vc_dispmanx_resource_delete(resource_bg);
    vc_dispmanx_display_close(dispman_display);

    if (VideoBuffer) free(VideoBuffer);
    VideoBuffer = 0;
}
Example #24
0
GLUSvoid _glusDestroyNativeWindow()
{
	if (_nativeWindowCreated)
	{
		DISPMANX_UPDATE_HANDLE_T dispmanUpdate;

		dispmanUpdate = vc_dispmanx_update_start(0);
		vc_dispmanx_element_remove(dispmanUpdate, _nativeWindow.element);
		vc_dispmanx_update_submit_sync(dispmanUpdate);

		_nativeWindowCreated = GLUS_FALSE;
	}
	memset(&_nativeWindow, 0, sizeof(_nativeWindow));

	if (_nativeDisplay)
	{
		vc_dispmanx_display_close(_nativeDisplay);

		_nativeDisplay = 0;
	}

	if (_fullscreen)
	{
		vc_tv_register_callback(resizeDone, 0);

		if (vc_tv_hdmi_power_on_preferred() == 0)
		{
			waitResizeDone();
		}

		vc_tv_unregister_callback(resizeDone);

		_fullscreen = GLUS_FALSE;
	}

	SDL_ShowCursor(SDL_ENABLE);

	SDL_Quit();

	bcm_host_deinit();
}
Example #25
0
static void
close_ogl (void)
{
#if defined (USE_OMX_TARGET_RPI)
    DISPMANX_UPDATE_HANDLE_T dispman_update;
#endif

    if (state->fshader) {
        glDeleteShader (state->fshader);
        glDetachShader (state->program, state->fshader);
    }

    if (state->vshader) {
        glDeleteShader (state->vshader);
        glDetachShader (state->program, state->vshader);
    }

    if (state->program)
        glDeleteProgram (state->program);

    if (state->tex)
        glDeleteTextures (1, &state->tex);

    /* clear screen */
    glClear (GL_COLOR_BUFFER_BIT);
    eglSwapBuffers (state->display, state->surface);

    /* Release OpenGL resources */
    eglMakeCurrent (state->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                    EGL_NO_CONTEXT);
    eglDestroySurface (state->display, state->surface);
    eglDestroyContext (state->display, state->context);
    gst_object_unref (state->gst_display);

#if defined (USE_OMX_TARGET_RPI)
    dispman_update = vc_dispmanx_update_start (0);
    vc_dispmanx_element_remove (dispman_update, state->dispman_element);
    vc_dispmanx_update_submit_sync (dispman_update);
    vc_dispmanx_display_close (state->dispman_display);
#endif
}
Example #26
0
static void destroy_dispmanx(struct ra_ctx *ctx)
{
    struct priv *p = ctx->priv;

    if (p->egl_surface) {
        eglMakeCurrent(p->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                       EGL_NO_CONTEXT);
        eglDestroySurface(p->egl_display, p->egl_surface);
        p->egl_surface = EGL_NO_SURFACE;
    }

    if (p->window)
        vc_dispmanx_element_remove(p->update, p->window);
    p->window = 0;
    if (p->display)
        vc_dispmanx_display_close(p->display);
    p->display = 0;
    if (p->update)
        vc_dispmanx_update_submit_sync(p->update);
    p->update = 0;
}
Example #27
0
static void
close_ogl (void)
{
  DISPMANX_UPDATE_HANDLE_T dispman_update;

  /* clear screen */
  glClear (GL_COLOR_BUFFER_BIT);
  eglSwapBuffers (state->display, state->surface);

  /* Release OpenGL resources */
  eglMakeCurrent (state->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
      EGL_NO_CONTEXT);
  eglDestroySurface (state->display, state->surface);
  eglDestroyContext (state->display, state->context);
  gst_egl_display_unref (state->gst_display);

  dispman_update = vc_dispmanx_update_start (0);
  vc_dispmanx_element_remove (dispman_update, state->dispman_element);
  vc_dispmanx_update_submit_sync (dispman_update);
  vc_dispmanx_display_close (state->dispman_display);
}
Example #28
0
File: vout.c Project: Kubink/vlc
static void close_dmx(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;
    DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(10);
    struct dmx_region_t *dmx_region = sys->dmx_region;
    struct dmx_region_t *dmx_region_next;

    while(dmx_region) {
        dmx_region_next = dmx_region->next;
        dmx_region_delete(dmx_region, update);
        dmx_region = dmx_region_next;
    }

    vc_dispmanx_update_submit_sync(update);
    sys->dmx_region = NULL;

    show_background(vd, false);

    vc_dispmanx_display_close(sys->dmx_handle);
    sys->dmx_handle = DISPMANX_NO_HANDLE;
}
Example #29
0
void vo_close(RECT_VARS_T* vars)
{
    int ret;

    /* Cleanup code from dispmanx.c */
    vars->update = vc_dispmanx_update_start( 10 );
    assert( vars->update );

    ret = vc_dispmanx_element_remove( vars->update, vars->element );
    assert( ret == 0 );

    ret = vc_dispmanx_update_submit_sync( vars->update );
    assert( ret == 0 );

    ret = vc_dispmanx_resource_delete( vars->resource );
    assert( ret == 0 );

    ret = vc_dispmanx_display_close( vars->display );
    assert( ret == 0 );
    /* End of cleanup */
}
static void DISPMANX_VideoQuit(_THIS)
{
	/* Clear the lock mutex */
	if ( hw_lock ) {
		SDL_DestroyMutex(hw_lock);
		hw_lock = NULL;
	}

	if (dispvars->pixmem != NULL){ 
		int i;
		for (i=0; i < NUM_MODELISTS; ++i){
			free(SDL_modelist[i]);
			SDL_modelist[i] = NULL;
			SDL_nummodes[i] = 0;
	  	}
		DISPMANX_FreeResources();
		DISPMANX_FreeBackground();
		vc_dispmanx_display_close( dispvars->display );
		bcm_host_deinit();
	}

	DISPMANX_CloseMouse(this);
	DISPMANX_CloseKeyboard(this);
	
	//MAC Set custom video mode block 2
	//Reestablecemos el modo de video original
	/*if (dispvars->isResChanged){
		int ret = vc_tv_hdmi_power_on_explicit_new(HDMI_MODE_HDMI, 
		dispvars->original_tv_state->display.hdmi.group,
	 	dispvars->original_tv_state->display.hdmi.mode);
		printf ("\nRestaurando modo original...%s\n", ret == 0 ? "OK " : "FALLO");
	}*/
	
	#ifdef debug_mode
		fclose (fp);
	#endif
	
	exit (0);
}