Re: [Mesa-dev] [PATCH 2/2] i965: implement MESA_framebuffer_flip_y [v3]

2018-07-27 Thread Chad Versace
On Mon 23 Jul 2018, Fritz Koenig wrote:
> Instead of using _mesa_is_winsys_fbo or
> _mesa_is_user_fbo to infer if an fbo is
> flipped use the InvertedY flag.
> 
> v2:
> * additional window-system framebuffer checks [for jason]
> v3:
> * s/inverted_y/flip_y/g [for chadv]
> * s/InvertedY/FlipY/g [for chadv]
> ---
>  src/mesa/drivers/dri/i965/brw_blorp.c |  2 +-
>  src/mesa/drivers/dri/i965/brw_meta_util.c |  4 +-
>  src/mesa/drivers/dri/i965/brw_sf.c|  6 +--
>  src/mesa/drivers/dri/i965/genX_state_upload.c | 50 +--
>  src/mesa/drivers/dri/i965/intel_extensions.c  |  1 +
>  src/mesa/drivers/dri/i965/intel_fbo.c | 11 ++--
>  .../drivers/dri/i965/intel_pixel_bitmap.c |  8 +--
>  src/mesa/drivers/dri/i965/intel_pixel_copy.c  |  4 +-
>  src/mesa/drivers/dri/i965/intel_pixel_draw.c  |  2 +-
>  9 files changed, 43 insertions(+), 45 deletions(-)

For the series,
Reviewed-by: Chad Versace 

I'll push soon.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] i965: implement MESA_framebuffer_flip_y [v3]

2018-07-23 Thread Fritz Koenig
Instead of using _mesa_is_winsys_fbo or
_mesa_is_user_fbo to infer if an fbo is
flipped use the InvertedY flag.

v2:
* additional window-system framebuffer checks [for jason]
v3:
* s/inverted_y/flip_y/g [for chadv]
* s/InvertedY/FlipY/g [for chadv]
---
 src/mesa/drivers/dri/i965/brw_blorp.c |  2 +-
 src/mesa/drivers/dri/i965/brw_meta_util.c |  4 +-
 src/mesa/drivers/dri/i965/brw_sf.c|  6 +--
 src/mesa/drivers/dri/i965/genX_state_upload.c | 50 +--
 src/mesa/drivers/dri/i965/intel_extensions.c  |  1 +
 src/mesa/drivers/dri/i965/intel_fbo.c | 11 ++--
 .../drivers/dri/i965/intel_pixel_bitmap.c |  8 +--
 src/mesa/drivers/dri/i965/intel_pixel_copy.c  |  4 +-
 src/mesa/drivers/dri/i965/intel_pixel_draw.c  |  2 +-
 9 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c 
b/src/mesa/drivers/dri/i965/brw_blorp.c
index b66ee18ba4..7476cee43a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -740,7 +740,7 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
/* Account for the fact that in the system framebuffer, the origin is at
 * the lower left.
 */
-   bool mirror_y = _mesa_is_winsys_fbo(ctx->ReadBuffer);
+   bool mirror_y = ctx->ReadBuffer->FlipY;
if (mirror_y)
   apply_y_flip(, , src_rb->Height);
 
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c 
b/src/mesa/drivers/dri/i965/brw_meta_util.c
index d292f5a8e2..908b098976 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.c
@@ -250,13 +250,13 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context 
*ctx,
/* Account for the fact that in the system framebuffer, the origin is at
 * the lower left.
 */
-   if (_mesa_is_winsys_fbo(read_fb)) {
+   if (read_fb->FlipY) {
   GLint tmp = read_fb->Height - *srcY0;
   *srcY0 = read_fb->Height - *srcY1;
   *srcY1 = tmp;
   *mirror_y = !*mirror_y;
}
-   if (_mesa_is_winsys_fbo(draw_fb)) {
+   if (draw_fb->FlipY) {
   GLint tmp = draw_fb->Height - *dstY0;
   *dstY0 = draw_fb->Height - *dstY1;
   *dstY1 = tmp;
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c 
b/src/mesa/drivers/dri/i965/brw_sf.c
index 73bc663f29..f4073fa6cf 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -90,7 +90,7 @@ brw_upload_sf_prog(struct brw_context *brw)
   return;
 
/* _NEW_BUFFERS */
-   bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
+   bool flip_y = ctx->DrawBuffer->FlipY;
 
memset(, 0, sizeof(key));
 
@@ -137,7 +137,7 @@ brw_upload_sf_prog(struct brw_context *brw)
 * Window coordinates in a FBO are inverted, which means point
 * sprite origin must be inverted, too.
 */
-   if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) != render_to_fbo)
+   if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) == flip_y)
   key.sprite_origin_lower_left = true;
 
/* BRW_NEW_FS_PROG_DATA */
@@ -161,7 +161,7 @@ brw_upload_sf_prog(struct brw_context *brw)
* face orientation, just as we invert the viewport in
* sf_unit_create_from_key().
*/
-  key.frontface_ccw = brw->polygon_front_bit == render_to_fbo;
+  key.frontface_ccw = brw->polygon_front_bit != flip_y;
}
 
if (!brw_search_cache(>cache, BRW_CACHE_SF_PROG, , sizeof(key),
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 9e0a17b9d9..cfafbb0c37 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -217,7 +217,7 @@ genX(upload_polygon_stipple)(struct brw_context *brw)
* to a FBO (i.e. any named frame buffer object), we *don't*
* need to invert - we already match the layout.
*/
-  if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+  if (ctx->DrawBuffer->FlipY) {
  for (unsigned i = 0; i < 32; i++)
 poly.PatternRow[i] = ctx->PolygonStipple[31 - i]; /* invert */
   } else {
@@ -257,7 +257,7 @@ genX(upload_polygon_stipple_offset)(struct brw_context *brw)
* to a user-created FBO then our native pixel coordinate system
* works just fine, and there's no window system to worry about.
*/
-  if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+  if (ctx->DrawBuffer->FlipY) {
  poly.PolygonStippleYOffset =
 (32 - (_mesa_geometric_height(ctx->DrawBuffer) & 31)) & 31;
   }
@@ -1468,7 +1468,7 @@ genX(upload_clip_state)(struct brw_context *brw)
 #endif
 
 #if GEN_GEN == 7
-  clip.FrontWinding = brw->polygon_front_bit == _mesa_is_user_fbo(fb);
+  clip.FrontWinding = brw->polygon_front_bit != fb->FlipY;
 
   if (ctx->Polygon.CullFlag) {
  switch (ctx->Polygon.CullFaceMode) {
@@ -1583,7 +1583,7 @@ genX(upload_sf)(struct brw_context *brw)
 
 #if GEN_GEN <= 7
/* _NEW_BUFFERS */
-   bool render_to_fbo =