<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 27, 2017 at 7:30 PM, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The intent is to use this extension on vc4 to allow X11 to do overlapping<br>
CopyArea() within a pixmap without first blitting the pixmap to a<br>
temporary. With associated glamor patches, improves x11perf<br>
-copywinwin100 performance on a Raspberry Pi 3 from ~4700/sec to<br>
~5130/sec, and is an even larger boost to uncomposited window movement<br>
performance (most copywinwin100 copies don't overlap).<br>
---<br>
docs/specs/MESA_tile_raster_<wbr>order.spec | 101 ++++++++++++++++++++++++++<br>
docs/specs/enums.txt | 5 ++<br>
include/GL/glext.h | 6 ++<br>
src/mapi/glapi/gen/MESA_tile_<wbr>raster_order.xml | 13 ++++<br>
src/mapi/glapi/gen/Makefile.am | 1 +<br>
src/mesa/main/context.c | 2 +<br>
src/mesa/main/enable.c | 27 +++++++<br>
src/mesa/main/extensions_<wbr>table.h | 1 +<br>
src/mesa/main/mtypes.h | 13 ++++<br>
src/mesa/state_tracker/st_<wbr>atom_rasterizer.c | 5 ++<br>
src/mesa/state_tracker/st_<wbr>context.c | 1 +<br>
src/mesa/state_tracker/st_<wbr>extensions.c | 1 +<br>
12 files changed, 176 insertions(+)<br>
create mode 100644 docs/specs/MESA_tile_raster_<wbr>order.spec<br>
create mode 100644 src/mapi/glapi/gen/MESA_tile_<wbr>raster_order.xml<br>
<br>
diff --git a/docs/specs/MESA_tile_raster_<wbr>order.spec b/docs/specs/MESA_tile_raster_<wbr>order.spec<br>
new file mode 100644<br>
index 000000000000..b6362fc7e5a6<br>
--- /dev/null<br>
+++ b/docs/specs/MESA_tile_raster_<wbr>order.spec<br>
@@ -0,0 +1,101 @@<br>
+Name<br>
+<br>
+ MESA_tile_raster_order<br>
+<br>
+Name Strings<br>
+<br>
+ GL_MESA_tile_raster_order<br>
+<br>
+Contact<br>
+<br>
+ Eric Anholt, Broadcom (<a href="mailto:eric@anholt.net">eric@anholt.net</a>)<br>
+<br>
+Status<br>
+<br>
+ Proposal<br>
+<br>
+Version<br>
+<br>
+ Last modified date: 26 July 2017<br>
+<br>
+Number<br>
+<br>
+ TBD<br>
+<br>
+Dependencies<br>
+<br>
+ GL_ARB_texture_barrier is required<br>
+<br>
+Overview<br>
+<br>
+ This extension extends the sampling-from-the-framebuffer behavior provided<br>
+ by GL_ARB_texture_barrier to allow setting the rasterization order of the<br>
+ scene, so that overlapping blits can be implemented. This can be used for<br>
+ scrolling or window movement within in 2D scenes, without first copying to<br>
+ a temporary.<br>
+<br>
+IP Status<br>
+<br>
+ None<br>
+<br>
+Issues<br>
+<br>
+ 1. Should this extension also affect BlitFramebuffer?<br>
+<br>
+ NOT RESOLVED: BlitFramebuffer could use the same underlying<br>
+ functionality to provide defined results for 1:1 overlapping blits,<br>
+ but one could use the coordinates being copied to just produce the<br>
+ right result automatically, rather than requiring the state flags to<br>
+ be adjusted.<br></blockquote><div><br></div><div>I've been kicking this around in my brain a bit since you sent the extension, and I think we (Intel) may be able to implement a glBlitFramebuffer version. The blitter hardware can do overlapping blits in a well-defined way and I think we could probably do something reasonably intelligent with blorp. At the very least, blorp can probably do better than doing a dumb copy to a temporary. You could do something like this:<br><br></div><div>while (not_empty(dst_region)) {<br></div><div> blit(dst_region - src_region)<br></div><div> dst_region -= dst_region - src_region;<br></div><div>}<br><br></div><div>which might end you up doing one draw call per line in the worst case. However, with a little knowledge of caching, we may be able to do better than that even in the one pixel move case. If we decided that was terrible performance, we could blit through a temporary but make sure it's small enough to always fit in cache. Point being, that there's a number of different ways we can do things better than a dumb copy to temp.<br><br></div><div>All that being said, we aren't nearly as memory constrained as you are so this isn't liable to be particularly high up on anyone's priority list so don't redesign the extension around us.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+New Procedures and Functions<br>
+<br>
+ None<br>
+<br>
+New Tokens<br>
+<br>
+ None<br>
+<br>
+Additions to Chapter 9 of the OpenGL 4.4 Specification (Per-Fragment<br>
+Operations and the Frame Buffer)<br>
+<br>
+ Modify Section 9.3.1 Rendering Feedback Loops, p. 289<br>
+<br>
+ Add the following exception to the list after "There is only a single read<br>
+ and write...":<br>
+<br>
+ - TILE_RASTER_ORDER_FIXED_MESA is enabled, and reads are only performed<br>
+ from texels offset from the current fragment shader invocation in the<br>
+ direction specified by TILE_RASTER_ORDER_INCREASING_<wbr>X_MESA and<br>
+ TILE_RASTER_ORDER_INCREASING_<wbr>Y_MESA (where those being disabled mean<br>
+ negative texel offsets), e.g. using "texelFetch2D(sampler,<br>
+ ivec2(gl_FragCoord.xy + vec2(dx, dy)), 0);".<br>
+<br>
+Additions to the AGL/GLX/WGL Specifications<br>
+<br>
+ None<br>
+<br>
+GLX Protocol<br>
+<br>
+ None<br>
+<br>
+Errors<br>
+<br>
+ None<br>
+<br>
+New State<br>
+<br>
+ Get Value Type Get Command Initial Value Description Section Attribute<br>
+ ------------------------------<wbr>----- ------ ------------- ------------- --------------------------- -------- ------------<br>
+ TILE_RASTER_ORDER_FIXED_MESA B IsEnabled True Tile rasterization order is 9.3.1 enable<br>
+ defined by<br>
+ TILE_RASTER_ORDER_INCREASING_*<wbr>_MESA.<br>
+ in increasing X direction<br>
+ TILE_RASTER_ORDER_INCREASING_<wbr>X_MESA B IsEnabled True Tiles are rasterized 9.3.1 enable<br>
+ in increasing X direction<br>
+ TILE_RASTER_ORDER_INCREASING_<wbr>Y_MESA B IsEnabled True Tiles are rasterized 9.3.1 enable<br>
+ in increasing Y direction<br>
+<br>
+Revision History<br>
+<br>
+ 26 July 2017 - Initial draft<br>
diff --git a/docs/specs/enums.txt b/docs/specs/enums.txt<br>
index 00d808483a43..4b0485f34901 100644<br>
--- a/docs/specs/enums.txt<br>
+++ b/docs/specs/enums.txt<br>
@@ -73,6 +73,11 @@ GL_MESA_program_debug<br>
GL_FRAGMENT_PROGRAM_CALLBACK_<wbr>FUNC_MESA 0x8BB6<br>
GL_FRAGMENT_PROGRAM_CALLBACK_<wbr>DATA_MESA 0x8BB7<br>
<br>
+GL_MESA_tile_raster_order<br>
+ GL_TILE_RASTER_ORDER_FIXED_<wbr>MESA 0x8BB8<br>
+ GL_TILE_RASTER_ORDER_<wbr>INCREASING_X_MESA 0x8BB9<br>
+ GL_TILE_RASTER_ORDER_<wbr>INCREASING_Y_MESA 0x8BBA<br>
+<br>
EGL_MESA_drm_image<br>
EGL_DRM_BUFFER_FORMAT_MESA 0x31D0<br>
EGL_DRM_BUFFER_USE_MESA 0x31D1<br>
diff --git a/include/GL/glext.h b/include/GL/glext.h<br>
index b7f611907211..a00f42c536b4 100644<br>
--- a/include/GL/glext.h<br>
+++ b/include/GL/glext.h<br>
@@ -12403,6 +12403,12 @@ GLAPI void APIENTRY glReplacementCodeuiTexCoord2fC<wbr>olor4fNormal3fVertex3fvSUN (co<br>
#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC<br>
#endif /* GL_WIN_specular_fog */<br>
<br>
+/* XXX: Get a regenerated header with the enums properly present. */<br>
+#define GL_TILE_RASTER_ORDER_FIXED_<wbr>MESA 0x8BB8<br>
+#define GL_TILE_RASTER_ORDER_<wbr>INCREASING_X_MESA 0x8BB9<br>
+#define GL_TILE_RASTER_ORDER_<wbr>INCREASING_Y_MESA 0x8BBA<br>
+<br>
+<br>
#ifdef __cplusplus<br>
}<br>
#endif<br>
diff --git a/src/mapi/glapi/gen/MESA_<wbr>tile_raster_order.xml b/src/mapi/glapi/gen/MESA_<wbr>tile_raster_order.xml<br>
new file mode 100644<br>
index 000000000000..a1f0cb89bee4<br>
--- /dev/null<br>
+++ b/src/mapi/glapi/gen/MESA_<wbr>tile_raster_order.xml<br>
@@ -0,0 +1,13 @@<br>
+<?xml version="1.0"?><br>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"><br>
+<br>
+<OpenGLAPI><br>
+<br>
+<!-- XXX: need an extension number --><br>
+<category name="GL_MESA_tile_rasterizer_<wbr>order"><br>
+ <enum name="TILE_RASTER_ORDER_FIXED_<wbr>MESA" value="0x8BB8"/><br>
+ <enum name="TILE_RASTER_ORDER_<wbr>INCREASING_X_MESA" value="0x8BB9"/><br>
+ <enum name="TILE_RASTER_ORDER_<wbr>INCREASING_Y_MESA" value="0x8BBA"/><br>
+</category><br>
+<br>
+</OpenGLAPI><br>
diff --git a/src/mapi/glapi/gen/Makefile.<wbr>am b/src/mapi/glapi/gen/Makefile.<wbr>am<br>
index bd04519f8042..45f30b7819c5 100644<br>
--- a/src/mapi/glapi/gen/Makefile.<wbr>am<br>
+++ b/src/mapi/glapi/gen/Makefile.<wbr>am<br>
@@ -208,6 +208,7 @@ API_XML = \<br>
KHR_robustness.xml \<br>
KHR_robustness_es.xml \<br>
KHR_texture_compression_astc.<wbr>xml \<br>
+ MESA_tile_raster_order.xml \<br>
NV_conditional_render.xml \<br>
NV_primitive_restart.xml \<br>
NV_texture_barrier.xml \<br>
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c<br>
index fe527a0ae29b..f744801fc730 100644<br>
--- a/src/mesa/main/context.c<br>
+++ b/src/mesa/main/context.c<br>
@@ -864,6 +864,8 @@ init_attrib_groups(struct gl_context *ctx)<br>
_mesa_init_texture_s3tc( ctx );<br>
<br>
/* Miscellaneous */<br>
+ ctx-><wbr>TileRasterOrderIncreasingX = GL_TRUE;<br>
+ ctx-><wbr>TileRasterOrderIncreasingY = GL_TRUE;<br>
ctx->NewState = _NEW_ALL;<br>
ctx->NewDriverState = ~0;<br>
ctx->ErrorValue = GL_NO_ERROR;<br>
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c<br>
index 2e5fb009314d..6d419b0013fa 100644<br>
--- a/src/mesa/main/enable.c<br>
+++ b/src/mesa/main/enable.c<br>
@@ -1040,6 +1040,33 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)<br>
}<br>
break;<br>
<br>
+ case GL_TILE_RASTER_ORDER_FIXED_<wbr>MESA:<br>
+ CHECK_EXTENSION(MESA_tile_<wbr>raster_order, cap);<br>
+ if (ctx->TileRasterOrderFixed != state) {<br>
+ FLUSH_VERTICES(ctx, 0);<br>
+ ctx->NewDriverState |= ctx->DriverFlags.<wbr>NewTileRasterOrder;<br>
+ ctx->TileRasterOrderFixed = state;<br>
+ }<br>
+ break;<br>
+<br>
+ case GL_TILE_RASTER_ORDER_<wbr>INCREASING_X_MESA:<br>
+ CHECK_EXTENSION(MESA_tile_<wbr>raster_order, cap);<br>
+ if (ctx-><wbr>TileRasterOrderIncreasingX != state) {<br>
+ FLUSH_VERTICES(ctx, 0);<br>
+ ctx->NewDriverState |= ctx->DriverFlags.<wbr>NewTileRasterOrder;<br>
+ ctx-><wbr>TileRasterOrderIncreasingX = state;<br>
+ }<br>
+ break;<br>
+<br>
+ case GL_TILE_RASTER_ORDER_<wbr>INCREASING_Y_MESA:<br>
+ CHECK_EXTENSION(MESA_tile_<wbr>raster_order, cap);<br>
+ if (ctx-><wbr>TileRasterOrderIncreasingY != state) {<br>
+ FLUSH_VERTICES(ctx, 0);<br>
+ ctx->NewDriverState |= ctx->DriverFlags.<wbr>NewTileRasterOrder;<br>
+ ctx-><wbr>TileRasterOrderIncreasingY = state;<br>
+ }<br>
+ break;<br>
+<br>
/* GL 3.1 primitive restart. Note: this enum is different from<br>
* GL_PRIMITIVE_RESTART_NV (which is client state).<br>
*/<br>
diff --git a/src/mesa/main/extensions_<wbr>table.h b/src/mesa/main/extensions_<wbr>table.h<br>
index 757b7bf94239..08f7a3f49f07 100644<br>
--- a/src/mesa/main/extensions_<wbr>table.h<br>
+++ b/src/mesa/main/extensions_<wbr>table.h<br>
@@ -310,6 +310,7 @@ EXT(KHR_texture_compression_<wbr>astc_hdr , KHR_texture_compression_astc_<wbr>hdr<br>
EXT(KHR_texture_compression_<wbr>astc_ldr , KHR_texture_compression_astc_<wbr>ldr , GLL, GLC, x , ES2, 2012)<br>
EXT(KHR_texture_compression_<wbr>astc_sliced_3d , KHR_texture_compression_astc_<wbr>sliced_3d , GLL, GLC, x , ES2, 2015)<br>
<br>
+EXT(MESA_tile_raster_order , MESA_tile_raster_order , GLL, GLC, x , ES2, 2017)<br>
EXT(MESA_pack_invert , MESA_pack_invert , GLL, GLC, x , x , 2002)<br>
EXT(MESA_shader_integer_<wbr>functions , MESA_shader_integer_functions , GLL, GLC, x , 30, 2016)<br>
EXT(MESA_texture_signed_rgba , EXT_texture_snorm , GLL, GLC, x , x , 2009)<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index 0d0536c7750e..34be919102ee 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -4166,6 +4166,7 @@ struct gl_extensions<br>
GLboolean KHR_texture_compression_astc_<wbr>hdr;<br>
GLboolean KHR_texture_compression_astc_<wbr>ldr;<br>
GLboolean KHR_texture_compression_astc_<wbr>sliced_3d;<br>
+ GLboolean MESA_tile_raster_order;<br>
GLboolean MESA_pack_invert;<br>
GLboolean MESA_shader_framebuffer_fetch;<br>
GLboolean MESA_shader_framebuffer_fetch_<wbr>non_coherent;<br>
@@ -4418,6 +4419,9 @@ struct gl_driver_flags<br>
/** gl_context::RasterDiscard */<br>
uint64_t NewRasterizerDiscard;<br>
<br>
+ /** gl_context::TileRasterOrder* */<br>
+ uint64_t NewTileRasterOrder;<br>
+<br>
/**<br>
* gl_context::<wbr>UniformBufferBindings<br>
* gl_shader_program::<wbr>UniformBlocks<br>
@@ -4958,6 +4962,15 @@ struct gl_context<br>
GLboolean IntelConservativeRasterization<wbr>; /**< GL_INTEL_CONSERVATIVE_<wbr>RASTERIZATION */<br>
<br>
/**<br>
+ * When set, TileRasterOrderIncreasingX/Y control the order that a tiled<br>
+ * renderer's tiles should be excecuted, to meet the requirements of<br>
+ * GL_MESA_tile_raster_order.<br>
+ */<br>
+ GLboolean TileRasterOrderFixed;<br>
+ GLboolean TileRasterOrderIncreasingX;<br>
+ GLboolean TileRasterOrderIncreasingY;<br>
+<br>
+ /**<br>
* \name Hooks for module contexts.<br>
*<br>
* These will eventually live in the driver or elsewhere.<br>
diff --git a/src/mesa/state_tracker/st_<wbr>atom_rasterizer.c b/src/mesa/state_tracker/st_<wbr>atom_rasterizer.c<br>
index 39be6b15a70e..4147340fd79a 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>atom_rasterizer.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>atom_rasterizer.c<br>
@@ -277,6 +277,11 @@ void st_update_rasterizer( struct st_context *st )<br>
<br>
/* ST_NEW_RASTERIZER */<br>
raster->rasterizer_discard = ctx->RasterDiscard;<br>
+ if (ctx->TileRasterOrderFixed) {<br>
+ raster->tile_raster_order_<wbr>fixed = true;<br>
+ raster->tile_raster_order_<wbr>increasing_x = ctx-><wbr>TileRasterOrderIncreasingX;<br>
+ raster->tile_raster_order_<wbr>increasing_y = ctx-><wbr>TileRasterOrderIncreasingY;<br>
+ }<br>
<br>
if (st->edgeflag_culls_prims) {<br>
/* All edge flags are FALSE. Cull the affected faces. */<br>
diff --git a/src/mesa/state_tracker/st_<wbr>context.c b/src/mesa/state_tracker/st_<wbr>context.c<br>
index 381ff9dae00d..ac214175b2cb 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>context.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>context.c<br>
@@ -488,6 +488,7 @@ static void st_init_driver_flags(struct st_context *st)<br>
<br>
f->NewArray = ST_NEW_VERTEX_ARRAYS;<br>
f->NewRasterizerDiscard = ST_NEW_RASTERIZER;<br>
+ f->NewTileRasterOrder = ST_NEW_RASTERIZER;<br>
f->NewUniformBuffer = ST_NEW_UNIFORM_BUFFER;<br>
f->NewDefaultTessLevels = ST_NEW_TESS_STATE;<br>
<br>
diff --git a/src/mesa/state_tracker/st_<wbr>extensions.c b/src/mesa/state_tracker/st_<wbr>extensions.c<br>
index 74193cc49285..f0fe7c2bb674 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>extensions.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>extensions.c<br>
@@ -646,6 +646,7 @@ void st_init_extensions(struct pipe_screen *screen,<br>
{ o(AMD_seamless_cubemap_per_<wbr>texture), PIPE_CAP_SEAMLESS_CUBE_MAP_<wbr>PER_TEXTURE },<br>
{ o(ATI_separate_stencil), PIPE_CAP_TWO_SIDED_STENCIL },<br>
{ o(ATI_texture_mirror_once), PIPE_CAP_TEXTURE_MIRROR_CLAMP },<br>
+ { o(MESA_tile_raster_order), PIPE_CAP_TILE_RASTER_ORDER },<br>
{ o(NV_conditional_render), PIPE_CAP_CONDITIONAL_RENDER },<br>
{ o(NV_fill_rectangle), PIPE_CAP_POLYGON_MODE_FILL_<wbr>RECTANGLE },<br>
{ o(NV_primitive_restart), PIPE_CAP_PRIMITIVE_RESTART },<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>