gem_render_copy
A few moons ago, Chris suggested to create a small, standalone, render copy test to add aub file support and help enabling new platforms instead of hijacking gem_render_linear_blits.
So here it is.
Signature · 1 line
Damien
PATCH 1/5 lib: Add a function to dump a scratch buf into a png
--- lib/Makefile.am | 1 + lib/rendercopy.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/rendercopy.h | 2 ++ 3 files changed, 52 insertions(+) create mode 100644 lib/rendercopy.c
lib/Makefile.am +1 -0
@@ -32,6 +32,7 @@ libintel_tools_la_SOURCES = \ rendercopy_gen6.c \ rendercopy_gen7.c \ rendercopy.h \ + rendercopy.c \ intel_reg_map.c \ intel_dpio.c \ intel_iosf.c \
lib/rendercopy.c new file +49 -0
49 lines not on this page · raw message
lib/rendercopy.h +2 -0
@@ -85,4 +85,6 @@ void gen2_render_copyfunc(struct intel_batchbuffer *batch, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); +void scratch_buf_write_to_png (struct scratch_buf *buf,const char *filename); +#endif /* RENDERCOPY_H */
Signature · 1 line
1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 tests/gem_render_copy: Add a simple render copy test
In reply to Damien LespiauThe goal is here to both: demonstrate a simple usage of render copy with the possibility to write pngs to visualize what it's doing and to provide a test bed to port the render copy function to new architectures.
--- tests/.gitignore | 1 + tests/Makefile.am | 1 + tests/gem_render_copy.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 tests/gem_render_copy.c
tests/.gitignore +1 -0
@@ -58,6 +58,7 @@ gem_readwrite gem_reg_read gem_reloc_overflow gem_reloc_vs_gpu +gem_render_copy gem_render_linear_blits gem_render_tiled_blits gem_ringfill
tests/Makefile.am +1 -0
@@ -87,6 +87,7 @@ TESTS_progs = \ gem_pin \ gem_pipe_control_store_loop \ gem_reg_read \ + gem_render_copy \ gem_render_linear_blits \ gem_render_tiled_blits \ gem_ring_sync_loop \
tests/gem_render_copy.c new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 tests/gem_render_copy: Only dump pngs when the -d option is given
In reply to Damien Lespiau--- tests/gem_render_copy.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
tests/gem_render_copy.c +18 -3
@@ -30,6 +30,7 @@*/ #include <stdbool.h> +#include <unistd.h> #include "rendercopy.h"
@@ -88,8 +89,19 @@ int main(int argc, char **argv)struct intel_batchbuffer *batch =NULL ;struct scratch_buf src, dst;render_copyfunc_t render_copy =NULL ; +int opt;int opt_dump_png = false; +while ((opt =getopt (argc, argv,"d" )) !=-1 ) { +switch (opt) { +case 'd' : + opt_dump_png = true; +break ; +default : +break ; + } + } + igt_fixture { data.drm_fd =drm_open_any (); data.devid =intel_get_drm_devid (data.drm_fd);
@@ -111,8 +123,10 @@ int main(int argc, char **argv)scratch_buf_check (&data, &src,WIDTH /2 ,HEIGHT /2 ,SRC_COLOR );scratch_buf_check (&data, &dst,WIDTH /2 ,HEIGHT /2 ,DST_COLOR ); -scratch_buf_write_to_png (&src,"source.png" ); -scratch_buf_write_to_png (&dst,"destination.png" ); +if (opt_dump_png) { +scratch_buf_write_to_png (&src,"source.png" ); +scratch_buf_write_to_png (&dst,"destination.png" ); + } render_copy(batch, &src, 0, 0, WIDTH, HEIGHT,
@@ -121,7 +135,8 @@ int main(int argc, char **argv)scratch_buf_check (&data, &dst,10 ,10 ,DST_COLOR );scratch_buf_check (&data, &dst,WIDTH -10 ,HEIGHT -10 ,SRC_COLOR ); -scratch_buf_write_to_png (&dst,"result.png" ); +if (opt_dump_png) +scratch_buf_write_to_png (&dst,"result.png" );return 0 ; }
Signature · 1 line
1.8.3.1
PATCH 4/5 tests/gem_render_copy: Add aub dump support
In reply to Damien Lespiau--- tests/gem_render_copy.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
tests/gem_render_copy.c +18 -3
@@ -91,6 +91,7 @@ int main(int argc, char **argv)render_copyfunc_t render_copy =NULL ;int opt;int opt_dump_png = false; +int opt_dump_aub =drmtest_dump_aub ();while ((opt =getopt (argc, argv,"d" )) !=-1 ) {switch (opt) {
@@ -128,15 +129,29 @@ int main(int argc, char **argv)scratch_buf_write_to_png (&dst,"destination.png" ); } +if (opt_dump_aub) { +drm_intel_bufmgr_gem_set_aub_filename (data.bufmgr, +"rendercopy.aub" ); +drm_intel_bufmgr_gem_set_aub_dump (data.bufmgr, true); + } +render_copy (batch, &src,0 ,0 ,WIDTH ,HEIGHT , &dst,WIDTH /2 ,HEIGHT /2 ); -scratch_buf_check (&data, &dst,10 ,10 ,DST_COLOR ); -scratch_buf_check (&data, &dst,WIDTH -10 ,HEIGHT -10 ,SRC_COLOR ); -if (opt_dump_png)scratch_buf_write_to_png (&dst,"result.png" ); +if (opt_dump_aub) { +drm_intel_gem_bo_aub_dump_bmp (dst.bo, +0 ,0 ,WIDTH ,HEIGHT , +AUB_DUMP_BMP_FORMAT_ARGB_8888 , +STRIDE ,0 ); +drm_intel_bufmgr_gem_set_aub_dump (data.bufmgr, false); + }else { +scratch_buf_check (&data, &dst,10 ,10 ,DST_COLOR ); +scratch_buf_check (&data, &dst,WIDTH -10 ,HEIGHT -10 ,SRC_COLOR ); + } +return 0 ; }
Signature · 1 line
1.8.3.1
PATCH 5/5 gem_render_linear_blits: Remove aub dump support
In reply to Damien LespiauIt's much easier to follow the new gem_render_copy test and acquire a aub dump from it.
--- tests/gem_render_linear_blits.c | 16 ---------------- 1 file changed, 16 deletions(-)
tests/gem_render_linear_blits.c +0 -16
@@ -90,11 +90,6 @@ int main(int argc, char **argv)if (argc >1 ) count =atoi (argv[1 ]); -if (drmtest_dump_aub ()) { - count =2 ; -drm_intel_bufmgr_gem_set_aub_filename (bufmgr,"rendercopy.aub" ); -drm_intel_bufmgr_gem_set_aub_dump (bufmgr, true); - }if (count ==0 ) count =3 *gem_aperture_size (fd) /SIZE /2 ;else if (count <2 ) {
@@ -135,17 +130,6 @@ int main(int argc, char **argv)render_copy (batch, &src,0 ,0 ,WIDTH ,HEIGHT , &dst,0 ,0 ); start_val[(i +1 ) % count] = start_val[i % count]; - -/* We're not really here for the test, we just want to dump a -* trace of a call to render_copy() */ -if (drmtest_dump_aub ()) { -drm_intel_gem_bo_aub_dump_bmp (dst.bo, -0 ,0 ,WIDTH ,HEIGHT , -AUB_DUMP_BMP_FORMAT_ARGB_8888 , -STRIDE ,0 ); -drm_intel_bufmgr_gem_set_aub_dump (bufmgr, false); -return 0 ; - } }for (i =0 ; i < count; i++)check_bo (fd, bo[i]->handle, start_val[i]);
Signature · 1 line
1.8.3.1
Quoted 5 lines · Damien Lespiau
A few moons ago, Chris suggested to create a small, standalone, render copy test to add aub file support and help enabling new platforms instead of hijacking
gem_render_linear_blits.So here it is.
A whole day without comment, pushed :)
As always, shout if needed.
Signature · 1 line
Damien