if (!pctx)
return NULL;
+ /* fd_context_init overwrites delete_rasterizer_state, so set this
+ * here. */
+ pctx->delete_rasterizer_state = fd6_rasterizer_state_delete;
+
fd6_ctx->vs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
DRM_FREEDRENO_GEM_TYPE_KMEM);
if (dirty & FD_DIRTY_RASTERIZER) {
struct fd6_rasterizer_stateobj *rasterizer =
fd6_rasterizer_stateobj(ctx->rasterizer);
-
- OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8000, 1);
- OUT_RING(ring, 0x80);
- OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8001, 1);
- OUT_RING(ring, 0x0);
- OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8004, 1);
- OUT_RING(ring, 0x0);
-
- OUT_PKT4(ring, REG_A6XX_GRAS_SU_CNTL, 1);
- OUT_RING(ring, rasterizer->gras_su_cntl);
-
- OUT_PKT4(ring, REG_A6XX_GRAS_SU_POINT_MINMAX, 2);
- OUT_RING(ring, rasterizer->gras_su_point_minmax);
- OUT_RING(ring, rasterizer->gras_su_point_size);
-
- OUT_PKT4(ring, REG_A6XX_GRAS_SU_POLY_OFFSET_SCALE, 3);
- OUT_RING(ring, rasterizer->gras_su_poly_offset_scale);
- OUT_RING(ring, rasterizer->gras_su_poly_offset_offset);
- OUT_RING(ring, rasterizer->gras_su_poly_offset_clamp);
-
-#if 0
- OUT_PKT4(ring, REG_A6XX_PC_RASTER_CNTL, 1);
- OUT_RING(ring, rasterizer->pc_raster_cntl);
-
- OUT_PKT4(ring, REG_A6XX_GRAS_CL_CNTL, 1);
- OUT_RING(ring, rasterizer->gras_cl_clip_cntl);
-#endif
+ fd6_emit_add_group(emit, rasterizer->stateobj,
+ FD6_GROUP_RASTERIZER, 0x7);
}
/* Since the primitive restart state is not part of a tracked object, we
FD6_GROUP_FS_CONST,
FD6_GROUP_VS_TEX,
FD6_GROUP_FS_TEX,
+ FD6_GROUP_RASTERIZER,
};
struct fd6_state_group {
fd6_rasterizer_state_create(struct pipe_context *pctx,
const struct pipe_rasterizer_state *cso)
{
+ struct fd_context *ctx = fd_context(pctx);
struct fd6_rasterizer_stateobj *so;
float psize_min, psize_max;
so->gras_cl_clip_cntl |= A6XX_GRAS_CL_CNTL_ZERO_GB_SCALE_Z;
#endif
+ so->stateobj = fd_ringbuffer_new_object(ctx->pipe, 15 * 4);
+ struct fd_ringbuffer *ring = so->stateobj;
+
+ OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8000, 1);
+ OUT_RING(ring, 0x80);
+ OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8001, 1);
+ OUT_RING(ring, 0x0);
+ OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8004, 1);
+ OUT_RING(ring, 0x0);
+
+ OUT_PKT4(ring, REG_A6XX_GRAS_SU_CNTL, 1);
+ OUT_RING(ring, so->gras_su_cntl);
+
+ OUT_PKT4(ring, REG_A6XX_GRAS_SU_POINT_MINMAX, 2);
+ OUT_RING(ring, so->gras_su_point_minmax);
+ OUT_RING(ring, so->gras_su_point_size);
+
+ OUT_PKT4(ring, REG_A6XX_GRAS_SU_POLY_OFFSET_SCALE, 3);
+ OUT_RING(ring, so->gras_su_poly_offset_scale);
+ OUT_RING(ring, so->gras_su_poly_offset_offset);
+ OUT_RING(ring, so->gras_su_poly_offset_clamp);
+
+#if 0
+ OUT_PKT4(ring, REG_A6XX_PC_RASTER_CNTL, 1);
+ OUT_RING(ring, so->pc_raster_cntl);
+
+ OUT_PKT4(ring, REG_A6XX_GRAS_CL_CNTL, 1);
+ OUT_RING(ring, so->gras_cl_clip_cntl);
+#endif
+
return so;
}
+
+void
+fd6_rasterizer_state_delete(struct pipe_context *pctx, void *hwcso)
+{
+ struct fd6_rasterizer_stateobj *so = hwcso;
+
+ fd_ringbuffer_del(so->stateobj);
+ FREE(hwcso);
+}
+
uint32_t gras_cl_clip_cntl;
uint32_t pc_primitive_cntl;
uint32_t pc_raster_cntl;
+
+ struct fd_ringbuffer *stateobj;
};
static inline struct fd6_rasterizer_stateobj *
void * fd6_rasterizer_state_create(struct pipe_context *pctx,
const struct pipe_rasterizer_state *cso);
+void fd6_rasterizer_state_delete(struct pipe_context *, void *hwcso);
#endif /* FD6_RASTERIZER_H_ */