From f69b35fa15f43747dde29addaeec845604d7e127 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 9 Apr 2010 17:27:06 +0800 Subject: st/egl: Remove pbuffer from the native interface. A pbuffer is an EGL resource. It does not need a native display to create. --- src/gallium/state_trackers/egl/common/egl_g3d_st.c | 57 +++++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) (limited to 'src/gallium/state_trackers/egl/common/egl_g3d_st.c') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c index 9573ba09d1..f4934982ed 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c @@ -140,6 +140,53 @@ egl_g3d_destroy_st_manager(struct st_manager *smapi) free(gsmapi); } +static boolean +egl_g3d_st_framebuffer_flush_front_pbuffer(struct st_framebuffer_iface *stfbi, + enum st_attachment_type statt) +{ + return TRUE; +} + +static boolean +egl_g3d_st_framebuffer_validate_pbuffer(struct st_framebuffer_iface *stfbi, + const enum st_attachment_type *statts, + unsigned count, + struct pipe_texture **out) +{ + _EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private; + struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); + struct pipe_texture templ; + unsigned i; + + for (i = 0; i < count; i++) { + out[i] = NULL; + + if (gsurf->stvis.render_buffer != statts[i]) + continue; + + if (!gsurf->render_texture) { + struct egl_g3d_display *gdpy = + egl_g3d_display(gsurf->base.Resource.Display); + struct pipe_screen *screen = gdpy->native->screen; + + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_2D; + templ.last_level = 0; + templ.width0 = gsurf->base.Width; + templ.height0 = gsurf->base.Height; + templ.depth0 = 1; + templ.format = gsurf->stvis.color_format; + templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; + + gsurf->render_texture = screen->texture_create(screen, &templ); + } + + pipe_texture_reference(&out[i], gsurf->render_texture); + } + + return TRUE; +} + static boolean egl_g3d_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, enum st_attachment_type statt) @@ -246,8 +293,14 @@ egl_g3d_create_st_framebuffer(_EGLSurface *surf) return NULL; stfbi->visual = &gsurf->stvis; - stfbi->flush_front = egl_g3d_st_framebuffer_flush_front; - stfbi->validate = egl_g3d_st_framebuffer_validate; + if (gsurf->base.Type != EGL_PBUFFER_BIT) { + stfbi->flush_front = egl_g3d_st_framebuffer_flush_front; + stfbi->validate = egl_g3d_st_framebuffer_validate; + } + else { + stfbi->flush_front = egl_g3d_st_framebuffer_flush_front_pbuffer; + stfbi->validate = egl_g3d_st_framebuffer_validate_pbuffer; + } stfbi->st_manager_private = (void *) &gsurf->base; return stfbi; -- cgit v1.2.3