| 78 | } |
| 79 | |
| 80 | static int commit_slices(struct vaapi_context *vactx) |
| 81 | { |
| 82 | VABufferID *slice_buf_ids; |
| 83 | VABufferID slice_param_buf_id, slice_data_buf_id; |
| 84 | |
| 85 | if (vactx->slice_count == 0) |
| 86 | return 0; |
| 87 | |
| 88 | slice_buf_ids = |
| 89 | av_fast_realloc(vactx->slice_buf_ids, |
| 90 | &vactx->slice_buf_ids_alloc, |
| 91 | (vactx->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0])); |
| 92 | if (!slice_buf_ids) |
| 93 | return -1; |
| 94 | vactx->slice_buf_ids = slice_buf_ids; |
| 95 | |
| 96 | slice_param_buf_id = 0; |
| 97 | if (vaCreateBuffer(vactx->display, vactx->context_id, |
| 98 | VASliceParameterBufferType, |
| 99 | vactx->slice_param_size, |
| 100 | vactx->slice_count, vactx->slice_params, |
| 101 | &slice_param_buf_id) != VA_STATUS_SUCCESS) |
| 102 | return -1; |
| 103 | vactx->slice_count = 0; |
| 104 | |
| 105 | slice_data_buf_id = 0; |
| 106 | if (vaCreateBuffer(vactx->display, vactx->context_id, |
| 107 | VASliceDataBufferType, |
| 108 | vactx->slice_data_size, |
| 109 | 1, (void *)vactx->slice_data, |
| 110 | &slice_data_buf_id) != VA_STATUS_SUCCESS) |
| 111 | return -1; |
| 112 | vactx->slice_data = NULL; |
| 113 | vactx->slice_data_size = 0; |
| 114 | |
| 115 | slice_buf_ids[vactx->n_slice_buf_ids++] = slice_param_buf_id; |
| 116 | slice_buf_ids[vactx->n_slice_buf_ids++] = slice_data_buf_id; |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | static void *alloc_buffer(struct vaapi_context *vactx, int type, unsigned int size, uint32_t *buf_id) |
| 121 | { |
no test coverage detected