From 2a15553e431f04d13b757a3a76e4eb7d794f1219 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 17 May 2010 21:34:30 +0200 Subject: [PATCH] st/egl: adapt to interface changes --- .../state_trackers/egl/common/egl_g3d.c | 2 +- .../state_trackers/egl/common/egl_g3d_api.c | 37 ++++++++----------- .../state_trackers/egl/kms/native_kms.c | 2 +- .../state_trackers/egl/x11/native_dri2.c | 7 ++-- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 3ab72dce2f3..871c33267ae 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -351,7 +351,7 @@ egl_g3d_fill_depth_stencil_formats(_EGLDisplay *dpy, /* pick the first supported format */ for (i = 0; i < n; i++) { if (screen->is_format_supported(screen, fmt[i], - PIPE_TEXTURE_2D, PIPE_BIND_DEPTH_STENCIL, 0)) { + PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) { formats[count++] = fmt[i]; break; } diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 478516453ce..4615a5829a6 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -407,24 +407,16 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) /** * Get the pipe surface of the given attachment of the native surface. */ -static struct pipe_surface * -get_pipe_surface(struct native_display *ndpy, struct native_surface *nsurf, - enum native_attachment natt, - unsigned bind) +static struct pipe_resource * +get_pipe_resource(struct native_display *ndpy, struct native_surface *nsurf, + enum native_attachment natt) { struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS]; - struct pipe_surface *psurf; textures[natt] = NULL; nsurf->validate(nsurf, 1 << natt, NULL, textures, NULL, NULL); - if (!textures[natt]) - return NULL; - - psurf = ndpy->screen->get_tex_surface(ndpy->screen, textures[natt], - 0, 0, 0, bind); - pipe_resource_reference(&textures[natt], NULL); - return psurf; + return textures[natt]; } static EGLBoolean @@ -437,7 +429,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, struct egl_g3d_config *gconf; struct native_surface *nsurf; struct pipe_screen *screen = gdpy->native->screen; - struct pipe_surface *psurf; + struct pipe_resource *ptex; if (!gsurf->render_texture) return EGL_TRUE; @@ -466,22 +458,23 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, return EGL_FALSE; } - psurf = get_pipe_surface(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, - PIPE_BIND_BLIT_DESTINATION); - if (psurf) { + ptex = get_pipe_resource(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT); + if (ptex) { struct pipe_surface *psrc; + struct pipe_subresource subsrc, subdst; + subsrc.face = 0; + subsrc.level = 0; + subdst.face = 0; + subdst.level = 0; - psrc = screen->get_tex_surface(screen, gsurf->render_texture, - 0, 0, 0, PIPE_BIND_BLIT_SOURCE); if (psrc) { - gdpy->pipe->surface_copy(gdpy->pipe, psurf, 0, 0, - psrc, 0, 0, psurf->width, psurf->height); - pipe_surface_reference(&psrc, NULL); + gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, subdst, 0, 0, 0, + gsurf->render_texture, subsrc, 0, 0, 0, ptex->width0, ptex->height0); nsurf->flush_frontbuffer(nsurf); } - pipe_surface_reference(&psurf, NULL); + pipe_resource_reference(&ptex, NULL); } nsurf->destroy(nsurf); diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c index cf7188dfdb7..d81178e5592 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ b/src/gallium/state_trackers/egl/kms/native_kms.c @@ -563,7 +563,7 @@ kms_display_is_format_supported(struct native_display *ndpy, enum pipe_format fmt, boolean is_color) { return ndpy->screen->is_format_supported(ndpy->screen, - fmt, PIPE_TEXTURE_2D, + fmt, PIPE_TEXTURE_2D, 0, (is_color) ? PIPE_BIND_RENDER_TARGET : PIPE_BIND_DEPTH_STENCIL, 0); } diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index d37f66da07e..63877ed5e51 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -498,9 +498,9 @@ choose_color_format(const __GLcontextModes *mode, enum pipe_format formats[32]) static boolean is_format_supported(struct pipe_screen *screen, - enum pipe_format fmt, boolean is_color) + enum pipe_format fmt, unsigned sample_count, boolean is_color) { - return screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, + return screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, sample_count, (is_color) ? PIPE_BIND_RENDER_TARGET : PIPE_BIND_DEPTH_STENCIL, 0); } @@ -512,6 +512,7 @@ dri2_display_convert_config(struct native_display *ndpy, { enum pipe_format formats[32]; int num_formats, i; + int sample_count = 0; if (!(mode->renderType & GLX_RGBA_BIT) || !mode->rgbMode) return FALSE; @@ -536,7 +537,7 @@ dri2_display_convert_config(struct native_display *ndpy, /* choose color format */ num_formats = choose_color_format(mode, formats); for (i = 0; i < num_formats; i++) { - if (is_format_supported(ndpy->screen, formats[i], TRUE)) { + if (is_format_supported(ndpy->screen, formats[i], sample_count, TRUE)) { nconf->color_format = formats[i]; break; } -- 2.30.2