Lines Matching defs:csb
45 * \brief Contains functions to manage Control Stream Builder (csb) object.
47 * A csb object can be used to create a primary/main control stream, referred
62 * \brief Size of the individual csb buffer object.
67 * \brief Initializes the csb object.
70 * \param[in] csb Control Stream Builder object to initialize.
76 struct pvr_csb *csb)
78 csb->start = NULL;
79 csb->next = NULL;
80 csb->pvr_bo = NULL;
81 csb->end = NULL;
82 csb->device = device;
83 csb->stream_type = stream_type;
84 csb->status = VK_SUCCESS;
85 list_inithead(&csb->pvr_bo_list);
89 * \brief Frees the resources associated with the csb object.
91 * \param[in] csb Control Stream Builder object to free.
95 void pvr_csb_finish(struct pvr_csb *csb)
97 list_for_each_entry_safe (struct pvr_bo, pvr_bo, &csb->pvr_bo_list, link) {
99 pvr_bo_free(csb->device, pvr_bo);
102 /* Leave the csb in a reset state to catch use after destroy instances */
103 pvr_csb_init(NULL, PVR_CMD_STREAM_TYPE_INVALID, csb);
107 * \brief Helper function to extend csb memory.
110 * using STREAM_LINK dwords and updates csb object to use the new buffer.
119 * \param[in] csb Control Stream Builder object to extend.
122 static bool pvr_csb_buffer_extend(struct pvr_csb *csb)
128 rogue_get_slc_cache_line_size(&csb->device->pdevice->dev_info);
140 result = pvr_bo_alloc(csb->device,
141 csb->device->heaps.general_heap,
147 vk_error(csb->device, result);
148 csb->status = result;
152 /* Chain to the old BO if this is not the first BO in csb */
153 if (csb->pvr_bo) {
154 csb->end += stream_link_space;
155 assert(csb->next + stream_link_space <= csb->end);
157 switch (csb->stream_type) {
159 pvr_csb_emit (csb, VDMCTRL_STREAM_LINK0, link) {
163 pvr_csb_emit (csb, VDMCTRL_STREAM_LINK1, link) {
170 pvr_csb_emit (csb, CDMCTRL_STREAM_LINK0, link) {
174 pvr_csb_emit (csb, CDMCTRL_STREAM_LINK1, link) {
186 csb->pvr_bo = pvr_bo;
187 csb->start = pvr_bo->bo->map;
192 csb->end = csb->start + pvr_bo->bo->size - stream_link_space;
193 csb->next = csb->start;
195 list_addtail(&pvr_bo->link, &csb->pvr_bo_list);
201 * \brief Provides a chunk of memory from the current csb buffer. In cases where
207 * \param[in] csb Control Stream Builder object to allocate from.
211 void *pvr_csb_alloc_dwords(struct pvr_csb *csb, uint32_t num_dwords)
215 if (csb->status != VK_SUCCESS)
218 if (csb->next + required_space > csb->end) {
219 bool ret = pvr_csb_buffer_extend(csb);
224 void *p = csb->next;
226 csb->next += required_space;
227 assert(csb->next <= csb->end);
234 * csb object. Given a VDMCTRL_STREAM_RETURN marks the end of the sub control
237 * \param[in] csb Control Stream Builder object to add VDMCTRL_STREAM_RETURN to.
240 VkResult pvr_csb_emit_return(struct pvr_csb *csb)
243 assert(csb->stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS);
246 pvr_csb_emit(csb, VDMCTRL_STREAM_RETURN, ret);
249 return csb->status;
253 * \brief Adds STREAM_TERMINATE dword into the control stream pointed by csb
257 * \param[in] csb Control Stream Builder object to terminate.
260 VkResult pvr_csb_emit_terminate(struct pvr_csb *csb)
262 switch (csb->stream_type) {
265 pvr_csb_emit(csb, VDMCTRL_STREAM_TERMINATE, terminate);
271 pvr_csb_emit(csb, CDMCTRL_STREAM_TERMINATE, terminate);
280 return csb->status;