[Mesa-dev] [PATCH 4/4] vc4: Don't store the depth/stencil buffers on eglSwapBuffers().
EGL allows this, since you basically never want the depth/stencil across a swap, and it lets you save memory bandwidth on renderers like ours. Improves the framerate of 5 seconds of es2gears by 0.405017% +/- 0.0743318% (n=482). --- This was a smaller effect than I was expecting of this change, but I guess the ridiculous overhead I have of validating shaders per draw call in the kernel is a bigger deal than this bandwidth cost. src/gallium/drivers/vc4/vc4_context.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c index d4a9eec..341accd 100644 --- a/src/gallium/drivers/vc4/vc4_context.c +++ b/src/gallium/drivers/vc4/vc4_context.c @@ -381,6 +381,9 @@ vc4_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, { struct vc4_context *vc4 = vc4_context(pctx); +if (flags & PIPE_FLUSH_INVALIDATE_ANCILLARY) +vc4->resolve &= ~(PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL); + vc4_flush(pctx); if (fence) { -- 2.1.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] gallium: Plumb the swap INVALIDATE_ANCILLARY flag through more layers.
--- src/gallium/include/pipe/p_defines.h | 3 ++- src/gallium/include/state_tracker/st_api.h| 1 + src/gallium/state_trackers/dri/dri_drawable.c | 2 ++ src/mesa/state_tracker/st_manager.c | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 6c5703a..89f0065 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -322,7 +322,8 @@ enum pipe_transfer_usage { * Flags for the flush function. */ enum pipe_flush_flags { - PIPE_FLUSH_END_OF_FRAME = (1 << 0) + PIPE_FLUSH_END_OF_FRAME = (1 << 0), + PIPE_FLUSH_INVALIDATE_ANCILLARY = (1 << 1), }; /** diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 86fdc69..2b42ac5 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -159,6 +159,7 @@ enum st_context_resource_type { */ #define ST_FLUSH_FRONT(1 << 0) #define ST_FLUSH_END_OF_FRAME (1 << 1) +#define ST_FLUSH_INVALIDATE_ANCILLARY (1 << 2) /** * Value to st_manager->get_param function. diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index b7df053..668cfb8 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -491,6 +491,8 @@ dri_flush(__DRIcontext *cPriv, flush_flags |= ST_FLUSH_FRONT; if (reason == __DRI2_THROTTLE_SWAPBUFFER) flush_flags |= ST_FLUSH_END_OF_FRAME; + if (flags & __DRI2_FLUSH_INVALIDATE_ANCILLARY) + flush_flags |= ST_FLUSH_INVALIDATE_ANCILLARY; /* Flush the context and throttle if needed. */ if (dri_screen(ctx->sPriv)->throttling_enabled && diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 606d678..10839eb 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -499,6 +499,9 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, if (flags & ST_FLUSH_END_OF_FRAME) { pipe_flags |= PIPE_FLUSH_END_OF_FRAME; } + if (flags & ST_FLUSH_INVALIDATE_ANCILLARY) { + pipe_flags |= PIPE_FLUSH_INVALIDATE_ANCILLARY; + } st_flush(st, fence, pipe_flags); if (flags & ST_FLUSH_FRONT) -- 2.1.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] egl: Inform the client API when ancillary buffers may become undefined.
This is part of the EGL spec, and is useful for a tiled renderer to avoid the memory bandwidth cost of storing the depth/stencil buffers. --- include/GL/internal/dri_interface.h | 1 + src/egl/drivers/dri2/egl_dri2.c | 36 + src/egl/drivers/dri2/egl_dri2.h | 3 +++ src/egl/drivers/dri2/platform_android.c | 2 +- src/egl/drivers/dri2/platform_drm.c | 2 +- src/egl/drivers/dri2/platform_wayland.c | 12 +-- src/egl/drivers/dri2/platform_x11.c | 3 +-- 7 files changed, 44 insertions(+), 15 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 8c5ceb9..1d670b1 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -279,6 +279,7 @@ struct __DRItexBufferExtensionRec { #define __DRI2_FLUSH_DRAWABLE (1 << 0) /* the drawable should be flushed. */ #define __DRI2_FLUSH_CONTEXT (1 << 1) /* glFlush should be called */ +#define __DRI2_FLUSH_INVALIDATE_ANCILLARY (1 << 2) enum __DRI2throttleReason { __DRI2_THROTTLE_SWAPBUFFER, diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 2a6811c..86e5f24 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1087,6 +1087,42 @@ dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, return dri2_dpy->vtbl->swap_interval(drv, dpy, surf, interval); } +/** + * Asks the client API to flush any rendering to the drawable so that we can + * do our swapbuffers. + */ +void +dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); + + if (dri2_dpy->flush) { + if (dri2_dpy->flush->base.version >= 4) { + /* We know there's a current context because: + * + * "If surface is not bound to the calling thread’s current + * context, an EGL_BAD_SURFACE error is generated." + */ + _EGLContext *ctx = _eglGetCurrentContext(); + struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); + + /* From the EGL 1.4 spec (page 52): + * + * "The contents of ancillary buffers are always undefined + * after calling eglSwapBuffers." + */ + dri2_dpy->flush->flush_with_flags(dri2_ctx->dri_context, + dri2_surf->dri_drawable, + __DRI2_FLUSH_DRAWABLE | + __DRI2_FLUSH_INVALIDATE_ANCILLARY, + __DRI2_THROTTLE_SWAPBUFFER); + } else { + dri2_dpy->flush->flush(dri2_surf->dri_drawable); + } + } +} + static EGLBoolean dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) { diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 52f05fb..9efe1f7 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -332,4 +332,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp); EGLBoolean dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp); +void +dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw); + #endif /* EGL_DRI2_INCLUDED */ diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 61a99ba..f482526 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -311,7 +311,7 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) dri2_drv->glFlush(); } - (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); + dri2_flush_drawable_for_swapbuffers(disp, draw); if (dri2_surf->buffer) droid_window_enqueue_buffer(dri2_surf); diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 753c60f..02e87f7 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -431,7 +431,7 @@ dri2_drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) dri2_surf->back = NULL; } - (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); + dri2_flush_drawable_for_swapbuffers(disp, draw); (*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); } diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index ba0eb10..e8b4413 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -649,17 +649,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv, } } - if (dri2_dpy->flush->base.version >= 4) { - ctx = _eglGetCurrentContext(); - dri2_ctx = dri2_egl_context(ctx); - (*dri2_dpy->flush->flush_with_flags)(dri2_ctx->dri_context, -
[Mesa-dev] [PATCH 3/4] vc4: Drop the content of vc4_flush_resource().
The callers all follow it with a flush of the context, and the flush of the context gives us more information about how things are being flushed. --- src/gallium/drivers/vc4/vc4_resource.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c index df4c207..a26b346 100644 --- a/src/gallium/drivers/vc4/vc4_resource.c +++ b/src/gallium/drivers/vc4/vc4_resource.c @@ -434,11 +434,11 @@ vc4_surface_destroy(struct pipe_context *pctx, struct pipe_surface *psurf) static void vc4_flush_resource(struct pipe_context *pctx, struct pipe_resource *resource) { -struct vc4_context *vc4 = vc4_context(pctx); - -/* XXX: Skip this if we don't have any queued drawing to it. */ -vc4->base.flush(pctx, NULL, 0); +/* All calls to flush_resource are followed by a flush of the context, + * so there's nothing to do. + */ } + static bool render_blit(struct pipe_context *ctx, struct pipe_blit_info *info) { -- 2.1.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 59879] reducing symbol visibility of shared objects / static libstdc++
https://bugs.freedesktop.org/show_bug.cgi?id=59879 Tobias Jakobi changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Tobias Jakobi --- Closing this since I no longer own a system where the AMD GPU relies on r600g. On my current radeonsi system the ut2003 issue doesn't appear, so I guess the visibility fixes mentioned by Emil have fixes this one as well. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 87654] undefined reference to `_eglBuiltInDriverGALLIUM'
https://bugs.freedesktop.org/show_bug.cgi?id=87654 Vinson Lee changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from Vinson Lee --- commit 890ef622d63cb1caa3f84dd04dc2442324e2b0f2 Author: Alexander von Gluck IV Date: Wed Dec 24 07:44:25 2014 -0600 egl: Fix non-dri SCons builds re #87657 * Revert change to egl main producing Shared Libraries * Check for dri before including dri code -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] gallium/target: Drop no longer needed Haiku viewport override
* Drop no longer needed mesa headers * Haiku LLVM pipe working with LLVM 3.5.0 on x86_64 --- .../targets/haiku-softpipe/GalliumContext.cpp | 31 +--- 1 files changed, 1 insertions(+), 30 deletions(-) diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp index 5df5234..62db7e2 100644 --- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp +++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp @@ -15,9 +15,6 @@ #include "bitmap_wrapper.h" extern "C" { #include "glapi/glapi.h" -#include "main/context.h" -#include "main/framebuffer.h" -#include "main/renderbuffer.h" #include "main/viewport.h" #include "pipe/p_format.h" #include "state_tracker/st_cb_fbo.h" @@ -44,31 +41,6 @@ extern "C" { #define ERROR(x...) printf("GalliumContext: " x) -static void -hgl_viewport(struct gl_context* glContext) -{ - // TODO: We should try to eliminate this function - - GLint x = glContext->ViewportArray[0].X; - GLint y = glContext->ViewportArray[0].Y; - GLint width = glContext->ViewportArray[0].Width; - GLint height = glContext->ViewportArray[0].Height; - - TRACE("%s(glContext: %p, x: %d, y: %d, w: %d, h: %d\n", __func__, - glContext, x, y, width, height); - - _mesa_check_init_viewport(glContext, width, height); - - struct gl_framebuffer *draw = glContext->WinSysDrawBuffer; - struct gl_framebuffer *read = glContext->WinSysReadBuffer; - - if (draw) - _mesa_resize_framebuffer(glContext, draw, width, height); - if (read) - _mesa_resize_framebuffer(glContext, read, width, height); -} - - GalliumContext::GalliumContext(ulong options) : fOptions(options), @@ -228,8 +200,6 @@ GalliumContext::CreateContext(Bitmap *bitmap) struct st_context *stContext = (struct st_context*)context->st; - stContext->ctx->Driver.Viewport = hgl_viewport; - // Init Gallium3D Post Processing // TODO: no pp filters are enabled yet through postProcessEnable context->postProcess = pp_init(stContext->pipe, context->postProcessEnable, @@ -406,6 +376,7 @@ GalliumContext::ResizeViewport(int32 width, int32 height) for (context_id i = 0; i < CONTEXT_MAX; i++) { if (fContext[i] && fContext[i]->st) { struct st_context *stContext = (struct st_context*)fContext[i]->st; + // TODO: _mesa_set_viewport needs to be removed for something st_api? _mesa_set_viewport(stContext->ctx, 0, 0, 0, width, height); st_manager_validate_framebuffers(stContext); } -- 1.7.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] gallium/st: Clean up Haiku depth mapping, fix colorspace errors
--- src/gallium/state_trackers/hgl/hgl.c | 48 + 1 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/gallium/state_trackers/hgl/hgl.c b/src/gallium/state_trackers/hgl/hgl.c index 4d7c479..0b30290 100644 --- a/src/gallium/state_trackers/hgl/hgl.c +++ b/src/gallium/state_trackers/hgl/hgl.c @@ -232,9 +232,10 @@ hgl_create_st_visual(ulong options) const GLboolean alphaFlag = ((options & BGL_ALPHA) == BGL_ALPHA); const GLboolean dblFlag = ((options & BGL_DOUBLE) == BGL_DOUBLE); const GLboolean stereoFlag = false; - const GLint depth = (options & BGL_DEPTH) ? 24 : 0; - const GLint stencil = (options & BGL_STENCIL) ? 8 : 0; - const GLint accum = (options & BGL_ACCUM) ? 16 : 0; + const GLboolean depthFlag = ((options & BGL_DEPTH) == BGL_DEPTH); + const GLboolean stencilFlag = ((options & BGL_STENCIL) == BGL_STENCIL); + const GLboolean accumFlag = ((options & BGL_ACCUM) == BGL_ACCUM); + const GLint red = rgbFlag ? 8 : 5; const GLint green = rgbFlag ? 8 : 5; const GLint blue= rgbFlag ? 8 : 5; @@ -244,9 +245,9 @@ hgl_create_st_visual(ulong options) TRACE("alpha:\t%d\n", (bool)alphaFlag); TRACE("dbl :\t%d\n", (bool)dblFlag); TRACE("stereo :\t%d\n", (bool)stereoFlag); - TRACE("depth:\t%d\n", depth); - TRACE("stencil :\t%d\n", stencil); - TRACE("accum:\t%d\n", accum); + TRACE("depth:\t%d\n", (bool)depthFlag); + TRACE("stencil :\t%d\n", (bool)stencilFlag); + TRACE("accum:\t%d\n", (bool)accumFlag); TRACE("red :\t%d\n", red); TRACE("green:\t%d\n", green); TRACE("blue :\t%d\n", blue); @@ -254,34 +255,23 @@ hgl_create_st_visual(ulong options) // Determine color format if (red == 8) { + // Color format if (alpha == 8) - visual->color_format = PIPE_FORMAT_A8R8G8B8_UNORM; + visual->color_format = PIPE_FORMAT_B8G8R8A8_UNORM; else - visual->color_format = PIPE_FORMAT_X8R8G8B8_UNORM; + visual->color_format = PIPE_FORMAT_B8G8R8X8_UNORM; + + // Depth buffer + if (depthFlag) + visual->depth_stencil_format = PIPE_FORMAT_Z32_UNORM; + else + visual->depth_stencil_format = PIPE_FORMAT_NONE; } else { - // TODO: I think this should be RGB vs BGR visual->color_format = PIPE_FORMAT_B5G6R5_UNORM; -} - // Determine depth stencil format - switch (depth) { - default: - case 0: - visual->depth_stencil_format = PIPE_FORMAT_NONE; - break; - case 16: - visual->depth_stencil_format = PIPE_FORMAT_Z16_UNORM; - break; - case 24: - if ((options & BGL_STENCIL) != 0) - visual->depth_stencil_format = PIPE_FORMAT_S8_UINT_Z24_UNORM; - else - visual->depth_stencil_format = PIPE_FORMAT_X8Z24_UNORM; - break; - case 32: - visual->depth_stencil_format = PIPE_FORMAT_Z32_UNORM; - break; - } + // TODO: Indexed color depth buffer? + visual->depth_stencil_format = PIPE_FORMAT_NONE; +} visual->accum_format = (options & BGL_ACCUM) ? PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE; -- 1.7.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev