Mesa (master): Revert "st/mesa: use sRGB formats for MSAA resolving if destination is sRGB"
Module: Mesa Branch: master Commit: 0c7047ab9cbcc13ecaca9a4fda5073b8d3b7a7f5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c7047ab9cbcc13ecaca9a4fda5073b8d3b7a7f5 Author: Kenneth GraunkeDate: Wed Aug 3 11:32:21 2016 -0700 Revert "st/mesa: use sRGB formats for MSAA resolving if destination is sRGB" This reverts commit 4e549ddb500cf677b6fa16d9ebdfa67cc23da097, dropping the hack from Gallium that I just deleted from i965. See the previous commit for rationale. Reviewed-by: Nicolai Hähnle --- src/mesa/state_tracker/st_cb_blit.c | 32 1 file changed, 32 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 826152d..5e7c34c 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -46,34 +46,6 @@ static void -st_adjust_blit_for_msaa_resolve(struct pipe_blit_info *blit) -{ - /* Even though we do multisample resolves at the time of the blit, OpenGL -* specification defines them as if they happen at the time of rendering, -* which means that the type of averaging we do during the resolve should -* only depend on the source format; the destination format should be -* ignored. But, specification doesn't seem to be strict about it. -* -* It has been observed that mulitisample resolves produce slightly better -* looking images when averaging is done using destination format. NVIDIA's -* proprietary OpenGL driver also follows this approach. -* -* When multisampling, if the source and destination formats are equal -* (aside from the color space), we choose to blit in sRGB space to get -* this higher quality image. -*/ - if (blit->src.resource->nr_samples > 1 && - blit->dst.resource->nr_samples <= 1) { - blit->dst.format = blit->dst.resource->format; - - if (util_format_is_srgb(blit->dst.resource->format)) - blit->src.format = util_format_srgb(blit->src.resource->format); - else - blit->src.format = util_format_linear(blit->src.resource->format); - } -} - -static void st_BlitFramebuffer(struct gl_context *ctx, struct gl_framebuffer *readFB, struct gl_framebuffer *drawFB, @@ -232,8 +204,6 @@ st_BlitFramebuffer(struct gl_context *ctx, blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace; blit.src.format = util_format_linear(srcObj->pt->format); - st_adjust_blit_for_msaa_resolve(); - st->pipe->blit(st->pipe, ); dstRb->defined = true; /* front buffer tracking */ } @@ -270,8 +240,6 @@ st_BlitFramebuffer(struct gl_context *ctx, blit.src.box.z = srcSurf->u.tex.first_layer; blit.src.format = util_format_linear(srcSurf->format); - st_adjust_blit_for_msaa_resolve(); - st->pipe->blit(st->pipe, ); dstRb->defined = true; /* front buffer tracking */ } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: Make Gallium' s BlitFramebuffer follow the GL 4.4 sRGB rules.
Module: Mesa Branch: master Commit: 3190c7ee9727161d627f107c2e7f8ec3a11941c1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3190c7ee9727161d627f107c2e7f8ec3a11941c1 Author: Kenneth GraunkeDate: Wed Aug 3 11:39:18 2016 -0700 st/mesa: Make Gallium's BlitFramebuffer follow the GL 4.4 sRGB rules. OpenGL 4.4 specifies that BlitFramebuffer should perform sRGB encode and decode like ES 3.x does, but only when GL_FRAMEBUFFER_SRGB is enabled. This is technically incompatible in certain cases, but is more consistent across GL, ES, and WebGL, and more flexible. The NVIDIA 367.35 drivers appear to follow this behavior. For the awful spec analysis, please read Piglit's tests/spec/arb_framebuffer_srgb/blit.c, which explains the differences between GL 4.1, 4.2, 4.3 (2012), 4.3 (2013), and 4.4, and why this is the right rule to implement. Signed-off-by: Kenneth Graunke Reviewed-by: Nicolai Hähnle --- src/mesa/state_tracker/st_cb_blit.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 5e7c34c..cfcf3f7 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -44,6 +44,14 @@ #include "util/u_format.h" +static void +st_adjust_blit_for_srgb(struct pipe_blit_info *blit, bool framebuffer_srgb) +{ + if (!framebuffer_srgb) { + blit->dst.format = util_format_linear(blit->dst.format); + blit->src.format = util_format_linear(blit->src.format); + } +} static void st_BlitFramebuffer(struct gl_context *ctx, @@ -197,12 +205,14 @@ st_BlitFramebuffer(struct gl_context *ctx, blit.dst.resource = dstSurf->texture; blit.dst.level = dstSurf->u.tex.level; blit.dst.box.z = dstSurf->u.tex.first_layer; - blit.dst.format = util_format_linear(dstSurf->format); + blit.dst.format = dstSurf->format; blit.src.resource = srcObj->pt; blit.src.level = srcAtt->TextureLevel; blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace; - blit.src.format = util_format_linear(srcObj->pt->format); + blit.src.format = srcObj->pt->format; + + st_adjust_blit_for_srgb(, ctx->Color.sRGBEnabled); st->pipe->blit(st->pipe, ); dstRb->defined = true; /* front buffer tracking */ @@ -233,12 +243,14 @@ st_BlitFramebuffer(struct gl_context *ctx, blit.dst.resource = dstSurf->texture; blit.dst.level = dstSurf->u.tex.level; blit.dst.box.z = dstSurf->u.tex.first_layer; - blit.dst.format = util_format_linear(dstSurf->format); + blit.dst.format = dstSurf->format; blit.src.resource = srcSurf->texture; blit.src.level = srcSurf->u.tex.level; blit.src.box.z = srcSurf->u.tex.first_layer; - blit.src.format = util_format_linear(srcSurf->format); + blit.src.format = srcSurf->format; + + st_adjust_blit_for_srgb(, ctx->Color.sRGBEnabled); st->pipe->blit(st->pipe, ); dstRb->defined = true; /* front buffer tracking */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meta: Make Meta's BlitFramebuffer() follow the GL 4.4 sRGB rules.
Module: Mesa Branch: master Commit: f6dc71483abb876386824ba97097089cc0b8f454 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6dc71483abb876386824ba97097089cc0b8f454 Author: Kenneth GraunkeDate: Tue Aug 2 16:32:52 2016 -0700 meta: Make Meta's BlitFramebuffer() follow the GL 4.4 sRGB rules. Just avoid whacking GL_FRAMEBUFFER_SRGB altogether, so we respect the application's setting. This appears to work. v2: Update one more comment (requested by Ian). Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/drivers/common/meta_blit.c | 84 + 1 file changed, 30 insertions(+), 54 deletions(-) diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index d6d3a42..991d52f 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -606,7 +606,6 @@ blitframebuffer_texture(struct gl_context *ctx, GLenum filter, GLint flipX, GLint flipY, GLboolean glsl_version, GLboolean do_depth) { - struct save_state *save = >Meta->Save[ctx->Meta->SaveStackDepth - 1]; int att_index = do_depth ? BUFFER_DEPTH : readFb->_ColorReadBufferIndex; const struct gl_renderbuffer_attachment *readAtt = >Attachment[att_index]; @@ -719,57 +718,32 @@ blitframebuffer_texture(struct gl_context *ctx, fb_tex_blit.samp_obj = _mesa_meta_setup_sampler(ctx, texObj, target, filter, srcLevel); - /* For desktop GL, we do our blits with no net sRGB decode or encode. -* -* However, if both the src and dst can be srgb decode/encoded, enable them -* so that we do any blending (from scaling or from MSAA resolves) in the -* right colorspace. -* -* Our choice of not doing any net encode/decode is from the GL 3.0 -* specification: -* -* "Blit operations bypass the fragment pipeline. The only fragment -* operations which affect a blit are the pixel ownership test and the -* scissor test." -* -* The GL 4.4 specification disagrees and says that the sRGB part of the -* fragment pipeline applies, but this was found to break applications -* (such as Left 4 Dead 2). -* -* However, for ES 3.0, we follow the specification and perform sRGB -* decoding and encoding. The specification has always been clear in -* the ES world, and hasn't changed over time. -*/ if (ctx->Extensions.EXT_texture_sRGB_decode) { - bool src_srgb = _mesa_get_format_color_encoding(rb->Format) == GL_SRGB; - if (save->API == API_OPENGLES2 && ctx->Version >= 30) { - /* From the ES 3.0.4 specification, page 198: - * "When values are taken from the read buffer, if the value of - * FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING for the framebuffer - * attachment corresponding to the read buffer is SRGB (see section - * 6.1.13), the red, green, and blue components are converted from - * the non-linear sRGB color space according to equation 3.24. - * - * When values are written to the draw buffers, blit operations - * bypass the fragment pipeline. The only fragment operations which - * affect a blit are the pixel ownership test, the scissor test, - * and sRGB conversion (see section 4.1.8)." - */ - _mesa_set_sampler_srgb_decode(ctx, fb_tex_blit.samp_obj, - src_srgb ? GL_DECODE_EXT -: GL_SKIP_DECODE_EXT); - _mesa_set_framebuffer_srgb(ctx, drawFb->Visual.sRGBCapable); - } else { - if (src_srgb && drawFb->Visual.sRGBCapable) { -_mesa_set_sampler_srgb_decode(ctx, fb_tex_blit.samp_obj, - GL_DECODE_EXT); -_mesa_set_framebuffer_srgb(ctx, GL_TRUE); - } else { -_mesa_set_sampler_srgb_decode(ctx, fb_tex_blit.samp_obj, - GL_SKIP_DECODE_EXT); -/* set_framebuffer_srgb was set by _mesa_meta_begin(). */ - } - } + /* The GL 4.4 spec, section 18.3.1 ("Blitting Pixel Rectangles") says: + * + *"When values are taken from the read buffer, if FRAMEBUFFER_SRGB + * is enabled and the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING + * for the framebuffer attachment corresponding to the read buffer + * is SRGB (see section 9.2.3), the red, green, and blue components + * are converted from the non-linear sRGB color space according to + * equation 3.24. + * + * When values are written to the draw buffers, blit operations + * bypass most of the fragment pipeline. The only fragment + * operations which affect a blit are the
Mesa (master): i965: Drop the "do resolves in sRGB" hack.
Module: Mesa Branch: master Commit: cc27c7fe38dde3cfde30eb88dd5088b139d71f26 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc27c7fe38dde3cfde30eb88dd5088b139d71f26 Author: Kenneth GraunkeDate: Tue Aug 2 11:04:01 2016 -0700 i965: Drop the "do resolves in sRGB" hack. I've never quite understood the purpose of this hack - supposedly, doing resolves in the sRGB colorspace is slightly more accurate. Currently, BlitFramebuffer() ignores sRGB encoding and decoding on OpenGL, although it encodes and decodes in GLES 3.x. The updated OpenGL 4.4 rules also allow for encoding and decoding if GL_FRAMEBUFFER_SRGB is enabled, allowing the application to control what colorspace blits are done in. I don't think this hack makes any sense in such a world - the application can do what it wants, and we shouldn't second guess them. A related Piglit patch, "Make multisample accuracy test set GL_FRAMEBUFFER_SRGB when resolving." makes the Piglit MSAA accuracy test explicitly request SRGB encoding/decoding during resolves when running "srgb" subtests. Without that patch, this commit will regress those tests, but with it, they should continue to work just fine. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 24 1 file changed, 24 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index a54680e..7532aac 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -1659,30 +1659,6 @@ brw_blorp_blit_miptrees(struct brw_context *brw, brw_blorp_surface_info_init(brw, , dst_mt, dst_level, dst_layer, dst_format, true); - /* Even though we do multisample resolves at the time of the blit, OpenGL -* specification defines them as if they happen at the time of rendering, -* which means that the type of averaging we do during the resolve should -* only depend on the source format; the destination format should be -* ignored. But, specification doesn't seem to be strict about it. -* -* It has been observed that mulitisample resolves produce slightly better -* looking images when averaging is done using destination format. NVIDIA's -* proprietary OpenGL driver also follow this approach. So, we choose to -* follow it in our driver. -* -* When multisampling, if the source and destination formats are equal -* (aside from the color space), we choose to blit in sRGB space to get -* this higher quality image. -*/ - if (params.src.num_samples > 1 && - _mesa_get_format_color_encoding(dst_mt->format) == GL_SRGB && - _mesa_get_srgb_format_linear(src_mt->format) == - _mesa_get_srgb_format_linear(dst_mt->format)) { - assert(brw->format_supported_as_render_target[dst_mt->format]); - params.dst.brw_surfaceformat = brw->render_target_format[dst_mt->format]; - params.src.brw_surfaceformat = brw_format_for_mesa_format(dst_mt->format); - } - /* When doing a multisample resolve of a GL_LUMINANCE32F or GL_INTENSITY32F * texture, the above code configures the source format for L32_FLOAT or * I32_FLOAT, and the destination format for R32_FLOAT. On Sandy Bridge, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Make BLORP' s BlitFramebuffer follow the GL 4.4 sRGB rules.
Module: Mesa Branch: master Commit: ad32dcf630c387e01f415f98717aad08d20ff9f2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad32dcf630c387e01f415f98717aad08d20ff9f2 Author: Kenneth GraunkeDate: Mon Aug 1 21:56:38 2016 -0700 i965: Make BLORP's BlitFramebuffer follow the GL 4.4 sRGB rules. OpenGL 4.4 specifies that BlitFramebuffer should perform sRGB encode and decode like ES 3.x does, but only when GL_FRAMEBUFFER_SRGB is enabled. This is technically incompatible in certain cases, but is more consistent across GL, ES, and WebGL, and more flexible. The NVIDIA 367.35 drivers appear to follow this behavior. For the awful spec analysis, please read Piglit's tests/spec/arb_framebuffer_srgb/blit.c, which explains the differences between GL 4.1, 4.2, 4.3 (2012), 4.3 (2013), and 4.4, and why this is the right rule to implement. Note that ctx->Color.sRGBEnabled is initialized to _mesa_is_gles(ctx), and ES doesn't have enable/disable flags for GL_FRAMEBUFFER_SRGB, so it's effectively on all the time. This means the ES behavior should be unchanged. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 20bbe7f..b903de1 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -61,11 +61,14 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit, GLfloat dstX0, GLfloat dstY0, GLfloat dstX1, GLfloat dstY1, GLenum filter, bool mirror_x, bool mirror_y) { + const struct gl_context *ctx = >ctx; + /* Find source/dst miptrees */ struct intel_mipmap_tree *src_mt = find_miptree(buffer_bit, src_irb); struct intel_mipmap_tree *dst_mt = find_miptree(buffer_bit, dst_irb); - const bool es = _mesa_is_gles(>ctx); + const bool do_srgb = ctx->Color.sRGBEnabled; + /* Do the blit */ brw_blorp_blit_miptrees(brw, src_mt, src_irb->mt_level, src_irb->mt_layer, @@ -75,7 +78,7 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, filter, mirror_x, mirror_y, - es, es); + do_srgb, do_srgb); dst_irb->need_downsample = true; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.
Module: Mesa Branch: master Commit: b1586526e84ab6eab2023b589da8e153f70dda50 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1586526e84ab6eab2023b589da8e153f70dda50 Author: Kenneth GraunkeDate: Tue Aug 2 20:58:30 2016 -0700 i965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion. Modern OpenGL BlitFramebuffer require sRGB encode/decode when GL_FRAMEBUFFER_SRGB is enabled. The blitter can't handle this, so we need to bail. On Gen4-5, this means falling back to Meta, which should handle it. We allow sRGB <-> sRGB blits, as decode then encode ought to be a noop (other than potential precision loss, which nobody wants anyway). Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/drivers/dri/i965/intel_blit.c | 4 ++-- src/mesa/drivers/dri/i965/intel_fbo.c | 8 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index 23e1ab6..8df5b48 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -211,8 +211,8 @@ intel_miptree_blit(struct brw_context *brw, return false; /* No sRGB decode or encode is done by the hardware blitter, which is -* consistent with what we want in the callers (glCopyTexSubImage(), -* glBlitFramebuffer(), texture validation, etc.). +* consistent with what we want in many callers (glCopyTexSubImage(), +* texture validation, etc.). */ mesa_format src_format = _mesa_get_srgb_format_linear(src_mt->format); mesa_format dst_format = _mesa_get_srgb_format_linear(dst_mt->format); diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 707a9d2..573c3a8 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -828,6 +828,14 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx, return mask; } + if (ctx->Color.sRGBEnabled && + _mesa_get_format_color_encoding(src_irb->mt->format) != + _mesa_get_format_color_encoding(dst_irb->mt->format)) { +perf_debug("glBlitFramebuffer() with sRGB conversion cannot be " + "handled by BLT path.\n"); +return mask; + } + if (!intel_miptree_blit(brw, src_irb->mt, src_irb->mt_level, src_irb->mt_layer, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Make BLORP do sRGB encode/decode on ES 2 as well.
Module: Mesa Branch: master Commit: 352401f6a9e50021e06459017de72c695ae684c2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=352401f6a9e50021e06459017de72c695ae684c2 Author: Kenneth GraunkeDate: Tue Aug 2 23:48:47 2016 -0700 i965: Make BLORP do sRGB encode/decode on ES 2 as well. This should have no effect, as all drivers which support BLORP also support ES 3.0 - so ES 2.0 would be promoted and follow the ES 3 rules. ES 1.0 doesn't have BlitFramebuffer. This is purely to clarify the next patch a bit. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 7532aac..20bbe7f 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -65,7 +65,7 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit, struct intel_mipmap_tree *src_mt = find_miptree(buffer_bit, src_irb); struct intel_mipmap_tree *dst_mt = find_miptree(buffer_bit, dst_irb); - const bool es3 = _mesa_is_gles3(>ctx); + const bool es = _mesa_is_gles(>ctx); /* Do the blit */ brw_blorp_blit_miptrees(brw, src_mt, src_irb->mt_level, src_irb->mt_layer, @@ -75,7 +75,7 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, filter, mirror_x, mirror_y, - es3, es3); + es, es); dst_irb->need_downsample = true; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/android: Add support for YV12 pixel format (v2)
Module: Mesa Branch: master Commit: 3723e9826f3662ed8ff160f8f24a9b7ee2617db9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3723e9826f3662ed8ff160f8f24a9b7ee2617db9 Author: Tomasz FigaDate: Tue Aug 2 20:07:54 2016 +0900 egl/android: Add support for YV12 pixel format (v2) This patch adds support for YV12 pixel format to the Android platform backend. Only creating EGL images is supported, it is not added to the list of available visuals. v2: Use const array defined just for YV12 instead of trying to be overly generic. Signed-off-by: Tomasz Figa Signed-off-by: Kalyan Kondapally Tested-by: Rob Herring Reviewed-by: Chad Versace Change-Id: I4aeb2d67a95c5cdd10b530c549b23146c8f0b983 --- src/egl/drivers/dri2/platform_android.c | 56 + 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 596833e..25ceb0e 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -40,6 +40,8 @@ #include "egl_dri2_fallbacks.h" #include "gralloc_drm.h" +#define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1)) + static int get_format_bpp(int native) { @@ -57,6 +59,9 @@ get_format_bpp(int native) case HAL_PIXEL_FORMAT_RGB_565: bpp = 2; break; + case HAL_PIXEL_FORMAT_YV12: + bpp = 1; + break; default: bpp = 0; break; @@ -73,6 +78,7 @@ static int get_fourcc(int native) case HAL_PIXEL_FORMAT_BGRA_: return __DRI_IMAGE_FOURCC_ARGB; case HAL_PIXEL_FORMAT_RGBA_: return __DRI_IMAGE_FOURCC_ABGR; case HAL_PIXEL_FORMAT_RGBX_: return __DRI_IMAGE_FOURCC_XBGR; + case HAL_PIXEL_FORMAT_YV12: return __DRI_IMAGE_FOURCC_YVU420; default: _eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", native); } @@ -483,22 +489,60 @@ static _EGLImage * droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx, struct ANativeWindowBuffer *buf, int fd) { + unsigned int offsets[3] = { 0, 0, 0 }; + unsigned int pitches[3] = { 0, 0, 0 }; + const int fourcc = get_fourcc(buf->format); - const int pitch = buf->stride * get_format_bpp(buf->format); + if (fourcc == -1) { + _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); + return NULL; + } - const EGLint attr_list[14] = { + pitches[0] = buf->stride * get_format_bpp(buf->format); + if (pitches[0] == 0) { + _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); + return NULL; + } + + switch (buf->format) { + case HAL_PIXEL_FORMAT_YV12: + /* Y plane is assumed to be at offset 0. */ + /* Cr plane is located after Y plane */ + offsets[1] = offsets[0] + pitches[0] * buf->height; + pitches[1] = ALIGN(pitches[0] / 2, 16); + /* Cb plane is located after Cr plane */ + offsets[2] = offsets[1] + pitches[1] * buf->height / 2; + pitches[2] = pitches[1]; + + const EGLint attr_list_yv12[] = { + EGL_WIDTH, buf->width, + EGL_HEIGHT, buf->height, + EGL_LINUX_DRM_FOURCC_EXT, fourcc, + EGL_DMA_BUF_PLANE0_FD_EXT, fd, + EGL_DMA_BUF_PLANE0_PITCH_EXT, pitches[0], + EGL_DMA_BUF_PLANE0_OFFSET_EXT, offsets[0], + EGL_DMA_BUF_PLANE1_FD_EXT, fd, + EGL_DMA_BUF_PLANE1_PITCH_EXT, pitches[1], + EGL_DMA_BUF_PLANE1_OFFSET_EXT, offsets[1], + EGL_DMA_BUF_PLANE2_FD_EXT, fd, + EGL_DMA_BUF_PLANE2_PITCH_EXT, pitches[2], + EGL_DMA_BUF_PLANE2_OFFSET_EXT, offsets[2], + EGL_NONE, 0 + }; + + return dri2_create_image_dma_buf(disp, ctx, NULL, attr_list_yv12); + } + + const EGLint attr_list[] = { EGL_WIDTH, buf->width, EGL_HEIGHT, buf->height, EGL_LINUX_DRM_FOURCC_EXT, fourcc, EGL_DMA_BUF_PLANE0_FD_EXT, fd, - EGL_DMA_BUF_PLANE0_PITCH_EXT, pitch, + EGL_DMA_BUF_PLANE0_PITCH_EXT, pitches[0], EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, EGL_NONE, 0 }; - if (fourcc == -1 || pitch == 0) - return NULL; - return dri2_create_image_dma_buf(disp, ctx, NULL, attr_list); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv/pipeline: rename info to rs_info in emit_rs_state
Module: Mesa Branch: master Commit: a3c472a2ec58038c5cd6b61f0c33260d38cd816e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3c472a2ec58038c5cd6b61f0c33260d38cd816e Author: Lionel LandwerlinDate: Mon Aug 8 20:30:07 2016 +0100 anv/pipeline: rename info to rs_info in emit_rs_state Signed-off-by: Lionel Landwerlin Reviewed-by: Anuj Phogat Reviewed-by: Jason Ekstrand --- src/intel/vulkan/genX_pipeline_util.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h index c17d930..0aa85ba 100644 --- a/src/intel/vulkan/genX_pipeline_util.h +++ b/src/intel/vulkan/genX_pipeline_util.h @@ -364,7 +364,7 @@ static const uint32_t vk_to_gen_front_face[] = { static void emit_rs_state(struct anv_pipeline *pipeline, - const VkPipelineRasterizationStateCreateInfo *info, + const VkPipelineRasterizationStateCreateInfo *rs_info, const struct anv_render_pass *pass, const struct anv_subpass *subpass, const struct anv_graphics_pipeline_create_info *extra) @@ -398,10 +398,10 @@ emit_rs_state(struct anv_pipeline *pipeline, raster.ForceMultisampling = false; #endif - raster.FrontWinding = vk_to_gen_front_face[info->frontFace]; - raster.CullMode = vk_to_gen_cullmode[info->cullMode]; - raster.FrontFaceFillMode = vk_to_gen_fillmode[info->polygonMode]; - raster.BackFaceFillMode = vk_to_gen_fillmode[info->polygonMode]; + raster.FrontWinding = vk_to_gen_front_face[rs_info->frontFace]; + raster.CullMode = vk_to_gen_cullmode[rs_info->cullMode]; + raster.FrontFaceFillMode = vk_to_gen_fillmode[rs_info->polygonMode]; + raster.BackFaceFillMode = vk_to_gen_fillmode[rs_info->polygonMode]; raster.ScissorRectangleEnable = !(extra && extra->use_rectlist); #if GEN_GEN >= 9 @@ -412,9 +412,9 @@ emit_rs_state(struct anv_pipeline *pipeline, raster.ViewportZClipTestEnable = !pipeline->depth_clamp_enable; #endif - raster.GlobalDepthOffsetEnableSolid = info->depthBiasEnable; - raster.GlobalDepthOffsetEnableWireframe = info->depthBiasEnable; - raster.GlobalDepthOffsetEnablePoint = info->depthBiasEnable; + raster.GlobalDepthOffsetEnableSolid = rs_info->depthBiasEnable; + raster.GlobalDepthOffsetEnableWireframe = rs_info->depthBiasEnable; + raster.GlobalDepthOffsetEnablePoint = rs_info->depthBiasEnable; #if GEN_GEN == 7 /* Gen7 requires that we provide the depth format in 3DSTATE_SF so that it ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv/pipeline/gen7: Set multisample modes
Module: Mesa Branch: master Commit: 8cde4ddbce330a45d27a350c7f4f18641d34fdd8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cde4ddbce330a45d27a350c7f4f18641d34fdd8 Author: Lionel LandwerlinDate: Mon Aug 8 20:30:08 2016 +0100 anv/pipeline/gen7: Set multisample modes Fixes the following failures : dEQP-VK.api.copy_and_blit.resolve_image.whole_4_bit dEQP-VK.api.copy_and_blit.resolve_image.whole_8_bit dEQP-VK.api.copy_and_blit.resolve_image.partial_4_bit dEQP-VK.api.copy_and_blit.resolve_image.partial_8_bit dEQP-VK.api.copy_and_blit.resolve_image.with_regions_4_bit dEQP-VK.api.copy_and_blit.resolve_image.with_regions_8_bit Tested on IVB/HSW Signed-off-by: Lionel Landwerlin Reviewed-by: Anuj Phogat Reviewed-by: Jason Ekstrand --- src/intel/vulkan/gen7_pipeline.c | 10 -- src/intel/vulkan/gen8_pipeline.c | 2 +- src/intel/vulkan/genX_pipeline_util.h | 5 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c index 1da28c0..135281d 100644 --- a/src/intel/vulkan/gen7_pipeline.c +++ b/src/intel/vulkan/gen7_pipeline.c @@ -68,7 +68,7 @@ genX(graphics_pipeline_create)( assert(pCreateInfo->pRasterizationState); emit_rs_state(pipeline, pCreateInfo->pRasterizationState, - pass, subpass, extra); + pCreateInfo->pMultisampleState, pass, subpass, extra); emit_ds_state(pipeline, pCreateInfo->pDepthStencilState, pass, subpass); @@ -85,7 +85,8 @@ genX(graphics_pipeline_create)( pCreateInfo->pMultisampleState->rasterizationSamples > 1) anv_finishme("VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO"); - uint32_t samples = 1; + uint32_t samples = pCreateInfo->pMultisampleState ? + pCreateInfo->pMultisampleState->rasterizationSamples : 1; uint32_t log2_samples = __builtin_ffs(samples) - 1; anv_batch_emit(>batch, GENX(3DSTATE_MULTISAMPLE), ms) { @@ -273,6 +274,11 @@ genX(graphics_pipeline_create)( } wm.BarycentricInterpolationMode= wm_prog_data->barycentric_interp_modes; + + wm.MultisampleRasterizationMode= samples > 1 ? + MSRASTMODE_ON_PATTERN : MSRASTMODE_OFF_PIXEL; + wm.MultisampleDispatchMode = wm_prog_data->persample_dispatch ? + MSDISPMODE_PERSAMPLE : MSDISPMODE_PERPIXEL; } } diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c index d16ce7b..1840ce2 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -120,7 +120,7 @@ genX(graphics_pipeline_create)( emit_ia_state(pipeline, pCreateInfo->pInputAssemblyState, extra); assert(pCreateInfo->pRasterizationState); emit_rs_state(pipeline, pCreateInfo->pRasterizationState, - pass, subpass, extra); + pCreateInfo->pMultisampleState, pass, subpass, extra); emit_ms_state(pipeline, pCreateInfo->pMultisampleState); emit_ds_state(pipeline, pCreateInfo->pDepthStencilState, pass, subpass); emit_cb_state(pipeline, pCreateInfo->pColorBlendState, diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h index 0aa85ba..d3b15d9 100644 --- a/src/intel/vulkan/genX_pipeline_util.h +++ b/src/intel/vulkan/genX_pipeline_util.h @@ -365,6 +365,7 @@ static const uint32_t vk_to_gen_front_face[] = { static void emit_rs_state(struct anv_pipeline *pipeline, const VkPipelineRasterizationStateCreateInfo *rs_info, + const VkPipelineMultisampleStateCreateInfo *ms_info, const struct anv_render_pass *pass, const struct anv_subpass *subpass, const struct anv_graphics_pipeline_create_info *extra) @@ -396,6 +397,10 @@ emit_rs_state(struct anv_pipeline *pipeline, raster.DXMultisampleRasterizationEnable = true; raster.ForcedSampleCount = FSC_NUMRASTSAMPLES_0; raster.ForceMultisampling = false; +#else + raster.MultisampleRasterizationMode = + (ms_info && ms_info->rasterizationSamples > 1) ? + MSRASTMODE_ON_PATTERN : MSRASTMODE_OFF_PIXEL; #endif raster.FrontWinding = vk_to_gen_front_face[rs_info->frontFace]; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Revert "glsl: don' t try to lower non-gl builtins as if they were gl_FragData"
Module: Mesa Branch: master Commit: 1ebf3c4b6741a3a3a9d46048abe3996cb9a86334 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ebf3c4b6741a3a3a9d46048abe3996cb9a86334 Author: Marek OlšákDate: Mon Aug 8 22:05:29 2016 +0200 Revert "glsl: don't try to lower non-gl builtins as if they were gl_FragData" This reverts commit a37e46323c7e18bec4160f2f66847c10b7041dc1. It broke the game Overlord such that it hung a GCN GNU. While I don't know how the hang happened because of its randomness and gfx corruption precedes it, many of the shaders contain this: out vec4 FragData[gl_MaxDrawBuffers]; --- src/compiler/glsl/opt_dead_builtin_varyings.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/glsl/opt_dead_builtin_varyings.cpp b/src/compiler/glsl/opt_dead_builtin_varyings.cpp index 900a096..33648d7 100644 --- a/src/compiler/glsl/opt_dead_builtin_varyings.cpp +++ b/src/compiler/glsl/opt_dead_builtin_varyings.cpp @@ -85,8 +85,7 @@ public: { ir_variable *var = ir->variable_referenced(); - if (!var || var->data.mode != this->mode || !var->type->is_array() || - !is_gl_identifier(var->name)) + if (!var || var->data.mode != this->mode || !var->type->is_array()) return visit_continue; /* Only match gl_FragData[], not gl_SecondaryFragDataEXT[] */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv/pipeline/gen8: Use fewer designated initializers in emit_rs_state
Module: Mesa Branch: master Commit: 1df511b6f07455b68b3500aa230c457eaa8e2a87 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1df511b6f07455b68b3500aa230c457eaa8e2a87 Author: Jason EkstrandDate: Sat Aug 6 07:55:10 2016 -0700 anv/pipeline/gen8: Use fewer designated initializers in emit_rs_state Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/vulkan/gen8_pipeline.c | 53 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c index e828359..7f8734a 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -57,42 +57,43 @@ emit_rs_state(struct anv_pipeline *pipeline, struct GENX(3DSTATE_SF) sf = { GENX(3DSTATE_SF_header), - .ViewportTransformEnable = !(extra && extra->use_rectlist), - .TriangleStripListProvokingVertexSelect = 0, - .LineStripListProvokingVertexSelect = 0, - .TriangleFanProvokingVertexSelect = 1, - .PointWidthSource = Vertex, - .PointWidth = 1.0, }; + sf.ViewportTransformEnable = !(extra && extra->use_rectlist); + sf.TriangleStripListProvokingVertexSelect = 0; + sf.LineStripListProvokingVertexSelect = 0; + sf.TriangleFanProvokingVertexSelect = 1; + sf.PointWidthSource = Vertex; + sf.PointWidth = 1.0; + GENX(3DSTATE_SF_pack)(NULL, pipeline->gen8.sf, ); struct GENX(3DSTATE_RASTER) raster = { GENX(3DSTATE_RASTER_header), + }; - /* For details on 3DSTATE_RASTER multisample state, see the BSpec table - * "Multisample Modes State". - */ - .DXMultisampleRasterizationEnable = samples > 1, - .ForcedSampleCount = FSC_NUMRASTSAMPLES_0, - .ForceMultisampling = false, - - .FrontWinding = vk_to_gen_front_face[info->frontFace], - .CullMode = vk_to_gen_cullmode[info->cullMode], - .FrontFaceFillMode = vk_to_gen_fillmode[info->polygonMode], - .BackFaceFillMode = vk_to_gen_fillmode[info->polygonMode], - .ScissorRectangleEnable = !(extra && extra->use_rectlist), + /* For details on 3DSTATE_RASTER multisample state, see the BSpec table +* "Multisample Modes State". +*/ + raster.DXMultisampleRasterizationEnable = samples > 1; + raster.ForcedSampleCount = FSC_NUMRASTSAMPLES_0; + raster.ForceMultisampling = false; + + raster.FrontWinding = vk_to_gen_front_face[info->frontFace]; + raster.CullMode = vk_to_gen_cullmode[info->cullMode]; + raster.FrontFaceFillMode = vk_to_gen_fillmode[info->polygonMode]; + raster.BackFaceFillMode = vk_to_gen_fillmode[info->polygonMode]; + raster.ScissorRectangleEnable = !(extra && extra->use_rectlist); #if GEN_GEN == 8 - .ViewportZClipTestEnable = !pipeline->depth_clamp_enable, + raster.ViewportZClipTestEnable = !pipeline->depth_clamp_enable; #else - /* GEN9+ splits ViewportZClipTestEnable into near and far enable bits */ - .ViewportZFarClipTestEnable = !pipeline->depth_clamp_enable, - .ViewportZNearClipTestEnable = !pipeline->depth_clamp_enable, + /* GEN9+ splits ViewportZClipTestEnable into near and far enable bits */ + raster.ViewportZFarClipTestEnable = !pipeline->depth_clamp_enable; + raster.ViewportZNearClipTestEnable = !pipeline->depth_clamp_enable; #endif - .GlobalDepthOffsetEnableSolid = info->depthBiasEnable, - .GlobalDepthOffsetEnableWireframe = info->depthBiasEnable, - .GlobalDepthOffsetEnablePoint = info->depthBiasEnable, - }; + raster.GlobalDepthOffsetEnableSolid = info->depthBiasEnable; + raster.GlobalDepthOffsetEnableWireframe = info->depthBiasEnable; + raster.GlobalDepthOffsetEnablePoint = info->depthBiasEnable; GENX(3DSTATE_RASTER_pack)(NULL, pipeline->gen8.raster, ); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv/pipeline/gen8: Unconditionally set DXMultisampleRasterizaitonEnable
Module: Mesa Branch: master Commit: 12e653adecc3c287329c6501fab3bc5d04e8eb3d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=12e653adecc3c287329c6501fab3bc5d04e8eb3d Author: Jason EkstrandDate: Sat Aug 6 08:42:51 2016 -0700 anv/pipeline/gen8: Unconditionally set DXMultisampleRasterizaitonEnable The multisample rasterization mode is computed based on this field, 3DSTATE_RASTER::DXMultisampleRasterizationMode (only for forced multisampling), 3DSTATE_RASTER::APIMode, and the number of samples. There are two tables in the SKL PRM that describe how the final multisample mode is calculated: "Windower (WM) Stage >> Multisampling >> Multisample ModeState >> Table 1" and the formula for "SF_INT::Multisample Rasterization Mode". The "DX Multisample Rasterization Enable" bit changes whether multisample mode is set to OFF_PIXEL or ON_PATTERN in the samples > 1 case. In the samples == 1 case, the bit has no effect. Since Vulkan has no concept of disabling multisampling for samples > 1, we can just set the bit. Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/vulkan/gen8_pipeline.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c index 7f8734a..4d198dc 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -47,14 +47,8 @@ emit_ia_state(struct anv_pipeline *pipeline, static void emit_rs_state(struct anv_pipeline *pipeline, const VkPipelineRasterizationStateCreateInfo *info, - const VkPipelineMultisampleStateCreateInfo *ms_info, const struct anv_graphics_pipeline_create_info *extra) { - uint32_t samples = 1; - - if (ms_info) - samples = ms_info->rasterizationSamples; - struct GENX(3DSTATE_SF) sf = { GENX(3DSTATE_SF_header), }; @@ -75,7 +69,7 @@ emit_rs_state(struct anv_pipeline *pipeline, /* For details on 3DSTATE_RASTER multisample state, see the BSpec table * "Multisample Modes State". */ - raster.DXMultisampleRasterizationEnable = samples > 1; + raster.DXMultisampleRasterizationEnable = true; raster.ForcedSampleCount = FSC_NUMRASTSAMPLES_0; raster.ForceMultisampling = false; @@ -173,8 +167,7 @@ genX(graphics_pipeline_create)( assert(pCreateInfo->pInputAssemblyState); emit_ia_state(pipeline, pCreateInfo->pInputAssemblyState, extra); assert(pCreateInfo->pRasterizationState); - emit_rs_state(pipeline, pCreateInfo->pRasterizationState, - pCreateInfo->pMultisampleState, extra); + emit_rs_state(pipeline, pCreateInfo->pRasterizationState, extra); emit_ms_state(pipeline, pCreateInfo->pMultisampleState); emit_ds_state(pipeline, pCreateInfo->pDepthStencilState, pass, subpass); emit_cb_state(pipeline, pCreateInfo->pColorBlendState, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): isl: Add a helper for getting a depth format from an isl_format
Module: Mesa Branch: master Commit: 21d5c1be6a334b924ac3dcedbdc35285e0c1ba16 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=21d5c1be6a334b924ac3dcedbdc35285e0c1ba16 Author: Jason EkstrandDate: Sat Aug 6 09:11:10 2016 -0700 isl: Add a helper for getting a depth format from an isl_format Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/isl/isl.h| 2 ++ src/intel/isl/isl_format.c | 24 2 files changed, 26 insertions(+) diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h index 19673f8..4caf0e8 100644 --- a/src/intel/isl/isl.h +++ b/src/intel/isl/isl.h @@ -1016,6 +1016,8 @@ isl_format_has_int_channel(enum isl_format fmt) unsigned isl_format_get_num_channels(enum isl_format fmt); +uint32_t isl_format_get_depth_format(enum isl_format fmt, bool has_stencil); + static inline bool isl_format_is_compressed(enum isl_format fmt) { diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c index e0b91bb..ef1324c 100644 --- a/src/intel/isl/isl_format.c +++ b/src/intel/isl/isl_format.c @@ -476,6 +476,30 @@ isl_format_get_num_channels(enum isl_format fmt) (fmtl->channels.i.bits > 0); } +uint32_t +isl_format_get_depth_format(enum isl_format fmt, bool has_stencil) +{ + switch (fmt) { + default: + unreachable("bad isl depth format"); + case ISL_FORMAT_R32_FLOAT_X8X24_TYPELESS: + assert(has_stencil); + return 0; /* D32_FLOAT_S8X24_UINT */ + case ISL_FORMAT_R32_FLOAT: + assert(!has_stencil); + return 1; /* D32_FLOAT */ + case ISL_FORMAT_R24_UNORM_X8_TYPELESS: + if (has_stencil) { + return 2; /* D24_UNORM_S8_UINT */ + } else { + return 3; /* D24_UNORM_X8_UINT */ + } + case ISL_FORMAT_R16_UNORM: + assert(!has_stencil); + return 5; /* D16_UNORM */ + } +} + enum isl_format isl_format_rgb_to_rgba(enum isl_format rgb) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv/pipeline: Unify 3DSTATE_RASTER and 3DSTATE_SF setup between gen7 and gen8
Module: Mesa Branch: master Commit: ce980541d5dc9b114c3aa69b3560fcb6023ccf32 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce980541d5dc9b114c3aa69b3560fcb6023ccf32 Author: Jason EkstrandDate: Sat Aug 6 08:28:23 2016 -0700 anv/pipeline: Unify 3DSTATE_RASTER and 3DSTATE_SF setup between gen7 and gen8 Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/vulkan/gen7_pipeline.c | 43 +--- src/intel/vulkan/gen8_pipeline.c | 49 src/intel/vulkan/genX_pipeline_util.h | 61 +++ 3 files changed, 62 insertions(+), 91 deletions(-) diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c index 6b57dd6..df8fa28 100644 --- a/src/intel/vulkan/gen7_pipeline.c +++ b/src/intel/vulkan/gen7_pipeline.c @@ -34,47 +34,6 @@ #include "genX_pipeline_util.h" -static void -gen7_emit_rs_state(struct anv_pipeline *pipeline, - const VkPipelineRasterizationStateCreateInfo *info, - const struct anv_graphics_pipeline_create_info *extra) -{ - struct GENX(3DSTATE_SF) sf = { - GENX(3DSTATE_SF_header), - - /* LegacyGlobalDepthBiasEnable */ - - .StatisticsEnable = true, - .FrontFaceFillMode= vk_to_gen_fillmode[info->polygonMode], - .BackFaceFillMode = vk_to_gen_fillmode[info->polygonMode], - .ViewportTransformEnable = !(extra && extra->use_rectlist), - .FrontWinding = vk_to_gen_front_face[info->frontFace], - /* bool AntiAliasingEnable; */ - - .CullMode = vk_to_gen_cullmode[info->cullMode], - - /* uint32_t LineEndCapAntialiasingRegionWidth; */ - .ScissorRectangleEnable = !(extra && extra->use_rectlist), - - /* uint32_t MultisampleRasterizationMode; */ - /* bool LastPixelEnable; */ - - .TriangleStripListProvokingVertexSelect = 0, - .LineStripListProvokingVertexSelect = 0, - .TriangleFanProvokingVertexSelect = 1, - - /* uint32_t AALineDistanceMode; */ - /* uint32_t VertexSubPixelPrecisionSelect; */ - .PointWidthSource = Vertex, - .PointWidth = 1.0, - .GlobalDepthOffsetEnableSolid = info->depthBiasEnable, - .GlobalDepthOffsetEnableWireframe = info->depthBiasEnable, - .GlobalDepthOffsetEnablePoint = info->depthBiasEnable, - }; - - GENX(3DSTATE_SF_pack)(NULL, >gen7.sf, ); -} - VkResult genX(graphics_pipeline_create)( VkDevice_device, @@ -108,7 +67,7 @@ genX(graphics_pipeline_create)( emit_vertex_input(pipeline, pCreateInfo->pVertexInputState, extra); assert(pCreateInfo->pRasterizationState); - gen7_emit_rs_state(pipeline, pCreateInfo->pRasterizationState, extra); + emit_rs_state(pipeline, pCreateInfo->pRasterizationState, extra); emit_ds_state(pipeline, pCreateInfo->pDepthStencilState, pass, subpass); diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c index 65339b9..e09d8cf 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -45,55 +45,6 @@ emit_ia_state(struct anv_pipeline *pipeline, } static void -emit_rs_state(struct anv_pipeline *pipeline, - const VkPipelineRasterizationStateCreateInfo *info, - const struct anv_graphics_pipeline_create_info *extra) -{ - struct GENX(3DSTATE_SF) sf = { - GENX(3DSTATE_SF_header), - }; - - sf.ViewportTransformEnable = !(extra && extra->use_rectlist); - sf.StatisticsEnable = true; - sf.TriangleStripListProvokingVertexSelect = 0; - sf.LineStripListProvokingVertexSelect = 0; - sf.TriangleFanProvokingVertexSelect = 1; - sf.PointWidthSource = Vertex; - sf.PointWidth = 1.0; - - GENX(3DSTATE_SF_pack)(NULL, pipeline->gen8.sf, ); - - struct GENX(3DSTATE_RASTER) raster = { - GENX(3DSTATE_RASTER_header), - }; - - /* For details on 3DSTATE_RASTER multisample state, see the BSpec table -* "Multisample Modes State". -*/ - raster.DXMultisampleRasterizationEnable = true; - raster.ForcedSampleCount = FSC_NUMRASTSAMPLES_0; - raster.ForceMultisampling = false; - - raster.FrontWinding = vk_to_gen_front_face[info->frontFace]; - raster.CullMode = vk_to_gen_cullmode[info->cullMode]; - raster.FrontFaceFillMode = vk_to_gen_fillmode[info->polygonMode]; - raster.BackFaceFillMode = vk_to_gen_fillmode[info->polygonMode]; -
Mesa (master): anv/pipeline/gen8: Remove an old comment
Module: Mesa Branch: master Commit: 2d76dcae718cf8d1478a70f3f23463ba8c534927 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d76dcae718cf8d1478a70f3f23463ba8c534927 Author: Jason EkstrandDate: Sat Aug 6 07:52:23 2016 -0700 anv/pipeline/gen8: Remove an old comment This is now handled in emit_3dstate_clip Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/vulkan/gen8_pipeline.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c index 2fa8ac9..e828359 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -65,8 +65,6 @@ emit_rs_state(struct anv_pipeline *pipeline, .PointWidth = 1.0, }; - /* FINISHME: VkBool32 rasterizerDiscardEnable; */ - GENX(3DSTATE_SF_pack)(NULL, pipeline->gen8.sf, ); struct GENX(3DSTATE_RASTER) raster = { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv/pipeline/gen8: Set 3DSTATE_SF::StatisticsEnable
Module: Mesa Branch: master Commit: 960e8a1260b34e8e34d2f39b91b11ea85ec483b1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=960e8a1260b34e8e34d2f39b91b11ea85ec483b1 Author: Jason EkstrandDate: Mon Aug 8 11:08:09 2016 -0700 anv/pipeline/gen8: Set 3DSTATE_SF::StatisticsEnable We've been setting it in gen7 forever but never in gen8; best to make it consistent. This hasn't caused any problems yet because we don't advertise support for statistics queries yet. Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/vulkan/gen8_pipeline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c index 4d198dc..65339b9 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -54,6 +54,7 @@ emit_rs_state(struct anv_pipeline *pipeline, }; sf.ViewportTransformEnable = !(extra && extra->use_rectlist); + sf.StatisticsEnable = true; sf.TriangleStripListProvokingVertexSelect = 0; sf.LineStripListProvokingVertexSelect = 0; sf.TriangleFanProvokingVertexSelect = 1; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv/pipeline/gen7: Set the depth format in 3DSTATE_SF
Module: Mesa Branch: master Commit: 52fcc40760d943e071536787cf3c49778c502706 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=52fcc40760d943e071536787cf3c49778c502706 Author: Jason EkstrandDate: Sat Aug 6 09:11:53 2016 -0700 anv/pipeline/gen7: Set the depth format in 3DSTATE_SF Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/vulkan/gen7_pipeline.c | 3 ++- src/intel/vulkan/gen8_pipeline.c | 3 ++- src/intel/vulkan/genX_pipeline_util.h | 21 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c index df8fa28..1da28c0 100644 --- a/src/intel/vulkan/gen7_pipeline.c +++ b/src/intel/vulkan/gen7_pipeline.c @@ -67,7 +67,8 @@ genX(graphics_pipeline_create)( emit_vertex_input(pipeline, pCreateInfo->pVertexInputState, extra); assert(pCreateInfo->pRasterizationState); - emit_rs_state(pipeline, pCreateInfo->pRasterizationState, extra); + emit_rs_state(pipeline, pCreateInfo->pRasterizationState, + pass, subpass, extra); emit_ds_state(pipeline, pCreateInfo->pDepthStencilState, pass, subpass); diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c index e09d8cf..d16ce7b 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -119,7 +119,8 @@ genX(graphics_pipeline_create)( assert(pCreateInfo->pInputAssemblyState); emit_ia_state(pipeline, pCreateInfo->pInputAssemblyState, extra); assert(pCreateInfo->pRasterizationState); - emit_rs_state(pipeline, pCreateInfo->pRasterizationState, extra); + emit_rs_state(pipeline, pCreateInfo->pRasterizationState, + pass, subpass, extra); emit_ms_state(pipeline, pCreateInfo->pMultisampleState); emit_ds_state(pipeline, pCreateInfo->pDepthStencilState, pass, subpass); emit_cb_state(pipeline, pCreateInfo->pColorBlendState, diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h index 5994120..c17d930 100644 --- a/src/intel/vulkan/genX_pipeline_util.h +++ b/src/intel/vulkan/genX_pipeline_util.h @@ -365,6 +365,8 @@ static const uint32_t vk_to_gen_front_face[] = { static void emit_rs_state(struct anv_pipeline *pipeline, const VkPipelineRasterizationStateCreateInfo *info, + const struct anv_render_pass *pass, + const struct anv_subpass *subpass, const struct anv_graphics_pipeline_create_info *extra) { struct GENX(3DSTATE_SF) sf = { @@ -414,6 +416,25 @@ emit_rs_state(struct anv_pipeline *pipeline, raster.GlobalDepthOffsetEnableWireframe = info->depthBiasEnable; raster.GlobalDepthOffsetEnablePoint = info->depthBiasEnable; +#if GEN_GEN == 7 + /* Gen7 requires that we provide the depth format in 3DSTATE_SF so that it +* can get the depth offsets correct. +*/ + if (subpass->depth_stencil_attachment < pass->attachment_count) { + VkFormat vk_format = + pass->attachments[subpass->depth_stencil_attachment].format; + assert(vk_format_is_depth_or_stencil(vk_format)); + if (vk_format_aspects(vk_format) & VK_IMAGE_ASPECT_DEPTH_BIT) { + enum isl_format isl_format = +anv_get_isl_format(>device->info, vk_format, + VK_IMAGE_ASPECT_DEPTH_BIT, + VK_IMAGE_TILING_OPTIMAL); + sf.DepthBufferSurfaceFormat = +isl_format_get_depth_format(isl_format, false); + } + } +#endif + #if GEN_GEN >= 8 GENX(3DSTATE_SF_pack)(NULL, pipeline->gen8.sf, ); GENX(3DSTATE_RASTER_pack)(NULL, pipeline->gen8.raster, ); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): genxml: Make 3DSTATE_SF more consistent between gen7 and gen8+
Module: Mesa Branch: master Commit: 6136fb8687d216565ea481875e651ff23b13bfd3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6136fb8687d216565ea481875e651ff23b13bfd3 Author: Jason EkstrandDate: Sat Aug 6 08:24:00 2016 -0700 genxml: Make 3DSTATE_SF more consistent between gen7 and gen8+ Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/genxml/gen7.xml| 7 +-- src/intel/genxml/gen75.xml | 7 +-- src/intel/vulkan/gen7_pipeline.c | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/intel/genxml/gen7.xml b/src/intel/genxml/gen7.xml index 1084093..5e82fab 100644 --- a/src/intel/genxml/gen7.xml +++ b/src/intel/genxml/gen7.xml @@ -1612,7 +1612,7 @@ - + @@ -1641,7 +1641,10 @@ - + + + + diff --git a/src/intel/genxml/gen75.xml b/src/intel/genxml/gen75.xml index b7bf13a..f1be2f8 100644 --- a/src/intel/genxml/gen75.xml +++ b/src/intel/genxml/gen75.xml @@ -1857,7 +1857,7 @@ - + @@ -1888,7 +1888,10 @@ - + + + + diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c index daebc27..6b57dd6 100644 --- a/src/intel/vulkan/gen7_pipeline.c +++ b/src/intel/vulkan/gen7_pipeline.c @@ -47,7 +47,7 @@ gen7_emit_rs_state(struct anv_pipeline *pipeline, .StatisticsEnable = true, .FrontFaceFillMode= vk_to_gen_fillmode[info->polygonMode], .BackFaceFillMode = vk_to_gen_fillmode[info->polygonMode], - .ViewTransformEnable = !(extra && extra->use_rectlist), + .ViewportTransformEnable = !(extra && extra->use_rectlist), .FrontWinding = vk_to_gen_front_face[info->frontFace], /* bool AntiAliasingEnable; */ @@ -65,7 +65,7 @@ gen7_emit_rs_state(struct anv_pipeline *pipeline, /* uint32_t AALineDistanceMode; */ /* uint32_t VertexSubPixelPrecisionSelect; */ - .UsePointWidthState = false, + .PointWidthSource = Vertex, .PointWidth = 1.0, .GlobalDepthOffsetEnableSolid = info->depthBiasEnable, .GlobalDepthOffsetEnableWireframe = info->depthBiasEnable, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Add extension plumbing for OES/ EXT_tessellation_shader.
Module: Mesa Branch: master Commit: 58709d36d73419c21b899d4b9d08a4a82a2cc28b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58709d36d73419c21b899d4b9d08a4a82a2cc28b Author: Kenneth GraunkeDate: Fri Jul 8 12:00:30 2016 -0700 glsl: Add extension plumbing for OES/EXT_tessellation_shader. This adds the #extension directive support, built-in #defines, lexer keyword support, and updates has_tessellation_shader(). Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/compiler/glsl/glsl_lexer.ll | 2 +- src/compiler/glsl/glsl_parser.yy | 3 ++- src/compiler/glsl/glsl_parser_extras.cpp | 4 src/compiler/glsl/glsl_parser_extras.h | 13 - 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll index 11711ee..7be2b89 100644 --- a/src/compiler/glsl/glsl_lexer.ll +++ b/src/compiler/glsl/glsl_lexer.ll @@ -311,7 +311,7 @@ invariant KEYWORD(120, 100, 120, 100, INVARIANT); flat KEYWORD(130, 100, 130, 300, FLAT); smooth KEYWORD(130, 300, 130, 300, SMOOTH); noperspective KEYWORD(130, 300, 130, 0, NOPERSPECTIVE); -patch KEYWORD_WITH_ALT(0, 300, 400, 0, yyextra->ARB_tessellation_shader_enable, PATCH); +patch KEYWORD_WITH_ALT(0, 300, 400, 320, yyextra->has_tessellation_shader(), PATCH); sampler1D DEPRECATED_ES_KEYWORD(SAMPLER1D); sampler2D return SAMPLER2D; diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 146589a..4ab9e14 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -1274,7 +1274,8 @@ layout_qualifier_id: } } - if ($$.flags.i && !state->has_geometry_shader()) { + if ($$.flags.i && !state->has_geometry_shader() && + !state->has_tessellation_shader()) { _mesa_glsl_error(& @1, state, "#version 150 layout " "qualifier `%s' used", $1); } diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index e702291..14a5540 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -634,6 +634,8 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(OES_shader_io_blocks), EXT(OES_shader_multisample_interpolation), EXT(OES_standard_derivatives), + EXT(OES_tessellation_point_size), + EXT(OES_tessellation_shader), EXT(OES_texture_3D), EXT(OES_texture_buffer), EXT(OES_texture_storage_multisample_2d_array), @@ -653,6 +655,8 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(EXT_shader_integer_mix), EXT(EXT_shader_io_blocks), EXT(EXT_shader_samples_identical), + EXT(EXT_tessellation_point_size), + EXT(EXT_tessellation_shader), EXT(EXT_texture_array), EXT(EXT_texture_buffer), EXT(MESA_shader_integer_functions), diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index f9c1ffc..991cfc6 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -279,7 +279,10 @@ struct _mesa_glsl_parse_state { bool has_tessellation_shader() const { - return ARB_tessellation_shader_enable || is_version(400, 0); + return ARB_tessellation_shader_enable || + OES_tessellation_shader_enable || + EXT_tessellation_shader_enable || + is_version(400, 320); } bool has_clip_distance() const @@ -649,6 +652,10 @@ struct _mesa_glsl_parse_state { bool OES_shader_multisample_interpolation_warn; bool OES_standard_derivatives_enable; bool OES_standard_derivatives_warn; + bool OES_tessellation_point_size_enable; + bool OES_tessellation_point_size_warn; + bool OES_tessellation_shader_enable; + bool OES_tessellation_shader_warn; bool OES_texture_3D_enable; bool OES_texture_3D_warn; bool OES_texture_buffer_enable; @@ -684,6 +691,10 @@ struct _mesa_glsl_parse_state { bool EXT_shader_io_blocks_warn; bool EXT_shader_samples_identical_enable; bool EXT_shader_samples_identical_warn; + bool EXT_tessellation_point_size_enable; + bool EXT_tessellation_point_size_warn; + bool EXT_tessellation_shader_enable; + bool EXT_tessellation_shader_warn; bool EXT_texture_array_enable; bool EXT_texture_array_warn; bool EXT_texture_buffer_enable; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Share code between _mesa_validate_DrawArrays[ _Instanced].
Module: Mesa Branch: master Commit: 23b2bcd460c5e91b528913526f16b8e5fd7d4278 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=23b2bcd460c5e91b528913526f16b8e5fd7d4278 Author: Kenneth GraunkeDate: Fri Jul 8 16:18:03 2016 -0700 mesa: Share code between _mesa_validate_DrawArrays[_Instanced]. Mostly, I want to share the GLES 3 transform feedback handling, though most of the rest of the code is identical as well. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/main/api_validate.c | 89 +--- 1 file changed, 25 insertions(+), 64 deletions(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 038b5a9..2ee2cd8 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -515,30 +515,24 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, "glDrawRangeElements"); } - -/** - * Called from the tnl module to error check the function parameters and - * verify that we really can draw something. - * \return GL_TRUE if OK to render, GL_FALSE if error found - */ -GLboolean -_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count) +static bool +validate_draw_arrays(struct gl_context *ctx, const char *func, + GLenum mode, GLsizei count, GLsizei numInstances) { struct gl_transform_feedback_object *xfb_obj = ctx->TransformFeedback.CurrentObject; FLUSH_CURRENT(ctx, 0); if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); - return GL_FALSE; + _mesa_error(ctx, GL_INVALID_VALUE, "%s(count)", func); + return false; } - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArrays")) { - return GL_FALSE; - } + if (!_mesa_valid_prim_mode(ctx, mode, func)) + return false; - if (!check_valid_to_render(ctx, "glDrawArrays")) - return GL_FALSE; + if (!check_valid_to_render(ctx, func)) + return false; /* From the GLES3 specification, section 2.14.2 (Transform Feedback * Primitive Capture): @@ -557,16 +551,27 @@ _mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count) size_t prim_count = vbo_count_tessellated_primitives(mode, count, 1); if (xfb_obj->GlesRemainingPrims < prim_count) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawArrays(exceeds transform feedback size)"); - return GL_FALSE; + "%s(exceeds transform feedback size)", func); + return false; } xfb_obj->GlesRemainingPrims -= prim_count; } if (count == 0) - return GL_FALSE; + return false; - return GL_TRUE; + return true; +} + +/** + * Called from the tnl module to error check the function parameters and + * verify that we really can draw something. + * \return GL_TRUE if OK to render, GL_FALSE if error found + */ +GLboolean +_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count) +{ + return validate_draw_arrays(ctx, "glDrawArrays", mode, count, 1); } @@ -574,26 +579,12 @@ GLboolean _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first, GLsizei count, GLsizei numInstances) { - struct gl_transform_feedback_object *xfb_obj - = ctx->TransformFeedback.CurrentObject; - FLUSH_CURRENT(ctx, 0); - - if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glDrawArraysInstanced(count=%d)", count); - return GL_FALSE; - } - if (first < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArraysInstanced(start=%d)", first); return GL_FALSE; } - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArraysInstanced")) { - return GL_FALSE; - } - if (numInstances <= 0) { if (numInstances < 0) _mesa_error(ctx, GL_INVALID_VALUE, @@ -601,37 +592,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi return GL_FALSE; } - if (!check_valid_to_render(ctx, "glDrawArraysInstanced(invalid to render)")) - return GL_FALSE; - - /* From the GLES3 specification, section 2.14.2 (Transform Feedback -* Primitive Capture): -* -* The error INVALID_OPERATION is generated by DrawArrays and -* DrawArraysInstanced if recording the vertices of a primitive to the -* buffer objects being used for transform feedback purposes would result -* in either exceeding the limits of any buffer object’s size, or in -* exceeding the end position offset + size − 1, as set by -* BindBufferRange. -* -* This is in contrast to the behaviour of desktop GL, where the extra -* primitives are silently dropped from the transform feedback buffer. -*/ - if (_mesa_is_gles3(ctx) &&
Mesa (master): glsl: Implicitly enable OES_shader_io_blocks if geom/ tess are enabled.
Module: Mesa Branch: master Commit: 522b5d45668bf13493901d5e4ed1ec9e75ae1324 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=522b5d45668bf13493901d5e4ed1ec9e75ae1324 Author: Kenneth GraunkeDate: Sat May 21 11:46:22 2016 -0700 glsl: Implicitly enable OES_shader_io_blocks if geom/tess are enabled. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/compiler/glsl/glsl_parser_extras.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index 991cfc6..0294ef7 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -267,8 +267,19 @@ struct _mesa_glsl_parse_state { bool has_shader_io_blocks() const { + /* The OES_geometry_shader_specification says: + * + *"If the OES_geometry_shader extension is enabled, the + * OES_shader_io_blocks extension is also implicitly enabled." + * + * The OES_tessellation_shader extension has similar wording. + */ return OES_shader_io_blocks_enable || EXT_shader_io_blocks_enable || + OES_geometry_shader_enable || + OES_tessellation_shader_enable || + EXT_tessellation_shader_enable || + is_version(150, 320); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Expose gl_PointSize if OES/ EXT_tessellation_point_size is enabled.
Module: Mesa Branch: master Commit: 0eaa84e8af850b627345e473bb5a7cc9941cf2b8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0eaa84e8af850b627345e473bb5a7cc9941cf2b8 Author: Kenneth GraunkeDate: Fri May 27 11:12:45 2016 -0700 glsl: Expose gl_PointSize if OES/EXT_tessellation_point_size is enabled. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/compiler/glsl/builtin_variables.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index 20d1d75..c9d8b1c 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -1263,7 +1263,11 @@ builtin_variable_generator::generate_varyings() if (!state->es_shader || state->stage == MESA_SHADER_VERTEX || (state->stage == MESA_SHADER_GEOMETRY && - state->OES_geometry_point_size_enable)) { + state->OES_geometry_point_size_enable) || + ((state->stage == MESA_SHADER_TESS_CTRL || +state->stage == MESA_SHADER_TESS_EVAL) && + (state->OES_tessellation_point_size_enable || +state->EXT_tessellation_point_size_enable))) { add_varying(VARYING_SLOT_PSIZ, float_t, "gl_PointSize"); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Skip ES 3.0/ 3.1 transform feedback primitive counting error.
Module: Mesa Branch: master Commit: 7314007925a25f65d178345dfc6d086c82e9a71e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7314007925a25f65d178345dfc6d086c82e9a71e Author: Kenneth GraunkeDate: Thu Oct 29 00:21:18 2015 -0700 mesa: Skip ES 3.0/3.1 transform feedback primitive counting error. This error condition is not implementable when using tessellation or geometry shaders. The text was also removed from the ES 3.2 spec. I believe the intended behavior is to remove the error condition when either OES_geometry_shader or OES_tessellation_shader are exposed. v2: Quote a better part of issue 13 (suggested by Ian). Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/main/api_validate.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 2ee2cd8..ec3cc1b 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -546,8 +546,24 @@ validate_draw_arrays(struct gl_context *ctx, const char *func, * * This is in contrast to the behaviour of desktop GL, where the extra * primitives are silently dropped from the transform feedback buffer. +* +* This text is removed in ES 3.2, presumably because it's not really +* implementable with geometry and tessellation shaders. In fact, +* the OES_geometry_shader spec says: +* +*"(13) Does this extension change how transform feedback operates +* compared to unextended OpenGL ES 3.0 or 3.1? +* +* RESOLVED: Yes. Because dynamic geometry amplification in a geometry +* shader can make it difficult if not impossible to predict the amount +* of geometry that may be generated in advance of executing the shader, +* the draw-time error for transform feedback buffer overflow conditions +* is removed and replaced with the GL behavior (primitives are not +* written and the corresponding counter is not updated)..." */ - if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) { + if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx) && + !_mesa_has_OES_geometry_shader(ctx) && + !_mesa_has_OES_tessellation_shader(ctx)) { size_t prim_count = vbo_count_tessellated_primitives(mode, count, 1); if (xfb_obj->GlesRemainingPrims < prim_count) { _mesa_error(ctx, GL_INVALID_OPERATION, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Add {OES, EXT}_tessellation_shader to the extensions table.
Module: Mesa Branch: master Commit: c8438b62b71f4e2bd3801e936143c439a68c4bd2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8438b62b71f4e2bd3801e936143c439a68c4bd2 Author: Kenneth GraunkeDate: Fri Jul 8 11:48:15 2016 -0700 mesa: Add {OES,EXT}_tessellation_shader to the extensions table. Also update _mesa_has_tessellation to know about the new extensions. For now, these are dummy_false, to avoid turning on the extension until everything's in place. Eventually, we'll move them over to the "ARB_tessellation_shader" bit so that any drivers supporting both the desktop extension and ES 3.1 get the feature. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/main/context.h | 7 +-- src/mesa/main/extensions_table.h | 4 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 133b17f..1871388 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -354,8 +354,11 @@ _mesa_has_shader_subroutine(const struct gl_context *ctx) static inline GLboolean _mesa_has_tessellation(const struct gl_context *ctx) { - return ctx->API == API_OPENGL_CORE && - ctx->Extensions.ARB_tessellation_shader; + /* _mesa_has_EXT_tessellation_shader(ctx) is redundant with the OES +* check, so don't bother calling it. +*/ + return _mesa_has_OES_tessellation_shader(ctx) || + _mesa_has_ARB_tessellation_shader(ctx); } diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index cbb3fb8..a83d9b7 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -234,6 +234,8 @@ EXT(EXT_shadow_funcs, ARB_shadow EXT(EXT_stencil_two_side, EXT_stencil_two_side , GLL, x , x , x , 2001) EXT(EXT_stencil_wrap, dummy_true , GLL, x , x , x , 2002) EXT(EXT_subtexture , dummy_true , GLL, x , x , x , 1995) +EXT(EXT_tessellation_point_size , dummy_false , x , x , x , 31, 2013) +EXT(EXT_tessellation_shader , dummy_false , x , x , x , 31, 2013) EXT(EXT_texture , dummy_true , GLL, x , x , x , 1996) EXT(EXT_texture3D , dummy_true , GLL, x , x , x , 1996) EXT(EXT_texture_array , EXT_texture_array , GLL, GLC, x , x , 2006) @@ -359,6 +361,8 @@ EXT(OES_stencil4, dummy_false EXT(OES_stencil8, dummy_true , x , x , ES1, ES2, 2005) EXT(OES_stencil_wrap, dummy_true , x , x , ES1, x , 2002) EXT(OES_surfaceless_context , dummy_true , x , x , ES1, ES2, 2012) +EXT(OES_tessellation_point_size , dummy_false , x , x , x , 31, 2014) +EXT(OES_tessellation_shader , dummy_false , x , x , x , 31, 2014) EXT(OES_texture_3D , dummy_true , x , x , x , ES2, 2005) EXT(OES_texture_border_clamp, ARB_texture_border_clamp , x , x , x , ES2, 2014) EXT(OES_texture_buffer , OES_texture_buffer , x , x , x , 31, 2014) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mapi: Add PatchParameteriOES and PatchParameteriEXT.
Module: Mesa Branch: master Commit: 73554c47e0795a8f15a351b80498c60cf22b2535 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=73554c47e0795a8f15a351b80498c60cf22b2535 Author: Kenneth GraunkeDate: Fri Jul 8 11:42:08 2016 -0700 mapi: Add PatchParameteriOES and PatchParameteriEXT. The OES_tessellation_shader and EXT_tessellation_shader specifications have suffixed names. These are identical to the core function, so just alias them. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mapi/glapi/gen/ARB_tessellation_shader.xml | 10 ++ src/mesa/main/tests/dispatch_sanity.cpp| 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/mapi/glapi/gen/ARB_tessellation_shader.xml b/src/mapi/glapi/gen/ARB_tessellation_shader.xml index cc55f9b..e26f227 100644 --- a/src/mapi/glapi/gen/ARB_tessellation_shader.xml +++ b/src/mapi/glapi/gen/ARB_tessellation_shader.xml @@ -58,6 +58,16 @@ + + + + + + + + + + diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index ee3c3d4..cfbf70d 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -2594,5 +2594,8 @@ const struct function gles31_functions_possible[] = { /* GL_OES_geometry_shader */ { "glFramebufferTextureOES", 31, -1}, + /* GL_OES_tessellation_shader */ + { "glPatchParameteriOES", 31, -1 }, + { NULL, 0, -1 }, }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Move tessellation shader gets to GL_CORE, GLES31 section.
Module: Mesa Branch: master Commit: 722fd10456f8e92d61c492b662a24215eb4cd166 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=722fd10456f8e92d61c492b662a24215eb4cd166 Author: Kenneth GraunkeDate: Fri Jul 8 11:49:30 2016 -0700 mesa: Move tessellation shader gets to GL_CORE, GLES31 section. This makes them available in the GLES 3.1 API. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/main/get_hash_params.py | 69 +--- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 0672b07..cd8e47f 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -532,16 +532,52 @@ descriptor=[ [ "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), extra_version_32_OES_geometry_shader" ], [ "MAX_GEOMETRY_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxUniformComponents), extra_version_32_OES_geometry_shader" ], +# GL_ARB_tessellation_shader / also OES and EXT + [ "PATCH_VERTICES", "CONTEXT_INT(TessCtrlProgram.patch_vertices), extra_ARB_tessellation_shader" ], + [ "PATCH_DEFAULT_OUTER_LEVEL", "CONTEXT_FLOAT4(TessCtrlProgram.patch_default_outer_level), extra_ARB_tessellation_shader" ], + [ "PATCH_DEFAULT_INNER_LEVEL", "CONTEXT_FLOAT2(TessCtrlProgram.patch_default_inner_level), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_GEN_LEVEL", "CONTEXT_INT(Const.MaxTessGenLevel), extra_ARB_tessellation_shader" ], + [ "MAX_PATCH_VERTICES", "CONTEXT_INT(Const.MaxPatchVertices), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_CONTROL_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxUniformComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_EVALUATION_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxUniformComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_CONTROL_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxOutputComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_PATCH_COMPONENTS", "CONTEXT_INT(Const.MaxTessPatchComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.MaxTessControlTotalOutputComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_EVALUATION_OUTPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxOutputComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_CONTROL_INPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxInputComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_EVALUATION_INPUT_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxInputComponents), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_CONTROL_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxUniformBlocks), extra_ARB_tessellation_shader" ], + [ "MAX_TESS_EVALUATION_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxUniformBlocks), extra_ARB_tessellation_shader" ], + [ "MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxCombinedUniformComponents), extra_ARB_tessellation_shader" ], + [ "MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxCombinedUniformComponents), extra_ARB_tessellation_shader" ], + [ "PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED", "CONTEXT_BOOL(Const.PrimitiveRestartForPatches), extra_ARB_tessellation_shader" ], + # GL_ARB_shader_image_load_store / geometry shader [ "MAX_GEOMETRY_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms), extra_ARB_shader_image_load_store_and_geometry_shader" ], +# GL_ARB_shader_image_load_store / tessellation shader + [ "MAX_TESS_CONTROL_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxImageUniforms), extra_ARB_shader_image_load_store_and_tessellation"], + [ "MAX_TESS_EVALUATION_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxImageUniforms), extra_ARB_shader_image_load_store_and_tessellation"], + # GL_ARB_shader_atomic_counters / geometry shader [ "MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers), extra_ARB_shader_atomic_counters_and_geometry_shader " ], [ "MAX_GEOMETRY_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters),
Mesa (master): egl/android: Make get_fourcc() accept HAL formats
Module: Mesa Branch: master Commit: 7dfb1a4074328bcdff4b407b8f44be538180791d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7dfb1a4074328bcdff4b407b8f44be538180791d Author: Tomasz FigaDate: Tue Aug 2 20:07:53 2016 +0900 egl/android: Make get_fourcc() accept HAL formats There are DRI_IMAGE_FOURCC macros, for which there are no corresponding DRI_IMAGE_FORMAT macros. To support such formats we need to make the lookup function take the native format directly. As a side effect, it simplifies all existing calls to this function, because they all called get_format() first to convert from native to DRI_IMAGE_FORMAT. Signed-off-by: Tomasz Figa Tested-by: Rob Herring Reviewed-by: Chad Versace Change-Id: I4674000fb5ccfd02e38b8fa89bc567ac1d4fc16b --- src/egl/drivers/dri2/platform_android.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 94e765d..596833e 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -66,14 +66,15 @@ get_format_bpp(int native) } /* createImageFromFds requires fourcc format */ -static int get_fourcc(int format) +static int get_fourcc(int native) { - switch(format) { - case __DRI_IMAGE_FORMAT_RGB565: return __DRI_IMAGE_FOURCC_RGB565; - case __DRI_IMAGE_FORMAT_ARGB: return __DRI_IMAGE_FOURCC_ARGB; - case __DRI_IMAGE_FORMAT_XRGB: return __DRI_IMAGE_FOURCC_XRGB; - case __DRI_IMAGE_FORMAT_ABGR: return __DRI_IMAGE_FOURCC_ABGR; - case __DRI_IMAGE_FORMAT_XBGR: return __DRI_IMAGE_FOURCC_XBGR; + switch (native) { + case HAL_PIXEL_FORMAT_RGB_565: return __DRI_IMAGE_FOURCC_RGB565; + case HAL_PIXEL_FORMAT_BGRA_: return __DRI_IMAGE_FOURCC_ARGB; + case HAL_PIXEL_FORMAT_RGBA_: return __DRI_IMAGE_FOURCC_ABGR; + case HAL_PIXEL_FORMAT_RGBX_: return __DRI_IMAGE_FOURCC_XBGR; + default: + _eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", native); } return -1; } @@ -92,6 +93,7 @@ static int get_format(int format) } return -1; } + static int get_native_buffer_fd(struct ANativeWindowBuffer *buf) { @@ -397,7 +399,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) return -1; } - fourcc = get_fourcc(get_format(dri2_surf->buffer->format)); + fourcc = get_fourcc(dri2_surf->buffer->format); pitch = dri2_surf->buffer->stride * get_format_bpp(dri2_surf->buffer->format); @@ -481,7 +483,7 @@ static _EGLImage * droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx, struct ANativeWindowBuffer *buf, int fd) { - const int fourcc = get_fourcc(get_format(buf->format)); + const int fourcc = get_fourcc(buf->format); const int pitch = buf->stride * get_format_bpp(buf->format); const EGLint attr_list[14] = { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/android: Respect buffer mask in droid_image_get_buffers (v2)
Module: Mesa Branch: master Commit: 217af75a4092545fb9f5afe4a12e0b74cb1b48e4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=217af75a4092545fb9f5afe4a12e0b74cb1b48e4 Author: Tomasz FigaDate: Tue Aug 2 20:07:50 2016 +0900 egl/android: Respect buffer mask in droid_image_get_buffers (v2) Drivers can request different set of buffers depending on the buffer mask they pass to the get_buffers callback. This patch makes droid_image_get_buffers() respect this mask. v2: Return error only in case of real error condition and ignore requests of unavailable buffers. Signed-off-by: Tomasz Figa Tested-by: Rob Herring Reviewed-by: Chad Versace Change-Id: I6c3c4eca90f4c618579f6725dec323c004cb44ba --- src/egl/drivers/dri2/platform_android.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 124a30c..d78c06d 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -434,16 +434,26 @@ droid_image_get_buffers(__DRIdrawable *driDrawable, { struct dri2_egl_surface *dri2_surf = loaderPrivate; + images->image_mask = 0; + if (update_buffers(dri2_surf) < 0) return 0; - if (get_back_bo(dri2_surf) < 0) { - _eglError(EGL_BAD_PARAMETER, "get_back_bo"); - return 0; + if (buffer_mask & __DRI_IMAGE_BUFFER_FRONT) { + /* + * We don't support front buffers and GLES doesn't require them for + * window surfaces, but some DRI drivers will request them anyway. + * We just ignore such request as other platforms backends do. + */ } - images->image_mask = __DRI_IMAGE_BUFFER_BACK; - images->back = dri2_surf->dri_image; + if (buffer_mask & __DRI_IMAGE_BUFFER_BACK) { + if (get_back_bo(dri2_surf) < 0) + return 0; + + images->back = dri2_surf->dri_image; + images->image_mask |= __DRI_IMAGE_BUFFER_BACK; + } return 1; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/android: Remove unused variables in droid_get_buffers_with_format()
Module: Mesa Branch: master Commit: c6c26bc589f57c083f040ad70d1606cfa382c66a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6c26bc589f57c083f040ad70d1606cfa382c66a Author: Tomasz FigaDate: Tue Aug 2 20:07:49 2016 +0900 egl/android: Remove unused variables in droid_get_buffers_with_format() Fix compilation warnings due to unused variables left after some earlier code changes. Signed-off-by: Tomasz Figa Tested-by: Rob Herring Reviewed-by: Chad Versace Change-Id: Iec09eb2a62887f3a38dff156756ed8385f3f3447 --- src/egl/drivers/dri2/platform_android.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index e3d5f0b..124a30c 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -635,9 +635,6 @@ droid_get_buffers_with_format(__DRIdrawable * driDrawable, int *out_count, void *loaderPrivate) { struct dri2_egl_surface *dri2_surf = loaderPrivate; - struct dri2_egl_display *dri2_dpy = - dri2_egl_display(dri2_surf->base.Resource.Display); - int i; if (update_buffers(dri2_surf) < 0) return NULL; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/android: Refactor image creation to separate flink and prime paths (v2)
Module: Mesa Branch: master Commit: e77b4933907106238c7872cb74d0ba0b5246aee6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e77b4933907106238c7872cb74d0ba0b5246aee6 Author: Tomasz FigaDate: Tue Aug 2 20:07:52 2016 +0900 egl/android: Refactor image creation to separate flink and prime paths (v2) This patch splits current dri2_create_image_android_native_buffer() into main entry point and two additional functions, one for creating an image from flink name and one for handling prime FDs using the generic DMA-buf path. This makes the code cleaner and also prepares for disabling flink path more easily in the future. v2: Split into separate patch. Add error messages. Signed-off-by: Tomasz Figa Tested-by: Rob Herring Reviewed-by: Chad Versace Change-Id: Ifdfb5927399d56992fe707160423c29278f49172 --- src/egl/drivers/dri2/platform_android.c | 99 +++-- 1 file changed, 57 insertions(+), 42 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index d78c06d..94e765d 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -478,53 +478,36 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) } static _EGLImage * -dri2_create_image_android_native_buffer(_EGLDisplay *disp, -_EGLContext *ctx, -struct ANativeWindowBuffer *buf) +droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx, + struct ANativeWindowBuffer *buf, int fd) { - struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - struct dri2_egl_image *dri2_img; - int name, fd; - int format; - - if (ctx != NULL) { - /* From the EGL_ANDROID_image_native_buffer spec: - * - * * If is EGL_NATIVE_BUFFER_ANDROID and is not - * EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated. - */ - _eglError(EGL_BAD_CONTEXT, "eglCreateEGLImageKHR: for " -"EGL_NATIVE_BUFFER_ANDROID, the context must be " -"EGL_NO_CONTEXT"); - return NULL; - } + const int fourcc = get_fourcc(get_format(buf->format)); + const int pitch = buf->stride * get_format_bpp(buf->format); + + const EGLint attr_list[14] = { + EGL_WIDTH, buf->width, + EGL_HEIGHT, buf->height, + EGL_LINUX_DRM_FOURCC_EXT, fourcc, + EGL_DMA_BUF_PLANE0_FD_EXT, fd, + EGL_DMA_BUF_PLANE0_PITCH_EXT, pitch, + EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, + EGL_NONE, 0 + }; - if (!buf || buf->common.magic != ANDROID_NATIVE_BUFFER_MAGIC || - buf->common.version != sizeof(*buf)) { - _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); + if (fourcc == -1 || pitch == 0) return NULL; - } - fd = get_native_buffer_fd(buf); - if (fd >= 0) { - const int fourcc = get_fourcc(get_format(buf->format)); - const int pitch = buf->stride * get_format_bpp(buf->format); - - const EGLint attr_list[14] = { - EGL_WIDTH, buf->width, - EGL_HEIGHT, buf->height, - EGL_LINUX_DRM_FOURCC_EXT, fourcc, - EGL_DMA_BUF_PLANE0_FD_EXT, fd, - EGL_DMA_BUF_PLANE0_PITCH_EXT, pitch, - EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, - EGL_NONE, 0 - }; - - if (fourcc == -1 || pitch == 0) - return NULL; + return dri2_create_image_dma_buf(disp, ctx, NULL, attr_list); +} - return dri2_create_image_dma_buf(disp, ctx, NULL, attr_list); - } +static _EGLImage * +droid_create_image_from_name(_EGLDisplay *disp, _EGLContext *ctx, + struct ANativeWindowBuffer *buf) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + struct dri2_egl_image *dri2_img; + int name; + int format; name = get_native_buffer_name(buf); if (!name) { @@ -565,6 +548,38 @@ dri2_create_image_android_native_buffer(_EGLDisplay *disp, } static _EGLImage * +dri2_create_image_android_native_buffer(_EGLDisplay *disp, +_EGLContext *ctx, +struct ANativeWindowBuffer *buf) +{ + int fd; + + if (ctx != NULL) { + /* From the EGL_ANDROID_image_native_buffer spec: + * + * * If is EGL_NATIVE_BUFFER_ANDROID and is not + * EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated. + */ + _eglError(EGL_BAD_CONTEXT, "eglCreateEGLImageKHR: for " +"EGL_NATIVE_BUFFER_ANDROID, the context must be " +"EGL_NO_CONTEXT"); + return NULL; + } + + if (!buf || buf->common.magic != ANDROID_NATIVE_BUFFER_MAGIC || + buf->common.version != sizeof(*buf)) { + _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); + return NULL; + } + + fd = get_native_buffer_fd(buf); + if (fd >= 0) +
Mesa (master): nir: make use of nir_cf_list_extract() helper
Module: Mesa Branch: master Commit: 8c4d9afb7e770f312079994994f42ddebf7e641c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c4d9afb7e770f312079994994f42ddebf7e641c Author: Timothy ArceriDate: Fri Aug 5 11:08:20 2016 +1000 nir: make use of nir_cf_list_extract() helper Reviewed-by: Kenneth Graunke --- src/compiler/nir/nir_opt_dead_cf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c index 81c1b65..3551124 100644 --- a/src/compiler/nir/nir_opt_dead_cf.c +++ b/src/compiler/nir/nir_opt_dead_cf.c @@ -128,8 +128,7 @@ opt_constant_if(nir_if *if_stmt, bool condition) : _stmt->else_list; nir_cf_list list; - nir_cf_extract(, nir_before_cf_list(cf_list), - nir_after_cf_list(cf_list)); + nir_cf_list_extract(, cf_list); nir_cf_reinsert(, nir_after_cf_node(_stmt->cf_node)); nir_cf_node_remove(_stmt->cf_node); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nir: Always print non-identity swizzles.
Module: Mesa Branch: master Commit: b1d9c742e92629086dc1bac423a9254ca26a27ff URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1d9c742e92629086dc1bac423a9254ca26a27ff Author: Matt TurnerDate: Tue Sep 22 10:30:05 2015 -0700 nir: Always print non-identity swizzles. Previously we would not print a swizzle on ssa_52 when only its .x component is used (as seen in the definition of ssa_53): vec3 ssa_52 = fadd ssa_51, ssa_51 vec1 ssa_53 = flog2 ssa_52 vec1 ssa_54 = flog2 ssa_52.y vec1 ssa_55 = flog2 ssa_52.z But this makes the interpretation of the RHS of the definition difficult to understand and dependent on the size of the LHS. Just print swizzles when they are not the identity swizzle, so the previous example is now printed as: vec3 ssa_52 = fadd ssa_51.xyz, ssa_51.xyz vec1 ssa_53 = flog2 ssa_52.x vec1 ssa_54 = flog2 ssa_52.y vec1 ssa_55 = flog2 ssa_52.z Reviewed-by: Timothy Arceri Reviewed-by: Jason Ekstrand --- src/compiler/nir/nir_print.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 3beb70a..9fa024e 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -186,17 +186,25 @@ print_alu_src(nir_alu_instr *instr, unsigned src, print_state *state) print_src(>src[src].src, state); bool print_swizzle = false; + unsigned used_channels = 0; + for (unsigned i = 0; i < 4; i++) { if (!nir_alu_instr_channel_used(instr, src, i)) continue; + used_channels++; + if (instr->src[src].swizzle[i] != i) { print_swizzle = true; break; } } - if (print_swizzle) { + unsigned live_channels = instr->src[src].src.is_ssa + ? instr->src[src].src.ssa->num_components + : instr->src[src].src.reg.reg->num_components; + + if (print_swizzle || used_channels != live_channels) { fprintf(fp, "."); for (unsigned i = 0; i < 4; i++) { if (!nir_alu_instr_channel_used(instr, src, i)) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Simplify interface qualifier parsing.
Module: Mesa Branch: master Commit: 86915b495b2fefa671750b24eda0225000ccbb9e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=86915b495b2fefa671750b24eda0225000ccbb9e Author: Kenneth GraunkeDate: Wed Jun 1 18:40:21 2016 -0700 glsl: Simplify interface qualifier parsing. This better matches the grammar in section 4.3.9 of the GLSL 4.5 spec, and also removes some redundant code. Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/glsl_parser.yy | 41 +++- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 61c4723..146589a 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -219,8 +219,6 @@ static bool match_layout_qualifier(const char *s1, const char *s2, %type subroutine_qualifier %type subroutine_type_list %type interface_qualifier -%type uniform_interface_qualifier -%type buffer_interface_qualifier %type type_specifier %type type_specifier_nonarray %type array_specifier @@ -2663,30 +2661,11 @@ basic_interface_block: { ast_interface_block *const block = $6; - block->block_name = $2; - block->declarations.push_degenerate_list_at_head(& $4->link); - - _mesa_ast_process_interface_block(& @1, state, block, $1); - - $$ = block; - } - | uniform_interface_qualifier NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';' - { - ast_interface_block *const block = $6; - - block->layout = *state->default_uniform_qualifier; - block->block_name = $2; - block->declarations.push_degenerate_list_at_head(& $4->link); - - _mesa_ast_process_interface_block(& @1, state, block, $1); - - $$ = block; - } - | buffer_interface_qualifier NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';' - { - ast_interface_block *const block = $6; - - block->layout = *state->default_shader_storage_qualifier; + if ($1.flags.q.uniform) { + block->layout = *state->default_uniform_qualifier; + } else if ($1.flags.q.buffer) { + block->layout = *state->default_shader_storage_qualifier; + } block->block_name = $2; block->declarations.push_degenerate_list_at_head(& $4->link); @@ -2707,18 +2686,12 @@ interface_qualifier: memset(& $$, 0, sizeof($$)); $$.flags.q.out = 1; } - ; - -uniform_interface_qualifier: - UNIFORM + | UNIFORM { memset(& $$, 0, sizeof($$)); $$.flags.q.uniform = 1; } - ; - -buffer_interface_qualifier: - BUFFER + | BUFFER { memset(& $$, 0, sizeof($$)); $$.flags.q.buffer = 1; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Combine GS and TES array resizing visitors.
Module: Mesa Branch: master Commit: bd1bd03268285bf562338ba3b0d6661c6319c698 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd1bd03268285bf562338ba3b0d6661c6319c698 Author: Kenneth GraunkeDate: Fri Jul 8 13:29:31 2016 -0700 glsl: Combine GS and TES array resizing visitors. These are largely identical, except that the GS version has a few extra error conditions. We can just pass in the stage and skip these. Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/linker.cpp | 107 ++- 1 file changed, 35 insertions(+), 72 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 1c8860e..f404913 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -180,49 +180,57 @@ private: }; -class geom_array_resize_visitor : public ir_hierarchical_visitor { +class array_resize_visitor : public ir_hierarchical_visitor { public: unsigned num_vertices; gl_shader_program *prog; + gl_shader_stage stage; - geom_array_resize_visitor(unsigned num_vertices, gl_shader_program *prog) + array_resize_visitor(unsigned num_vertices, +gl_shader_program *prog, +gl_shader_stage stage) { this->num_vertices = num_vertices; this->prog = prog; + this->stage = stage; } - virtual ~geom_array_resize_visitor() + virtual ~array_resize_visitor() { /* empty */ } virtual ir_visitor_status visit(ir_variable *var) { - if (!var->type->is_array() || var->data.mode != ir_var_shader_in) + if (!var->type->is_array() || var->data.mode != ir_var_shader_in || + var->data.patch) return visit_continue; unsigned size = var->type->length; - /* Generate a link error if the shader has declared this array with an - * incorrect size. - */ - if (!var->data.implicit_sized_array && - size && size != this->num_vertices) { - linker_error(this->prog, "size of array %s declared as %u, " - "but number of input vertices is %u\n", - var->name, size, this->num_vertices); - return visit_continue; - } + if (stage == MESA_SHADER_GEOMETRY) { + /* Generate a link error if the shader has declared this array with + * an incorrect size. + */ + if (!var->data.implicit_sized_array && + size && size != this->num_vertices) { +linker_error(this->prog, "size of array %s declared as %u, " + "but number of input vertices is %u\n", + var->name, size, this->num_vertices); +return visit_continue; + } - /* Generate a link error if the shader attempts to access an input - * array using an index too large for its actual size assigned at link - * time. - */ - if (var->data.max_array_access >= (int)this->num_vertices) { - linker_error(this->prog, "geometry shader accesses element %i of " - "%s, but only %i input vertices\n", - var->data.max_array_access, var->name, this->num_vertices); - return visit_continue; + /* Generate a link error if the shader attempts to access an input + * array using an index too large for its actual size assigned at + * link time. + */ + if (var->data.max_array_access >= (int)this->num_vertices) { +linker_error(this->prog, "%s shader accesses element %i of " + "%s, but only %i input vertices\n", + _mesa_shader_stage_to_string(this->stage), + var->data.max_array_access, var->name, this->num_vertices); +return visit_continue; + } } var->type = glsl_type::get_array_instance(var->type->fields.array, @@ -251,53 +259,6 @@ public: } }; -class tess_eval_array_resize_visitor : public ir_hierarchical_visitor { -public: - unsigned num_vertices; - gl_shader_program *prog; - - tess_eval_array_resize_visitor(unsigned num_vertices, gl_shader_program *prog) - { - this->num_vertices = num_vertices; - this->prog = prog; - } - - virtual ~tess_eval_array_resize_visitor() - { - /* empty */ - } - - virtual ir_visitor_status visit(ir_variable *var) - { - if (!var->type->is_array() || var->data.mode != ir_var_shader_in || var->data.patch) - return visit_continue; - - var->type = glsl_type::get_array_instance(var->type->fields.array, -this->num_vertices); - var->data.max_array_access = this->num_vertices - 1; - - return visit_continue; - } - - /* Dereferences of input variables need to be updated so that their type -
Mesa (master): glsl: Add a has_tessellation_shader() helper.
Module: Mesa Branch: master Commit: d0642c52fce91936443ea64ebbc2719813b95aae URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0642c52fce91936443ea64ebbc2719813b95aae Author: Kenneth GraunkeDate: Fri May 20 15:17:37 2016 -0700 glsl: Add a has_tessellation_shader() helper. Similar to has_geometry_shader(), has_compute_shader(), and so on. This will make it easier to add more conditions here later. Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/builtin_variables.cpp | 6 ++ src/compiler/glsl/glsl_parser.yy| 19 +-- src/compiler/glsl/glsl_parser_extras.h | 5 + 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index f63dc3a..20d1d75 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -861,8 +861,7 @@ builtin_variable_generator::generate_constants() state->Const.MaxImageSamples); } - if (state->is_version(400, 0) || - state->ARB_tessellation_shader_enable) { + if (state->has_tessellation_shader()) { add_const("gl_MaxTessControlImageUniforms", state->Const.MaxTessControlImageUniforms); add_const("gl_MaxTessEvaluationImageUniforms", @@ -880,8 +879,7 @@ builtin_variable_generator::generate_constants() state->ARB_viewport_array_enable) add_const("gl_MaxViewports", state->Const.MaxViewports); - if (state->is_version(400, 0) || - state->ARB_tessellation_shader_enable) { + if (state->has_tessellation_shader()) { add_const("gl_MaxPatchVertices", state->Const.MaxPatchVertices); add_const("gl_MaxTessGenLevel", state->Const.MaxTessGenLevel); add_const("gl_MaxTessControlInputComponents", state->Const.MaxTessControlInputComponents); diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 3885688..61c4723 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -1390,9 +1390,7 @@ layout_qualifier_id: } } - if ($$.flags.i && - !state->ARB_tessellation_shader_enable && - !state->is_version(400, 0)) { + if ($$.flags.i && !state->has_tessellation_shader()) { _mesa_glsl_error(& @1, state, "primitive mode qualifier `%s' requires " "GLSL 4.00 or ARB_tessellation_shader", $1); @@ -1415,9 +1413,7 @@ layout_qualifier_id: } } - if ($$.flags.i && - !state->ARB_tessellation_shader_enable && - !state->is_version(400, 0)) { + if ($$.flags.i && !state->has_tessellation_shader()) { _mesa_glsl_error(& @1, state, "vertex spacing qualifier `%s' requires " "GLSL 4.00 or ARB_tessellation_shader", $1); @@ -1432,9 +1428,7 @@ layout_qualifier_id: $$.ordering = GL_CCW; } - if ($$.flags.i && - !state->ARB_tessellation_shader_enable && - !state->is_version(400, 0)) { + if ($$.flags.i && !state->has_tessellation_shader()) { _mesa_glsl_error(& @1, state, "ordering qualifier `%s' requires " "GLSL 4.00 or ARB_tessellation_shader", $1); @@ -1446,9 +1440,7 @@ layout_qualifier_id: $$.point_mode = true; } - if ($$.flags.i && - !state->ARB_tessellation_shader_enable && - !state->is_version(400, 0)) { + if ($$.flags.i && !state->has_tessellation_shader()) { _mesa_glsl_error(& @1, state, "qualifier `point_mode' requires " "GLSL 4.00 or ARB_tessellation_shader"); @@ -1608,8 +1600,7 @@ layout_qualifier_id: if (match_layout_qualifier("vertices", $1, state) == 0) { $$.flags.q.vertices = 1; $$.vertices = new(ctx) ast_layout_expression(@1, $3); - if (!state->ARB_tessellation_shader_enable && - !state->is_version(400, 0)) { + if (!state->has_tessellation_shader()) { _mesa_glsl_error(& @1, state, "vertices qualifier requires GLSL 4.00 or " "ARB_tessellation_shader"); diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index cca7fa8..f9c1ffc 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -277,6 +277,11 @@ struct _mesa_glsl_parse_state { return OES_geometry_shader_enable || is_version(150, 320); } + bool has_tessellation_shader() const + { + return ARB_tessellation_shader_enable ||
Mesa (master): glsl: Fix the program resource names of gl_TessLevelOuter/ Inner[].
Module: Mesa Branch: master Commit: 1556f16e46ba3037c3901808c2e1ac5df8e2b20e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1556f16e46ba3037c3901808c2e1ac5df8e2b20e Author: Kenneth GraunkeDate: Thu Jun 23 23:12:45 2016 -0700 glsl: Fix the program resource names of gl_TessLevelOuter/Inner[]. These are lowered to gl_TessLevel{Outer,Inner}MESA. We need them to appear in the program resource list with their original names and types. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/linker.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 6d45a02..2271676 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3702,6 +3702,18 @@ create_shader_variable(struct gl_shader_program *shProg, if (in->data.mode == ir_var_system_value && in->data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) { out->name = ralloc_strdup(shProg, "gl_VertexID"); + } else if ((in->data.mode == ir_var_shader_out && + in->data.location == VARYING_SLOT_TESS_LEVEL_OUTER) || + (in->data.mode == ir_var_system_value && + in->data.location == SYSTEM_VALUE_TESS_LEVEL_OUTER)) { + out->name = ralloc_strdup(shProg, "gl_TessLevelOuter"); + type = glsl_type::get_array_instance(glsl_type::float_type, 4); + } else if ((in->data.mode == ir_var_shader_out && + in->data.location == VARYING_SLOT_TESS_LEVEL_INNER) || + (in->data.mode == ir_var_system_value && + in->data.location == SYSTEM_VALUE_TESS_LEVEL_INNER)) { + out->name = ralloc_strdup(shProg, "gl_TessLevelInner"); + type = glsl_type::get_array_instance(glsl_type::float_type, 2); } else { out->name = ralloc_strdup(shProg, name); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Fix location bias for patch variables.
Module: Mesa Branch: master Commit: 398428f40684addd0a1465cf268436e8b1865351 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=398428f40684addd0a1465cf268436e8b1865351 Author: Kenneth GraunkeDate: Fri Jun 24 00:09:00 2016 -0700 glsl: Fix location bias for patch variables. We need to subtract VARYING_SLOT_PATCH0, not VARYING_SLOT_VAR0. Since "patch" only applies to inputs and outputs, we can just handle this once outside the switch statement, rather than replicating the check twice and complicating the earlier conditions. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/linker.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 2271676..1c8860e 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3866,6 +3866,9 @@ add_interface_variables(struct gl_shader_program *shProg, continue; }; + if (var->data.patch) + loc_bias = int(VARYING_SLOT_PATCH0); + /* Skip packed varyings, packed varyings are handled separately * by add_packed_varyings. */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Delete bogus ir_set_program_inouts assert.
Module: Mesa Branch: master Commit: 4a49851da140fedf0e133034a202570725ad03a9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a49851da140fedf0e133034a202570725ad03a9 Author: Kenneth GraunkeDate: Wed Oct 28 16:39:11 2015 -0700 glsl: Delete bogus ir_set_program_inouts assert. This assertion is bogus. Varying structs, and arrays of structs, are allowed by GLSL, and we can see them here. While we currently don't have any partial-variable support for those, simply returning false and marking the entire thing as used is certainly legitimate. I believe this is often swept under the rug by varying packing, but that's disabled in certain tessellation situations. Hit by 20 dEQP-GLES31.functional.tessellation.user_defined_io.* tests. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/ir_set_program_inouts.cpp | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp index 7c61994..060bea8 100644 --- a/src/compiler/glsl/ir_set_program_inouts.cpp +++ b/src/compiler/glsl/ir_set_program_inouts.cpp @@ -260,15 +260,19 @@ ir_set_program_inouts_visitor::try_mark_partial_variable(ir_variable *var, * lowering passes (do_vec_index_to_swizzle() gets rid of indexing into * vectors, and lower_packed_varyings() gets rid of structs that occur in * varyings). +* +* However, we don't use varying packing in all cases - tessellation +* shaders bypass it. This means we'll see varying structs and arrays +* of structs here. For now, we just give up so the caller marks the +* entire variable as used. */ if (!(type->is_matrix() || (type->is_array() && (type->fields.array->is_numeric() || type->fields.array->is_boolean() { - assert(!"Unexpected indexing in ir_set_program_inouts"); - /* For safety in release builds, in case we ever encounter unexpected - * indexing, give up and let the caller mark the whole variable as used. + /* If we don't know how to handle this case, give up and let the + * caller mark the whole variable as used. */ return false; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: add has_draw_indirect_multi flag
Module: Mesa Branch: master Commit: 96bbb620a5952828cabe27ef7eb3adaa3f2226f4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=96bbb620a5952828cabe27ef7eb3adaa3f2226f4 Author: Nicolai HähnleDate: Fri Jul 29 17:59:11 2016 +0100 radeonsi: add has_draw_indirect_multi flag Prefer to use DRAW_(INDEX)_INDIRECT_MULTI when available in the firmware. Versions for SI and CI already added as provided by the firmware team, but keep in mind that they won't currently be used since the radeon kernel module has no interface to query the firmware version. Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_pipe.c | 12 src/gallium/drivers/radeonsi/si_pipe.h | 1 + src/gallium/drivers/radeonsi/si_state_draw.c | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index e33823d..ffeeda3 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -785,6 +785,18 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws) sscreen->b.chip_class >= VI && sscreen->b.info.max_se >= 2; + sscreen->has_draw_indirect_multi = + (sscreen->b.family >= CHIP_POLARIS10) || + (sscreen->b.chip_class == VI && +sscreen->b.info.pfp_fw_version >= 121 && +sscreen->b.info.me_fw_version >= 87) || + (sscreen->b.chip_class == CIK && +sscreen->b.info.pfp_fw_version >= 211 && +sscreen->b.info.me_fw_version >= 173) || + (sscreen->b.chip_class == SI && +sscreen->b.info.pfp_fw_version >= 121 && +sscreen->b.info.me_fw_version >= 87); + sscreen->b.has_cp_dma = true; sscreen->b.has_streamout = true; pipe_mutex_init(sscreen->shader_parts_mutex); diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 55f8965..9e6bd78 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -85,6 +85,7 @@ struct si_screen { unsignedgs_table_depth; unsignedtess_offchip_block_dw_size; boolhas_distributed_tess; + boolhas_draw_indirect_multi; /* Whether shaders are monolithic (1-part) or separate (3-part). */ booluse_monolithic_shaders; diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 8f26f8c..a60723d 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -634,7 +634,7 @@ static void si_emit_draw_packets(struct si_context *sctx, radeon_emit(cs, index_max_size); } - if (sctx->b.family < CHIP_POLARIS10) { + if (!sctx->screen->has_draw_indirect_multi) { radeon_emit(cs, PKT3(info->indexed ? PKT3_DRAW_INDEX_INDIRECT : PKT3_DRAW_INDIRECT, 3, render_cond_bit)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: move spi_ps_input_addr override outside of the loop
Module: Mesa Branch: master Commit: 7f5a8dc27e7965af3d6a4389950fcc90f8b2430a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f5a8dc27e7965af3d6a4389950fcc90f8b2430a Author: Nicolai HähnleDate: Wed Aug 3 13:30:32 2016 +0200 radeonsi: move spi_ps_input_addr override outside of the loop Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_shader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 455f604..64c367e 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -5990,10 +5990,10 @@ void si_shader_binary_read_config(struct radeon_shader_binary *binary, } break; } - - if (!conf->spi_ps_input_addr) - conf->spi_ps_input_addr = conf->spi_ps_input_ena; } + + if (!conf->spi_ps_input_addr) + conf->spi_ps_input_addr = conf->spi_ps_input_ena; } void si_shader_apply_scratch_relocs(struct si_context *sctx, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: unify emitting PKT3_SET_BASE for indirect draws
Module: Mesa Branch: master Commit: cf7d18b75c987fdb31bf1f55d1740055d8917327 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf7d18b75c987fdb31bf1f55d1740055d8917327 Author: Nicolai HähnleDate: Fri Jul 29 17:51:23 2016 +0100 radeonsi: unify emitting PKT3_SET_BASE for indirect draws Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_state_draw.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index d743e22..523c2ea 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -591,8 +591,17 @@ static void si_emit_draw_packets(struct si_context *sctx, sctx->last_sh_base_reg = sh_base_reg; } } else { + uint64_t indirect_va = r600_resource(info->indirect)->gpu_address; + + assert(indirect_va % 8 == 0); + si_invalidate_draw_sh_constants(sctx); + radeon_emit(cs, PKT3(PKT3_SET_BASE, 2, 0)); + radeon_emit(cs, 1); + radeon_emit(cs, indirect_va); + radeon_emit(cs, indirect_va >> 32); + radeon_add_to_buffer_list(>b, >b.gfx, (struct r600_resource *)info->indirect, RADEON_USAGE_READ, RADEON_PRIO_DRAW_INDIRECT); @@ -608,17 +617,9 @@ static void si_emit_draw_packets(struct si_context *sctx, RADEON_USAGE_READ, RADEON_PRIO_INDEX_BUFFER); if (info->indirect) { - uint64_t indirect_va = r600_resource(info->indirect)->gpu_address; - - assert(indirect_va % 8 == 0); assert(index_va % 2 == 0); assert(info->indirect_offset % 4 == 0); - radeon_emit(cs, PKT3(PKT3_SET_BASE, 2, 0)); - radeon_emit(cs, 1); - radeon_emit(cs, indirect_va); - radeon_emit(cs, indirect_va >> 32); - radeon_emit(cs, PKT3(PKT3_INDEX_BASE, 1, 0)); radeon_emit(cs, index_va); radeon_emit(cs, index_va >> 32); @@ -656,16 +657,8 @@ static void si_emit_draw_packets(struct si_context *sctx, } } else { if (info->indirect) { - uint64_t indirect_va = r600_resource(info->indirect)->gpu_address; - - assert(indirect_va % 8 == 0); assert(info->indirect_offset % 4 == 0); - radeon_emit(cs, PKT3(PKT3_SET_BASE, 2, 0)); - radeon_emit(cs, 1); - radeon_emit(cs, indirect_va); - radeon_emit(cs, indirect_va >> 32); - if (sctx->b.family < CHIP_POLARIS10) { radeon_emit(cs, PKT3(PKT3_DRAW_INDIRECT, 3, render_cond_bit)); radeon_emit(cs, info->indirect_offset); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: transpose indirect/index draw dispatch
Module: Mesa Branch: master Commit: 5c343cce0f33e534481317ea99cf8192960d5e9f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c343cce0f33e534481317ea99cf8192960d5e9f Author: Nicolai HähnleDate: Fri Jul 29 18:05:30 2016 +0100 radeonsi: transpose indirect/index draw dispatch This allows better code sharing for indirect draw calls. Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_state_draw.c | 76 1 file changed, 31 insertions(+), 45 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index bae0f94..8f26f8c 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -619,36 +619,45 @@ static void si_emit_draw_packets(struct si_context *sctx, RADEON_USAGE_READ, RADEON_PRIO_DRAW_INDIRECT); } - if (info->indexed) { - if (info->indirect) { - assert(info->indirect_offset % 4 == 0); + if (info->indirect) { + unsigned di_src_sel = info->indexed ? V_0287F0_DI_SRC_SEL_DMA + : V_0287F0_DI_SRC_SEL_AUTO_INDEX; + + assert(info->indirect_offset % 4 == 0); + if (info->indexed) { radeon_emit(cs, PKT3(PKT3_INDEX_BASE, 1, 0)); radeon_emit(cs, index_va); radeon_emit(cs, index_va >> 32); radeon_emit(cs, PKT3(PKT3_INDEX_BUFFER_SIZE, 0, 0)); radeon_emit(cs, index_max_size); + } - if (sctx->b.family < CHIP_POLARIS10) { - radeon_emit(cs, PKT3(PKT3_DRAW_INDEX_INDIRECT, 3, render_cond_bit)); - radeon_emit(cs, info->indirect_offset); - radeon_emit(cs, (sh_base_reg + SI_SGPR_BASE_VERTEX * 4 - SI_SH_REG_OFFSET) >> 2); - radeon_emit(cs, (sh_base_reg + SI_SGPR_START_INSTANCE * 4 - SI_SH_REG_OFFSET) >> 2); - radeon_emit(cs, V_0287F0_DI_SRC_SEL_DMA); - } else { - radeon_emit(cs, PKT3(PKT3_DRAW_INDEX_INDIRECT_MULTI, 8, render_cond_bit)); - radeon_emit(cs, info->indirect_offset); - radeon_emit(cs, (sh_base_reg + SI_SGPR_BASE_VERTEX * 4 - SI_SH_REG_OFFSET) >> 2); - radeon_emit(cs, (sh_base_reg + SI_SGPR_START_INSTANCE * 4 - SI_SH_REG_OFFSET) >> 2); - radeon_emit(cs, 0); /* draw_index */ - radeon_emit(cs, 1); /* count */ - radeon_emit(cs, 0); /* count_addr -- disabled */ - radeon_emit(cs, 0); - radeon_emit(cs, 16); /* stride */ - radeon_emit(cs, V_0287F0_DI_SRC_SEL_DMA); - } + if (sctx->b.family < CHIP_POLARIS10) { + radeon_emit(cs, PKT3(info->indexed ? PKT3_DRAW_INDEX_INDIRECT + : PKT3_DRAW_INDIRECT, +3, render_cond_bit)); + radeon_emit(cs, info->indirect_offset); + radeon_emit(cs, (sh_base_reg + SI_SGPR_BASE_VERTEX * 4 - SI_SH_REG_OFFSET) >> 2); + radeon_emit(cs, (sh_base_reg + SI_SGPR_START_INSTANCE * 4 - SI_SH_REG_OFFSET) >> 2); + radeon_emit(cs, di_src_sel); } else { + radeon_emit(cs, PKT3(info->indexed ? PKT3_DRAW_INDEX_INDIRECT_MULTI : + PKT3_DRAW_INDIRECT_MULTI, +8, render_cond_bit)); + radeon_emit(cs, info->indirect_offset); + radeon_emit(cs, (sh_base_reg + SI_SGPR_BASE_VERTEX * 4 - SI_SH_REG_OFFSET) >> 2); + radeon_emit(cs, (sh_base_reg + SI_SGPR_START_INSTANCE * 4 - SI_SH_REG_OFFSET) >> 2); + radeon_emit(cs, 0); /* draw_index */ + radeon_emit(cs, 1); /* count */ + radeon_emit(cs, 0); /* count_addr -- disabled */ + radeon_emit(cs, 0); + radeon_emit(cs, 16); /* stride */ + radeon_emit(cs, di_src_sel); + } + } else { + if (info->indexed) { index_va += info->start * ib->index_size; radeon_emit(cs, PKT3(PKT3_DRAW_INDEX_2, 4, render_cond_bit)); @@ -657,34 +666,11 @@ static void si_emit_draw_packets(struct si_context *sctx,
Mesa (master): radeonsi: drop unnecessary u_pstipple.h include
Module: Mesa Branch: master Commit: 287822ee33b3eb57b459d23e6b0624424df2fca4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=287822ee33b3eb57b459d23e6b0624424df2fca4 Author: Nicolai HähnleDate: Wed Aug 3 12:54:45 2016 +0200 radeonsi: drop unnecessary u_pstipple.h include Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_shader.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 0aae097..455f604 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -39,7 +39,6 @@ #include "radeon/radeon_elf_util.h" #include "radeon/radeon_llvm_emit.h" #include "util/u_memory.h" -#include "util/u_pstipple.h" #include "util/u_string.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_build.h" ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: do not pass the return type to buffer_load_const
Module: Mesa Branch: master Commit: 3e4c5693a1f498411bfd280c4123f9c93ba19e3a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e4c5693a1f498411bfd280c4123f9c93ba19e3a Author: Nicolai HähnleDate: Wed Aug 3 12:52:28 2016 +0200 radeonsi: do not pass the return type to buffer_load_const Overriding it is not allowed anyway, and actually lead to a crash when polygon stippling was used with monolithic shaders. Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_shader.c | 36 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 62a1486..0aae097 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1593,12 +1593,14 @@ static LLVMValueRef get_thread_id(struct si_shader_context *ctx) /** * Load a dword from a constant buffer. */ -static LLVMValueRef buffer_load_const(LLVMBuilderRef builder, LLVMValueRef resource, - LLVMValueRef offset, LLVMTypeRef return_type) +static LLVMValueRef buffer_load_const(struct si_shader_context *ctx, + LLVMValueRef resource, + LLVMValueRef offset) { + LLVMBuilderRef builder = ctx->radeon_bld.gallivm.builder; LLVMValueRef args[2] = {resource, offset}; - return lp_build_intrinsic(builder, "llvm.SI.load.const", return_type, args, 2, + return lp_build_intrinsic(builder, "llvm.SI.load.const", ctx->f32, args, 2, LLVMReadNoneAttribute); } @@ -1618,8 +1620,8 @@ static LLVMValueRef load_sample_position(struct radeon_llvm_context *radeon_bld, LLVMValueRef offset1 = LLVMBuildAdd(builder, offset0, lp_build_const_int32(gallivm, 4), ""); LLVMValueRef pos[4] = { - buffer_load_const(builder, resource, offset0, ctx->f32), - buffer_load_const(builder, resource, offset1, ctx->f32), + buffer_load_const(ctx, resource, offset0), + buffer_load_const(ctx, resource, offset1), lp_build_const_float(gallivm, 0), lp_build_const_float(gallivm, 0) }; @@ -1772,9 +1774,8 @@ static void declare_system_value( offset = decl->Semantic.Name == TGSI_SEMANTIC_DEFAULT_TESSINNER_SI ? 4 : 0; for (i = 0; i < 4; i++) - val[i] = buffer_load_const(gallivm->builder, buf, - lp_build_const_int32(gallivm, (offset + i) * 4), - ctx->f32); + val[i] = buffer_load_const(ctx, buf, + lp_build_const_int32(gallivm, (offset + i) * 4)); value = lp_build_gather_values(gallivm, val, 4); break; } @@ -1908,8 +1909,7 @@ static LLVMValueRef fetch_constant( addr = lp_build_add(_base->uint_bld, addr, lp_build_const_int32(base->gallivm, idx * 4)); - result = buffer_load_const(base->gallivm->builder, bufp, - addr, ctx->f32); + result = buffer_load_const(ctx, bufp, addr); if (!tgsi_type_is_64bit(type)) result = bitcast(bld_base, type, result); @@ -1921,8 +1921,8 @@ static LLVMValueRef fetch_constant( addr2 = lp_build_add(_base->uint_bld, addr2, lp_build_const_int32(base->gallivm, idx * 4)); - result2 = buffer_load_const(base->gallivm->builder, ctx->const_buffers[buf], - addr2, ctx->f32); + result2 = buffer_load_const(ctx, ctx->const_buffers[buf], + addr2); result = radeon_llvm_emit_fetch_64bit(bld_base, type, result, result2); @@ -2219,8 +2219,8 @@ static void si_llvm_emit_clipvertex(struct lp_build_tgsi_context *bld_base, args[1] = lp_build_const_int32(base->gallivm, ((reg_index * 4 + chan) * 4 + const_chan) * 4); - base_elt = buffer_load_const(base->gallivm->builder, const_resource, - args[1], ctx->f32); + base_elt = buffer_load_const(ctx, const_resource, +args[1]); args[5 + chan] = lp_build_add(base, args[5 + chan], lp_build_mul(base, base_elt, @@ -5725,10
Mesa (master): radeonsi: move index buffer calculations in si_emit_draw_packets up
Module: Mesa Branch: master Commit: 64ff23a58cd4f5daeb52d5f8e2d37904696d6cb4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=64ff23a58cd4f5daeb52d5f8e2d37904696d6cb4 Author: Nicolai HähnleDate: Fri Jul 29 17:56:21 2016 +0100 radeonsi: move index buffer calculations in si_emit_draw_packets up Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_state_draw.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 523c2ea..bae0f94 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -520,6 +520,8 @@ static void si_emit_draw_packets(struct si_context *sctx, struct radeon_winsys_cs *cs = sctx->b.gfx.cs; unsigned sh_base_reg = sctx->shader_userdata.sh_base[PIPE_SHADER_VERTEX]; bool render_cond_bit = sctx->b.render_cond && !sctx->b.render_cond_force_off; + uint32_t index_max_size = 0; + uint64_t index_va = 0; if (info->count_from_stream_output) { struct r600_so_target *t = @@ -567,6 +569,16 @@ static void si_emit_draw_packets(struct si_context *sctx, assert(!"unreachable"); return; } + + index_max_size = (ib->buffer->width0 - ib->offset) / + ib->index_size; + index_va = r600_resource(ib->buffer)->gpu_address + ib->offset; + + assert(index_va % 2 == 0); + + radeon_add_to_buffer_list(>b, >b.gfx, + (struct r600_resource *)ib->buffer, + RADEON_USAGE_READ, RADEON_PRIO_INDEX_BUFFER); } if (!info->indirect) { @@ -608,16 +620,7 @@ static void si_emit_draw_packets(struct si_context *sctx, } if (info->indexed) { - uint32_t index_max_size = (ib->buffer->width0 - ib->offset) / - ib->index_size; - uint64_t index_va = r600_resource(ib->buffer)->gpu_address + ib->offset; - - radeon_add_to_buffer_list(>b, >b.gfx, - (struct r600_resource *)ib->buffer, - RADEON_USAGE_READ, RADEON_PRIO_INDEX_BUFFER); - if (info->indirect) { - assert(index_va % 2 == 0); assert(info->indirect_offset % 4 == 0); radeon_emit(cs, PKT3(PKT3_INDEX_BASE, 1, 0)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): winsys/amdgpu: query ME/PFP/CE firmware versions
Module: Mesa Branch: master Commit: e0736c438c15f1793630424d29ef63868f12a172 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0736c438c15f1793630424d29ef63868f12a172 Author: Nicolai HähnleDate: Thu Jul 28 16:40:21 2016 +0100 winsys/amdgpu: query ME/PFP/CE firmware versions The radeon kernel module doesn't have the firmware query interface, so the corresponding values will remain 0. Reviewed-by: Marek Olšák --- src/gallium/drivers/radeon/r600_pipe_common.c | 3 +++ src/gallium/drivers/radeon/radeon_winsys.h| 3 +++ src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 22 ++ 3 files changed, 28 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 7fd3fe0..2d05e16 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -1103,6 +1103,9 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, printf("gfx_ib_pad_with_type2 = %i\n", rscreen->info.gfx_ib_pad_with_type2); printf("has_sdma = %i\n", rscreen->info.has_sdma); printf("has_uvd = %i\n", rscreen->info.has_uvd); + printf("me_fw_version = %i\n", rscreen->info.me_fw_version); + printf("pfp_fw_version = %i\n", rscreen->info.pfp_fw_version); + printf("ce_fw_version = %i\n", rscreen->info.ce_fw_version); printf("vce_fw_version = %i\n", rscreen->info.vce_fw_version); printf("vce_harvest_config = %i\n", rscreen->info.vce_harvest_config); printf("clock_crystal_freq = %i\n", rscreen->info.clock_crystal_freq); diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index e7787d3..cc79d54 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -265,6 +265,9 @@ struct radeon_info { boolhas_uvd; uint32_tuvd_fw_version; uint32_tvce_fw_version; +uint32_tme_fw_version; +uint32_tpfp_fw_version; +uint32_tce_fw_version; uint32_tvce_harvest_config; uint32_tclock_crystal_freq; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index 9a04cbe..1f24fcd 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -99,6 +99,7 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd) struct amdgpu_heap_info vram, gtt; struct drm_amdgpu_info_hw_ip dma = {}, uvd = {}, vce = {}; uint32_t vce_version = 0, vce_feature = 0, uvd_version = 0, uvd_feature = 0; + uint32_t unused_feature; int r, i, j; drmDevicePtr devinfo; @@ -151,6 +152,27 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd) goto fail; } + r = amdgpu_query_firmware_version(ws->dev, AMDGPU_INFO_FW_GFX_ME, 0, 0, +>info.me_fw_version, _feature); + if (r) { + fprintf(stderr, "amdgpu: amdgpu_query_firmware_version(me) failed.\n"); + goto fail; + } + + r = amdgpu_query_firmware_version(ws->dev, AMDGPU_INFO_FW_GFX_PFP, 0, 0, +>info.pfp_fw_version, _feature); + if (r) { + fprintf(stderr, "amdgpu: amdgpu_query_firmware_version(pfp) failed.\n"); + goto fail; + } + + r = amdgpu_query_firmware_version(ws->dev, AMDGPU_INFO_FW_GFX_CE, 0, 0, +>info.ce_fw_version, _feature); + if (r) { + fprintf(stderr, "amdgpu: amdgpu_query_firmware_version(ce) failed.\n"); + goto fail; + } + r = amdgpu_query_firmware_version(ws->dev, AMDGPU_INFO_FW_UVD, 0, 0, _version, _feature); if (r) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit