#ifndef ILO_RENDER_GEN_H
#define ILO_RENDER_GEN_H
+#include "core/ilo_builder.h"
+#include "core/ilo_builder_3d.h"
+#include "core/ilo_builder_render.h"
+#include "core/ilo_state_raster.h"
+
#include "ilo_common.h"
-#include "ilo_builder.h"
#include "ilo_state.h"
#include "ilo_render.h"
* Render Engine.
*/
struct ilo_render {
- const struct ilo_dev_info *dev;
+ const struct ilo_dev *dev;
struct ilo_builder *builder;
struct intel_bo *workaround_bo;
- uint32_t sample_pattern_1x;
- uint32_t sample_pattern_2x;
- uint32_t sample_pattern_4x;
- uint32_t sample_pattern_8x[2];
- uint32_t sample_pattern_16x[4];
+ struct ilo_state_sample_pattern sample_pattern;
bool hw_ctx_changed;
*/
uint32_t deferred_pipe_control_dw1;
- bool primitive_restart;
int reduced_prim;
int so_max_vertices;
+ struct ilo_state_urb urb;
+ struct ilo_state_raster rs;
+ struct ilo_state_cc cc;
+
uint32_t SF_VIEWPORT;
uint32_t CLIP_VIEWPORT;
uint32_t SF_CLIP_VIEWPORT; /* GEN7+ */
int reduced_prim;
bool prim_changed;
- bool primitive_restart_changed;
+
+ struct ilo_state_urb_delta urb_delta;
+ struct ilo_state_vf_delta vf_delta;
+ struct ilo_state_raster_delta rs_delta;
+ struct ilo_state_viewport_delta vp_delta;
+ struct ilo_state_cc_delta cc_delta;
/* dynamic states */
bool viewport_changed;
ilo_render_get_rectlist_commands_len_gen6(const struct ilo_render *render,
const struct ilo_blitter *blitter);
+int
+ilo_render_get_rectlist_commands_len_gen8(const struct ilo_render *render,
+ const struct ilo_blitter *blitter);
+
static inline int
ilo_render_get_rectlist_commands_len(const struct ilo_render *render,
const struct ilo_blitter *blitter)
{
- return ilo_render_get_rectlist_commands_len_gen6(render, blitter);
+ if (ilo_dev_gen(render->dev) >= ILO_GEN(8))
+ return ilo_render_get_rectlist_commands_len_gen8(render, blitter);
+ else
+ return ilo_render_get_rectlist_commands_len_gen6(render, blitter);
}
void
const struct ilo_blitter *blitter,
const struct ilo_render_rectlist_session *session);
+void
+ilo_render_emit_rectlist_commands_gen8(struct ilo_render *r,
+ const struct ilo_blitter *blitter,
+ const struct ilo_render_rectlist_session *session);
+
static inline void
ilo_render_emit_rectlist_commands(struct ilo_render *render,
const struct ilo_blitter *blitter,
{
const unsigned batch_used = ilo_builder_batch_used(render->builder);
- if (ilo_dev_gen(render->dev) >= ILO_GEN(7))
+ if (ilo_dev_gen(render->dev) >= ILO_GEN(8))
+ ilo_render_emit_rectlist_commands_gen8(render, blitter, session);
+ else if (ilo_dev_gen(render->dev) >= ILO_GEN(7))
ilo_render_emit_rectlist_commands_gen7(render, blitter, session);
else
ilo_render_emit_rectlist_commands_gen6(render, blitter, session);
const struct ilo_state_vector *vec,
struct ilo_render_launch_grid_session *session);
+/**
+ * A convenient wrapper for gen6_PIPE_CONTROL(). This should be enough for
+ * our needs everywhere except for queries.
+ */
+static inline void
+ilo_render_pipe_control(struct ilo_render *r, uint32_t dw1)
+{
+ const uint32_t write_mask = (dw1 & GEN6_PIPE_CONTROL_WRITE__MASK);
+ struct intel_bo *bo = (write_mask) ? r->workaround_bo : NULL;
+
+ ILO_DEV_ASSERT(r->dev, 6, 8);
+
+ if (write_mask)
+ assert(write_mask == GEN6_PIPE_CONTROL_WRITE_IMM);
+
+ if (dw1 & GEN6_PIPE_CONTROL_CS_STALL) {
+ /* CS stall cannot be set alone */
+ const uint32_t mask = GEN6_PIPE_CONTROL_RENDER_CACHE_FLUSH |
+ GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH |
+ GEN6_PIPE_CONTROL_PIXEL_SCOREBOARD_STALL |
+ GEN6_PIPE_CONTROL_DEPTH_STALL |
+ GEN6_PIPE_CONTROL_WRITE__MASK;
+ if (!(dw1 & mask))
+ dw1 |= GEN6_PIPE_CONTROL_PIXEL_SCOREBOARD_STALL;
+ }
+
+ gen6_PIPE_CONTROL(r->builder, dw1, bo, 0, 0);
+
+ r->state.current_pipe_control_dw1 |= dw1;
+ r->state.deferred_pipe_control_dw1 &= ~dw1;
+}
+
+/**
+ * A convenient wrapper for gen{6,7}_3DPRIMITIVE().
+ */
+static inline void
+ilo_render_3dprimitive(struct ilo_render *r,
+ const struct pipe_draw_info *info,
+ const struct ilo_ib_state *ib)
+{
+ ILO_DEV_ASSERT(r->dev, 6, 8);
+
+ if (r->state.deferred_pipe_control_dw1)
+ ilo_render_pipe_control(r, r->state.deferred_pipe_control_dw1);
+
+ /* 3DPRIMITIVE */
+ if (ilo_dev_gen(r->dev) >= ILO_GEN(7))
+ gen7_3DPRIMITIVE(r->builder, info, ib);
+ else
+ gen6_3DPRIMITIVE(r->builder, info, ib);
+
+ r->state.current_pipe_control_dw1 = 0;
+ assert(!r->state.deferred_pipe_control_dw1);
+}
+
void
gen6_wa_pre_pipe_control(struct ilo_render *r, uint32_t dw1);
const struct ilo_state_vector *vec,
struct ilo_render_draw_session *session);
-void
-gen7_draw_vf_draw(struct ilo_render *r,
- const struct ilo_state_vector *vec,
- struct ilo_render_draw_session *session);
-
#endif /* ILO_RENDER_GEN_H */