aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-04-01 08:44:08 +1000
committerMarge Bot <[email protected]>2020-04-01 20:58:23 +0000
commit2a2fd4c5308dee51d48630863255f1c6a04768a9 (patch)
treeaebb3aca6540730466e04414c169b755dd94404b /src/gallium
parentc07bbdbe8268a2c80c602f71eb413f0d84920038 (diff)
gallium/llvmpipe: add an optimised 32-bit memset
This might have other users beyond filling/clearing buffers, increase a fullscreen 4k gears from 68->74 fps on my Ryzen since gears is really just a clear benchmark, and this helps clearing. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4394> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4394>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_surface.c10
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c6
2 files changed, 5 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 847c0008079..527e6662f0b 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -41,7 +41,7 @@
#include "util/u_rect.h"
#include "util/u_surface.h"
#include "util/u_pack_color.h"
-
+#include "util/u_memset.h"
/**
* Initialize a pipe_surface object. 'view' is considered to have
@@ -141,9 +141,7 @@ util_fill_rect(ubyte * dst,
break;
case 4:
for (i = 0; i < height; i++) {
- uint32_t *row = (uint32_t *)dst;
- for (j = 0; j < width; j++)
- *row++ = uc->ui[0];
+ util_memset32(dst, uc->ui[0], width);
dst += dst_stride;
}
break;
@@ -492,9 +490,7 @@ util_clear_depth_stencil_texture(struct pipe_context *pipe,
case 4:
if (!need_rmw) {
for (i = 0; i < height; i++) {
- uint32_t *row = (uint32_t *)dst_map;
- for (j = 0; j < width; j++)
- *row++ = (uint32_t) zstencil;
+ util_memset32(dst_map, (uint32_t)zstencil, width);
dst_map += dst_stride;
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index ef783ea6fb1..ad55ed7be79 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -33,7 +33,7 @@
#include "util/u_pack_color.h"
#include "util/u_string.h"
#include "util/u_thread.h"
-
+#include "util/u_memset.h"
#include "util/os_time.h"
#include "lp_scene_queue.h"
@@ -236,9 +236,7 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task,
case 4:
if (clear_mask == 0xffffffff) {
for (i = 0; i < height; i++) {
- uint32_t *row = (uint32_t *)dst;
- for (j = 0; j < width; j++)
- *row++ = clear_value;
+ util_memset32(dst, clear_value, width);
dst += dst_stride;
}
}