[Mesa-dev] [PATCH] intel/blorp: Fix buffer blit with the max buffer sizes

Vadym Shovkoplias vadim.shovkoplias at gmail.com
Thu Sep 27 15:03:00 UTC 2018


Fixes:
      * fbo-blit-check-limits

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108088
Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias at globallogic.com>
---
 src/intel/blorp/blorp.h                   |  8 ++--
 src/intel/blorp/blorp_blit.c              |  8 ++--
 src/mesa/drivers/dri/i965/brw_blorp.c     | 20 ++++-----
 src/mesa/drivers/dri/i965/brw_blorp.h     |  8 ++--
 src/mesa/drivers/dri/i965/brw_meta_util.c | 49 ++++++++++++-----------
 src/mesa/drivers/dri/i965/brw_meta_util.h |  8 ++--
 6 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
index ee343a4a6b..c535d66a1d 100644
--- a/src/intel/blorp/blorp.h
+++ b/src/intel/blorp/blorp.h
@@ -135,10 +135,10 @@ blorp_blit(struct blorp_batch *batch,
            const struct blorp_surf *dst_surf,
            unsigned dst_level, unsigned dst_layer,
            enum isl_format dst_format, struct isl_swizzle dst_swizzle,
-           float src_x0, float src_y0,
-           float src_x1, float src_y1,
-           float dst_x0, float dst_y0,
-           float dst_x1, float dst_y1,
+           double src_x0, double src_y0,
+           double src_x1, double src_y1,
+           double dst_x0, double dst_y0,
+           double dst_x1, double dst_y1,
            enum blorp_filter filter,
            bool mirror_x, bool mirror_y);
 
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 3c963c60ea..33944b84cf 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -2226,10 +2226,10 @@ blorp_blit(struct blorp_batch *batch,
            const struct blorp_surf *dst_surf,
            unsigned dst_level, unsigned dst_layer,
            enum isl_format dst_format, struct isl_swizzle dst_swizzle,
-           float src_x0, float src_y0,
-           float src_x1, float src_y1,
-           float dst_x0, float dst_y0,
-           float dst_x1, float dst_y1,
+           double src_x0, double src_y0,
+           double src_x1, double src_y1,
+           double dst_x0, double dst_y0,
+           double dst_x1, double dst_y1,
            enum blorp_filter filter,
            bool mirror_x, bool mirror_y)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index ad747e0766..6406644614 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -282,10 +282,10 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
                         struct intel_mipmap_tree *dst_mt,
                         unsigned dst_level, unsigned dst_layer,
                         mesa_format dst_format,
-                        float src_x0, float src_y0,
-                        float src_x1, float src_y1,
-                        float dst_x0, float dst_y0,
-                        float dst_x1, float dst_y1,
+                        double src_x0, double src_y0,
+                        double src_x1, double src_y1,
+                        double dst_x0, double dst_y0,
+                        double dst_x1, double dst_y1,
                         GLenum gl_filter, bool mirror_x, bool mirror_y,
                         bool decode_srgb, bool encode_srgb)
 {
@@ -324,8 +324,8 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
    }
 
    enum blorp_filter blorp_filter;
-   if (fabsf(dst_x1 - dst_x0) == fabsf(src_x1 - src_x0) &&
-       fabsf(dst_y1 - dst_y0) == fabsf(src_y1 - src_y0)) {
+   if (fabs(dst_x1 - dst_x0) == fabs(src_x1 - src_x0) &&
+       fabs(dst_y1 - dst_y0) == fabs(src_y1 - src_y0)) {
       if (src_mt->surf.samples > 1 && dst_mt->surf.samples <= 1) {
          /* From the OpenGL ES 3.2 specification, section 16.2.1:
           *
@@ -572,8 +572,8 @@ static void
 do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit,
               struct intel_renderbuffer *src_irb, mesa_format src_format,
               struct intel_renderbuffer *dst_irb, mesa_format dst_format,
-              GLfloat srcX0, GLfloat srcY0, GLfloat srcX1, GLfloat srcY1,
-              GLfloat dstX0, GLfloat dstY0, GLfloat dstX1, GLfloat dstY1,
+              GLdouble srcX0, GLdouble srcY0, GLdouble srcX1, GLdouble srcY1,
+              GLdouble dstX0, GLdouble dstY0, GLdouble dstX1, GLdouble dstY1,
               GLenum filter, bool mirror_x, bool mirror_y)
 {
    const struct gl_context *ctx = &brw->ctx;
@@ -602,8 +602,8 @@ static bool
 try_blorp_blit(struct brw_context *brw,
                const struct gl_framebuffer *read_fb,
                const struct gl_framebuffer *draw_fb,
-               GLfloat srcX0, GLfloat srcY0, GLfloat srcX1, GLfloat srcY1,
-               GLfloat dstX0, GLfloat dstY0, GLfloat dstX1, GLfloat dstY1,
+               GLdouble srcX0, GLdouble srcY0, GLdouble srcX1, GLdouble srcY1,
+               GLdouble dstX0, GLdouble dstY0, GLdouble dstX1, GLdouble dstY1,
                GLenum filter, GLbitfield buffer_bit)
 {
    const struct gen_device_info *devinfo = &brw->screen->devinfo;
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index 551e1fcdcb..67f1b5cd38 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -42,10 +42,10 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
                         struct intel_mipmap_tree *dst_mt,
                         unsigned dst_level, unsigned dst_layer,
                         mesa_format dst_format,
-                        float src_x0, float src_y0,
-                        float src_x1, float src_y1,
-                        float dst_x0, float dst_y0,
-                        float dst_x1, float dst_y1,
+                        double src_x0, double src_y0,
+                        double src_x1, double src_y1,
+                        double dst_x0, double dst_y0,
+                        double dst_x1, double dst_y1,
                         GLenum filter, bool mirror_x, bool mirror_y,
                         bool decode_srgb, bool encode_srgb);
 
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c
index 908b098976..844068ce90 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.c
@@ -36,11 +36,11 @@
  * If coord0 > coord1, swap them and invert the "mirror" boolean.
  */
 static inline void
-fixup_mirroring(bool *mirror, float *coord0, float *coord1)
+fixup_mirroring(bool *mirror, double *coord0, double *coord1)
 {
    if (*coord0 > *coord1) {
       *mirror = !*mirror;
-      float tmp = *coord0;
+      double tmp = *coord0;
       *coord0 = *coord1;
       *coord1 = tmp;
    }
@@ -65,9 +65,10 @@ fixup_mirroring(bool *mirror, float *coord0, float *coord1)
  * \return false if we clip everything away, true otherwise
  */
 static inline bool
-compute_pixels_clipped(float x0, float y0, float x1, float y1,
-                       float min_x, float min_y, float max_x, float max_y,
-                       float *clipped_x0, float *clipped_y0, float *clipped_x1, float *clipped_y1)
+compute_pixels_clipped(double x0, double y0, double x1, double y1,
+                       double min_x, double min_y, double max_x, double max_y,
+                       double *clipped_x0, double *clipped_y0,
+                       double *clipped_x1, double *clipped_y1)
 {
    /* If we are going to clip everything away, stop. */
    if (!(min_x <= max_x &&
@@ -120,11 +121,11 @@ compute_pixels_clipped(float x0, float y0, float x1, float y1,
  */
 static inline void
 clip_coordinates(bool mirror,
-                 float *src, float *dst0, float *dst1,
-                 float clipped_src0,
-                 float clipped_dst0,
-                 float clipped_dst1,
-                 float scale,
+                 double *src, double *dst0, double *dst1,
+                 double clipped_src0,
+                 double clipped_dst0,
+                 double clipped_dst1,
+                 double scale,
                  bool isLeftOrBottom)
 {
    /* When clipping we need to add or subtract pixels from the original
@@ -158,10 +159,10 @@ bool
 brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
                                  const struct gl_framebuffer *read_fb,
                                  const struct gl_framebuffer *draw_fb,
-                                 GLfloat *srcX0, GLfloat *srcY0,
-                                 GLfloat *srcX1, GLfloat *srcY1,
-                                 GLfloat *dstX0, GLfloat *dstY0,
-                                 GLfloat *dstX1, GLfloat *dstY1,
+                                 GLdouble *srcX0, GLdouble *srcY0,
+                                 GLdouble *srcX1, GLdouble *srcY1,
+                                 GLdouble *dstX0, GLdouble *dstY0,
+                                 GLdouble *dstX1, GLdouble *dstY1,
                                  bool *mirror_x, bool *mirror_y)
 {
    *mirror_x = false;
@@ -176,14 +177,14 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
    /* Compute number of pixels to clip for each side of both rects. Return
     * early if we are going to clip everything away.
     */
-   float clip_src_x0;
-   float clip_src_x1;
-   float clip_src_y0;
-   float clip_src_y1;
-   float clip_dst_x0;
-   float clip_dst_x1;
-   float clip_dst_y0;
-   float clip_dst_y1;
+   double clip_src_x0;
+   double clip_src_x1;
+   double clip_src_y0;
+   double clip_src_y1;
+   double clip_dst_x0;
+   double clip_dst_x1;
+   double clip_dst_y0;
+   double clip_dst_y1;
 
    if (!compute_pixels_clipped(*srcX0, *srcY0, *srcX1, *srcY1,
                                0, 0, read_fb->Width, read_fb->Height,
@@ -220,8 +221,8 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
     * 4 * 2 = 8 > 5 in the src.
     */
 
-   float scaleX = (float) (*srcX1 - *srcX0) / (*dstX1 - *dstX0);
-   float scaleY = (float) (*srcY1 - *srcY0) / (*dstY1 - *dstY0);
+   double scaleX = (double) (*srcX1 - *srcX0) / (*dstX1 - *dstX0);
+   double scaleY = (double) (*srcY1 - *srcY0) / (*dstY1 - *dstY0);
 
    /* Clip left side */
    clip_coordinates(*mirror_x,
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.h b/src/mesa/drivers/dri/i965/brw_meta_util.h
index 4b3408df15..ed1688e203 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.h
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.h
@@ -36,10 +36,10 @@ bool
 brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
                                  const struct gl_framebuffer *read_fb,
                                  const struct gl_framebuffer *draw_fb,
-                                 GLfloat *srcX0, GLfloat *srcY0,
-                                 GLfloat *srcX1, GLfloat *srcY1,
-                                 GLfloat *dstX0, GLfloat *dstY0,
-                                 GLfloat *dstX1, GLfloat *dstY1,
+                                 GLdouble *srcX0, GLdouble *srcY0,
+                                 GLdouble *srcX1, GLdouble *srcY1,
+                                 GLdouble *dstX0, GLdouble *dstY0,
+                                 GLdouble *dstX1, GLdouble *dstY1,
                                  bool *mirror_x, bool *mirror_y);
 
 union isl_color_value
-- 
2.18.0



More information about the mesa-dev mailing list