Re: [Mesa-dev] [PATCH 2/2] glsl: Improve debug output and variable names for opt_dead_code_local.
> > -static bool debug = false; > +static bool debug = true; > Accidental debug flag? -- Aras Pranckevičius work: http://unity3d.com home: http://aras-p.info ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] st/vdpau: Add rotation
Signed-off-by: Kusanagi Kouichi --- src/gallium/state_trackers/vdpau/output.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 9cb1106..2f78df4 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -658,6 +658,7 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface, vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view, RectToPipe(source_rect, &src_rect), NULL, ColorsToPipe(colors, flags, vlcolors)); + vl_compositor_rotate_layer(cstate, 0, flags & 3); vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect)); vl_compositor_render(cstate, compositor, dst_vlsurface->surface, &dst_vlsurface->dirty_area, false); @@ -717,6 +718,7 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface, vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view, RectToPipe(source_rect, &src_rect), NULL, ColorsToPipe(colors, flags, vlcolors)); + vl_compositor_rotate_layer(cstate, 0, flags & 3); vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect)); vl_compositor_render(cstate, compositor, dst_vlsurface->surface, &dst_vlsurface->dirty_area, false); -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] vl: Add rotation
Signed-off-by: Kusanagi Kouichi --- src/gallium/auxiliary/vl/vl_compositor.c | 52 +--- src/gallium/auxiliary/vl/vl_compositor.h | 13 +++- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 3cea044..031efb3 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -570,6 +570,10 @@ calc_src_and_dst(struct vl_compositor_layer *layer, unsigned width, unsigned hei layer->src.br = calc_bottomright(size, src); layer->dst.tl = calc_topleft(size, dst); layer->dst.br = calc_bottomright(size, dst); + layer->dst.tr.x = layer->dst.br.x; + layer->dst.tr.y = layer->dst.tl.y; + layer->dst.bl.x = layer->dst.tl.x; + layer->dst.bl.y = layer->dst.br.y; layer->zw.x = 0.0f; layer->zw.y = size.y; } @@ -589,8 +593,8 @@ gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) vb[ 4].x = layer->colors[0].z; vb[ 4].y = layer->colors[0].w; - vb[ 5].x = layer->dst.br.x; - vb[ 5].y = layer->dst.tl.y; + vb[ 5].x = layer->dst.tr.x; + vb[ 5].y = layer->dst.tr.y; vb[ 6].x = layer->src.br.x; vb[ 6].y = layer->src.tl.y; vb[ 7] = layer->zw; @@ -609,8 +613,8 @@ gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) vb[14].x = layer->colors[2].z; vb[14].y = layer->colors[2].w; - vb[15].x = layer->dst.tl.x; - vb[15].y = layer->dst.br.y; + vb[15].x = layer->dst.bl.x; + vb[15].y = layer->dst.bl.y; vb[16].x = layer->src.tl.x; vb[16].y = layer->src.br.y; vb[17] = layer->zw; @@ -964,6 +968,46 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *s, } void +vl_compositor_rotate_layer(struct vl_compositor_state *s, + unsigned layer, + int rotate) +{ + struct vl_compositor_layer *l; + struct vertex2f v; + + assert(s); + assert(layer < VL_COMPOSITOR_MAX_LAYERS); + + l = &s->layers[layer]; + switch (rotate) { + case 1: + v = l->dst.tl; + l->dst.tl = l->dst.tr; + l->dst.tr = l->dst.br; + l->dst.br = l->dst.bl; + l->dst.bl = v; + break; + case 2: + v = l->dst.tl; + l->dst.tl = l->dst.br; + l->dst.br = v; + v = l->dst.tr; + l->dst.tr = l->dst.bl; + l->dst.bl = v; + break; + case 3: + v = l->dst.bl; + l->dst.bl = l->dst.br; + l->dst.br = l->dst.tr; + l->dst.tr = l->dst.tl; + l->dst.tl = v; + break; + default: + break; + } +} + +void vl_compositor_render(struct vl_compositor_state *s, struct vl_compositor *c, struct pipe_surface*dst_surface, diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 97cbef0..38383d8 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -67,7 +67,10 @@ struct vl_compositor_layer struct pipe_sampler_view *sampler_views[3]; struct { struct vertex2f tl, br; - } src, dst; + } src; + struct { + struct vertex2f tl, tr, br, bl; + } dst; struct vertex2f zw; struct vertex4f colors[4]; }; @@ -216,6 +219,14 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *state, struct u_rect *dst_rect, struct vertex4f *colors); +/** + * rotate a layer + */ +void +vl_compositor_rotate_layer(struct vl_compositor_state *state, + unsigned layer, + int rotate); + /*@}*/ /** -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] vl: Add rotation
Hi Kusanagi, Am 06.03.2014 09:20, schrieb Kusanagi Kouichi: Signed-off-by: Kusanagi Kouichi --- src/gallium/auxiliary/vl/vl_compositor.c | 52 +--- src/gallium/auxiliary/vl/vl_compositor.h | 13 +++- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 3cea044..031efb3 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -570,6 +570,10 @@ calc_src_and_dst(struct vl_compositor_layer *layer, unsigned width, unsigned hei layer->src.br = calc_bottomright(size, src); layer->dst.tl = calc_topleft(size, dst); layer->dst.br = calc_bottomright(size, dst); + layer->dst.tr.x = layer->dst.br.x; + layer->dst.tr.y = layer->dst.tl.y; + layer->dst.bl.x = layer->dst.tl.x; + layer->dst.bl.y = layer->dst.br.y; layer->zw.x = 0.0f; layer->zw.y = size.y; } @@ -589,8 +593,8 @@ gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) vb[ 4].x = layer->colors[0].z; vb[ 4].y = layer->colors[0].w; - vb[ 5].x = layer->dst.br.x; - vb[ 5].y = layer->dst.tl.y; + vb[ 5].x = layer->dst.tr.x; + vb[ 5].y = layer->dst.tr.y; vb[ 6].x = layer->src.br.x; vb[ 6].y = layer->src.tl.y; vb[ 7] = layer->zw; @@ -609,8 +613,8 @@ gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) vb[14].x = layer->colors[2].z; vb[14].y = layer->colors[2].w; - vb[15].x = layer->dst.tl.x; - vb[15].y = layer->dst.br.y; + vb[15].x = layer->dst.bl.x; + vb[15].y = layer->dst.bl.y; vb[16].x = layer->src.tl.x; vb[16].y = layer->src.br.y; vb[17] = layer->zw; A good start, but I would prefer that you do the rotation in gen_rect_verts instead and keep dst as it is. Also please define an enum for the rotation, make this enum compatible with VDPAU and have static asserts in the VDPAU state tracker on this assumption. Thx for working on this, Christian. @@ -964,6 +968,46 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *s, } void +vl_compositor_rotate_layer(struct vl_compositor_state *s, + unsigned layer, + int rotate) +{ + struct vl_compositor_layer *l; + struct vertex2f v; + + assert(s); + assert(layer < VL_COMPOSITOR_MAX_LAYERS); + + l = &s->layers[layer]; + switch (rotate) { + case 1: + v = l->dst.tl; + l->dst.tl = l->dst.tr; + l->dst.tr = l->dst.br; + l->dst.br = l->dst.bl; + l->dst.bl = v; + break; + case 2: + v = l->dst.tl; + l->dst.tl = l->dst.br; + l->dst.br = v; + v = l->dst.tr; + l->dst.tr = l->dst.bl; + l->dst.bl = v; + break; + case 3: + v = l->dst.bl; + l->dst.bl = l->dst.br; + l->dst.br = l->dst.tr; + l->dst.tr = l->dst.tl; + l->dst.tl = v; + break; + default: + break; + } +} + +void vl_compositor_render(struct vl_compositor_state *s, struct vl_compositor *c, struct pipe_surface*dst_surface, diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 97cbef0..38383d8 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -67,7 +67,10 @@ struct vl_compositor_layer struct pipe_sampler_view *sampler_views[3]; struct { struct vertex2f tl, br; - } src, dst; + } src; + struct { + struct vertex2f tl, tr, br, bl; + } dst; struct vertex2f zw; struct vertex4f colors[4]; }; @@ -216,6 +219,14 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *state, struct u_rect *dst_rect, struct vertex4f *colors); +/** + * rotate a layer + */ +void +vl_compositor_rotate_layer(struct vl_compositor_state *state, + unsigned layer, + int rotate); + /*@}*/ /** ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 75797] EGL application crashes with BadDrawable at SwapBuffers
https://bugs.freedesktop.org/show_bug.cgi?id=75797 Marek Chalupa changed: What|Removed |Added CC||mchqwe...@gmail.com -- 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] fix vdpau interop when using -Bsymbolic-functions in ldflags
Explicitly add radeon_drm_winsys_create and nouveau_drm_screen_create to the dynamic list. This will ensure vdpau interop still works even when the user links with -Bsymbolic-functions in hardened builds. Signed-off-by: Maarten Lankhorst Tested-by: Rachel Greenham Reported-by: Peter Frühberger --- diff --git a/src/gallium/targets/dri-nouveau/Makefile.am b/src/gallium/targets/dri-nouveau/Makefile.am index 4bd4e21..f34acf8 100644 --- a/src/gallium/targets/dri-nouveau/Makefile.am +++ b/src/gallium/targets/dri-nouveau/Makefile.am @@ -35,7 +35,9 @@ dri_LTLIBRARIES = nouveau_dri.la nodist_EXTRA_nouveau_dri_la_SOURCES = dummy.cpp nouveau_dri_la_SOURCES = target.c -nouveau_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +nouveau_dri_la_LDFLAGS = \ + $(GALLIUM_DRI_LINKER_FLAGS) \ + -Wl,--dynamic-list=$(srcdir)/nouveau_dri.dyn nouveau_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/dri-nouveau/nouveau_dri.dyn b/src/gallium/targets/dri-nouveau/nouveau_dri.dyn new file mode 100644 index 000..a10356b --- /dev/null +++ b/src/gallium/targets/dri-nouveau/nouveau_dri.dyn @@ -0,0 +1,3 @@ +{ + nouveau_drm_screen_create; +}; diff --git a/src/gallium/targets/r300/dri/Makefile.am b/src/gallium/targets/r300/dri/Makefile.am index 4bd9ea4..e2becdb 100644 --- a/src/gallium/targets/r300/dri/Makefile.am +++ b/src/gallium/targets/r300/dri/Makefile.am @@ -37,7 +37,9 @@ nodist_EXTRA_r300_dri_la_SOURCES = dummy.cpp r300_dri_la_SOURCES = \ drm_target.c -r300_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +r300_dri_la_LDFLAGS = \ + $(GALLIUM_DRI_LINKER_FLAGS) \ + -Wl,--dynamic-list=$(srcdir)/radeon.dyn r300_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/r300/dri/radeon.dyn b/src/gallium/targets/r300/dri/radeon.dyn new file mode 100644 index 000..8d243dc --- /dev/null +++ b/src/gallium/targets/r300/dri/radeon.dyn @@ -0,0 +1,3 @@ +{ + radeon_drm_winsys_create; +}; diff --git a/src/gallium/targets/r600/dri/Makefile.am b/src/gallium/targets/r600/dri/Makefile.am index 1f13b80..149106f 100644 --- a/src/gallium/targets/r600/dri/Makefile.am +++ b/src/gallium/targets/r600/dri/Makefile.am @@ -36,7 +36,9 @@ dri_LTLIBRARIES = r600_dri.la r600_dri_la_SOURCES = \ drm_target.c -r600_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +r600_dri_la_LDFLAGS = \ + $(GALLIUM_DRI_LINKER_FLAGS) \ + -Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn r600_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/r600/vdpau/Makefile.am b/src/gallium/targets/r600/vdpau/Makefile.am index 509b954..d1a528d 100644 --- a/src/gallium/targets/r600/vdpau/Makefile.am +++ b/src/gallium/targets/r600/vdpau/Makefile.am @@ -35,7 +35,8 @@ libvdpau_r600_la_SOURCES = \ $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c libvdpau_r600_la_LDFLAGS = \ - $(GALLIUM_VDPAU_LINKER_FLAGS) + $(GALLIUM_VDPAU_LINKER_FLAGS) \ + -Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn libvdpau_r600_la_LIBADD = \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ diff --git a/src/gallium/targets/radeonsi/dri/Makefile.am b/src/gallium/targets/radeonsi/dri/Makefile.am index eab28b5..a8db0a8 100644 --- a/src/gallium/targets/radeonsi/dri/Makefile.am +++ b/src/gallium/targets/radeonsi/dri/Makefile.am @@ -37,7 +37,9 @@ nodist_EXTRA_radeonsi_dri_la_SOURCES = dummy.cpp radeonsi_dri_la_SOURCES = \ drm_target.c -radeonsi_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +radeonsi_dri_la_LDFLAGS = \ + $(GALLIUM_DRI_LINKER_FLAGS) \ + -Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn radeonsi_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/radeonsi/vdpau/Makefile.am b/src/gallium/targets/radeonsi/vdpau/Makefile.am index 54d65b3..0d53c18 100644 --- a/src/gallium/targets/radeonsi/vdpau/Makefile.am +++ b/src/gallium/targets/radeonsi/vdpau/Makefile.am @@ -36,7 +36,9 @@ libvdpau_radeonsi_la_SOURCES = \ $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c libvdpau_radeonsi_la_LDFLAGS = \ - $(GALLIUM_VDPAU_LINKER_FLAGS) + $(GALLIUM_VDPAU_LINKER_FLAGS) \ + -Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn + libvdpau_radeonsi_la_LIBADD = \ $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ diff --git a/src/gallium/targets/vdpau-nouveau/Makefile.am b/src/gallium/targets/vdpau-nouveau/Makefile.am index 3cdf103..66738f1 100644 --- a/src/gallium/targets/vdpau-nouveau/Makefile.am +++ b/src/gallium/targets/vdpau-nouveau/Makefile.am @@ -36,7 +36,8 @@ libvdpau_nouveau_la_SOURCES = \ $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c libvdpau_nouveau_la_LDFLAGS = \ - $(GALLIUM_VDPAU_LINKER_FLAG
[Mesa-dev] Meta GenerateMipmap() support for array textures
I recently started looking at a suite of microbenchmarks, and discovered that one of the tests called GenerateMipmaps repeatedly (sadly, probably not intentionally). Naturally, it used a 2DArray texture, which we didn't support, so we hit the slow path. Not only that, but it was half-float, which meant we hit our -really- slow paths. So, here's a small series that adds array texture support for GenerateMipmaps. The first couple patches are just rearranging and tidying. --Ken ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/11] meta: Add a 'layer' argument to bind_fbo_image().
For array textures and 3D textures, this represents the layer to use. Just pass 0 for now. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 5bdf127..6ca6f22 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -48,7 +48,8 @@ * Bind a particular texture level/layer to mipmap->FBO's GL_COLOR_ATTACHMENT0. */ static void -bind_fbo_image(struct gl_texture_object *texObj, GLenum target, GLuint level) +bind_fbo_image(struct gl_texture_object *texObj, GLenum target, + GLuint level, GLuint layer) { switch (target) { case GL_TEXTURE_1D: @@ -58,13 +59,14 @@ bind_fbo_image(struct gl_texture_object *texObj, GLenum target, GLuint level) texObj->Name, level); break; + case GL_TEXTURE_1D_ARRAY: + case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_3D: - _mesa_FramebufferTexture3D(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - target, - texObj->Name, - level, - 0); /* XXX: Unfinished */ + _mesa_FramebufferTextureLayer(GL_FRAMEBUFFER, +GL_COLOR_ATTACHMENT0, +texObj->Name, +level, +layer); break; default: /* 2D / cube */ _mesa_FramebufferTexture2D(GL_FRAMEBUFFER, @@ -135,7 +137,7 @@ fallback_required(struct gl_context *ctx, GLenum target, _mesa_GenFramebuffers(1, &mipmap->FBO); _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO); - bind_fbo_image(texObj, target, srcLevel); + bind_fbo_image(texObj, target, srcLevel, 0); status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT); @@ -323,7 +325,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* limit minification to src level */ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); - bind_fbo_image(texObj, faceTarget, dstLevel); + bind_fbo_image(texObj, faceTarget, dstLevel, 0); _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/11] meta: Replace GLboolean with bool in fallback_required().
This doesn't interact with the GL API, so we shouldn't use GL types. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 205c5e4..6db3f8f 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -50,7 +50,7 @@ * images are mapped. * \return GL_TRUE if a fallback is needed, GL_FALSE otherwise */ -static GLboolean +static bool fallback_required(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { @@ -67,7 +67,7 @@ fallback_required(struct gl_context *ctx, GLenum target, _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, "glGenerateMipmap() to %s target\n", _mesa_lookup_enum_by_nr(target)); - return GL_TRUE; + return true; } srcLevel = texObj->BaseLevel; @@ -75,14 +75,14 @@ fallback_required(struct gl_context *ctx, GLenum target, if (!baseImage) { _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, "glGenerateMipmap() couldn't find base teximage\n"); - return GL_TRUE; + return true; } if (_mesa_is_format_compressed(baseImage->TexFormat)) { _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, "glGenerateMipmap() with %s format\n", _mesa_get_format_name(baseImage->TexFormat)); - return GL_TRUE; + return true; } if (_mesa_get_format_color_encoding(baseImage->TexFormat) == GL_SRGB && @@ -94,7 +94,7 @@ fallback_required(struct gl_context *ctx, GLenum target, _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, "glGenerateMipmap() of sRGB texture without " "sRGB decode\n"); - return GL_TRUE; + return true; } /* @@ -132,10 +132,10 @@ fallback_required(struct gl_context *ctx, GLenum target, if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, "glGenerateMipmap() got incomplete FBO\n"); - return GL_TRUE; + return true; } - return GL_FALSE; + return false; } void -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/11] meta: Refactor code for binding a texture image to the FBO.
Almost the exact same code appeared twice, and it needs to expand to handle additional texture targets. Refactor it to tidy up the code and avoid duplicating more work in the future. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 81 +++--- 1 file changed, 35 insertions(+), 46 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 9bce97d..5bdf127 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -45,6 +45,37 @@ #include "drivers/common/meta.h" /** + * Bind a particular texture level/layer to mipmap->FBO's GL_COLOR_ATTACHMENT0. + */ +static void +bind_fbo_image(struct gl_texture_object *texObj, GLenum target, GLuint level) +{ + switch (target) { + case GL_TEXTURE_1D: + _mesa_FramebufferTexture1D(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + target, + texObj->Name, + level); + break; + case GL_TEXTURE_3D: + _mesa_FramebufferTexture3D(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + target, + texObj->Name, + level, + 0); /* XXX: Unfinished */ + break; + default: /* 2D / cube */ + _mesa_FramebufferTexture2D(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + target, + texObj->Name, + level); + } +} + +/** * Check if the call to _mesa_meta_GenerateMipmap() will require a * software fallback. The fallback path will require that the texture * images are mapped. @@ -104,26 +135,7 @@ fallback_required(struct gl_context *ctx, GLenum target, _mesa_GenFramebuffers(1, &mipmap->FBO); _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO); - if (target == GL_TEXTURE_1D) { - _mesa_FramebufferTexture1D(GL_FRAMEBUFFER_EXT, -GL_COLOR_ATTACHMENT0_EXT, -target, texObj->Name, srcLevel); - } -#if 0 - /* other work is needed to enable 3D mipmap generation */ - else if (target == GL_TEXTURE_3D) { - GLint zoffset = 0; - _mesa_FramebufferTexture3D(GL_FRAMEBUFFER_EXT, -GL_COLOR_ATTACHMENT0_EXT, -target, texObj->Name, srcLevel, zoffset); - } -#endif - else { - /* 2D / cube */ - _mesa_FramebufferTexture2D(GL_FRAMEBUFFER_EXT, -GL_COLOR_ATTACHMENT0_EXT, -target, texObj->Name, srcLevel); - } + bind_fbo_image(texObj, target, srcLevel); status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT); @@ -271,7 +283,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, const GLuint srcLevel = dstLevel - 1; GLsizei srcWidth, srcHeight, srcDepth; GLsizei dstWidth, dstHeight, dstDepth; - GLenum status; srcImage = _mesa_select_tex_image(ctx, texObj, faceTarget, srcLevel); assert(srcImage->Border == 0); @@ -312,35 +323,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* limit minification to src level */ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); - /* Set to draw into the current dstLevel */ - if (target == GL_TEXTURE_1D) { - _mesa_FramebufferTexture1D(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - target, - texObj->Name, - dstLevel); - } - else if (target == GL_TEXTURE_3D) { - GLint zoffset = 0; /* XXX unfinished */ - _mesa_FramebufferTexture3D(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - target, - texObj->Name, - dstLevel, zoffset); - } else { - /* 2D / cube */ - _mesa_FramebufferTexture2D(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - faceTarget, - texObj->Name, - dstLevel); - } + bind_fbo_image(texObj, faceTarget, dstLevel); _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); /* sanity check */ - status = _mesa_CheckFramebufferStatus(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + if (_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER) != + GL_FRAMEBU
[Mesa-dev] [PATCH 11/11] meta: Support GenerateMipmaps on 1DArray textures.
I don't know how many people care about this case, but it's easy enough to do, so we may as well. The tricky part is that for some reason Mesa stores the number of array slices in Height, not Depth. I thought the easiest way to handle that here was to make Height = 1 (the actual height), and srcDepth = srcImage->Height. This requires some munging when calling _mesa_prepare_mipmap_level, so I created a wrapper that sorts it out for us. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 42 -- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 9d352e9..3db073a 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -94,7 +94,7 @@ fallback_required(struct gl_context *ctx, GLenum target, GLenum status; /* check for fallbacks */ - if (target == GL_TEXTURE_3D || target == GL_TEXTURE_1D_ARRAY) { + if (target == GL_TEXTURE_3D) { _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, "glGenerateMipmap() to %s target\n", _mesa_lookup_enum_by_nr(target)); @@ -163,6 +163,22 @@ _mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap) _mesa_meta_blit_shader_table_cleanup(&mipmap->shaders); } +static GLboolean +prepare_mipmap_level(struct gl_context *ctx, + struct gl_texture_object *texObj, GLuint level, + GLsizei width, GLsizei height, GLsizei depth, + GLenum intFormat, mesa_format format) +{ + if (texObj->Target == GL_TEXTURE_1D_ARRAY) { + /* Work around Mesa expecting the number of array slices in "height". */ + height = depth; + depth = 1; + } + + return _mesa_prepare_mipmap_level(ctx, texObj, level, width, height, depth, + 0, intFormat, format); +} + /** * Called via ctx->Driver.GenerateMipmap() * Note: We don't yet support 3D textures, 1D/2D array textures or texture @@ -276,8 +292,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* src size */ srcWidth = srcImage->Width; - srcHeight = srcImage->Height; - srcDepth = srcImage->Depth; + if (target == GL_TEXTURE_1D_ARRAY) { + srcHeight = 1; + srcDepth = srcImage->Height; + } else { + srcHeight = srcImage->Height; + srcDepth = srcImage->Depth; + } /* new dst size */ dstWidth = minify(srcWidth, 1); @@ -296,11 +317,10 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* Set MaxLevel large enough to hold the new level when we allocate it */ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, dstLevel); - if (!_mesa_prepare_mipmap_level(ctx, texObj, dstLevel, - dstWidth, dstHeight, dstDepth, - srcImage->Border, - srcImage->InternalFormat, - srcImage->TexFormat)) { + if (!prepare_mipmap_level(ctx, texObj, dstLevel, +dstWidth, dstHeight, dstDepth, +srcImage->InternalFormat, +srcImage->TexFormat)) { /* All done. We either ran out of memory or we would go beyond the * last valid level of an immutable texture if we continued. */ @@ -339,7 +359,11 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, } assert(dstWidth == ctx->DrawBuffer->Width); - assert(dstHeight == ctx->DrawBuffer->Height); + if (target == GL_TEXTURE_1D_ARRAY) { +assert(dstHeight == 1); + } else { +assert(dstHeight == ctx->DrawBuffer->Height); + } _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/11] meta: Use srcWidth/Height/Depth rather than srcImage->Width and such.
This is equivalent for now, and will differ once we add 1DArray support. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index d9535d9..9d352e9 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -284,9 +284,9 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, dstHeight = minify(srcHeight, 1); dstDepth = target == GL_TEXTURE_3D ? minify(srcDepth, 1) : srcDepth; - if (dstWidth == srcImage->Width && - dstHeight == srcImage->Height && - dstDepth == srcImage->Depth) { + if (dstWidth == srcWidth && + dstHeight == srcHeight && + dstDepth == srcDepth) { /* all done */ break; } -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/11] meta: Make _mesa_meta_check_generate_mipmap_fallback static.
This was only ever used in one place; there's no reason for it to be non-static. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta.h | 4 src/mesa/drivers/common/meta_generate_mipmap.c | 8 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 16bd427..6029a77 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -410,10 +410,6 @@ _mesa_meta_Bitmap(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -extern GLboolean -_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj); - extern void _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index f1bc291..205c5e4 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -50,9 +50,9 @@ * images are mapped. * \return GL_TRUE if a fallback is needed, GL_FALSE otherwise */ -GLboolean -_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj) +static GLboolean +fallback_required(struct gl_context *ctx, GLenum target, + struct gl_texture_object *texObj) { const GLuint fboSave = ctx->DrawBuffer->Name; struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap; @@ -175,7 +175,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, const GLint slice = 0; GLuint samplerSave; - if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) { + if (fallback_required(ctx, target, texObj)) { _mesa_generate_mipmap(ctx, target, texObj); return; } -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/11] meta: Drop redundant FBO creation code in GenerateMipmaps.
fallback_required() already creates the FBO in order to check whether we can render to the format. So it's guaranteed to exist. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 6db3f8f..6a0ccbd 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -208,10 +208,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, if (currentTexUnitSave != 0) _mesa_BindTexture(target, texObj->Name); - if (!mipmap->FBO) { - _mesa_GenFramebuffers(1, &mipmap->FBO); - } - if (!mipmap->Sampler) { _mesa_GenSamplers(1, &mipmap->Sampler); _mesa_BindSampler(ctx->Texture.CurrentUnit, mipmap->Sampler); @@ -236,6 +232,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_BindSampler(ctx->Texture.CurrentUnit, mipmap->Sampler); } + assert(mipmap->FBO != 0); _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO); _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE); -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/11] meta: Support GenerateMipmaps on 2DArray textures.
This is largely a matter of looping over the number of slices/layers, and not minifying depth (presumably that code exists for the unfinished 3D texture support). Normally, I would have made the loop over array slices the outermost loop. I suspect that would make it trickier to support 3D textures someday, though, so I didn't. The advantage is that we would only have one BufferData call per slice, rather than one per miplevel and slice. However, a GenerateMipmaps microbenchmark indicates that either way is basically just as fast. So I'm not sure it's worth bothering. Improves performance in a GenerateMipmaps microbenchmark by nearly 5x. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 69 +- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 6ca6f22..d9535d9 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -94,9 +94,7 @@ fallback_required(struct gl_context *ctx, GLenum target, GLenum status; /* check for fallbacks */ - if (target == GL_TEXTURE_3D || - target == GL_TEXTURE_1D_ARRAY || - target == GL_TEXTURE_2D_ARRAY) { + if (target == GL_TEXTURE_3D || target == GL_TEXTURE_1D_ARRAY) { _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, "glGenerateMipmap() to %s target\n", _mesa_lookup_enum_by_nr(target)); @@ -186,7 +184,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, ctx->Extensions.ARB_fragment_shader; GLenum faceTarget; GLuint dstLevel; - const GLint slice = 0; GLuint samplerSave; if (fallback_required(ctx, target, texObj)) { @@ -254,15 +251,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* Silence valgrind warnings about reading uninitialized stack. */ memset(verts, 0, sizeof(verts)); - /* Setup texture coordinates */ - _mesa_meta_setup_texture_coords(faceTarget, - slice, - 0, 0, 1, /* width, height never used here */ - verts[0].tex, - verts[1].tex, - verts[2].tex, - verts[3].tex); - /* setup vertex positions */ verts[0].x = -1.0F; verts[0].y = -1.0F; @@ -273,16 +261,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, verts[3].x = -1.0F; verts[3].y = 1.0F; - /* upload vertex data */ - _mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), - verts, GL_DYNAMIC_DRAW_ARB); - /* texture is already locked, unlock now */ _mesa_unlock_texture(ctx, texObj); for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) { const struct gl_texture_image *srcImage; const GLuint srcLevel = dstLevel - 1; + GLuint layer; GLsizei srcWidth, srcHeight, srcDepth; GLsizei dstWidth, dstHeight, dstDepth; @@ -297,7 +282,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* new dst size */ dstWidth = minify(srcWidth, 1); dstHeight = minify(srcHeight, 1); - dstDepth = minify(srcDepth, 1); + dstDepth = target == GL_TEXTURE_3D ? minify(srcDepth, 1) : srcDepth; if (dstWidth == srcImage->Width && dstHeight == srcImage->Height && @@ -325,25 +310,39 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, /* limit minification to src level */ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); - bind_fbo_image(texObj, faceTarget, dstLevel, 0); - - _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - - /* sanity check */ - if (_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER) != - GL_FRAMEBUFFER_COMPLETE) { - _mesa_problem(ctx, "Unexpected incomplete framebuffer in " - "_mesa_meta_GenerateMipmap()"); - break; - } - - assert(dstWidth == ctx->DrawBuffer->Width); - assert(dstHeight == ctx->DrawBuffer->Height); - /* setup viewport */ _mesa_set_viewport(ctx, 0, 0, 0, dstWidth, dstHeight); - - _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0); + + for (layer = 0; layer < dstDepth; ++layer) { + /* Setup texture coordinates */ + _mesa_meta_setup_texture_coords(faceTarget, + layer, + 0, 0, 1, /* width, height never used here */ + verts[0].tex, + verts[1].tex, + verts[2].tex, + verts[3].tex); + + /
[Mesa-dev] [PATCH 02/11] meta: Split GenerateMipmap() into its own file.
Putting the implementation of each GL function in its own file makes it much easier not to get lost. Signed-off-by: Kenneth Graunke --- src/mesa/Makefile.sources | 1 + src/mesa/drivers/common/meta.c | 338 +- src/mesa/drivers/common/meta.h | 3 + src/mesa/drivers/common/meta_generate_mipmap.c | 372 + 4 files changed, 377 insertions(+), 337 deletions(-) create mode 100644 src/mesa/drivers/common/meta_generate_mipmap.c diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index f6f4062..f4904fb 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -321,6 +321,7 @@ SPARC_FILES = \ COMMON_DRIVER_FILES = \ $(SRCDIR)drivers/common/driverfuncs.c \ $(SRCDIR)drivers/common/meta_blit.c \ + $(SRCDIR)drivers/common/meta_generate_mipmap.c \ $(SRCDIR)drivers/common/meta.c diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 2ac7867..030e111 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -89,7 +89,6 @@ choose_blit_shader(GLenum target, struct blit_shader_table *table); static void cleanup_temp_texture(struct temp_texture *tex); static void meta_glsl_clear_cleanup(struct clear_state *clear); -static void meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap); static void meta_decompress_cleanup(struct decompress_state *decompress); static void meta_drawpix_cleanup(struct drawpix_state *drawpix); @@ -361,7 +360,7 @@ _mesa_meta_free(struct gl_context *ctx) _mesa_make_current(ctx, NULL, NULL); _mesa_meta_glsl_blit_cleanup(&ctx->Meta->Blit); meta_glsl_clear_cleanup(&ctx->Meta->Clear); - meta_glsl_generate_mipmap_cleanup(&ctx->Meta->Mipmap); + _mesa_meta_glsl_generate_mipmap_cleanup(&ctx->Meta->Mipmap); cleanup_temp_texture(&ctx->Meta->TempTex); meta_decompress_cleanup(&ctx->Meta->Decompress); meta_drawpix_cleanup(&ctx->Meta->DrawPix); @@ -2360,102 +2359,6 @@ _mesa_meta_Bitmap(struct gl_context *ctx, _mesa_meta_end(ctx); } - -/** - * Check if the call to _mesa_meta_GenerateMipmap() will require a - * software fallback. The fallback path will require that the texture - * images are mapped. - * \return GL_TRUE if a fallback is needed, GL_FALSE otherwise - */ -GLboolean -_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj) -{ - const GLuint fboSave = ctx->DrawBuffer->Name; - struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap; - struct gl_texture_image *baseImage; - GLuint srcLevel; - GLenum status; - - /* check for fallbacks */ - if (target == GL_TEXTURE_3D || - target == GL_TEXTURE_1D_ARRAY || - target == GL_TEXTURE_2D_ARRAY) { - _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, - "glGenerateMipmap() to %s target\n", - _mesa_lookup_enum_by_nr(target)); - return GL_TRUE; - } - - srcLevel = texObj->BaseLevel; - baseImage = _mesa_select_tex_image(ctx, texObj, target, srcLevel); - if (!baseImage) { - _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, - "glGenerateMipmap() couldn't find base teximage\n"); - return GL_TRUE; - } - - if (_mesa_is_format_compressed(baseImage->TexFormat)) { - _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, - "glGenerateMipmap() with %s format\n", - _mesa_get_format_name(baseImage->TexFormat)); - return GL_TRUE; - } - - if (_mesa_get_format_color_encoding(baseImage->TexFormat) == GL_SRGB && - !ctx->Extensions.EXT_texture_sRGB_decode) { - /* The texture format is sRGB but we can't turn off sRGB->linear - * texture sample conversion. So we won't be able to generate the - * right colors when rendering. Need to use a fallback. - */ - _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, - "glGenerateMipmap() of sRGB texture without " - "sRGB decode\n"); - return GL_TRUE; - } - - /* -* Test that we can actually render in the texture's format. -*/ - if (!mipmap->FBO) - _mesa_GenFramebuffers(1, &mipmap->FBO); - _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO); - - if (target == GL_TEXTURE_1D) { - _mesa_FramebufferTexture1D(GL_FRAMEBUFFER_EXT, -GL_COLOR_ATTACHMENT0_EXT, -target, texObj->Name, srcLevel); - } -#if 0 - /* other work is needed to enable 3D mipmap generation */ - else if (target == GL_TEXTURE_3D) { - GLint zoffset = 0; - _mesa_FramebufferTexture3D(GL_FRAMEBUFFER_EXT, -GL_COLOR_ATTACHMENT0_EXT, -target, texObj->Name,
[Mesa-dev] [PATCH 06/11] meta: Use minify() in GenerateMipmaps code.
This is what the macro is for. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta_generate_mipmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 6a0ccbd..9bce97d 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -282,9 +282,9 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, srcDepth = srcImage->Depth; /* new dst size */ - dstWidth = MAX2(1, srcWidth / 2); - dstHeight = MAX2(1, srcHeight / 2); - dstDepth = MAX2(1, srcDepth / 2); + dstWidth = minify(srcWidth, 1); + dstHeight = minify(srcHeight, 1); + dstDepth = minify(srcDepth, 1); if (dstWidth == srcImage->Width && dstHeight == srcImage->Height && -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/11] meta: De-static setup_texture_coords().
This will be used in multiple files soon. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/common/meta.c | 46 +- src/mesa/drivers/common/meta.h | 11 ++ 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index cde34f9..2ac7867 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2465,16 +2465,16 @@ _mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, * \param height height of the texture image * \param coords0/1/2/3 returns the computed texcoords */ -static void -setup_texture_coords(GLenum faceTarget, - GLint slice, - GLint width, - GLint height, - GLint depth, - GLfloat coords0[4], - GLfloat coords1[4], - GLfloat coords2[4], - GLfloat coords3[4]) +void +_mesa_meta_setup_texture_coords(GLenum faceTarget, +GLint slice, +GLint width, +GLint height, +GLint depth, +GLfloat coords0[4], +GLfloat coords1[4], +GLfloat coords2[4], +GLfloat coords3[4]) { static const GLfloat st[4][2] = { {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} @@ -2618,7 +2618,7 @@ setup_texture_coords(GLenum faceTarget, } break; default: - assert(0 && "unexpected target in meta setup_texture_coords()"); + assert(!"unexpected target in _mesa_meta_setup_texture_coords()"); } } @@ -2808,13 +2808,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, memset(verts, 0, sizeof(verts)); /* Setup texture coordinates */ - setup_texture_coords(faceTarget, -slice, -0, 0, 1, /* width, height never used here */ -verts[0].tex, -verts[1].tex, -verts[2].tex, -verts[3].tex); + _mesa_meta_setup_texture_coords(faceTarget, + slice, + 0, 0, 1, /* width, height never used here */ + verts[0].tex, + verts[1].tex, + verts[2].tex, + verts[3].tex); /* setup vertex positions */ verts[0].x = -1.0F; @@ -3219,11 +3219,11 @@ decompress_texture_image(struct gl_context *ctx, /* Silence valgrind warnings about reading uninitialized stack. */ memset(verts, 0, sizeof(verts)); - setup_texture_coords(faceTarget, slice, width, height, depth, -verts[0].tex, -verts[1].tex, -verts[2].tex, -verts[3].tex); + _mesa_meta_setup_texture_coords(faceTarget, slice, width, height, depth, + verts[0].tex, + verts[1].tex, + verts[2].tex, + verts[3].tex); /* setup vertex positions */ verts[0].x = -1.0F; diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index fcf45c4..d2f40f8 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -448,6 +448,17 @@ GLboolean _mesa_meta_alloc_texture(struct temp_texture *tex, GLsizei width, GLsizei height, GLenum intFormat); +void +_mesa_meta_setup_texture_coords(GLenum faceTarget, +GLint slice, +GLint width, +GLint height, +GLint depth, +GLfloat coords0[4], +GLfloat coords1[4], +GLfloat coords2[4], +GLfloat coords3[4]); + struct temp_texture * _mesa_meta_get_temp_texture(struct gl_context *ctx); -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] i965: Switch mapping modes for non-explicit-flush blit-temporary maps.
Any reason why these patches are not applied in current GIT other than lack of review? I was kind of hoping that maybe some of them can impact Dota 2 perf, since it seems that Dota 2 is memory bandwidth limited. On Thu, Feb 27, 2014 at 11:53 PM, Eric Anholt wrote: > On LLC, it should always be better to use a cached mapping than the GTT. > On non-LLC, it seems pretty silly to try to optimize read performance for > the INVALIDATE_RANGE_BIT case. This will make the buffer_storage logic > easier. > --- > src/mesa/drivers/dri/i965/intel_buffer_objects.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c > b/src/mesa/drivers/dri/i965/intel_buffer_objects.c > index e6124dc..5bf4533 100644 > --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c > +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c > @@ -421,11 +421,11 @@ intel_bufferobj_map_range(struct gl_context * ctx, > "range map", > length + extra, > alignment); > -if (!(access & GL_MAP_READ_BIT)) { > - drm_intel_gem_bo_map_gtt(intel_obj->range_map_bo[index]); > -} else { > +if (brw->has_llc) { > drm_intel_bo_map(intel_obj->range_map_bo[index], > (access & GL_MAP_WRITE_BIT) != 0); > +} else { > + drm_intel_gem_bo_map_gtt(intel_obj->range_map_bo[index]); > } > obj->Mappings[index].Pointer = > intel_obj->range_map_bo[index]->virtual + extra; > -- > 1.9.rc1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] fix vdpau interop when using -Bsymbolic-functions in ldflags
Am 06.03.2014 10:56, schrieb Maarten Lankhorst: Explicitly add radeon_drm_winsys_create and nouveau_drm_screen_create to the dynamic list. This will ensure vdpau interop still works even when the user links with -Bsymbolic-functions in hardened builds. Signed-off-by: Maarten Lankhorst Tested-by: Rachel Greenham Reported-by: Peter Frühberger Reviewed-by: Christian König --- diff --git a/src/gallium/targets/dri-nouveau/Makefile.am b/src/gallium/targets/dri-nouveau/Makefile.am index 4bd4e21..f34acf8 100644 --- a/src/gallium/targets/dri-nouveau/Makefile.am +++ b/src/gallium/targets/dri-nouveau/Makefile.am @@ -35,7 +35,9 @@ dri_LTLIBRARIES = nouveau_dri.la nodist_EXTRA_nouveau_dri_la_SOURCES = dummy.cpp nouveau_dri_la_SOURCES = target.c -nouveau_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +nouveau_dri_la_LDFLAGS = \ +$(GALLIUM_DRI_LINKER_FLAGS) \ +-Wl,--dynamic-list=$(srcdir)/nouveau_dri.dyn nouveau_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/dri-nouveau/nouveau_dri.dyn b/src/gallium/targets/dri-nouveau/nouveau_dri.dyn new file mode 100644 index 000..a10356b --- /dev/null +++ b/src/gallium/targets/dri-nouveau/nouveau_dri.dyn @@ -0,0 +1,3 @@ +{ +nouveau_drm_screen_create; +}; diff --git a/src/gallium/targets/r300/dri/Makefile.am b/src/gallium/targets/r300/dri/Makefile.am index 4bd9ea4..e2becdb 100644 --- a/src/gallium/targets/r300/dri/Makefile.am +++ b/src/gallium/targets/r300/dri/Makefile.am @@ -37,7 +37,9 @@ nodist_EXTRA_r300_dri_la_SOURCES = dummy.cpp r300_dri_la_SOURCES = \ drm_target.c -r300_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +r300_dri_la_LDFLAGS = \ +$(GALLIUM_DRI_LINKER_FLAGS) \ +-Wl,--dynamic-list=$(srcdir)/radeon.dyn r300_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/r300/dri/radeon.dyn b/src/gallium/targets/r300/dri/radeon.dyn new file mode 100644 index 000..8d243dc --- /dev/null +++ b/src/gallium/targets/r300/dri/radeon.dyn @@ -0,0 +1,3 @@ +{ +radeon_drm_winsys_create; +}; diff --git a/src/gallium/targets/r600/dri/Makefile.am b/src/gallium/targets/r600/dri/Makefile.am index 1f13b80..149106f 100644 --- a/src/gallium/targets/r600/dri/Makefile.am +++ b/src/gallium/targets/r600/dri/Makefile.am @@ -36,7 +36,9 @@ dri_LTLIBRARIES = r600_dri.la r600_dri_la_SOURCES = \ drm_target.c -r600_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +r600_dri_la_LDFLAGS = \ +$(GALLIUM_DRI_LINKER_FLAGS) \ +-Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn r600_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/r600/vdpau/Makefile.am b/src/gallium/targets/r600/vdpau/Makefile.am index 509b954..d1a528d 100644 --- a/src/gallium/targets/r600/vdpau/Makefile.am +++ b/src/gallium/targets/r600/vdpau/Makefile.am @@ -35,7 +35,8 @@ libvdpau_r600_la_SOURCES = \ $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c libvdpau_r600_la_LDFLAGS = \ -$(GALLIUM_VDPAU_LINKER_FLAGS) +$(GALLIUM_VDPAU_LINKER_FLAGS) \ +-Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn libvdpau_r600_la_LIBADD = \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ diff --git a/src/gallium/targets/radeonsi/dri/Makefile.am b/src/gallium/targets/radeonsi/dri/Makefile.am index eab28b5..a8db0a8 100644 --- a/src/gallium/targets/radeonsi/dri/Makefile.am +++ b/src/gallium/targets/radeonsi/dri/Makefile.am @@ -37,7 +37,9 @@ nodist_EXTRA_radeonsi_dri_la_SOURCES = dummy.cpp radeonsi_dri_la_SOURCES = \ drm_target.c -radeonsi_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) +radeonsi_dri_la_LDFLAGS = \ +$(GALLIUM_DRI_LINKER_FLAGS) \ +-Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn radeonsi_dri_la_LIBADD = \ $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ diff --git a/src/gallium/targets/radeonsi/vdpau/Makefile.am b/src/gallium/targets/radeonsi/vdpau/Makefile.am index 54d65b3..0d53c18 100644 --- a/src/gallium/targets/radeonsi/vdpau/Makefile.am +++ b/src/gallium/targets/radeonsi/vdpau/Makefile.am @@ -36,7 +36,9 @@ libvdpau_radeonsi_la_SOURCES = \ $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c libvdpau_radeonsi_la_LDFLAGS = \ -$(GALLIUM_VDPAU_LINKER_FLAGS) +$(GALLIUM_VDPAU_LINKER_FLAGS) \ +-Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn + libvdpau_radeonsi_la_LIBADD = \ $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ diff --git a/src/gallium/targets/vdpau-nouveau/Makefile.am b/src/gallium/targets/vdpau-nouveau/Makefile.am index 3cdf103..66738f1 100644 --- a/src/gallium/targets/vdpau-nouveau/Makefile.am +++ b/src/gallium/targets/vdpau-nouveau/Makefile.am @@ -36,7 +36,8 @@ libvdpau_nouveau_la_SOURCES = \ $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c libvdpau_nouveau_la_LDFLAGS = \ -$(GALLIUM_VDPAU_LINKER_FLAGS) +$(GALLIUM_VDP
Re: [Mesa-dev] [PATCH 1/3] radeon: Rename struct radeon_llvm_binary to radeon_shader_binary
On Thu, Mar 06, 2014 at 11:57:29AM +0900, Michel Dänzer wrote: > On Mit, 2014-03-05 at 21:25 -0500, Tom Stellard wrote: > > And move its definition into r600_pipe_common.h; This struct is a just > > a container for shader code and has nothing to do with LLVM. > > Well, it has something to do with LLVM in that the drivers only use it > with LLVM. :) > > > > diff --git a/src/gallium/drivers/radeon/Makefile.am > > b/src/gallium/drivers/radeon/Makefile.am > > index 7971191..b521658 100644 > > --- a/src/gallium/drivers/radeon/Makefile.am > > +++ b/src/gallium/drivers/radeon/Makefile.am > > @@ -17,6 +17,7 @@ noinst_LTLIBRARIES += libllvmradeon.la > > > > libllvmradeon_la_CFLAGS = \ > > $(GALLIUM_DRIVER_CFLAGS) \ > > + $(RADEON_CFLAGS) \ > > $(LLVM_CFLAGS) > > > > libllvmradeon_la_SOURCES = \ > > Should this be a separate change? > I will drop this part. I'm not sure why it's in here, and it doesn't appear to be necessary. -Tom > > Other than that, patches 1 and 2 are > > Reviewed-by: Michel Dänzer > > > -- > Earthling Michel Dänzer| http://www.amd.com > Libre software enthusiast |Mesa and X developer > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] clover: Inline all functions for drivers that don't support subroutines
Tom Stellard writes: > --- > src/gallium/drivers/radeon/radeon_llvm_util.c | 35 -- > .../state_trackers/clover/core/compiler.hpp| 3 +- > src/gallium/state_trackers/clover/core/device.cpp | 6 +++ > src/gallium/state_trackers/clover/core/device.hpp | 1 + > src/gallium/state_trackers/clover/core/program.cpp | 3 +- > .../state_trackers/clover/llvm/invocation.cpp | 55 > +- > 6 files changed, 55 insertions(+), 48 deletions(-) > > diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.c > b/src/gallium/drivers/radeon/radeon_llvm_util.c > index 2ace91f..fe7f9a6 100644 > --- a/src/gallium/drivers/radeon/radeon_llvm_util.c > +++ b/src/gallium/drivers/radeon/radeon_llvm_util.c > @@ -53,40 +53,6 @@ unsigned radeon_llvm_get_num_kernels(LLVMContextRef ctx, > return LLVMGetNamedMetadataNumOperands(mod, "opencl.kernels"); > } > > -static void radeon_llvm_optimize(LLVMModuleRef mod) > -{ > - const char *data_layout = LLVMGetDataLayout(mod); > - LLVMTargetDataRef TD = LLVMCreateTargetData(data_layout); > - LLVMPassManagerBuilderRef builder = LLVMPassManagerBuilderCreate(); > - LLVMPassManagerRef pass_manager = LLVMCreatePassManager(); > - > - /* Functions calls are not supported yet, so we need to inline > - * everything. The most efficient way to do this is to add > - * the always_inline attribute to all non-kernel functions > - * and then run the Always Inline pass. The Always Inline > - * pass will automaically inline functions with this attribute > - * and does not perform the expensive cost analysis that the normal > - * inliner does. > - */ > - > - LLVMValueRef fn; > - for (fn = LLVMGetFirstFunction(mod); fn; fn = LLVMGetNextFunction(fn)) { > - /* All the non-kernel functions have internal linkage */ > - if (LLVMGetLinkage(fn) == LLVMInternalLinkage) { > - LLVMAddFunctionAttr(fn, LLVMAlwaysInlineAttribute); > - } > - } > - > - LLVMAddTargetData(TD, pass_manager); > - LLVMAddAlwaysInlinerPass(pass_manager); > - LLVMPassManagerBuilderPopulateModulePassManager(builder, pass_manager); > - > - LLVMRunPassManager(pass_manager, mod); > - LLVMPassManagerBuilderDispose(builder); > - LLVMDisposePassManager(pass_manager); > - LLVMDisposeTargetData(TD); > -} > - > LLVMModuleRef radeon_llvm_get_kernel_module(LLVMContextRef ctx, unsigned > index, > const unsigned char *bitcode, unsigned bitcode_len) > { > @@ -109,6 +75,5 @@ LLVMModuleRef radeon_llvm_get_kernel_module(LLVMContextRef > ctx, unsigned index, > LLVMDeleteFunction(kernel_function); > } > FREE(kernel_metadata); > - radeon_llvm_optimize(mod); > return mod; > } > diff --git a/src/gallium/state_trackers/clover/core/compiler.hpp > b/src/gallium/state_trackers/clover/core/compiler.hpp > index 49cd022..5035a6b 100644 > --- a/src/gallium/state_trackers/clover/core/compiler.hpp > +++ b/src/gallium/state_trackers/clover/core/compiler.hpp > @@ -32,7 +32,8 @@ namespace clover { > module compile_program_llvm(const compat::string &source, > pipe_shader_ir ir, > const compat::string &target, > - const compat::string &opts); > + const compat::string &opts, > + bool subroutines_supported); > > module compile_program_tgsi(const compat::string &source); > } > diff --git a/src/gallium/state_trackers/clover/core/device.cpp > b/src/gallium/state_trackers/clover/core/device.cpp > index 2c5f9b7..6820f56 100644 > --- a/src/gallium/state_trackers/clover/core/device.cpp > +++ b/src/gallium/state_trackers/clover/core/device.cpp > @@ -187,3 +187,9 @@ enum pipe_endian > device::endianness() const { > return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS); > } > + > +bool > +device::subroutines_supported() const { > + return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, > + PIPE_SHADER_CAP_SUBROUTINES); > +} > diff --git a/src/gallium/state_trackers/clover/core/device.hpp > b/src/gallium/state_trackers/clover/core/device.hpp > index 433ac81..b187a93 100644 > --- a/src/gallium/state_trackers/clover/core/device.hpp > +++ b/src/gallium/state_trackers/clover/core/device.hpp > @@ -68,6 +68,7 @@ namespace clover { >enum pipe_shader_ir ir_format() const; >std::string ir_target() const; >enum pipe_endian endianness() const; > + bool subroutines_supported() const; > >friend class command_queue; >friend class root_resource; > diff --git a/src/gallium/state_trackers/clover/core/program.cpp > b/src/gallium/state_trackers/clover/core/program.cpp > index 3aaa652..b547023 100644 > --- a/src/gallium/state_trackers/clover/core/program.cpp > +++ b/src/gallium/state_track
Re: [Mesa-dev] [PATCH 12/20] drivers/dri: link megadriver with -no-undefined
On 04/03/2014 21:12, Emil Velikov wrote: > From: Jon TURNEY > > v2: (Emil) > - Do not link agaist libglapi. > > Signed-off-by: Jon TURNEY > Signed-off-by: Emil Velikov > --- > src/mesa/drivers/dri/Makefile.am | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/Makefile.am > b/src/mesa/drivers/dri/Makefile.am > index 18f880a..eea1939 100644 > --- a/src/mesa/drivers/dri/Makefile.am > +++ b/src/mesa/drivers/dri/Makefile.am > @@ -51,7 +51,7 @@ driinclude_HEADERS = > $(top_srcdir)/include/GL/internal/dri_interface.h > nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp > mesa_dri_drivers_la_SOURCES = > mesa_dri_drivers_la_LDFLAGS = \ > --module -avoid-version -shared \ > +-module -avoid-version -shared -no-undefined \ > -Wl,-Bsymbolic \ > $() > mesa_dri_drivers_la_LIBADD = \ > I don't think this patch should be committed. If you are not linking with libglapi, so mesa_dri_drivers has undefined symbols, you shouldn't use -no-undefined. (-no-undefined does nothing on linux at the moment, for what appears to be no particularly good reason, but that could possibly change in the future) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/20] Automake cleanups and Cygwin fixes
On 04/03/2014 21:12, Emil Velikov wrote: > Hi all, > > An interesting cleanup series inspired by Jon Turney's tinderbox. > > Highlights: > - Cleanup unused configure.ac variables dating from the static makefile days. > - Use platform specific library extension for links generation. > - Move all the link generation in three files. > - Make check fix when building without direct rendering. > - A few cosmetic configure.ac fixes. > - And last but not least, always build mesa shared. Most of the build system > assumed that already, so update the warning messages, and cleanup configure. > > An interesting point brought my Jon, is that Cygwin needs to link all the dri > drivers agaist libglapi, which mesa explicitly does not do. AFAICS the idea > is that the correct glapi should be loaded (statically or dl_open'ed) by the > GL provider prior to managing the dri. > > Does anyone know the reason behind this ? Note that xserver 1.14 and prior have their own glapi implementation, which a loaded driver would be using. > The series can be found in the cygwin-fixes branch in my repo at > https://github.com/evelikov/Mesa/ > > Review and comments are greatly appreciated. except for my NAK for 12/20, Reviewed-by: Jon TURNEY ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] glapi: remove u_mutex wrapper code, use c99 thread mutexes directly
On 03/05/2014 08:37 PM, Chia-I Wu wrote: On Thu, Mar 6, 2014 at 7:06 AM, Brian Paul wrote: --- src/mapi/mapi.c | 10 +- src/mapi/stub.c |6 +++--- src/mapi/u_current.c |6 +++--- src/mapi/u_execmem.c |6 +++--- src/mapi/u_thread.h | 10 -- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/mapi/mapi.c b/src/mapi/mapi.c index 56f209b..8d0baca 100644 --- a/src/mapi/mapi.c +++ b/src/mapi/mapi.c @@ -72,15 +72,15 @@ get_stub(const char *name, const struct mapi_stub *alias) void mapi_init(const char *spec) { - u_mutex_declare_static(mutex); + static mtx_t mutex = _MTX_INITIALIZER_NP; const char *p; int ver, count; - u_mutex_lock(mutex); + mtx_lock(&mutex); /* already initialized */ if (mapi_num_stubs) { - u_mutex_unlock(mutex); + mtx_unlock(&mutex); return; } @@ -90,7 +90,7 @@ mapi_init(const char *spec) /* parse version string */ ver = atoi(p); if (ver != 1) { - u_mutex_unlock(mutex); + mtx_unlock(&mutex); return; } p += strlen(p) + 1; @@ -115,7 +115,7 @@ mapi_init(const char *spec) mapi_num_stubs = count; - u_mutex_unlock(mutex); + mtx_unlock(&mutex); } /** diff --git a/src/mapi/stub.c b/src/mapi/stub.c index acd2c0a..b5db597 100644 --- a/src/mapi/stub.c +++ b/src/mapi/stub.c @@ -126,11 +126,11 @@ stub_add_dynamic(const char *name) struct mapi_stub * stub_find_dynamic(const char *name, int generate) { - u_mutex_declare_static(dynamic_mutex); + static mtx_t dynamic_mutex = _MTX_INITIALIZER_NP PTHREAD_MUTEX_INITIALIZER; PTHREAD_MUTEX_INITIALIZER should be dropped. With that fixed, Got it. Thanks. I guess this code didn't get compiled in my current configuration. I'm still trying to figure out all the mapi/ code. I don't yet understand the (four!) different mapi compile modes and when they're used. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] svga: replace an assertion with warning
These patches aren't applied so far? I can't find them in git. We received a downstream bug report that could be solved by the 1st patch. https://bugs.archlinux.org/task/39199 -Andy Archlinux ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] clover: Inline all functions for drivers that don't support subroutines
On Thu, Mar 06, 2014 at 01:45:36PM +0100, Francisco Jerez wrote: > Tom Stellard writes: > > > --- > > src/gallium/drivers/radeon/radeon_llvm_util.c | 35 -- > > .../state_trackers/clover/core/compiler.hpp| 3 +- > > src/gallium/state_trackers/clover/core/device.cpp | 6 +++ > > src/gallium/state_trackers/clover/core/device.hpp | 1 + > > src/gallium/state_trackers/clover/core/program.cpp | 3 +- > > .../state_trackers/clover/llvm/invocation.cpp | 55 > > +- > > 6 files changed, 55 insertions(+), 48 deletions(-) > > > > diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.c > > b/src/gallium/drivers/radeon/radeon_llvm_util.c > > index 2ace91f..fe7f9a6 100644 > > --- a/src/gallium/drivers/radeon/radeon_llvm_util.c > > +++ b/src/gallium/drivers/radeon/radeon_llvm_util.c > > @@ -53,40 +53,6 @@ unsigned radeon_llvm_get_num_kernels(LLVMContextRef ctx, > > return LLVMGetNamedMetadataNumOperands(mod, "opencl.kernels"); > > } > > > > -static void radeon_llvm_optimize(LLVMModuleRef mod) > > -{ > > - const char *data_layout = LLVMGetDataLayout(mod); > > - LLVMTargetDataRef TD = LLVMCreateTargetData(data_layout); > > - LLVMPassManagerBuilderRef builder = LLVMPassManagerBuilderCreate(); > > - LLVMPassManagerRef pass_manager = LLVMCreatePassManager(); > > - > > - /* Functions calls are not supported yet, so we need to inline > > -* everything. The most efficient way to do this is to add > > -* the always_inline attribute to all non-kernel functions > > -* and then run the Always Inline pass. The Always Inline > > -* pass will automaically inline functions with this attribute > > -* and does not perform the expensive cost analysis that the normal > > -* inliner does. > > -*/ > > - > > - LLVMValueRef fn; > > - for (fn = LLVMGetFirstFunction(mod); fn; fn = LLVMGetNextFunction(fn)) { > > - /* All the non-kernel functions have internal linkage */ > > - if (LLVMGetLinkage(fn) == LLVMInternalLinkage) { > > - LLVMAddFunctionAttr(fn, LLVMAlwaysInlineAttribute); > > - } > > - } > > - > > - LLVMAddTargetData(TD, pass_manager); > > - LLVMAddAlwaysInlinerPass(pass_manager); > > - LLVMPassManagerBuilderPopulateModulePassManager(builder, pass_manager); > > - > > - LLVMRunPassManager(pass_manager, mod); > > - LLVMPassManagerBuilderDispose(builder); > > - LLVMDisposePassManager(pass_manager); > > - LLVMDisposeTargetData(TD); > > -} > > - > > LLVMModuleRef radeon_llvm_get_kernel_module(LLVMContextRef ctx, unsigned > > index, > > const unsigned char *bitcode, unsigned bitcode_len) > > { > > @@ -109,6 +75,5 @@ LLVMModuleRef > > radeon_llvm_get_kernel_module(LLVMContextRef ctx, unsigned index, > > LLVMDeleteFunction(kernel_function); > > } > > FREE(kernel_metadata); > > - radeon_llvm_optimize(mod); > > return mod; > > } > > diff --git a/src/gallium/state_trackers/clover/core/compiler.hpp > > b/src/gallium/state_trackers/clover/core/compiler.hpp > > index 49cd022..5035a6b 100644 > > --- a/src/gallium/state_trackers/clover/core/compiler.hpp > > +++ b/src/gallium/state_trackers/clover/core/compiler.hpp > > @@ -32,7 +32,8 @@ namespace clover { > > module compile_program_llvm(const compat::string &source, > > pipe_shader_ir ir, > > const compat::string &target, > > - const compat::string &opts); > > + const compat::string &opts, > > + bool subroutines_supported); > > > > module compile_program_tgsi(const compat::string &source); > > } > > diff --git a/src/gallium/state_trackers/clover/core/device.cpp > > b/src/gallium/state_trackers/clover/core/device.cpp > > index 2c5f9b7..6820f56 100644 > > --- a/src/gallium/state_trackers/clover/core/device.cpp > > +++ b/src/gallium/state_trackers/clover/core/device.cpp > > @@ -187,3 +187,9 @@ enum pipe_endian > > device::endianness() const { > > return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS); > > } > > + > > +bool > > +device::subroutines_supported() const { > > + return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, > > + PIPE_SHADER_CAP_SUBROUTINES); > > +} > > diff --git a/src/gallium/state_trackers/clover/core/device.hpp > > b/src/gallium/state_trackers/clover/core/device.hpp > > index 433ac81..b187a93 100644 > > --- a/src/gallium/state_trackers/clover/core/device.hpp > > +++ b/src/gallium/state_trackers/clover/core/device.hpp > > @@ -68,6 +68,7 @@ namespace clover { > >enum pipe_shader_ir ir_format() const; > >std::string ir_target() const; > >enum pipe_endian endianness() const; > > + bool subroutines_supported() const; > > > >friend class command_queue; > >friend class root_resource; > > diff --git a/src/gall
[Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
From: José Fonseca With the recent SRGB changes all my automated OpenGL llvmpipe tests (piglit, conform, glretrace) start asserting with the backtrace below. I'm hoping this change will fix it. I'm not entirely sure, as this doesn't happen in my development machine (the bug probably depends on the exact X visual). Anyway, it seems the sensible thing to do here. Program terminated with signal 5, Trace/breakpoint trap. #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281 #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281 No locals. #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at src/mesa/state_tracker/st_format.c:758 __func__ = "st_pipe_format_to_mesa_format" #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 strb = 0x19e8420 #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer (stfb=stfb@entry=0x19e7fa0, idx=) at src/mesa/state_tracker/st_manager.c:314 rb = format = PIPE_FORMAT_R8G8B8A8_SRGB sw = #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, st=0x19e7fa0, stfbi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:458 stfb = 0x19e7fa0 mode = {rgbMode = 1 '\001', floatMode = 0 '\000', colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode = 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, accumAlphaBits = 0, depthBits = 24, stencilBits = 8, numAuxBuffers = 0, level = 0, visualRating = 0, transparentPixel = 0, transparentRed = 0, transparentGreen = 0, transparentBlue = 0, transparentAlpha = 0, transparentIndex = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, maxPbufferHeight = 0, maxPbufferPixels = 0, optimalPbufferWidth = 0, optimalPbufferHeight = 0, swapMethod = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted = 0, sRGBCapable = 1} idx = #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, fb=, stfbi=stfbi@entry=0x19e7a30) at src/mesa/state_tracker/st_manager.c:728 No locals. #6 0x7fa32409e8cc in st_api_make_current (stapi=, stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:747 st = 0x19dfce0 stdraw = 0x640064 stread = 0x130006 ret = #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at src/gallium/state_trackers/glx/xlib/xm_api.c:1194 No locals. #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, draw=8388610, read=8388610, ctx=0x195bac0) at src/gallium/state_trackers/glx/xlib/glx_api.c:1177 drawBuffer = readBuffer = xmctx = 0x195bb00 glxCtx = 0x195bac0 firsttime = 0 '\000' no_rast = 0 '\000' #9 0x7fa32407852f in glXMakeCurrent (dpy=, drawable=, ctx=) at src/gallium/state_trackers/glx/xlib/glx_api.c:1211 No locals. --- src/mesa/state_tracker/st_format.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 25577ac..0311a2b 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -753,6 +753,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_B8G8R8X8_SRGB: return MESA_FORMAT_B8G8R8X8_SRGB; + case PIPE_FORMAT_R8G8B8A8_SRGB: + return MESA_FORMAT_B8G8R8A8_SRGB; default: assert(0); -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
On 03/06/2014 09:59 AM, jfons...@vmware.com wrote: From: José Fonseca With the recent SRGB changes all my automated OpenGL llvmpipe tests (piglit, conform, glretrace) start asserting with the backtrace below. I'm hoping this change will fix it. I'm not entirely sure, as this doesn't happen in my development machine (the bug probably depends on the exact X visual). Anyway, it seems the sensible thing to do here. Program terminated with signal 5, Trace/breakpoint trap. #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281 #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281 No locals. #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at src/mesa/state_tracker/st_format.c:758 __func__ = "st_pipe_format_to_mesa_format" #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 strb = 0x19e8420 #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer (stfb=stfb@entry=0x19e7fa0, idx=) at src/mesa/state_tracker/st_manager.c:314 rb = format = PIPE_FORMAT_R8G8B8A8_SRGB sw = #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, st=0x19e7fa0, stfbi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:458 stfb = 0x19e7fa0 mode = {rgbMode = 1 '\001', floatMode = 0 '\000', colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode = 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, accumAlphaBits = 0, depthBits = 24, stencilBits = 8, numAuxBuffers = 0, level = 0, visualRating = 0, transparentPixel = 0, transparentRed = 0, transparentGreen = 0, transparentBlue = 0, transparentAlpha = 0, transparentIndex = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, maxPbufferHeight = 0, maxPbufferPixels = 0, optimalPbufferWidth = 0, optimalPbufferHeight = 0, swapMethod = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted = 0, sRGBCapable = 1} idx = #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, fb=, stfbi=stfbi@entry=0x19e7a30) at src/mesa/state_tracker/st_manager.c:728 No locals. #6 0x7fa32409e8cc in st_api_make_current (stapi=, stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:747 st = 0x19dfce0 stdraw = 0x640064 stread = 0x130006 ret = #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at src/gallium/state_trackers/glx/xlib/xm_api.c:1194 No locals. #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, draw=8388610, read=8388610, ctx=0x195bac0) at src/gallium/state_trackers/glx/xlib/glx_api.c:1177 drawBuffer = readBuffer = xmctx = 0x195bb00 glxCtx = 0x195bac0 firsttime = 0 '\000' no_rast = 0 '\000' #9 0x7fa32407852f in glXMakeCurrent (dpy=, drawable=, ctx=) at src/gallium/state_trackers/glx/xlib/glx_api.c:1211 No locals. --- src/mesa/state_tracker/st_format.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 25577ac..0311a2b 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -753,6 +753,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_B8G8R8X8_SRGB: return MESA_FORMAT_B8G8R8X8_SRGB; + case PIPE_FORMAT_R8G8B8A8_SRGB: + return MESA_FORMAT_B8G8R8A8_SRGB; Hmm, we don't have a MESA_FORMAT_R8G8B8A8_SRGB to match that pipe format so I'm not sure this is correct. But if this fixes the crash, it's better than nothing. Acked-by: Brian Paul I could look into adding MESA_FORMAT_R8G8B8A8_SRGB... -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] glsl: Improve debug output and variable names for opt_dead_code_local.
Aras Pranckevicius writes: >> >> -static bool debug = false; >> +static bool debug = true; >> > > Accidental debug flag? Yeah, caught that just after sending it out. I've been bad at these recently :( pgp4nOw1NV75X.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] i965: Switch mapping modes for non-explicit-flush blit-temporary maps.
Vedran Rodic writes: > Any reason why these patches are not applied in current GIT other than > lack of review? I was kind of hoping that maybe some of them can > impact Dota 2 perf, since it seems that Dota 2 is memory bandwidth > limited. Just lack of review. pgpk7LoYlWRDP.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
- Original Message - > On 03/06/2014 09:59 AM, jfons...@vmware.com wrote: > > From: José Fonseca > > > > With the recent SRGB changes all my automated OpenGL llvmpipe tests > > (piglit, conform, glretrace) start asserting with the backtrace below. > > > > I'm hoping this change will fix it. I'm not entirely sure, as this > > doesn't happen in my development machine (the bug probably depends on > > the exact X visual). > > > > Anyway, it seems the sensible thing to do here. > > > > Program terminated with signal 5, Trace/breakpoint trap. > > #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", > > file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", > > line=line@entry=758, function=function@entry=0x7fa324e40160 > > <__func__.34798> "st_pipe_format_to_mesa_format") at > > src/gallium/auxiliary/util/u_debug.c:281 > > #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", > > file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", > > line=line@entry=758, function=function@entry=0x7fa324e40160 > > <__func__.34798> "st_pipe_format_to_mesa_format") at > > src/gallium/auxiliary/util/u_debug.c:281 > > No locals. > > #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format > > (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at > > src/mesa/state_tracker/st_format.c:758 > > __func__ = "st_pipe_format_to_mesa_format" > > #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb > > (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, > > sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 > > strb = 0x19e8420 > > #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer > > (stfb=stfb@entry=0x19e7fa0, idx=) at > > src/mesa/state_tracker/st_manager.c:314 > > rb = > > format = PIPE_FORMAT_R8G8B8A8_SRGB > > sw = > > #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, > > st=0x19e7fa0, stfbi=0x19e7a30) at > > src/mesa/state_tracker/st_manager.c:458 > > stfb = 0x19e7fa0 > > mode = {rgbMode = 1 '\001', floatMode = 0 '\000', > > colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode = > > 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', > > haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, > > blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, > > blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, > > accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, > > accumAlphaBits = 0, depthBits = 24, stencilBits = 8, > > numAuxBuffers = 0, level = 0, visualRating = 0, > > transparentPixel = 0, transparentRed = 0, transparentGreen = > > 0, transparentBlue = 0, transparentAlpha = 0, transparentIndex > > = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, > > maxPbufferHeight = 0, maxPbufferPixels = 0, > > optimalPbufferWidth = 0, optimalPbufferHeight = 0, swapMethod > > = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, > > bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted = > > 0, sRGBCapable = 1} > > idx = > > #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, > > fb=, stfbi=stfbi@entry=0x19e7a30) at > > src/mesa/state_tracker/st_manager.c:728 > > No locals. > > #6 0x7fa32409e8cc in st_api_make_current (stapi=, > > stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at > > src/mesa/state_tracker/st_manager.c:747 > > st = 0x19dfce0 > > stdraw = 0x640064 > > stread = 0x130006 > > ret = > > #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, > > drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at > > src/gallium/state_trackers/glx/xlib/xm_api.c:1194 > > No locals. > > #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, > > draw=8388610, read=8388610, ctx=0x195bac0) at > > src/gallium/state_trackers/glx/xlib/glx_api.c:1177 > > drawBuffer = > > readBuffer = > > xmctx = 0x195bb00 > > glxCtx = 0x195bac0 > > firsttime = 0 '\000' > > no_rast = 0 '\000' > > #9 0x7fa32407852f in glXMakeCurrent (dpy=, > > drawable=, ctx=) at > > src/gallium/state_trackers/glx/xlib/glx_api.c:1211 > > No locals. > > --- > > src/mesa/state_tracker/st_format.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/src/mesa/state_tracker/st_format.c > > b/src/mesa/state_tracker/st_format.c > > index 25577ac..0311a2b 100644 > > --- a/src/mesa/state_tracker/st_format.c > > +++ b/src/mesa/state_tracker/st_format.c > > @@ -753,6 +753,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format) > > > > case PIPE_FORMAT_B8G8R8X
Re: [Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
- Original Message - > > > - Original Message - > > On 03/06/2014 09:59 AM, jfons...@vmware.com wrote: > > > From: José Fonseca > > > > > > With the recent SRGB changes all my automated OpenGL llvmpipe tests > > > (piglit, conform, glretrace) start asserting with the backtrace below. > > > > > > I'm hoping this change will fix it. I'm not entirely sure, as this > > > doesn't happen in my development machine (the bug probably depends on > > > the exact X visual). > > > > > > Anyway, it seems the sensible thing to do here. > > > > > > Program terminated with signal 5, Trace/breakpoint trap. > > > #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", > > > file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", > > > line=line@entry=758, function=function@entry=0x7fa324e40160 > > > <__func__.34798> "st_pipe_format_to_mesa_format") at > > > src/gallium/auxiliary/util/u_debug.c:281 > > > #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", > > > file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", > > > line=line@entry=758, function=function@entry=0x7fa324e40160 > > > <__func__.34798> "st_pipe_format_to_mesa_format") at > > > src/gallium/auxiliary/util/u_debug.c:281 > > > No locals. > > > #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format > > > (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at > > > src/mesa/state_tracker/st_format.c:758 > > > __func__ = "st_pipe_format_to_mesa_format" > > > #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb > > > (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, > > > sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 > > > strb = 0x19e8420 > > > #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer > > > (stfb=stfb@entry=0x19e7fa0, idx=) at > > > src/mesa/state_tracker/st_manager.c:314 > > > rb = > > > format = PIPE_FORMAT_R8G8B8A8_SRGB > > > sw = > > > #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, > > > st=0x19e7fa0, stfbi=0x19e7a30) at > > > src/mesa/state_tracker/st_manager.c:458 > > > stfb = 0x19e7fa0 > > > mode = {rgbMode = 1 '\001', floatMode = 0 '\000', > > > colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode = > > > 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', > > > haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, > > > blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, > > > blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, > > > accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, > > > accumAlphaBits = 0, depthBits = 24, stencilBits = 8, > > > numAuxBuffers = 0, level = 0, visualRating = 0, > > > transparentPixel = 0, transparentRed = 0, transparentGreen = > > > 0, transparentBlue = 0, transparentAlpha = 0, > > > transparentIndex > > > = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, > > > maxPbufferHeight = 0, maxPbufferPixels = 0, > > > optimalPbufferWidth = 0, optimalPbufferHeight = 0, swapMethod > > > = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, > > > bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted > > > = > > > 0, sRGBCapable = 1} > > > idx = > > > #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, > > > fb=, stfbi=stfbi@entry=0x19e7a30) at > > > src/mesa/state_tracker/st_manager.c:728 > > > No locals. > > > #6 0x7fa32409e8cc in st_api_make_current (stapi=, > > > stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at > > > src/mesa/state_tracker/st_manager.c:747 > > > st = 0x19dfce0 > > > stdraw = 0x640064 > > > stread = 0x130006 > > > ret = > > > #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, > > > drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at > > > src/gallium/state_trackers/glx/xlib/xm_api.c:1194 > > > No locals. > > > #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, > > > draw=8388610, read=8388610, ctx=0x195bac0) at > > > src/gallium/state_trackers/glx/xlib/glx_api.c:1177 > > > drawBuffer = > > > readBuffer = > > > xmctx = 0x195bb00 > > > glxCtx = 0x195bac0 > > > firsttime = 0 '\000' > > > no_rast = 0 '\000' > > > #9 0x7fa32407852f in glXMakeCurrent (dpy=, > > > drawable=, ctx=) at > > > src/gallium/state_trackers/glx/xlib/glx_api.c:1211 > > > No locals. > > > --- > > > src/mesa/state_tracker/st_format.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/src/mesa/state_tracker/st_format.c > > > b/src/mesa/state
Re: [Mesa-dev] Meta GenerateMipmap() support for array textures
The series looks good to me. I didn't see anything I'd change. Reviewed-by: Matt Turner ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
Am 06.03.2014 18:32, schrieb Jose Fonseca: > > > - Original Message - >> >> >> - Original Message - >>> On 03/06/2014 09:59 AM, jfons...@vmware.com wrote: From: José Fonseca With the recent SRGB changes all my automated OpenGL llvmpipe tests (piglit, conform, glretrace) start asserting with the backtrace below. I'm hoping this change will fix it. I'm not entirely sure, as this doesn't happen in my development machine (the bug probably depends on the exact X visual). Anyway, it seems the sensible thing to do here. Program terminated with signal 5, Trace/breakpoint trap. #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281 #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281 No locals. #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at src/mesa/state_tracker/st_format.c:758 __func__ = "st_pipe_format_to_mesa_format" #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 strb = 0x19e8420 #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer (stfb=stfb@entry=0x19e7fa0, idx=) at src/mesa/state_tracker/st_manager.c:314 rb = format = PIPE_FORMAT_R8G8B8A8_SRGB sw = #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, st=0x19e7fa0, stfbi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:458 stfb = 0x19e7fa0 mode = {rgbMode = 1 '\001', floatMode = 0 '\000', colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode = 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, accumAlphaBits = 0, depthBits = 24, stencilBits = 8, numAuxBuffers = 0, level = 0, visualRating = 0, transparentPixel = 0, transparentRed = 0, transparentGreen = 0, transparentBlue = 0, transparentAlpha = 0, transparentIndex = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, maxPbufferHeight = 0, maxPbufferPixels = 0, optimalPbufferWidth = 0, optimalPbufferHeight = 0, swapMethod = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted = 0, sRGBCapable = 1} idx = #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, fb=, stfbi=stfbi@entry=0x19e7a30) at src/mesa/state_tracker/st_manager.c:728 No locals. #6 0x7fa32409e8cc in st_api_make_current (stapi=, stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:747 st = 0x19dfce0 stdraw = 0x640064 stread = 0x130006 ret = #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at src/gallium/state_trackers/glx/xlib/xm_api.c:1194 No locals. #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, draw=8388610, read=8388610, ctx=0x195bac0) at src/gallium/state_trackers/glx/xlib/glx_api.c:1177 drawBuffer = readBuffer = xmctx = 0x195bb00 glxCtx = 0x195bac0 firsttime = 0 '\000' no_rast = 0 '\000' #9 0x7fa32407852f in glXMakeCurrent (dpy=, drawable=, ctx=) at src/gallium/state_trackers/glx/xlib/glx_api.c:1211 No locals. --- src/mesa/state_tracker/st_format.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 25577ac..0311
Re: [Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
- Original Message - > Am 06.03.2014 18:32, schrieb Jose Fonseca: > > > > > > - Original Message - > >> > >> > >> - Original Message - > >>> On 03/06/2014 09:59 AM, jfons...@vmware.com wrote: > From: José Fonseca > > With the recent SRGB changes all my automated OpenGL llvmpipe tests > (piglit, conform, glretrace) start asserting with the backtrace below. > > I'm hoping this change will fix it. I'm not entirely sure, as this > doesn't happen in my development machine (the bug probably depends on > the exact X visual). > > Anyway, it seems the sensible thing to do here. > > Program terminated with signal 5, Trace/breakpoint trap. > #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", > file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", > line=line@entry=758, function=function@entry=0x7fa324e40160 > <__func__.34798> "st_pipe_format_to_mesa_format") at > src/gallium/auxiliary/util/u_debug.c:281 > #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", > file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", > line=line@entry=758, function=function@entry=0x7fa324e40160 > <__func__.34798> "st_pipe_format_to_mesa_format") at > src/gallium/auxiliary/util/u_debug.c:281 > No locals. > #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format > (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at > src/mesa/state_tracker/st_format.c:758 > __func__ = "st_pipe_format_to_mesa_format" > #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb > (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, > sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 > strb = 0x19e8420 > #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer > (stfb=stfb@entry=0x19e7fa0, idx=) at > src/mesa/state_tracker/st_manager.c:314 > rb = > format = PIPE_FORMAT_R8G8B8A8_SRGB > sw = > #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, > st=0x19e7fa0, stfbi=0x19e7a30) at > src/mesa/state_tracker/st_manager.c:458 > stfb = 0x19e7fa0 > mode = {rgbMode = 1 '\001', floatMode = 0 '\000', > colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode > = > 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', > haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, > blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, > blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, > accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, > accumAlphaBits = 0, depthBits = 24, stencilBits = 8, > numAuxBuffers = 0, level = 0, visualRating = 0, > transparentPixel = 0, transparentRed = 0, transparentGreen = > 0, transparentBlue = 0, transparentAlpha = 0, > transparentIndex > = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, > maxPbufferHeight = 0, maxPbufferPixels = 0, > optimalPbufferWidth = 0, optimalPbufferHeight = 0, > swapMethod > = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, > bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted > = > 0, sRGBCapable = 1} > idx = > #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, > fb=, stfbi=stfbi@entry=0x19e7a30) at > src/mesa/state_tracker/st_manager.c:728 > No locals. > #6 0x7fa32409e8cc in st_api_make_current (stapi= out>, > stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at > src/mesa/state_tracker/st_manager.c:747 > st = 0x19dfce0 > stdraw = 0x640064 > stread = 0x130006 > ret = > #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, > drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at > src/gallium/state_trackers/glx/xlib/xm_api.c:1194 > No locals. > #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, > draw=8388610, read=8388610, ctx=0x195bac0) at > src/gallium/state_trackers/glx/xlib/glx_api.c:1177 > drawBuffer = > readBuffer = > xmctx = 0x195bb00 > glxCtx = 0x195bac0 > firsttime = 0 '\000' > no_rast = 0 '\000' > #9 0x7fa32407852f in glXMakeCurrent (dpy=, > drawable=, ctx=) at > src/gallium/state
[Mesa-dev] [PATCH] mesa: add MESA_FORMAT_R8G8B8A8_SRGB
To match PIPE_FORMAT_R8G8B8A8_SRGB. --- src/mesa/main/format_pack.c | 27 +++ src/mesa/main/format_unpack.c| 14 ++ src/mesa/main/formats.c | 15 +++ src/mesa/main/formats.h |1 + src/mesa/main/texstore.c |3 +++ src/mesa/swrast/s_texfetch.c |6 ++ src/mesa/swrast/s_texfetch_tmp.h | 13 + 7 files changed, 79 insertions(+) diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index b870001..3c14d8f 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -1108,6 +1108,31 @@ pack_float_SARGB8(const GLfloat src[4], void *dst) } +/* MESA_FORMAT_R8G8B8A8_SRGB */ + +static void +pack_ubyte_SABGR8(const GLubyte src[4], void *dst) +{ + GLuint *d = ((GLuint *) dst); + GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); + GLubyte g = linear_ubyte_to_srgb_ubyte(src[RCOMP]); + GLubyte b = linear_ubyte_to_srgb_ubyte(src[RCOMP]); + *d = PACK_COLOR_(src[ACOMP], b, g, r); +} + +static void +pack_float_SABGR8(const GLfloat src[4], void *dst) +{ + GLuint *d = ((GLuint *) dst); + GLubyte r, g, b, a; + r = linear_float_to_srgb_ubyte(src[RCOMP]); + g = linear_float_to_srgb_ubyte(src[GCOMP]); + b = linear_float_to_srgb_ubyte(src[BCOMP]); + UNCLAMPED_FLOAT_TO_UBYTE(a, src[ACOMP]); + *d = PACK_COLOR_(a, b, g, r); +} + + /* MESA_FORMAT_L_SRGB8 */ static void @@ -1961,6 +1986,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_SRGB8; table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_SRGBA8; table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_SARGB8; + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_SABGR8; table[MESA_FORMAT_L_SRGB8] = pack_ubyte_SL8; table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_SLA8; /* n/a */ @@ -2125,6 +2151,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_BGR_SRGB8] = pack_float_SRGB8; table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_SRGBA8; table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_SARGB8; + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_SABGR8; table[MESA_FORMAT_L_SRGB8] = pack_float_SL8; table[MESA_FORMAT_L8A8_SRGB] = pack_float_SLA8; diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 1a0e727..2348ef6 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -797,6 +797,19 @@ unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_SABGR8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff ); + dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff ); + dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff ); + dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */ + } +} + +static void unpack_SL8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); @@ -2388,6 +2401,7 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8; table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8; + table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_SABGR8; table[MESA_FORMAT_L_SRGB8] = unpack_SL8; table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8; table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index e0b774e..0cf97fa 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -520,6 +520,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { + MESA_FORMAT_R8G8B8A8_SRGB, + "MESA_FORMAT_R8G8B8A8_SRGB", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { MESA_FORMAT_L_SRGB8, "MESA_FORMAT_L_SRGB8", GL_LUMINANCE, @@ -2034,6 +2043,7 @@ _mesa_get_format_color_encoding(mesa_format format) case MESA_FORMAT_BGR_SRGB8: case MESA_FORMAT_A8B8G8R8_SRGB: case MESA_FORMAT_B8G8R8A8_SRGB: + case MESA_FORMAT_R8G8B8A8_SRGB: case MESA_FORMAT_L_SRGB8: case MESA_FORMAT_L8A8_SRGB: case MESA_FORMAT_SRGB_DXT1: @@ -2069,6 +2079,9 @@ _mesa_get_srgb_format_linear(mesa_format format) case MESA_FORMAT_B8G8R8A8_SRGB: format = MESA_FORMAT_B8G8R8A8_UNORM; break; + case MESA_FORMAT_R8G8B8A8_SRGB: + format = MESA_FORMAT_R8G8B8A8_UNORM; + break; case MESA_FORMAT_L_SRGB8: format = MESA_FORMAT_L_UNORM8; break; @@ -2576,6 +2589,7 @@ _mesa_format_to_type_and_comps(mesa_format format, return; case MESA_FORMAT_A8B8G8R8_SRGB: case MESA_FORMAT_B8G8R8A8_SRGB: + case MESA_FORMAT_R8G8B8A8_SRGB:
[Mesa-dev] [PATCH] mesa: fix copy & paste bugs in pack_ubyte_SARGB8()
Cc: "10.0" "10.1" --- src/mesa/main/format_pack.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index b870001..e0d2a18 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -1090,8 +1090,8 @@ pack_ubyte_SARGB8(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); - GLubyte g = linear_ubyte_to_srgb_ubyte(src[RCOMP]); - GLubyte b = linear_ubyte_to_srgb_ubyte(src[RCOMP]); + GLubyte g = linear_ubyte_to_srgb_ubyte(src[GCOMP]); + GLubyte b = linear_ubyte_to_srgb_ubyte(src[BCOMP]); *d = PACK_COLOR_(src[ACOMP], r, g, b); } -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH] mesa: fix copy & paste bugs in pack_ubyte_SARGB8()
On Thu, Mar 6, 2014 at 9:59 AM, Brian Paul wrote: > Cc: "10.0" "10.1" > --- > src/mesa/main/format_pack.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c > index b870001..e0d2a18 100644 > --- a/src/mesa/main/format_pack.c > +++ b/src/mesa/main/format_pack.c > @@ -1090,8 +1090,8 @@ pack_ubyte_SARGB8(const GLubyte src[4], void *dst) > { > GLuint *d = ((GLuint *) dst); > GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > - GLubyte g = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > - GLubyte b = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > + GLubyte g = linear_ubyte_to_srgb_ubyte(src[GCOMP]); > + GLubyte b = linear_ubyte_to_srgb_ubyte(src[BCOMP]); > *d = PACK_COLOR_(src[ACOMP], r, g, b); > } > > -- > 1.7.10.4 > > ___ > mesa-stable mailing list > mesa-sta...@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-stable Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: add MESA_FORMAT_R8G8B8A8_SRGB
- Original Message - > To match PIPE_FORMAT_R8G8B8A8_SRGB. > --- > src/mesa/main/format_pack.c | 27 +++ > src/mesa/main/format_unpack.c| 14 ++ > src/mesa/main/formats.c | 15 +++ > src/mesa/main/formats.h |1 + > src/mesa/main/texstore.c |3 +++ > src/mesa/swrast/s_texfetch.c |6 ++ > src/mesa/swrast/s_texfetch_tmp.h | 13 + > 7 files changed, 79 insertions(+) > > diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c > index b870001..3c14d8f 100644 > --- a/src/mesa/main/format_pack.c > +++ b/src/mesa/main/format_pack.c > @@ -1108,6 +1108,31 @@ pack_float_SARGB8(const GLfloat src[4], void *dst) > } > > > +/* MESA_FORMAT_R8G8B8A8_SRGB */ > + > +static void > +pack_ubyte_SABGR8(const GLubyte src[4], void *dst) > +{ > + GLuint *d = ((GLuint *) dst); > + GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > + GLubyte g = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > + GLubyte b = linear_ubyte_to_srgb_ubyte(src[RCOMP]); G/BCOMP here Otherwise looks good. Jose > + *d = PACK_COLOR_(src[ACOMP], b, g, r); > +} > + > +static void > +pack_float_SABGR8(const GLfloat src[4], void *dst) > +{ > + GLuint *d = ((GLuint *) dst); > + GLubyte r, g, b, a; > + r = linear_float_to_srgb_ubyte(src[RCOMP]); > + g = linear_float_to_srgb_ubyte(src[GCOMP]); > + b = linear_float_to_srgb_ubyte(src[BCOMP]); > + UNCLAMPED_FLOAT_TO_UBYTE(a, src[ACOMP]); > + *d = PACK_COLOR_(a, b, g, r); > +} > + > + > /* MESA_FORMAT_L_SRGB8 */ > > static void > @@ -1961,6 +1986,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) >table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_SRGB8; >table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_SRGBA8; >table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_SARGB8; > + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_SABGR8; >table[MESA_FORMAT_L_SRGB8] = pack_ubyte_SL8; >table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_SLA8; >/* n/a */ > @@ -2125,6 +2151,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format) >table[MESA_FORMAT_BGR_SRGB8] = pack_float_SRGB8; >table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_SRGBA8; >table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_SARGB8; > + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_SABGR8; >table[MESA_FORMAT_L_SRGB8] = pack_float_SL8; >table[MESA_FORMAT_L8A8_SRGB] = pack_float_SLA8; > > diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c > index 1a0e727..2348ef6 100644 > --- a/src/mesa/main/format_unpack.c > +++ b/src/mesa/main/format_unpack.c > @@ -797,6 +797,19 @@ unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint > n) > } > > static void > +unpack_SABGR8(const void *src, GLfloat dst[][4], GLuint n) > +{ > + const GLuint *s = ((const GLuint *) src); > + GLuint i; > + for (i = 0; i < n; i++) { > + dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff ); > + dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff ); > + dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff ); > + dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */ > + } > +} > + > +static void > unpack_SL8(const void *src, GLfloat dst[][4], GLuint n) > { > const GLubyte *s = ((const GLubyte *) src); > @@ -2388,6 +2401,7 @@ get_unpack_rgba_function(mesa_format format) >table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; >table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8; >table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8; > + table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_SABGR8; >table[MESA_FORMAT_L_SRGB8] = unpack_SL8; >table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8; >table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c > index e0b774e..0cf97fa 100644 > --- a/src/mesa/main/formats.c > +++ b/src/mesa/main/formats.c > @@ -520,6 +520,15 @@ static struct gl_format_info > format_info[MESA_FORMAT_COUNT] = >1, 1, 4 > }, > { > + MESA_FORMAT_R8G8B8A8_SRGB, > + "MESA_FORMAT_R8G8B8A8_SRGB", > + GL_RGBA, > + GL_UNSIGNED_NORMALIZED, > + 8, 8, 8, 8, > + 0, 0, 0, 0, 0, > + 1, 1, 4 > + }, > + { >MESA_FORMAT_L_SRGB8, >"MESA_FORMAT_L_SRGB8", >GL_LUMINANCE, > @@ -2034,6 +2043,7 @@ _mesa_get_format_color_encoding(mesa_format format) > case MESA_FORMAT_BGR_SRGB8: > case MESA_FORMAT_A8B8G8R8_SRGB: > case MESA_FORMAT_B8G8R8A8_SRGB: > + case MESA_FORMAT_R8G8B8A8_SRGB: > case MESA_FORMAT_L_SRGB8: > case MESA_FORMAT_L8A8_SRGB: > case MESA_FORMAT_SRGB_DXT1: > @@ -2069,6 +2079,9 @@ _mesa_get_srgb_format_linear(mesa_format format) > case MESA_FORMAT_B8G8R8A8_SRGB: >format = MESA_FORMAT_B8G8R8A8_UNORM; >break; > + case MESA_FORMAT_R8G8B8A8_SRGB: > + f
Re: [Mesa-dev] [PATCH] mesa: add MESA_FORMAT_R8G8B8A8_SRGB
Just one typo otherwise looks good (though I couldn't tell if it would be missing in one of these swtich statements...). Roland Am 06.03.2014 18:58, schrieb Brian Paul: > To match PIPE_FORMAT_R8G8B8A8_SRGB. > --- > src/mesa/main/format_pack.c | 27 +++ > src/mesa/main/format_unpack.c| 14 ++ > src/mesa/main/formats.c | 15 +++ > src/mesa/main/formats.h |1 + > src/mesa/main/texstore.c |3 +++ > src/mesa/swrast/s_texfetch.c |6 ++ > src/mesa/swrast/s_texfetch_tmp.h | 13 + > 7 files changed, 79 insertions(+) > > diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c > index b870001..3c14d8f 100644 > --- a/src/mesa/main/format_pack.c > +++ b/src/mesa/main/format_pack.c > @@ -1108,6 +1108,31 @@ pack_float_SARGB8(const GLfloat src[4], void *dst) > } > > > +/* MESA_FORMAT_R8G8B8A8_SRGB */ > + > +static void > +pack_ubyte_SABGR8(const GLubyte src[4], void *dst) > +{ > + GLuint *d = ((GLuint *) dst); > + GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > + GLubyte g = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > + GLubyte b = linear_ubyte_to_srgb_ubyte(src[RCOMP]); That should be GCOMP/BCOMP for g/b respectively. I bet you copied it from either pack_ubyte_SARGB() or pack_ubyte_SRGB8() but not from pack_ubyte_SRGBA8() :-). (I don't think we should really see these functions in action so errors go unnoticed...) > + *d = PACK_COLOR_(src[ACOMP], b, g, r); > +} > + > +static void > +pack_float_SABGR8(const GLfloat src[4], void *dst) > +{ > + GLuint *d = ((GLuint *) dst); > + GLubyte r, g, b, a; > + r = linear_float_to_srgb_ubyte(src[RCOMP]); > + g = linear_float_to_srgb_ubyte(src[GCOMP]); > + b = linear_float_to_srgb_ubyte(src[BCOMP]); > + UNCLAMPED_FLOAT_TO_UBYTE(a, src[ACOMP]); > + *d = PACK_COLOR_(a, b, g, r); > +} > + > + > /* MESA_FORMAT_L_SRGB8 */ > > static void > @@ -1961,6 +1986,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) >table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_SRGB8; >table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_SRGBA8; >table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_SARGB8; > + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_SABGR8; >table[MESA_FORMAT_L_SRGB8] = pack_ubyte_SL8; >table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_SLA8; >/* n/a */ > @@ -2125,6 +2151,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format) >table[MESA_FORMAT_BGR_SRGB8] = pack_float_SRGB8; >table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_SRGBA8; >table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_SARGB8; > + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_SABGR8; >table[MESA_FORMAT_L_SRGB8] = pack_float_SL8; >table[MESA_FORMAT_L8A8_SRGB] = pack_float_SLA8; > > diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c > index 1a0e727..2348ef6 100644 > --- a/src/mesa/main/format_unpack.c > +++ b/src/mesa/main/format_unpack.c > @@ -797,6 +797,19 @@ unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint > n) > } > > static void > +unpack_SABGR8(const void *src, GLfloat dst[][4], GLuint n) > +{ > + const GLuint *s = ((const GLuint *) src); > + GLuint i; > + for (i = 0; i < n; i++) { > + dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff ); > + dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff ); > + dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff ); > + dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */ > + } > +} > + > +static void > unpack_SL8(const void *src, GLfloat dst[][4], GLuint n) > { > const GLubyte *s = ((const GLubyte *) src); > @@ -2388,6 +2401,7 @@ get_unpack_rgba_function(mesa_format format) >table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; >table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8; >table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8; > + table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_SABGR8; >table[MESA_FORMAT_L_SRGB8] = unpack_SL8; >table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8; >table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c > index e0b774e..0cf97fa 100644 > --- a/src/mesa/main/formats.c > +++ b/src/mesa/main/formats.c > @@ -520,6 +520,15 @@ static struct gl_format_info > format_info[MESA_FORMAT_COUNT] = >1, 1, 4 > }, > { > + MESA_FORMAT_R8G8B8A8_SRGB, > + "MESA_FORMAT_R8G8B8A8_SRGB", > + GL_RGBA, > + GL_UNSIGNED_NORMALIZED, > + 8, 8, 8, 8, > + 0, 0, 0, 0, 0, > + 1, 1, 4 > + }, > + { >MESA_FORMAT_L_SRGB8, >"MESA_FORMAT_L_SRGB8", >GL_LUMINANCE, > @@ -2034,6 +2043,7 @@ _mesa_get_format_color_encoding(mesa_format format) > case MESA_FORMAT_BGR_SRGB8: > case MESA_FORMAT_A8B8G8R8_SRGB: > case MESA_FORMAT_B8G8R8A8_SRGB: > + ca
Re: [Mesa-dev] [PATCH] mesa: add MESA_FORMAT_R8G8B8A8_SRGB
On 03/06/2014 11:09 AM, Roland Scheidegger wrote: Just one typo otherwise looks good (though I couldn't tell if it would be missing in one of these swtich statements...). Roland Am 06.03.2014 18:58, schrieb Brian Paul: To match PIPE_FORMAT_R8G8B8A8_SRGB. --- src/mesa/main/format_pack.c | 27 +++ src/mesa/main/format_unpack.c| 14 ++ src/mesa/main/formats.c | 15 +++ src/mesa/main/formats.h |1 + src/mesa/main/texstore.c |3 +++ src/mesa/swrast/s_texfetch.c |6 ++ src/mesa/swrast/s_texfetch_tmp.h | 13 + 7 files changed, 79 insertions(+) diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index b870001..3c14d8f 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -1108,6 +1108,31 @@ pack_float_SARGB8(const GLfloat src[4], void *dst) } +/* MESA_FORMAT_R8G8B8A8_SRGB */ + +static void +pack_ubyte_SABGR8(const GLubyte src[4], void *dst) +{ + GLuint *d = ((GLuint *) dst); + GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); + GLubyte g = linear_ubyte_to_srgb_ubyte(src[RCOMP]); + GLubyte b = linear_ubyte_to_srgb_ubyte(src[RCOMP]); That should be GCOMP/BCOMP for g/b respectively. I bet you copied it from either pack_ubyte_SARGB() or pack_ubyte_SRGB8() but not from pack_ubyte_SRGBA8() :-). D'oh! Thanks. I'll fix pack_ubyte_SRGB8() too. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: fix copy & paste bugs in pack_ubyte_SRGB8()
Am 06.03.2014 19:25, schrieb Brian Paul: > Cc: "10.0" "10.1" > --- > src/mesa/main/format_pack.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c > index e0d2a18..89958f7 100644 > --- a/src/mesa/main/format_pack.c > +++ b/src/mesa/main/format_pack.c > @@ -1044,8 +1044,8 @@ pack_ubyte_SRGB8(const GLubyte src[4], void *dst) > { > GLubyte *d = ((GLubyte *) dst); > d[2] = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > - d[1] = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > - d[0] = linear_ubyte_to_srgb_ubyte(src[RCOMP]); > + d[1] = linear_ubyte_to_srgb_ubyte(src[GCOMP]); > + d[0] = linear_ubyte_to_srgb_ubyte(src[BCOMP]); > } > > static void > Looks good (the other fix too). Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: use new MESA_FORMAT_R8G8B8A8_SRGB
To fix the problem that Jose worked around in 1d8e3067fd9. --- src/mesa/state_tracker/st_format.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 0311a2b..0be900e7 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -147,6 +147,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_A8B8G8R8_SRGB; case MESA_FORMAT_B8G8R8A8_SRGB: return PIPE_FORMAT_B8G8R8A8_SRGB; + case MESA_FORMAT_R8G8B8A8_SRGB: + return PIPE_FORMAT_R8G8B8A8_SRGB; case MESA_FORMAT_RGBA_FLOAT32: return PIPE_FORMAT_R32G32B32A32_FLOAT; case MESA_FORMAT_RGBA_FLOAT16: @@ -754,7 +756,7 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_B8G8R8X8_SRGB: return MESA_FORMAT_B8G8R8X8_SRGB; case PIPE_FORMAT_R8G8B8A8_SRGB: - return MESA_FORMAT_B8G8R8A8_SRGB; + return MESA_FORMAT_R8G8B8A8_SRGB; default: assert(0); -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/11] meta: De-static setup_texture_coords().
On Thu, Mar 6, 2014 at 2:47 AM, Kenneth Graunke wrote: > This will be used in multiple files soon. > > Signed-off-by: Kenneth Graunke > --- > src/mesa/drivers/common/meta.c | 46 > +- > src/mesa/drivers/common/meta.h | 11 ++ > 2 files changed, 34 insertions(+), 23 deletions(-) > > diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c > index cde34f9..2ac7867 100644 > --- a/src/mesa/drivers/common/meta.c > +++ b/src/mesa/drivers/common/meta.c > @@ -2465,16 +2465,16 @@ _mesa_meta_check_generate_mipmap_fallback(struct > gl_context *ctx, GLenum target, > * \param height height of the texture image > * \param coords0/1/2/3 returns the computed texcoords > */ > -static void > -setup_texture_coords(GLenum faceTarget, > - GLint slice, > - GLint width, > - GLint height, > - GLint depth, > - GLfloat coords0[4], > - GLfloat coords1[4], > - GLfloat coords2[4], > - GLfloat coords3[4]) > +void > +_mesa_meta_setup_texture_coords(GLenum faceTarget, > +GLint slice, > +GLint width, > +GLint height, > +GLint depth, > +GLfloat coords0[4], > +GLfloat coords1[4], > +GLfloat coords2[4], > +GLfloat coords3[4]) > { > static const GLfloat st[4][2] = { >{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} > @@ -2618,7 +2618,7 @@ setup_texture_coords(GLenum faceTarget, >} >break; > default: > - assert(0 && "unexpected target in meta setup_texture_coords()"); > + assert(!"unexpected target in _mesa_meta_setup_texture_coords()"); > } > } > > @@ -2808,13 +2808,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, > GLenum target, > memset(verts, 0, sizeof(verts)); > > /* Setup texture coordinates */ > - setup_texture_coords(faceTarget, > -slice, > -0, 0, 1, /* width, height never used here */ > -verts[0].tex, > -verts[1].tex, > -verts[2].tex, > -verts[3].tex); > + _mesa_meta_setup_texture_coords(faceTarget, > + slice, > + 0, 0, 1, /* width, height never used here > */ > + verts[0].tex, > + verts[1].tex, > + verts[2].tex, > + verts[3].tex); > > /* setup vertex positions */ > verts[0].x = -1.0F; > @@ -3219,11 +3219,11 @@ decompress_texture_image(struct gl_context *ctx, > /* Silence valgrind warnings about reading uninitialized stack. */ > memset(verts, 0, sizeof(verts)); > > - setup_texture_coords(faceTarget, slice, width, height, depth, > -verts[0].tex, > -verts[1].tex, > -verts[2].tex, > -verts[3].tex); > + _mesa_meta_setup_texture_coords(faceTarget, slice, width, height, depth, > + verts[0].tex, > + verts[1].tex, > + verts[2].tex, > + verts[3].tex); > > /* setup vertex positions */ > verts[0].x = -1.0F; > diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h > index fcf45c4..d2f40f8 100644 > --- a/src/mesa/drivers/common/meta.h > +++ b/src/mesa/drivers/common/meta.h > @@ -448,6 +448,17 @@ GLboolean > _mesa_meta_alloc_texture(struct temp_texture *tex, > GLsizei width, GLsizei height, GLenum intFormat); > > +void > +_mesa_meta_setup_texture_coords(GLenum faceTarget, > +GLint slice, > +GLint width, > +GLint height, > +GLint depth, > +GLfloat coords0[4], > +GLfloat coords1[4], > +GLfloat coords2[4], > +GLfloat coords3[4]); > + > struct temp_texture * > _mesa_meta_get_temp_texture(struct gl_context *ctx); > > -- > 1.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev This Series is: Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: fix copy & paste bugs in pack_ubyte_SRGB8()
Cc: "10.0" "10.1" --- src/mesa/main/format_pack.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index e0d2a18..89958f7 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -1044,8 +1044,8 @@ pack_ubyte_SRGB8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); d[2] = linear_ubyte_to_srgb_ubyte(src[RCOMP]); - d[1] = linear_ubyte_to_srgb_ubyte(src[RCOMP]); - d[0] = linear_ubyte_to_srgb_ubyte(src[RCOMP]); + d[1] = linear_ubyte_to_srgb_ubyte(src[GCOMP]); + d[0] = linear_ubyte_to_srgb_ubyte(src[BCOMP]); } static void -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: add test_format_conversion() debug function
To check that the st_mesa_format_to_pipe_format() and st_pipe_format_to_mesa_format() functions correctly convert all corresponding Mesa/Gallium formats. This found that MESA_FORMAT_YCBCR_REV was missing in st_mesa_format_to_pipe_format(). Fixed that too. --- src/mesa/state_tracker/st_format.c | 44 +++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 0be900e7..a55ee30 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -121,6 +121,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_Z32_FLOAT_S8X24_UINT; case MESA_FORMAT_YCBCR: return PIPE_FORMAT_UYVY; + case MESA_FORMAT_YCBCR_REV: + return PIPE_FORMAT_YUYV; case MESA_FORMAT_RGB_DXT1: return PIPE_FORMAT_DXT1_RGB; case MESA_FORMAT_RGBA_DXT1: @@ -759,13 +761,41 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_R8G8B8A8_SRGB; default: - assert(0); return MESA_FORMAT_NONE; } } /** + * Debug only: check that the two functions above correctly map + * Mesa formats to Gallium formats and back again. + */ +static void +test_format_conversion(void) +{ + GLuint i; + + /* test all Mesa formats */ + for (i = 1; i < MESA_FORMAT_COUNT; i++) { + enum pipe_format pf = st_mesa_format_to_pipe_format(i); + if (pf != PIPE_FORMAT_NONE) { + mesa_format mf = st_pipe_format_to_mesa_format(pf); + assert(mf == i); + } + } + + /* Test all Gallium formats */ + for (i = 1; i < PIPE_FORMAT_COUNT; i++) { + mesa_format mf = st_pipe_format_to_mesa_format(i); + if (mf != MESA_FORMAT_NONE) { + enum pipe_format pf = st_mesa_format_to_pipe_format(mf); + assert(pf == i); + } + } +} + + +/** * Map GL texture formats to Gallium pipe formats. */ struct format_mapping @@ -1641,6 +1671,18 @@ st_choose_format(struct st_context *st, GLenum internalFormat, int i, j; enum pipe_format pf; +#ifdef DEBUG + { + static boolean firstCall = TRUE; + if (firstCall) { + test_format_conversion(); + firstCall = FALSE; + } + } +#else + (void) test_format_conversion; +#endif + /* can't render to compressed formats at this time */ if (_mesa_is_compressed_format(st->ctx, internalFormat) && (bindings & ~PIPE_BIND_SAMPLER_VIEW)) { -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] nv50, nvc0: adjust blit_3d handling of ms output textures
This fixes some unwanted scaling when the output is multisampled. Also increases nvc0 maximum supported texture size to be able to work with a 32k texture. Signed-off-by: Ilia Mirkin Cc: "10.0 10.1" --- Ran the EXT_framebuffer_multisample tests, they improve a lot. The remaining failures are probably due to incorrect sampling rather than the image being totally wrong. src/gallium/drivers/nouveau/nv50/nv50_surface.c | 12 src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 12 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index dc6d628..6073deb 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -977,6 +977,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) float x0, x1, y0, y1, z; float dz; float x_range, y_range; + float x_output, y_output; blit->mode = nv50_blit_select_mode(info); blit->color_mask = nv50_blit_derive_color_mask(info); @@ -996,11 +997,14 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) x_range = (float)info->src.box.width / (float)info->dst.box.width; y_range = (float)info->src.box.height / (float)info->dst.box.height; + x_output = 16384 << nv50_miptree(dst)->ms_x; + y_output = 16384 << nv50_miptree(dst)->ms_y; + x0 = (float)info->src.box.x - x_range * (float)info->dst.box.x; y0 = (float)info->src.box.y - y_range * (float)info->dst.box.y; - x1 = x0 + 16384.0f * x_range; - y1 = y0 + 16384.0f * y_range; + x1 = x0 + x_output * x_range; + y1 = y0 + y_output * y_range; x0 *= (float)(1 << nv50_miptree(src)->ms_x); x1 *= (float)(1 << nv50_miptree(src)->ms_x); @@ -1069,7 +1073,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) PUSH_DATAf(push, y0); PUSH_DATAf(push, z); BEGIN_NV04(push, NV50_3D(VTX_ATTR_2F_X(0)), 2); - PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_x); + PUSH_DATAf(push, x_output); PUSH_DATAf(push, 0.0f); BEGIN_NV04(push, NV50_3D(VTX_ATTR_3F_X(1)), 3); PUSH_DATAf(push, x0); @@ -1077,7 +1081,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) PUSH_DATAf(push, z); BEGIN_NV04(push, NV50_3D(VTX_ATTR_2F_X(0)), 2); PUSH_DATAf(push, 0.0f); - PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_y); + PUSH_DATAf(push, y_output); BEGIN_NV04(push, NV50_3D(VERTEX_END_GL), 1); PUSH_DATA (push, 0); } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c index 32d234e..0df5b69 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c @@ -855,6 +855,7 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info) float x0, x1, y0, y1, z; float dz; float x_range, y_range; + float x_output, y_output; blit->mode = nv50_blit_select_mode(info); blit->color_mask = nv50_blit_derive_color_mask(info); @@ -877,8 +878,11 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info) x0 = (float)info->src.box.x - x_range * (float)info->dst.box.x; y0 = (float)info->src.box.y - y_range * (float)info->dst.box.y; - x1 = x0 + 16384.0f * x_range; - y1 = y0 + 16384.0f * y_range; + x_output = 65536 << nv50_miptree(dst)->ms_x; + y_output = 65536 << nv50_miptree(dst)->ms_y; + + x1 = x0 + x_output * x_range; + y1 = y0 + y_output * y_range; x0 *= (float)(1 << nv50_miptree(src)->ms_x); x1 *= (float)(1 << nv50_miptree(src)->ms_x); @@ -953,7 +957,7 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info) PUSH_DATAf(push, z); BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); PUSH_DATA (push, 0x74200); - PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_x); + PUSH_DATAf(push, x_output); PUSH_DATAf(push, 0.0f); BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 4); PUSH_DATA (push, 0x74301); @@ -963,7 +967,7 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info) BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); PUSH_DATA (push, 0x74200); PUSH_DATAf(push, 0.0f); - PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_y); + PUSH_DATAf(push, y_output); IMMED_NVC0(push, NVC0_3D(VERTEX_END_GL), 0); } -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 75226] Dark rendering of War for the Overworld
https://bugs.freedesktop.org/show_bug.cgi?id=75226 --- Comment #18 from Erich Hoover --- (In reply to comment #17) > I've pushed the fix to master (commit 4c68c6dcf). It is verified with the > trace on radeonsi, ilo, and llvmpipe. I am closing the bug now. In case it > does not fix the real game, feel free to reopen it. Thanks so much! I'll see what I can do about getting the users to test it :) -- 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 75226] Dark rendering of War for the Overworld
https://bugs.freedesktop.org/show_bug.cgi?id=75226 commiethebeas...@gmail.com changed: What|Removed |Added CC||commiethebeas...@gmail.com -- 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 1/2] i965: Reorganize the code in brw_upload_binding_tables.
This makes both the empty and non-empty binding table paths exit through the bottom of the function, which gives us a place to share code. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_binding_tables.c | 35 +- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c index b39bd10..0de5d1a 100644 --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c @@ -58,27 +58,28 @@ brw_upload_binding_table(struct brw_context *brw, /* CACHE_NEW_*_PROG */ struct brw_stage_prog_data *prog_data = stage_state->prog_data; - /* If there are no surfaces, skip making the binding table altogether. */ if (prog_data->binding_table.size_bytes == 0) { - if (stage_state->bind_bo_offset != 0) { - brw->state.dirty.brw |= brw_new_binding_table; - stage_state->bind_bo_offset = 0; + /* There are no surfaces; skip making the binding table altogether. */ + if (stage_state->bind_bo_offset == 0) + return; + + stage_state->bind_bo_offset = 0; + } else { + /* Upload a new binding table. */ + if (INTEL_DEBUG & DEBUG_SHADER_TIME) { + brw->vtbl.create_raw_surface( +brw, brw->shader_time.bo, 0, brw->shader_time.bo->size, + &stage_state->surf_offset[prog_data->binding_table.shader_time_start], true); } - return; - } - if (INTEL_DEBUG & DEBUG_SHADER_TIME) { - brw->vtbl.create_raw_surface( - brw, brw->shader_time.bo, 0, brw->shader_time.bo->size, - &stage_state->surf_offset[prog_data->binding_table.shader_time_start], true); - } + uint32_t *bind = brw_state_batch(brw, AUB_TRACE_BINDING_TABLE, + prog_data->binding_table.size_bytes, 32, + &stage_state->bind_bo_offset); - uint32_t *bind = brw_state_batch(brw, AUB_TRACE_BINDING_TABLE, -prog_data->binding_table.size_bytes, 32, -&stage_state->bind_bo_offset); - - /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */ - memcpy(bind, stage_state->surf_offset, prog_data->binding_table.size_bytes); + /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */ + memcpy(bind, stage_state->surf_offset, + prog_data->binding_table.size_bytes); + } brw->state.dirty.brw |= brw_new_binding_table; } -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] i965: Move binding table update packets to binding table setup time.
From: Eric Anholt This keeps us from needing to reemit all the other stage state just because a surface changed. Improves unoptimized glamor x11perf -f8text by 1.10201% +/- 0.489869% (n=296). [v1] v2: (by Kenneth Graunke) - Drop binding table packets from Gen8 unit state as well. - Pass _3DSTATE_BINDING_TABLE_POINTERS_XS to brw_upload_binding_table, cutting even more code. Signed-off-by: Eric Anholt Signed-off-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_binding_tables.c | 20 +--- src/mesa/drivers/dri/i965/gen7_vs_state.c | 6 -- src/mesa/drivers/dri/i965/gen7_wm_state.c | 6 -- src/mesa/drivers/dri/i965/gen8_ps_state.c | 6 -- src/mesa/drivers/dri/i965/gen8_vs_state.c | 6 -- 5 files changed, 17 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c index 0de5d1a..1cd4bba 100644 --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c @@ -52,6 +52,7 @@ */ static void brw_upload_binding_table(struct brw_context *brw, + uint32_t packet_name, GLbitfield brw_new_binding_table, struct brw_stage_state *stage_state) { @@ -82,6 +83,13 @@ brw_upload_binding_table(struct brw_context *brw, } brw->state.dirty.brw |= brw_new_binding_table; + + if (brw->gen >= 7) { + BEGIN_BATCH(2); + OUT_BATCH(packet_name << 16 | (2 - 2)); + OUT_BATCH(stage_state->bind_bo_offset); + ADVANCE_BATCH(); + } } /** @@ -93,7 +101,9 @@ brw_upload_binding_table(struct brw_context *brw, static void brw_vs_upload_binding_table(struct brw_context *brw) { - brw_upload_binding_table(brw, BRW_NEW_VS_BINDING_TABLE, &brw->vs.base); + brw_upload_binding_table(brw, +_3DSTATE_BINDING_TABLE_POINTERS_VS, +BRW_NEW_VS_BINDING_TABLE, &brw->vs.base); } const struct brw_tracked_state brw_vs_binding_table = { @@ -112,7 +122,9 @@ const struct brw_tracked_state brw_vs_binding_table = { static void brw_upload_wm_binding_table(struct brw_context *brw) { - brw_upload_binding_table(brw, BRW_NEW_PS_BINDING_TABLE, &brw->wm.base); + brw_upload_binding_table(brw, +_3DSTATE_BINDING_TABLE_POINTERS_PS, +BRW_NEW_PS_BINDING_TABLE, &brw->wm.base); } const struct brw_tracked_state brw_wm_binding_table = { @@ -132,7 +144,9 @@ brw_gs_upload_binding_table(struct brw_context *brw) if (brw->geometry_program == NULL) return; - brw_upload_binding_table(brw, BRW_NEW_GS_BINDING_TABLE, &brw->gs.base); + brw_upload_binding_table(brw, +_3DSTATE_BINDING_TABLE_POINTERS_GS, +BRW_NEW_GS_BINDING_TABLE, &brw->gs.base); } const struct brw_tracked_state brw_gs_binding_table = { diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c index c4f1d26..0d9859b 100644 --- a/src/mesa/drivers/dri/i965/gen7_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c @@ -75,12 +75,6 @@ upload_vs_state(struct brw_context *brw) if (!brw->is_haswell) gen7_emit_vs_workaround_flush(brw); - /* BRW_NEW_VS_BINDING_TABLE */ - BEGIN_BATCH(2); - OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_VS << 16 | (2 - 2)); - OUT_BATCH(stage_state->bind_bo_offset); - ADVANCE_BATCH(); - /* CACHE_NEW_SAMPLER */ BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_VS << 16 | (2 - 2)); diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index 38067e6..ca3e275 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -143,12 +143,6 @@ upload_ps_state(struct brw_context *brw) const int max_threads_shift = brw->is_haswell ? HSW_PS_MAX_THREADS_SHIFT : IVB_PS_MAX_THREADS_SHIFT; - /* BRW_NEW_PS_BINDING_TABLE */ - BEGIN_BATCH(2); - OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_PS << 16 | (2 - 2)); - OUT_BATCH(brw->wm.base.bind_bo_offset); - ADVANCE_BATCH(); - /* CACHE_NEW_SAMPLER */ BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_PS << 16 | (2 - 2)); diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c b/src/mesa/drivers/dri/i965/gen8_ps_state.c index 561fc96..7d8f954 100644 --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c @@ -136,12 +136,6 @@ upload_ps_state(struct brw_context *brw) struct gl_context *ctx = &brw->ctx; uint32_t dw3 = 0, dw6 = 0, dw7 = 0; - /* BRW_NEW_PS_BINDING_TABLE */ - BEGIN_BATCH(2); - OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_PS << 16 | (2 - 2)); - OUT_BATCH(brw->wm.base.bind_bo_offset); - ADVANCE_BATCH(); - /* CACHE_NEW_SAMPLER */ BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_PS <<
[Mesa-dev] [PATCH] gallium: allow setting of the internal stream output offset
D3D10 allows setting of the internal offset of a buffer, which is in general only incremented via actual stream output writes. By allowing setting of the internal offset draw_auto is capable of rendering from buffers which have not been actually streamed out to. Our interface didn't allow. This change functionally shouldn't make any difference to OpenGL where instead of an append_bitmask you just get a real array where -1 means append (like in D3D) and 0 means do not append. Signed-off-by: Zack Rusin --- src/gallium/auxiliary/cso_cache/cso_context.c | 13 - src/gallium/auxiliary/cso_cache/cso_context.h | 2 +- src/gallium/auxiliary/draw/draw_pt.c | 8 +--- src/gallium/auxiliary/hud/hud_context.c | 2 +- src/gallium/auxiliary/postprocess/pp_run.c| 2 +- src/gallium/auxiliary/util/u_blit.c | 2 +- src/gallium/auxiliary/util/u_blitter.c| 13 + src/gallium/auxiliary/util/u_gen_mipmap.c | 2 +- src/gallium/docs/source/context.rst | 9 + src/gallium/drivers/galahad/glhd_context.c| 4 ++-- src/gallium/drivers/ilo/ilo_state.c | 8 ++-- src/gallium/drivers/llvmpipe/lp_state_so.c| 7 --- src/gallium/drivers/noop/noop_state.c | 2 +- src/gallium/drivers/nouveau/nv50/nv50_state.c | 7 --- src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 7 --- src/gallium/drivers/radeon/r600_pipe_common.h | 2 +- src/gallium/drivers/radeon/r600_streamout.c | 5 - src/gallium/drivers/radeonsi/si_descriptors.c | 4 ++-- src/gallium/drivers/softpipe/sp_state_so.c| 2 +- src/gallium/drivers/trace/tr_context.c| 6 +++--- src/gallium/include/pipe/p_context.h | 2 +- src/gallium/tools/trace/dump_state.py | 4 ++-- src/mesa/state_tracker/st_cb_bitmap.c | 2 +- src/mesa/state_tracker/st_cb_clear.c | 2 +- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- src/mesa/state_tracker/st_cb_drawtex.c| 2 +- src/mesa/state_tracker/st_cb_xformfb.c| 20 +--- 27 files changed, 84 insertions(+), 57 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 2dcf01d..9146684 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -332,7 +332,7 @@ void cso_release_all( struct cso_context *ctx ) ctx->pipe->bind_vertex_elements_state( ctx->pipe, NULL ); if (ctx->pipe->set_stream_output_targets) - ctx->pipe->set_stream_output_targets(ctx->pipe, 0, NULL, 0); + ctx->pipe->set_stream_output_targets(ctx->pipe, 0, NULL, NULL); } /* free fragment sampler views */ @@ -1241,7 +1241,7 @@ void cso_set_stream_outputs(struct cso_context *ctx, unsigned num_targets, struct pipe_stream_output_target **targets, - unsigned append_bitmask) + const unsigned *offsets) { struct pipe_context *pipe = ctx->pipe; uint i; @@ -1266,7 +1266,7 @@ cso_set_stream_outputs(struct cso_context *ctx, } pipe->set_stream_output_targets(pipe, num_targets, targets, - append_bitmask); + offsets); ctx->nr_so_targets = num_targets; } @@ -1292,6 +1292,7 @@ cso_restore_stream_outputs(struct cso_context *ctx) { struct pipe_context *pipe = ctx->pipe; uint i; + unsigned offset[PIPE_MAX_SO_BUFFERS]; if (!ctx->has_streamout) { return; @@ -1302,19 +1303,21 @@ cso_restore_stream_outputs(struct cso_context *ctx) return; } + assert(ctx->nr_so_targets_saved <= PIPE_MAX_SO_BUFFERS); for (i = 0; i < ctx->nr_so_targets_saved; i++) { pipe_so_target_reference(&ctx->so_targets[i], NULL); /* move the reference from one pointer to another */ ctx->so_targets[i] = ctx->so_targets_saved[i]; ctx->so_targets_saved[i] = NULL; + /* -1 means append */ + offset[i] = (unsigned)-1; } for (; i < ctx->nr_so_targets; i++) { pipe_so_target_reference(&ctx->so_targets[i], NULL); } - /* ~0 means append */ pipe->set_stream_output_targets(pipe, ctx->nr_so_targets_saved, - ctx->so_targets, ~0); + ctx->so_targets, offset); ctx->nr_so_targets = ctx->nr_so_targets_saved; ctx->nr_so_targets_saved = 0; diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 822e2df..1aa9998 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -115,7 +115,7 @@ unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx); void cso_set_stream_outputs(struct cso_context *ctx, unsigned num_targets, struct pipe_stream_outp
[Mesa-dev] [Bug 71547] compilation failure :#error "SSE4.1 instruction set not enabled"
https://bugs.freedesktop.org/show_bug.cgi?id=71547 Matt Turner changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #7 from Matt Turner --- Pushed and marked for 10.0 and 10.1 branches. -- 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 v3] i965: Move binding table update packets to binding table setup time.
From: Eric Anholt This keeps us from needing to reemit all the other stage state just because a surface changed. Improves unoptimized glamor x11perf -f8text by 1.10201% +/- 0.489869% (n=296). [v1] v2: (by Kenneth Graunke) - Drop binding table packets from Gen8 unit state as well. - Pass _3DSTATE_BINDING_TABLE_POINTERS_XS to brw_upload_binding_table, cutting even more code. v3: Don't forget to drop them from 3DSTATE_GS (botched refactor in v2). Signed-off-by: Eric Anholt Signed-off-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_binding_tables.c | 20 +--- src/mesa/drivers/dri/i965/gen7_gs_state.c | 6 -- src/mesa/drivers/dri/i965/gen7_vs_state.c | 6 -- src/mesa/drivers/dri/i965/gen7_wm_state.c | 6 -- src/mesa/drivers/dri/i965/gen8_gs_state.c | 6 -- src/mesa/drivers/dri/i965/gen8_ps_state.c | 6 -- src/mesa/drivers/dri/i965/gen8_vs_state.c | 6 -- 7 files changed, 17 insertions(+), 39 deletions(-) I accidentally dropped the GS stuff in v2 of this patch. Fixed now and re-piglited on Haswell. diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c index 0de5d1a..1cd4bba 100644 --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c @@ -52,6 +52,7 @@ */ static void brw_upload_binding_table(struct brw_context *brw, + uint32_t packet_name, GLbitfield brw_new_binding_table, struct brw_stage_state *stage_state) { @@ -82,6 +83,13 @@ brw_upload_binding_table(struct brw_context *brw, } brw->state.dirty.brw |= brw_new_binding_table; + + if (brw->gen >= 7) { + BEGIN_BATCH(2); + OUT_BATCH(packet_name << 16 | (2 - 2)); + OUT_BATCH(stage_state->bind_bo_offset); + ADVANCE_BATCH(); + } } /** @@ -93,7 +101,9 @@ brw_upload_binding_table(struct brw_context *brw, static void brw_vs_upload_binding_table(struct brw_context *brw) { - brw_upload_binding_table(brw, BRW_NEW_VS_BINDING_TABLE, &brw->vs.base); + brw_upload_binding_table(brw, +_3DSTATE_BINDING_TABLE_POINTERS_VS, +BRW_NEW_VS_BINDING_TABLE, &brw->vs.base); } const struct brw_tracked_state brw_vs_binding_table = { @@ -112,7 +122,9 @@ const struct brw_tracked_state brw_vs_binding_table = { static void brw_upload_wm_binding_table(struct brw_context *brw) { - brw_upload_binding_table(brw, BRW_NEW_PS_BINDING_TABLE, &brw->wm.base); + brw_upload_binding_table(brw, +_3DSTATE_BINDING_TABLE_POINTERS_PS, +BRW_NEW_PS_BINDING_TABLE, &brw->wm.base); } const struct brw_tracked_state brw_wm_binding_table = { @@ -132,7 +144,9 @@ brw_gs_upload_binding_table(struct brw_context *brw) if (brw->geometry_program == NULL) return; - brw_upload_binding_table(brw, BRW_NEW_GS_BINDING_TABLE, &brw->gs.base); + brw_upload_binding_table(brw, +_3DSTATE_BINDING_TABLE_POINTERS_GS, +BRW_NEW_GS_BINDING_TABLE, &brw->gs.base); } const struct brw_tracked_state brw_gs_binding_table = { diff --git a/src/mesa/drivers/dri/i965/gen7_gs_state.c b/src/mesa/drivers/dri/i965/gen7_gs_state.c index b179d19..d18ae15 100644 --- a/src/mesa/drivers/dri/i965/gen7_gs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_gs_state.c @@ -66,12 +66,6 @@ upload_gs_state(struct brw_context *brw) /* CACHE_NEW_GS_PROG */ const struct brw_vec4_prog_data *prog_data = &brw->gs.prog_data->base; - /* BRW_NEW_GS_BINDING_TABLE */ - BEGIN_BATCH(2); - OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_GS << 16 | (2 - 2)); - OUT_BATCH(stage_state->bind_bo_offset); - ADVANCE_BATCH(); - /* CACHE_NEW_SAMPLER */ BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_GS << 16 | (2 - 2)); diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c index c4f1d26..0d9859b 100644 --- a/src/mesa/drivers/dri/i965/gen7_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c @@ -75,12 +75,6 @@ upload_vs_state(struct brw_context *brw) if (!brw->is_haswell) gen7_emit_vs_workaround_flush(brw); - /* BRW_NEW_VS_BINDING_TABLE */ - BEGIN_BATCH(2); - OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_VS << 16 | (2 - 2)); - OUT_BATCH(stage_state->bind_bo_offset); - ADVANCE_BATCH(); - /* CACHE_NEW_SAMPLER */ BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_VS << 16 | (2 - 2)); diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index 38067e6..ca3e275 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -143,12 +143,6 @@ upload_ps_state(struct brw_context *brw) const int max_threads_shift = brw->is_haswell ? HSW_PS_MAX_THREADS_SHIFT : IVB_PS
[Mesa-dev] [Bug 75797] EGL application crashes with BadDrawable at SwapBuffers
https://bugs.freedesktop.org/show_bug.cgi?id=75797 --- Comment #1 from Kristian Høgsberg --- Created attachment 95275 --> https://bugs.freedesktop.org/attachment.cgi?id=95275&action=edit Proposed fix I think we should just remove the optimization since a 0x0 size always indicate that we haven't fetched buffers yet. -- 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] clover: Fix build against LLVM SVN r203065 or newer
From: Michel Dänzer llvm/Linker.h was moved to llvm/Linker/Linker.h. Signed-off-by: Michel Dänzer --- src/gallium/state_trackers/clover/llvm/invocation.cpp | 4 1 file changed, 4 insertions(+) diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp index a9ac83b..a81bdf8 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp @@ -29,7 +29,11 @@ #include #include #include +#if HAVE_LLVM < 0x0305 #include +#else +#include +#endif #if HAVE_LLVM < 0x0303 #include #include -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] clover: Fix build against LLVM SVN r203065 or newer
On Fri, Mar 07, 2014 at 10:49:59AM +0900, Michel Dänzer wrote: > From: Michel Dänzer > > llvm/Linker.h was moved to llvm/Linker/Linker.h. > > Signed-off-by: Michel Dänzer Reviewed-by: Tom Stellard > --- > src/gallium/state_trackers/clover/llvm/invocation.cpp | 4 > 1 file changed, 4 insertions(+) > > diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp > b/src/gallium/state_trackers/clover/llvm/invocation.cpp > index a9ac83b..a81bdf8 100644 > --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp > +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp > @@ -29,7 +29,11 @@ > #include > #include > #include > +#if HAVE_LLVM < 0x0305 > #include > +#else > +#include > +#endif > #if HAVE_LLVM < 0x0303 > #include > #include > -- > 1.9.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: add test_format_conversion() debug function
Reviewed-by: Marek Olšák Marek On Thu, Mar 6, 2014 at 7:53 PM, Brian Paul wrote: > To check that the st_mesa_format_to_pipe_format() and > st_pipe_format_to_mesa_format() functions correctly convert > all corresponding Mesa/Gallium formats. > > This found that MESA_FORMAT_YCBCR_REV was missing in > st_mesa_format_to_pipe_format(). Fixed that too. > --- > src/mesa/state_tracker/st_format.c | 44 > +++- > 1 file changed, 43 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/state_tracker/st_format.c > b/src/mesa/state_tracker/st_format.c > index 0be900e7..a55ee30 100644 > --- a/src/mesa/state_tracker/st_format.c > +++ b/src/mesa/state_tracker/st_format.c > @@ -121,6 +121,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) >return PIPE_FORMAT_Z32_FLOAT_S8X24_UINT; > case MESA_FORMAT_YCBCR: >return PIPE_FORMAT_UYVY; > + case MESA_FORMAT_YCBCR_REV: > + return PIPE_FORMAT_YUYV; > case MESA_FORMAT_RGB_DXT1: >return PIPE_FORMAT_DXT1_RGB; > case MESA_FORMAT_RGBA_DXT1: > @@ -759,13 +761,41 @@ st_pipe_format_to_mesa_format(enum pipe_format format) >return MESA_FORMAT_R8G8B8A8_SRGB; > > default: > - assert(0); >return MESA_FORMAT_NONE; > } > } > > > /** > + * Debug only: check that the two functions above correctly map > + * Mesa formats to Gallium formats and back again. > + */ > +static void > +test_format_conversion(void) > +{ > + GLuint i; > + > + /* test all Mesa formats */ > + for (i = 1; i < MESA_FORMAT_COUNT; i++) { > + enum pipe_format pf = st_mesa_format_to_pipe_format(i); > + if (pf != PIPE_FORMAT_NONE) { > + mesa_format mf = st_pipe_format_to_mesa_format(pf); > + assert(mf == i); > + } > + } > + > + /* Test all Gallium formats */ > + for (i = 1; i < PIPE_FORMAT_COUNT; i++) { > + mesa_format mf = st_pipe_format_to_mesa_format(i); > + if (mf != MESA_FORMAT_NONE) { > + enum pipe_format pf = st_mesa_format_to_pipe_format(mf); > + assert(pf == i); > + } > + } > +} > + > + > +/** > * Map GL texture formats to Gallium pipe formats. > */ > struct format_mapping > @@ -1641,6 +1671,18 @@ st_choose_format(struct st_context *st, GLenum > internalFormat, > int i, j; > enum pipe_format pf; > > +#ifdef DEBUG > + { > + static boolean firstCall = TRUE; > + if (firstCall) { > + test_format_conversion(); > + firstCall = FALSE; > + } > + } > +#else > + (void) test_format_conversion; > +#endif > + > /* can't render to compressed formats at this time */ > if (_mesa_is_compressed_format(st->ctx, internalFormat) > && (bindings & ~PIPE_BIND_SAMPLER_VIEW)) { > -- > 1.7.10.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 1/2] vl: Add rotation
Signed-off-by: Kusanagi Kouichi --- src/gallium/auxiliary/vl/vl_compositor.c | 64 src/gallium/auxiliary/vl/vl_compositor.h | 18 + 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 3cea044..ad08b52 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -577,10 +577,48 @@ calc_src_and_dst(struct vl_compositor_layer *layer, unsigned width, unsigned hei static void gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) { + struct vertex2f tl, tr, br, bl; + assert(vb && layer); - vb[ 0].x = layer->dst.tl.x; - vb[ 0].y = layer->dst.tl.y; + switch (layer->rotate) { + default: + case VL_COMPOSITOR_ROTATE_0: + tl = layer->dst.tl; + tr.x = layer->dst.br.x; + tr.y = layer->dst.tl.y; + br = layer->dst.br; + bl.x = layer->dst.tl.x; + bl.y = layer->dst.br.y; + break; + case VL_COMPOSITOR_ROTATE_90: + tl.x = layer->dst.br.x; + tl.y = layer->dst.tl.y; + tr = layer->dst.br; + br.x = layer->dst.tl.x; + br.y = layer->dst.br.y; + bl = layer->dst.tl; + break; + case VL_COMPOSITOR_ROTATE_180: + tl = layer->dst.br; + tr.x = layer->dst.tl.x; + tr.y = layer->dst.br.y; + br = layer->dst.tl; + bl.x = layer->dst.br.x; + bl.y = layer->dst.tl.y; + break; + case VL_COMPOSITOR_ROTATE_270: + tl.x = layer->dst.tl.x; + tl.y = layer->dst.br.y; + tr = layer->dst.tl; + br.x = layer->dst.br.x; + br.y = layer->dst.tl.y; + bl = layer->dst.br; + break; + } + + vb[ 0].x = tl.x; + vb[ 0].y = tl.y; vb[ 1].x = layer->src.tl.x; vb[ 1].y = layer->src.tl.y; vb[ 2] = layer->zw; @@ -589,8 +627,8 @@ gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) vb[ 4].x = layer->colors[0].z; vb[ 4].y = layer->colors[0].w; - vb[ 5].x = layer->dst.br.x; - vb[ 5].y = layer->dst.tl.y; + vb[ 5].x = tr.x; + vb[ 5].y = tr.y; vb[ 6].x = layer->src.br.x; vb[ 6].y = layer->src.tl.y; vb[ 7] = layer->zw; @@ -599,8 +637,8 @@ gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) vb[ 9].x = layer->colors[1].z; vb[ 9].y = layer->colors[1].w; - vb[10].x = layer->dst.br.x; - vb[10].y = layer->dst.br.y; + vb[10].x = br.x; + vb[10].y = br.y; vb[11].x = layer->src.br.x; vb[11].y = layer->src.br.y; vb[12] = layer->zw; @@ -609,8 +647,8 @@ gen_rect_verts(struct vertex2f *vb, struct vl_compositor_layer *layer) vb[14].x = layer->colors[2].z; vb[14].y = layer->colors[2].w; - vb[15].x = layer->dst.tl.x; - vb[15].y = layer->dst.br.y; + vb[15].x = bl.x; + vb[15].y = bl.y; vb[16].x = layer->src.tl.x; vb[16].y = layer->src.br.y; vb[17] = layer->zw; @@ -964,6 +1002,16 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *s, } void +vl_compositor_set_layer_rotation(struct vl_compositor_state *s, + unsigned layer, + enum vl_compositor_rotation rotate) +{ + assert(s); + assert(layer < VL_COMPOSITOR_MAX_LAYERS); + s->layers[layer].rotate = rotate; +} + +void vl_compositor_render(struct vl_compositor_state *s, struct vl_compositor *c, struct pipe_surface*dst_surface, diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 97cbef0..934b634 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -53,6 +53,15 @@ enum vl_compositor_deinterlace VL_COMPOSITOR_BOB_BOTTOM }; +/* clockwise degree */ +enum vl_compositor_rotation +{ + VL_COMPOSITOR_ROTATE_0, + VL_COMPOSITOR_ROTATE_90, + VL_COMPOSITOR_ROTATE_180, + VL_COMPOSITOR_ROTATE_270 +}; + struct vl_compositor_layer { bool clearing; @@ -70,6 +79,7 @@ struct vl_compositor_layer } src, dst; struct vertex2f zw; struct vertex4f colors[4]; + enum vl_compositor_rotation rotate; }; struct vl_compositor_state @@ -216,6 +226,14 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *state, struct u_rect *dst_rect, struct vertex4f *colors); +/** + * set the layer rotation + */ +void +vl_compositor_set_layer_rotation(struct vl_compositor_state *state, + unsigned layer, + enum vl_compositor_rotation rotate); + /*@}*/ /** -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 2/2] st/vdpau: Add rotation
Signed-off-by: Kusanagi Kouichi --- src/gallium/state_trackers/vdpau/output.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 9cb1106..457f678 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -658,6 +658,11 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface, vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view, RectToPipe(source_rect, &src_rect), NULL, ColorsToPipe(colors, flags, vlcolors)); + STATIC_ASSERT(VL_COMPOSITOR_ROTATE_0 == VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); + STATIC_ASSERT(VL_COMPOSITOR_ROTATE_90 == VDP_OUTPUT_SURFACE_RENDER_ROTATE_90); + STATIC_ASSERT(VL_COMPOSITOR_ROTATE_180 == VDP_OUTPUT_SURFACE_RENDER_ROTATE_180); + STATIC_ASSERT(VL_COMPOSITOR_ROTATE_270 == VDP_OUTPUT_SURFACE_RENDER_ROTATE_270); + vl_compositor_set_layer_rotation(cstate, 0, flags & 3); vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect)); vl_compositor_render(cstate, compositor, dst_vlsurface->surface, &dst_vlsurface->dirty_area, false); @@ -717,6 +722,7 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface, vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view, RectToPipe(source_rect, &src_rect), NULL, ColorsToPipe(colors, flags, vlcolors)); + vl_compositor_set_layer_rotation(cstate, 0, flags & 3); vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect)); vl_compositor_render(cstate, compositor, dst_vlsurface->surface, &dst_vlsurface->dirty_area, false); -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] glapi: remove u_mutex wrapper code, use c99 thread mutexes directly
On Thu, Mar 6, 2014 at 11:03 PM, Brian Paul wrote: > On 03/05/2014 08:37 PM, Chia-I Wu wrote: >> >> On Thu, Mar 6, 2014 at 7:06 AM, Brian Paul wrote: >>> >>> --- >>> src/mapi/mapi.c | 10 +- >>> src/mapi/stub.c |6 +++--- >>> src/mapi/u_current.c |6 +++--- >>> src/mapi/u_execmem.c |6 +++--- >>> src/mapi/u_thread.h | 10 -- >>> 5 files changed, 14 insertions(+), 24 deletions(-) >>> >>> diff --git a/src/mapi/mapi.c b/src/mapi/mapi.c >>> index 56f209b..8d0baca 100644 >>> --- a/src/mapi/mapi.c >>> +++ b/src/mapi/mapi.c >>> @@ -72,15 +72,15 @@ get_stub(const char *name, const struct mapi_stub >>> *alias) >>> void >>> mapi_init(const char *spec) >>> { >>> - u_mutex_declare_static(mutex); >>> + static mtx_t mutex = _MTX_INITIALIZER_NP; >>> const char *p; >>> int ver, count; >>> >>> - u_mutex_lock(mutex); >>> + mtx_lock(&mutex); >>> >>> /* already initialized */ >>> if (mapi_num_stubs) { >>> - u_mutex_unlock(mutex); >>> + mtx_unlock(&mutex); >>> return; >>> } >>> >>> @@ -90,7 +90,7 @@ mapi_init(const char *spec) >>> /* parse version string */ >>> ver = atoi(p); >>> if (ver != 1) { >>> - u_mutex_unlock(mutex); >>> + mtx_unlock(&mutex); >>> return; >>> } >>> p += strlen(p) + 1; >>> @@ -115,7 +115,7 @@ mapi_init(const char *spec) >>> >>> mapi_num_stubs = count; >>> >>> - u_mutex_unlock(mutex); >>> + mtx_unlock(&mutex); >>> } >>> >>> /** >>> diff --git a/src/mapi/stub.c b/src/mapi/stub.c >>> index acd2c0a..b5db597 100644 >>> --- a/src/mapi/stub.c >>> +++ b/src/mapi/stub.c >>> @@ -126,11 +126,11 @@ stub_add_dynamic(const char *name) >>> struct mapi_stub * >>> stub_find_dynamic(const char *name, int generate) >>> { >>> - u_mutex_declare_static(dynamic_mutex); >>> + static mtx_t dynamic_mutex = _MTX_INITIALIZER_NP >>> PTHREAD_MUTEX_INITIALIZER; >> >> PTHREAD_MUTEX_INITIALIZER should be dropped. With that fixed, > > > Got it. Thanks. I guess this code didn't get compiled in my current > configuration. I'm still trying to figure out all the mapi/ code. I don't > yet understand the (four!) different mapi compile modes and when they're > used. With --enable-shared-glapi, mapi is compiled twice. Once in MAPI_MODE_GLAPI mode, to create libglapi.so, which is an implementation of glapi.h. And then once again in MAPI_MODE_BRIDGE mode, which provides all glFoo() symbols and gets statically linked to by libGL.so. Those glFoo() call into libglapi.so to get/set current dispatch table and etc. With --disable-shared-glapi, a different implementation of glapi.h and glFoo() symbols is created and is statically linked to by libGL.so. In this case, mapi is compiled once in MAPI_MODE_UTIL mode, to provide u_current and u_execmem utility functions. The old code, src/mapi/glapi/*.[ch], is used only when --disable-shared-glapi is given. It is so because mapi does not have a replacement for gl_SPARC_asm.py. Otherwise, we could get rid of the old code and use mapi everywhere. > > -Brian > -- o...@lunarg.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
On Fri, Mar 7, 2014 at 2:04 AM, Jose Fonseca wrote: > > > - Original Message - >> Am 06.03.2014 18:32, schrieb Jose Fonseca: >> > >> > >> > - Original Message - >> >> >> >> >> >> - Original Message - >> >>> On 03/06/2014 09:59 AM, jfons...@vmware.com wrote: >> From: José Fonseca >> >> With the recent SRGB changes all my automated OpenGL llvmpipe tests >> (piglit, conform, glretrace) start asserting with the backtrace below. >> >> I'm hoping this change will fix it. I'm not entirely sure, as this >> doesn't happen in my development machine (the bug probably depends on >> the exact X visual). >> >> Anyway, it seems the sensible thing to do here. >> >> Program terminated with signal 5, Trace/breakpoint trap. >> #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", >> file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", >> line=line@entry=758, function=function@entry=0x7fa324e40160 >> <__func__.34798> "st_pipe_format_to_mesa_format") at >> src/gallium/auxiliary/util/u_debug.c:281 >> #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", >> file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", >> line=line@entry=758, function=function@entry=0x7fa324e40160 >> <__func__.34798> "st_pipe_format_to_mesa_format") at >> src/gallium/auxiliary/util/u_debug.c:281 >> No locals. >> #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format >> (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at >> src/mesa/state_tracker/st_format.c:758 >> __func__ = "st_pipe_format_to_mesa_format" >> #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb >> (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, >> sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 >> strb = 0x19e8420 >> #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer >> (stfb=stfb@entry=0x19e7fa0, idx=) at >> src/mesa/state_tracker/st_manager.c:314 >> rb = >> format = PIPE_FORMAT_R8G8B8A8_SRGB >> sw = >> #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, >> st=0x19e7fa0, stfbi=0x19e7a30) at >> src/mesa/state_tracker/st_manager.c:458 >> stfb = 0x19e7fa0 >> mode = {rgbMode = 1 '\001', floatMode = 0 '\000', >> colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode >> = >> 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', >> haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, >> blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, >> blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, >> accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, >> accumAlphaBits = 0, depthBits = 24, stencilBits = 8, >> numAuxBuffers = 0, level = 0, visualRating = 0, >> transparentPixel = 0, transparentRed = 0, transparentGreen = >> 0, transparentBlue = 0, transparentAlpha = 0, >> transparentIndex >> = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, >> maxPbufferHeight = 0, maxPbufferPixels = 0, >> optimalPbufferWidth = 0, optimalPbufferHeight = 0, >> swapMethod >> = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, >> bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted >> = >> 0, sRGBCapable = 1} >> idx = >> #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, >> fb=, stfbi=stfbi@entry=0x19e7a30) at >> src/mesa/state_tracker/st_manager.c:728 >> No locals. >> #6 0x7fa32409e8cc in st_api_make_current (stapi=> out>, >> stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at >> src/mesa/state_tracker/st_manager.c:747 >> st = 0x19dfce0 >> stdraw = 0x640064 >> stread = 0x130006 >> ret = >> #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, >> drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at >> src/gallium/state_trackers/glx/xlib/xm_api.c:1194 >> No locals. >> #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, >> draw=8388610, read=8388610, ctx=0x195bac0) at >> src/gallium/state_trackers/glx/xlib/glx_api.c:1177 >> drawBuffer = >> readBuffer = >> xmctx = 0x195bb00 >> glxCtx = 0x195bac0 >> firsttime = 0 '\000' >> >>>
Re: [Mesa-dev] [PATCH] st/mesa: use new MESA_FORMAT_R8G8B8A8_SRGB
On Fri, Mar 7, 2014 at 2:39 AM, Brian Paul wrote: > To fix the problem that Jose worked around in 1d8e3067fd9. Looks good to me. > --- > src/mesa/state_tracker/st_format.c |4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/state_tracker/st_format.c > b/src/mesa/state_tracker/st_format.c > index 0311a2b..0be900e7 100644 > --- a/src/mesa/state_tracker/st_format.c > +++ b/src/mesa/state_tracker/st_format.c > @@ -147,6 +147,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) >return PIPE_FORMAT_A8B8G8R8_SRGB; > case MESA_FORMAT_B8G8R8A8_SRGB: >return PIPE_FORMAT_B8G8R8A8_SRGB; > + case MESA_FORMAT_R8G8B8A8_SRGB: > + return PIPE_FORMAT_R8G8B8A8_SRGB; > case MESA_FORMAT_RGBA_FLOAT32: >return PIPE_FORMAT_R32G32B32A32_FLOAT; > case MESA_FORMAT_RGBA_FLOAT16: > @@ -754,7 +756,7 @@ st_pipe_format_to_mesa_format(enum pipe_format format) > case PIPE_FORMAT_B8G8R8X8_SRGB: >return MESA_FORMAT_B8G8R8X8_SRGB; > case PIPE_FORMAT_R8G8B8A8_SRGB: > - return MESA_FORMAT_B8G8R8A8_SRGB; > + return MESA_FORMAT_R8G8B8A8_SRGB; > > default: >assert(0); > -- > 1.7.10.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev -- o...@lunarg.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
On Fri, Mar 7, 2014 at 11:56 AM, Chia-I Wu wrote: > On Fri, Mar 7, 2014 at 2:04 AM, Jose Fonseca wrote: >> >> >> - Original Message - >>> Am 06.03.2014 18:32, schrieb Jose Fonseca: >>> > >>> > >>> > - Original Message - >>> >> >>> >> >>> >> - Original Message - >>> >>> On 03/06/2014 09:59 AM, jfons...@vmware.com wrote: >>> From: José Fonseca >>> >>> With the recent SRGB changes all my automated OpenGL llvmpipe tests >>> (piglit, conform, glretrace) start asserting with the backtrace below. >>> >>> I'm hoping this change will fix it. I'm not entirely sure, as this >>> doesn't happen in my development machine (the bug probably depends on >>> the exact X visual). >>> >>> Anyway, it seems the sensible thing to do here. >>> >>> Program terminated with signal 5, Trace/breakpoint trap. >>> #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", >>> file=file@entry=0x7fa324e3fc30 >>> "src/mesa/state_tracker/st_format.c", >>> line=line@entry=758, function=function@entry=0x7fa324e40160 >>> <__func__.34798> "st_pipe_format_to_mesa_format") at >>> src/gallium/auxiliary/util/u_debug.c:281 >>> #0 _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", >>> file=file@entry=0x7fa324e3fc30 >>> "src/mesa/state_tracker/st_format.c", >>> line=line@entry=758, function=function@entry=0x7fa324e40160 >>> <__func__.34798> "st_pipe_format_to_mesa_format") at >>> src/gallium/auxiliary/util/u_debug.c:281 >>> No locals. >>> #1 0x7fa3241d22b3 in st_pipe_format_to_mesa_format >>> (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at >>> src/mesa/state_tracker/st_format.c:758 >>> __func__ = "st_pipe_format_to_mesa_format" >>> #2 0x7fa3241c8ec5 in st_new_renderbuffer_fb >>> (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, >>> sw=) at src/mesa/state_tracker/st_cb_fbo.c:295 >>> strb = 0x19e8420 >>> #3 0x7fa32409d355 in st_framebuffer_add_renderbuffer >>> (stfb=stfb@entry=0x19e7fa0, idx=) at >>> src/mesa/state_tracker/st_manager.c:314 >>> rb = >>> format = PIPE_FORMAT_R8G8B8A8_SRGB >>> sw = >>> #4 0x7fa32409e635 in st_framebuffer_create (st=0x19e7fa0, >>> st=0x19e7fa0, stfbi=0x19e7a30) at >>> src/mesa/state_tracker/st_manager.c:458 >>> stfb = 0x19e7fa0 >>> mode = {rgbMode = 1 '\001', floatMode = 0 '\000', >>> colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode >>> = >>> 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', >>> haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, >>> blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, >>> blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, >>> accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, >>> accumAlphaBits = 0, depthBits = 24, stencilBits = 8, >>> numAuxBuffers = 0, level = 0, visualRating = 0, >>> transparentPixel = 0, transparentRed = 0, transparentGreen >>> = >>> 0, transparentBlue = 0, transparentAlpha = 0, >>> transparentIndex >>> = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, >>> maxPbufferHeight = 0, maxPbufferPixels = 0, >>> optimalPbufferWidth = 0, optimalPbufferHeight = 0, >>> swapMethod >>> = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, >>> bindToMipmapTexture = 0, bindToTextureTargets = 0, >>> yInverted >>> = >>> 0, sRGBCapable = 1} >>> idx = >>> #5 st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, >>> fb=, stfbi=stfbi@entry=0x19e7a30) at >>> src/mesa/state_tracker/st_manager.c:728 >>> No locals. >>> #6 0x7fa32409e8cc in st_api_make_current (stapi=>> out>, >>> stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at >>> src/mesa/state_tracker/st_manager.c:747 >>> st = 0x19dfce0 >>> stdraw = 0x640064 >>> stread = 0x130006 >>> ret = >>> #7 0x7fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, >>> drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at >>> src/gallium/state_trackers/glx/xlib/xm_api.c:1194 >>> No locals. >>> #8 0x7fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, >>> draw=8388610, read=8388610, ctx=0x195bac0) at >>> src/gallium/state_trackers/glx/xlib/glx_api.c:1177 >>> >>
[Mesa-dev] [PATCH 2/4] mesa/main: add generic bits of ARB_clear_texture impl
Signed-off-by: Ilia Mirkin --- I believe I've addressed all the comments from Brian and Ian. If you still see something you mentioned before, please assume incompetence rather than malice :) I'm happy to get rid of the border stuff and just stuck a assert(border == 0) in there. Like I said -- I'm really unsure as to what these things are. But if I do leave it in, I think that using Width is correct, at least in the comments, Width is listed as 2^logwidth + 2*border, so the clear will go from -border to 2^logwidth + border. src/mesa/main/dd.h | 14 + src/mesa/main/teximage.c | 150 ++- 2 files changed, 163 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 9715241..f05d62c 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -275,6 +275,20 @@ struct dd_function_table { GLint level, mesa_format format, GLint width, GLint height, GLint depth, GLint border); + + + /** +* Called by glClearTexImage and glClearTexSubImage. Should clear the +* specified area with the specified texel, provided in the TexFormat of +* the texImage. +*/ + void (*ClearTexSubImage)(struct gl_context *ctx, +struct gl_texture_image *texImage, +GLint xoffset, GLint yoffset, GLint zoffset, +GLsizei width, GLsizei height, GLsizei depth, +const GLubyte *clearValue, +GLsizeiptr clearValueSize); + /*@}*/ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 2e671b0..65f0684 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -48,6 +48,7 @@ #include "texobj.h" #include "texstate.h" #include "texstorage.h" +#include "texstore.h" #include "textureview.h" #include "mtypes.h" #include "glformats.h" @@ -3794,22 +3795,169 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, x, y, width, height); } +static struct gl_texture_image * +get_tex_image(struct gl_context *ctx, const char *function, + GLuint texture, GLint level, GLint zoffset) +{ + GLenum target = 0; + struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture); + struct gl_texture_image *texImage; + + if (!texture || !texObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid texture)", function); + return NULL; + } + + switch (texObj->Target) { + case GL_TEXTURE_BUFFER: + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(texture can't be buffer)", function); + return NULL; + case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP_ARRAY: + target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset; + break; + default: + break; + } + + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(missing image)", function); + return NULL; + } + + return texImage; +} + +static void +clear_tex_sub_image(struct gl_context *ctx, const char *function, +struct gl_texture_image *texImage, +GLint xoffset, GLint yoffset, GLint zoffset, +GLsizei width, GLsizei height, GLsizei depth, +GLenum format, GLenum type, const void *data) +{ + GLenum ret; + GLubyte clearValue[MAX_PIXEL_BYTES]; + GLubyte *clearValuePtr = clearValue; + GLsizeiptr clearValueSize; + + if (!texImage) + return; + + ret = _mesa_error_check_format_and_type(ctx, format, type); + if (ret != GL_NO_ERROR) { + _mesa_error(ctx, ret, "%s(invalid format, type)", function); + return; + } + + if (_mesa_is_compressed_format(ctx, texImage->InternalFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(compressed format)", function); + return; + } + + if (texImage->_BaseFormat == GL_DEPTH_COMPONENT) { + if (format != GL_DEPTH_COMPONENT) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid format)", function); + return; + } + } else if (texImage->_BaseFormat == GL_DEPTH_STENCIL) { + if (format != GL_DEPTH_STENCIL) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid format)", function); + return; + } + } else if (texImage->_BaseFormat == GL_STENCIL_INDEX) { + if (format != GL_STENCIL_INDEX) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid format)", function); + return; + } + } else { + assert(_mesa_is_color_format(texImage->_BaseFormat)); + if (format == GL_DEPTH_COMPONENT || + format == GL_DEPTH_STENCIL || + format == GL_STENCIL_INDEX) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid format)", function); + return; + } + } + + if (_mesa_is_format_integer_color
[Mesa-dev] [PATCH 1/4] mesa/main: add ARB_clear_texture entrypoints
Signed-off-by: Ilia Mirkin --- Using void instead of GLvoid doesn't work -- the script that reads these xml files doesn't know about it (at least in the const GLvoid * context) src/mapi/glapi/gen/ARB_clear_texture.xml | 34 src/mapi/glapi/gen/gl_API.xml| 2 ++ src/mesa/main/extensions.c | 1 + src/mesa/main/mtypes.h | 1 + src/mesa/main/tests/dispatch_sanity.cpp | 4 src/mesa/main/teximage.c | 16 +++ src/mesa/main/teximage.h | 10 ++ 7 files changed, 68 insertions(+) create mode 100644 src/mapi/glapi/gen/ARB_clear_texture.xml diff --git a/src/mapi/glapi/gen/ARB_clear_texture.xml b/src/mapi/glapi/gen/ARB_clear_texture.xml new file mode 100644 index 000..bd9116f --- /dev/null +++ b/src/mapi/glapi/gen/ARB_clear_texture.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 7e1946e..15f8e32 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8515,6 +8515,8 @@ +http://www.w3.org/2001/XInclude"/> + diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index a72284c..77da1eb 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -86,6 +86,7 @@ static const struct extension extension_table[] = { { "GL_ARB_buffer_storage", o(ARB_buffer_storage), GL, 2013 }, { "GL_ARB_clear_buffer_object", o(dummy_true), GL, 2012 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, + { "GL_ARB_clear_texture", o(ARB_clear_texture), GL, 2013 }, { "GL_ARB_compute_shader", o(ARB_compute_shader), GL, 2012 }, { "GL_ARB_copy_buffer", o(dummy_true), GL, 2008 }, { "GL_ARB_conservative_depth", o(ARB_conservative_depth), GL, 2011 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d05649c..c5abab6 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3491,6 +3491,7 @@ struct gl_extensions GLboolean ARB_base_instance; GLboolean ARB_blend_func_extended; GLboolean ARB_buffer_storage; + GLboolean ARB_clear_texture; GLboolean ARB_color_buffer_float; GLboolean ARB_compute_shader; GLboolean ARB_conservative_depth; diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index d1b0011..8690b5d 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -936,6 +936,10 @@ const struct function gl_core_functions_possible[] = { /* GL_ARB_buffer_storage */ { "glBufferStorage", 43, -1 }, + /* GL_ARB_clear_texture */ + { "glClearTexImage", 13, -1 }, + { "glClearTexSubImage", 13, -1 }, + { NULL, 0, -1 } }; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index a6c3581..2e671b0 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3794,6 +3794,22 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, x, y, width, height); } +void GLAPIENTRY +_mesa_ClearTexSubImage( GLuint texture, GLint level, +GLint xoffset, GLint yoffset, GLint zoffset, +GLsizei width, GLsizei height, GLsizei depth, +GLenum format, GLenum type, const void *data ) +{ + +} + +void GLAPIENTRY +_mesa_ClearTexImage( GLuint texture, GLint level, + GLenum format, GLenum type, const void *data ) +{ + +} + diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 51d94d1..f247d51 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -261,6 +261,16 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, extern void GLAPIENTRY +_mesa_ClearTexSubImage( GLuint texture, GLint level, +GLint xoffset, GLint yoffset, GLint zoffset, +GLsizei width, GLsizei height, GLsizei depth, +GLenum format, GLenum type, const void *data ); + +extern void GLAPIENTRY +_mesa_ClearTexImage( GLuint texture, GLint level, + GLenum format, GLenum type, const void *data ); + +extern void GLAPIENTRY _mesa_CompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize
[Mesa-dev] [RFC PATCH 4/4] nv50: provide a clear_resource implementation
Signed-off-by: Ilia Mirkin --- This isn't really for inclusion quite yet, but rather a demonstration. I'm pretty sure I've messed up at least some of the cases. It should all become more apparent once more piglit tests are available, testing more things. [Among other things, I know I'm leaking the nv50_surface I create.] src/gallium/drivers/nouveau/nv50/nv50_surface.c | 78 + 1 file changed, 78 insertions(+) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index 6073deb..0302eda 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -27,6 +27,7 @@ #include "util/u_inlines.h" #include "util/u_pack_color.h" #include "util/u_format.h" +#include "util/u_math.h" #include "util/u_surface.h" #include "tgsi/tgsi_ureg.h" @@ -290,6 +291,12 @@ nv50_clear_render_target(struct pipe_context *pipe, BEGIN_NV04(push, NV50_3D(RT_CONTROL), 1); PUSH_DATA (push, 1); + BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2); + PUSH_DATA (push, width << 16); + PUSH_DATA (push, height << 16); + BEGIN_NV04(push, NV50_3D(SCISSOR_HORIZ(0)), 2); + PUSH_DATA (push, width << 16); + PUSH_DATA (push, height << 16); BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(0)), 5); PUSH_DATAh(push, bo->offset + sf->offset); PUSH_DATA (push, bo->offset + sf->offset); @@ -393,6 +400,76 @@ nv50_clear_depth_stencil(struct pipe_context *pipe, nv50->dirty |= NV50_NEW_FRAMEBUFFER; } +static void +nv50_clear_resource(struct pipe_context *pipe, +struct pipe_resource *res, +const struct pipe_box *box, +const void *data) +{ + struct nv50_miptree *mt = nv50_miptree(res); + struct nv50_surface *sf; + enum pipe_format dst_fmt; + union pipe_color_union color; + + assert(res->target != PIPE_BUFFER); + + switch (util_format_get_blocksizebits(res->format)) { + case 128: + dst_fmt = PIPE_FORMAT_R32G32B32A32_UINT; + memcpy(&color.ui, data, 128 / 8); + break; + case 64: + dst_fmt = PIPE_FORMAT_R32G32_UINT; + memcpy(&color.ui, data, 64 / 8); + memset(&color.ui[2], 0, 64 / 8); + break; + case 32: + dst_fmt = PIPE_FORMAT_R32_UINT; + memcpy(&color.ui, data, 32 / 8); + memset(&color.ui[1], 0, 96 / 8); + break; + case 16: + dst_fmt = PIPE_FORMAT_R16_UINT; + color.ui[0] = util_cpu_to_le32( +util_le16_to_cpu(*(unsigned short *)data)); + memset(&color.ui[1], 0, 96 / 8); + break; + case 8: + dst_fmt = PIPE_FORMAT_R8_UINT; + color.ui[0] = util_cpu_to_le32(*(unsigned char *)data); + memset(&color.ui[1], 0, 96 / 8); + break; + default: + assert(!"Unknown texel element size"); + return; + } + + sf = CALLOC_STRUCT(nv50_surface); + if (!sf) + return; + + pipe_reference_init(&sf->base.reference, 1); + pipe_resource_reference(&sf->base.texture, res); + + /* XXX check 3D textures vs *_ARRAY textures */ + /* XXX should I call nv50_miptree_surface_new? */ + sf->base.context = pipe; + sf->base.format = dst_fmt; + sf->base.writable = 1; + sf->base.u.tex.first_layer = box->z; + sf->base.u.tex.last_layer = box->z + box->depth; + sf->base.width = sf->width = res->width0 << mt->ms_x; + sf->base.height = sf->height = res->height0 << mt->ms_y; + sf->depth = MIN2(box->depth, MAX2(res->depth0, res->array_size)) - box->z; + if (mt->layout_3d) + sf->offset += nv50_mt_zslice_offset(mt, 0, box->z); + else + sf->offset += mt->layer_stride * box->z; + + nv50_clear_render_target(pipe, &sf->base, &color, +box->x, box->y, box->width, box->height); +} + void nv50_clear(struct pipe_context *pipe, unsigned buffers, const union pipe_color_union *color, @@ -1401,6 +1478,7 @@ nv50_init_surface_functions(struct nv50_context *nv50) pipe->resource_copy_region = nv50_resource_copy_region; pipe->blit = nv50_blit; pipe->flush_resource = nv50_flush_resource; + pipe->clear_resource = nv50_clear_resource; pipe->clear_render_target = nv50_clear_render_target; pipe->clear_depth_stencil = nv50_clear_depth_stencil; } -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] st/mesa: add an api for clearing resources and ARB_clear_texture impl
Signed-off-by: Ilia Mirkin --- Unfortunately a generic implementation isn't possible since this has to deal with multisampled textures, where the storage format isn't well-defined. Maybe we can assume that in each case it will be a certain amount of width/height increase and create PIPE_CAP's? Probably not worth it, since each driver will want to provide an accelerated version. Christoph also suggested that maybe we should abuse the clear_render_target interface -- that's how I've implemented nv50 internally. But I don't think we can really guarantee that all drivers would work that way. Is clear_resource the right thing to call it, or should it be clear_surface and take a pipe_surface? I was concerned that it might not be legal to create a pipe_surface with a texture format that's non-renderable-to. src/gallium/include/pipe/p_context.h | 9 + src/mesa/state_tracker/st_cb_texture.c | 23 +++ src/mesa/state_tracker/st_extensions.c | 3 +++ 3 files changed, 35 insertions(+) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 0702729..ab4c198 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -291,6 +291,15 @@ struct pipe_context { void (*blit)(struct pipe_context *pipe, const struct pipe_blit_info *info); + /** +* Clear the resource with the specified texel. Not guaranteed to be a +* renderable format. Data provided in the resource's format. +*/ + void (*clear_resource)(struct pipe_context *pipe, + struct pipe_resource *res, + const struct pipe_box *box, + const void *data); + /*@}*/ /** diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index f0bf374..1cb9efb 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1746,6 +1746,28 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target, } } +static void +st_ClearTexSubImage(struct gl_context *ctx, +struct gl_texture_image *texImage, +GLint xoffset, GLint yoffset, GLint zoffset, +GLsizei width, GLsizei height, GLsizei depth, +const GLubyte *clearValue, GLsizeiptr clearValueSize) +{ + struct st_texture_image *stImage = st_texture_image(texImage); + struct pipe_resource *pt = stImage->pt; + struct st_context *st = st_context(ctx); + struct pipe_context *pipe = st->pipe; + struct pipe_box box; + + /* XXX need to handle data stored in stImage->TexData? */ + if (!pt) + return; + + u_box_3d(xoffset, yoffset, zoffset, width, height, depth, &box); + + pipe->clear_resource(pipe, pt, &box, clearValue); +} + void st_init_texture_functions(struct dd_function_table *functions) @@ -1777,4 +1799,5 @@ st_init_texture_functions(struct dd_function_table *functions) functions->TestProxyTexImage = st_TestProxyTexImage; functions->AllocTextureStorage = st_AllocTextureStorage; + functions->ClearTexSubImage = st_ClearTexSubImage; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 18ddd4e..bda3127 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -797,4 +797,7 @@ void st_init_extensions(struct st_context *st) } if (ctx->Const.MaxProgramTextureGatherComponents > 0) ctx->Extensions.ARB_texture_gather = GL_TRUE; + + if (st->pipe->clear_resource) + ctx->Extensions.ARB_clear_texture = GL_TRUE; } -- 1.8.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 66346] shader_query.cpp:49: error: invalid conversion from 'void*' to 'GLuint'
https://bugs.freedesktop.org/show_bug.cgi?id=66346 --- Comment #3 from Vinson Lee --- mesa: 378c6f2246d66254ce0f88cac6daf25b1c012a41 (master 10.2.0-devel) Mac OS X build is still broken. -- 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
Re: [Mesa-dev] [PATCH 1/4] mesa/main: add ARB_clear_texture entrypoints
On 03/07/2014 08:41 AM, Ilia Mirkin wrote: diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index a72284c..77da1eb 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -86,6 +86,7 @@ static const struct extension extension_table[] = { { "GL_ARB_buffer_storage", o(ARB_buffer_storage), GL, 2013 }, { "GL_ARB_clear_buffer_object", o(dummy_true), GL, 2012 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, + { "GL_ARB_clear_texture", o(ARB_clear_texture), GL, 2013 }, { "GL_ARB_compute_shader", o(ARB_compute_shader), GL, 2012 }, { "GL_ARB_copy_buffer", o(dummy_true), GL, 2008 }, { "GL_ARB_conservative_depth", o(ARB_conservative_depth), GL, 2011 }, Move that line one line up to get the list alphabetically sorted. -- Petri Latvala ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] mesa/main: add ARB_clear_texture entrypoints
On Fri, Mar 7, 2014 at 1:57 AM, Petri Latvala wrote: > On 03/07/2014 08:41 AM, Ilia Mirkin wrote: >> >> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c >> index a72284c..77da1eb 100644 >> --- a/src/mesa/main/extensions.c >> +++ b/src/mesa/main/extensions.c >> @@ -86,6 +86,7 @@ static const struct extension extension_table[] = { >> { "GL_ARB_buffer_storage", >> o(ARB_buffer_storage), GL, 2013 }, >> { "GL_ARB_clear_buffer_object", o(dummy_true), >> GL, 2012 }, >> { "GL_ARB_color_buffer_float", >> o(ARB_color_buffer_float), GL, 2004 }, >> + { "GL_ARB_clear_texture", o(ARB_clear_texture), >> GL, 2013 }, >> { "GL_ARB_compute_shader", >> o(ARB_compute_shader), GL, 2012 }, >> { "GL_ARB_copy_buffer", o(dummy_true), >> GL, 2008 }, >> { "GL_ARB_conservative_depth", >> o(ARB_conservative_depth), GL, 2011 }, >> > > Move that line one line up to get the list alphabetically sorted. Of course. Embarassing. -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev