aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2013-11-29 11:57:15 +0200
committerTopi Pohjolainen <[email protected]>2014-01-23 08:44:44 +0200
commitf031487dcb77f2fe053d0d39d32e443c7b2207dc (patch)
treefce3664365e274609fc6c408a8b017bb0fb28e5e /src/mesa
parentd8c7740ddabeb456243e40dc3cf0e86c7fca09d0 (diff)
i965/blorp: introduce separate eu-emitter for blit compiler
Prepares for presenting blorp blit programs using FS IR that allows EU-assembly generation using i965 glsl-compiler backend (fs_generator). v2: rebased on top of endif-jump counter fix (moving the added brw_set_uip_jip() into the emitter) Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/Makefile.sources1
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp43
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp65
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h42
4 files changed, 113 insertions, 38 deletions
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index d0c85cf9d66..a3fb4172edc 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -30,6 +30,7 @@ i965_FILES = \
brw_binding_tables.c \
brw_blorp.cpp \
brw_blorp_blit.cpp \
+ brw_blorp_blit_eu.cpp \
brw_blorp_clear.cpp \
brw_cc.c \
brw_cfg.cpp \
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 3b92c569137..f9c355b372a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -25,13 +25,11 @@
#include "main/fbobject.h"
#include "main/renderbuffer.h"
-#include "glsl/ralloc.h"
-
#include "intel_fbo.h"
#include "brw_blorp.h"
#include "brw_context.h"
-#include "brw_eu.h"
+#include "brw_blorp_blit_eu.h"
#include "brw_state.h"
#define FILE_DEBUG_FLAG DEBUG_BLORP
@@ -624,12 +622,11 @@ enum sampler_message_arg
* (In these formulas, pitch is the number of bytes occupied by a single row
* of samples).
*/
-class brw_blorp_blit_program
+class brw_blorp_blit_program : public brw_blorp_eu_emitter
{
public:
brw_blorp_blit_program(struct brw_context *brw,
const brw_blorp_blit_prog_key *key);
- ~brw_blorp_blit_program();
const GLuint *compile(struct brw_context *brw, GLuint *program_size,
FILE *dump_file = stdout);
@@ -668,10 +665,8 @@ private:
*/
static const unsigned LOG2_MAX_BLEND_SAMPLES = 3;
- void *mem_ctx;
struct brw_context *brw;
const brw_blorp_blit_prog_key *key;
- struct brw_compile func;
/* Thread dispatch header */
struct brw_reg R0;
@@ -745,16 +740,10 @@ private:
brw_blorp_blit_program::brw_blorp_blit_program(
struct brw_context *brw,
const brw_blorp_blit_prog_key *key)
- : mem_ctx(ralloc_context(NULL)),
+ : brw_blorp_eu_emitter(brw),
brw(brw),
key(key)
{
- brw_init_compile(brw, &func, mem_ctx);
-}
-
-brw_blorp_blit_program::~brw_blorp_blit_program()
-{
- ralloc_free(mem_ctx);
}
const GLuint *
@@ -806,21 +795,6 @@ brw_blorp_blit_program::compile(struct brw_context *brw,
memset(&prog_data, 0, sizeof(prog_data));
prog_data.persample_msaa_dispatch = key->persample_msaa_dispatch;
- /*
- * By default everything is emitted as 16-wide with only a few exceptions
- * handled explicitly either here in the compiler or by one of the specific
- * code emission calls.
- * It should be also noted that here in this file any alterations of the
- * compression control settings are only used to affect the execution size
- * of the instructions. The instruction template used to initialise all the
- * instructions is effectively not altered -- the value stays at zero
- * representing either GEN6_COMPRESSION_1Q or GEN6_COMPRESSION_1H depending
- * on the context.
- * If any other settings are used in the instruction headers, they are set
- * elsewhere by the individual code emission calls.
- */
- brw_set_compression_control(&func, BRW_COMPRESSION_COMPRESSED);
-
alloc_regs();
compute_frag_coords();
@@ -928,14 +902,7 @@ brw_blorp_blit_program::compile(struct brw_context *brw,
*/
render_target_write();
- brw_set_uip_jip(&func);
-
- if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) {
- printf("Native code for BLORP blit:\n");
- brw_dump_compile(&func, dump_file, 0, func.next_insn_offset);
- printf("\n");
- }
- return brw_get_program(&func, program_size);
+ return get_program(program_size, dump_file);
}
void
@@ -2385,7 +2352,7 @@ brw_blorp_blit_params::get_wm_prog(struct brw_context *brw,
&prog_offset, prog_data)) {
brw_blorp_blit_program prog(brw, &this->wm_prog_key);
GLuint program_size;
- const GLuint *program = prog.compile(brw, &program_size);
+ const GLuint *program = prog.compile(brw, &program_size, stdout);
brw_upload_cache(&brw->cache, BRW_BLORP_BLIT_PROG,
&this->wm_prog_key, sizeof(this->wm_prog_key),
program, program_size,
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
new file mode 100644
index 00000000000..8d723d64052
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "glsl/ralloc.h"
+#include "brw_blorp_blit_eu.h"
+
+brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw)
+ : mem_ctx(ralloc_context(NULL))
+{
+ brw_init_compile(brw, &func, mem_ctx);
+
+ /*
+ * By default everything is emitted as 16-wide with only a few expections
+ * handled explicitly either here in the compiler or by one of the specific
+ * code emission calls.
+ * It should be also noted that here in this file any alterations of the
+ * compression control settings are only used to affect the execution size
+ * of the instructions. The instruction template used to initialise all the
+ * instructions is effectively not altered -- the value stays at zero
+ * representing either GEN6_COMPRESSION_1Q or GEN6_COMPRESSION_1H depending
+ * on the context.
+ * If any other settings are used in the instruction headers, they are set
+ * elsewhere by the individual code emission calls.
+ */
+ brw_set_compression_control(&func, BRW_COMPRESSION_COMPRESSED);
+}
+
+brw_blorp_eu_emitter::~brw_blorp_eu_emitter()
+{
+ ralloc_free(mem_ctx);
+}
+
+const unsigned *
+brw_blorp_eu_emitter::get_program(unsigned *program_size, FILE *dump_file)
+{
+ brw_set_uip_jip(&func);
+
+ if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) {
+ printf("Native code for BLORP blit:\n");
+ brw_dump_compile(&func, dump_file, 0, func.next_insn_offset);
+ printf("\n");
+ }
+
+ return brw_get_program(&func, program_size);
+}
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
new file mode 100644
index 00000000000..1bcb0d98bff
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef BRW_BLORP_BLIT_EU_H
+#define BRW_BLORP_BLIT_EU_H
+
+#include "brw_context.h"
+#include "brw_eu.h"
+
+class brw_blorp_eu_emitter
+{
+protected:
+ explicit brw_blorp_eu_emitter(struct brw_context *brw);
+ ~brw_blorp_eu_emitter();
+
+ const unsigned *get_program(unsigned *program_size, FILE *dump_file);
+
+ void *mem_ctx;
+ struct brw_compile func;
+};
+
+#endif /* BRW_BLORP_BLIT_EU_H */