예제 #1
0
GLboolean
nouveau_context_bind(__DRIcontextPrivate *driContextPriv,
		     __DRIdrawablePrivate *driDrawPriv,
		     __DRIdrawablePrivate *driReadPriv)
{
	struct nouveau_context *nv;
	struct nouveau_framebuffer *draw, *read;

	if (!driContextPriv) {
		st_make_current(NULL, NULL, NULL);
		return GL_TRUE;
	}

	nv = driContextPriv->driverPrivate;
	draw = driDrawPriv->driverPrivate;
	read = driReadPriv->driverPrivate;

	st_make_current(nv->st, draw->stfb, read->stfb);

	if ((nv->dri_drawable != driDrawPriv) ||
	    (nv->last_stamp != driDrawPriv->lastStamp)) {
		nv->dri_drawable = driDrawPriv;
		st_resize_framebuffer(draw->stfb, driDrawPriv->w,
				      driDrawPriv->h);
		nv->last_stamp = driDrawPriv->lastStamp;
	}

	if (driDrawPriv != driReadPriv) {
		st_resize_framebuffer(read->stfb, driReadPriv->w,
				      driReadPriv->h);
	}

	return GL_TRUE;
}
예제 #2
0
/**
 * This will be called whenever the currently bound window is moved/resized.
 */
void
intelUpdateWindowSize(__DRIdrawablePrivate *dPriv)
{
   struct intel_framebuffer *intelfb = intel_framebuffer(dPriv);
   assert(intelfb->stfb);
   st_resize_framebuffer(intelfb->stfb, dPriv->w, dPriv->h);
}
예제 #3
0
static void
check_and_update_buffer_size(struct xlib_egl_surface *surface)
{
   uint width, height;
   get_drawable_size(surface->Dpy, surface->Win, &width, &height);
   st_resize_framebuffer(surface->Framebuffer, width, height);
   surface->Base.Width = width;
   surface->Base.Height = height;
}
예제 #4
0
/**
 * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
 */
static EGLSurface
xlib_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
                            NativeWindowType window, const EGLint *attrib_list)
{
   struct xlib_egl_driver *xdrv = xlib_egl_driver(drv);
   _EGLDisplay *disp = _eglLookupDisplay(dpy);
   _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);

   struct xlib_egl_surface *surf;
   __GLcontextModes visual;
   uint width, height;

   surf = CALLOC_STRUCT(xlib_egl_surface);
   if (!surf)
      return EGL_NO_SURFACE;

   /* Let EGL lib init the common stuff */
   if (!_eglInitSurface(drv, dpy, &surf->Base, EGL_WINDOW_BIT,
                        config, attrib_list)) {
      free(surf);
      return EGL_NO_SURFACE;
   }

   _eglSaveSurface(&surf->Base);

   /*
    * Now init the Xlib and gallium stuff
    */
   surf->Win = (Window) window;  /* The X window ID */
   surf->Dpy = disp->Xdpy;  /* The X display */
   surf->Gc = XCreateGC(surf->Dpy, surf->Win, 0, NULL);

   surf->winsys = xdrv->winsys;

   _eglConfigToContextModesRec(conf, &visual);
   get_drawable_size(surf->Dpy, surf->Win, &width, &height);
   get_drawable_visual_info(surf->Dpy, surf->Win, &surf->VisInfo);

   surf->Base.Width = width;
   surf->Base.Height = height;

   /* Create GL statetracker framebuffer */
   surf->Framebuffer = st_create_framebuffer(&visual,
                                             choose_color_format(&visual),
                                             choose_depth_format(&visual),
                                             choose_stencil_format(&visual),
                                             width, height,
                                             (void *) surf);

   st_resize_framebuffer(surf->Framebuffer, width, height);

   return _eglGetSurfaceHandle(&surf->Base);
}