1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2010 Christian König 4bf215546Sopenharmony_ci * All Rights Reserved. 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 12bf215546Sopenharmony_ci * the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 16bf215546Sopenharmony_ci * of the Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci **************************************************************************/ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci#include <assert.h> 29bf215546Sopenharmony_ci#include "util/format/u_format.h" 30bf215546Sopenharmony_ci#include "vl_vertex_buffers.h" 31bf215546Sopenharmony_ci#include "vl_types.h" 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci/* vertices for a quad covering a block */ 34bf215546Sopenharmony_cistatic const struct vertex2f block_quad[4] = { 35bf215546Sopenharmony_ci {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} 36bf215546Sopenharmony_ci}; 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_cistruct pipe_vertex_buffer 39bf215546Sopenharmony_civl_vb_upload_quads(struct pipe_context *pipe) 40bf215546Sopenharmony_ci{ 41bf215546Sopenharmony_ci struct pipe_vertex_buffer quad; 42bf215546Sopenharmony_ci struct pipe_transfer *buf_transfer; 43bf215546Sopenharmony_ci struct vertex2f *v; 44bf215546Sopenharmony_ci 45bf215546Sopenharmony_ci unsigned i; 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci assert(pipe); 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ci /* create buffer */ 50bf215546Sopenharmony_ci quad.stride = sizeof(struct vertex2f); 51bf215546Sopenharmony_ci quad.buffer_offset = 0; 52bf215546Sopenharmony_ci quad.buffer.resource = pipe_buffer_create 53bf215546Sopenharmony_ci ( 54bf215546Sopenharmony_ci pipe->screen, 55bf215546Sopenharmony_ci PIPE_BIND_VERTEX_BUFFER, 56bf215546Sopenharmony_ci PIPE_USAGE_DEFAULT, 57bf215546Sopenharmony_ci sizeof(struct vertex2f) * 4 58bf215546Sopenharmony_ci ); 59bf215546Sopenharmony_ci quad.is_user_buffer = false; 60bf215546Sopenharmony_ci 61bf215546Sopenharmony_ci if(!quad.buffer.resource) 62bf215546Sopenharmony_ci return quad; 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ci /* and fill it */ 65bf215546Sopenharmony_ci v = pipe_buffer_map 66bf215546Sopenharmony_ci ( 67bf215546Sopenharmony_ci pipe, 68bf215546Sopenharmony_ci quad.buffer.resource, 69bf215546Sopenharmony_ci PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, 70bf215546Sopenharmony_ci &buf_transfer 71bf215546Sopenharmony_ci ); 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ci for (i = 0; i < 4; ++i, ++v) { 74bf215546Sopenharmony_ci v->x = block_quad[i].x; 75bf215546Sopenharmony_ci v->y = block_quad[i].y; 76bf215546Sopenharmony_ci } 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_ci pipe_buffer_unmap(pipe, buf_transfer); 79bf215546Sopenharmony_ci 80bf215546Sopenharmony_ci return quad; 81bf215546Sopenharmony_ci} 82bf215546Sopenharmony_ci 83bf215546Sopenharmony_cistruct pipe_vertex_buffer 84bf215546Sopenharmony_civl_vb_upload_pos(struct pipe_context *pipe, unsigned width, unsigned height) 85bf215546Sopenharmony_ci{ 86bf215546Sopenharmony_ci struct pipe_vertex_buffer pos; 87bf215546Sopenharmony_ci struct pipe_transfer *buf_transfer; 88bf215546Sopenharmony_ci struct vertex2s *v; 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci unsigned x, y; 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_ci assert(pipe); 93bf215546Sopenharmony_ci 94bf215546Sopenharmony_ci /* create buffer */ 95bf215546Sopenharmony_ci pos.stride = sizeof(struct vertex2s); 96bf215546Sopenharmony_ci pos.buffer_offset = 0; 97bf215546Sopenharmony_ci pos.buffer.resource = pipe_buffer_create 98bf215546Sopenharmony_ci ( 99bf215546Sopenharmony_ci pipe->screen, 100bf215546Sopenharmony_ci PIPE_BIND_VERTEX_BUFFER, 101bf215546Sopenharmony_ci PIPE_USAGE_DEFAULT, 102bf215546Sopenharmony_ci sizeof(struct vertex2s) * width * height 103bf215546Sopenharmony_ci ); 104bf215546Sopenharmony_ci pos.is_user_buffer = false; 105bf215546Sopenharmony_ci 106bf215546Sopenharmony_ci if(!pos.buffer.resource) 107bf215546Sopenharmony_ci return pos; 108bf215546Sopenharmony_ci 109bf215546Sopenharmony_ci /* and fill it */ 110bf215546Sopenharmony_ci v = pipe_buffer_map 111bf215546Sopenharmony_ci ( 112bf215546Sopenharmony_ci pipe, 113bf215546Sopenharmony_ci pos.buffer.resource, 114bf215546Sopenharmony_ci PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, 115bf215546Sopenharmony_ci &buf_transfer 116bf215546Sopenharmony_ci ); 117bf215546Sopenharmony_ci 118bf215546Sopenharmony_ci for ( y = 0; y < height; ++y) { 119bf215546Sopenharmony_ci for ( x = 0; x < width; ++x, ++v) { 120bf215546Sopenharmony_ci v->x = x; 121bf215546Sopenharmony_ci v->y = y; 122bf215546Sopenharmony_ci } 123bf215546Sopenharmony_ci } 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_ci pipe_buffer_unmap(pipe, buf_transfer); 126bf215546Sopenharmony_ci 127bf215546Sopenharmony_ci return pos; 128bf215546Sopenharmony_ci} 129bf215546Sopenharmony_ci 130bf215546Sopenharmony_cistatic struct pipe_vertex_element 131bf215546Sopenharmony_civl_vb_get_quad_vertex_element(void) 132bf215546Sopenharmony_ci{ 133bf215546Sopenharmony_ci struct pipe_vertex_element element; 134bf215546Sopenharmony_ci 135bf215546Sopenharmony_ci /* setup rectangle element */ 136bf215546Sopenharmony_ci element.src_offset = 0; 137bf215546Sopenharmony_ci element.instance_divisor = 0; 138bf215546Sopenharmony_ci element.vertex_buffer_index = 0; 139bf215546Sopenharmony_ci element.dual_slot = false; 140bf215546Sopenharmony_ci element.src_format = PIPE_FORMAT_R32G32_FLOAT; 141bf215546Sopenharmony_ci 142bf215546Sopenharmony_ci return element; 143bf215546Sopenharmony_ci} 144bf215546Sopenharmony_ci 145bf215546Sopenharmony_cistatic void 146bf215546Sopenharmony_civl_vb_element_helper(struct pipe_vertex_element* elements, unsigned num_elements, 147bf215546Sopenharmony_ci unsigned vertex_buffer_index) 148bf215546Sopenharmony_ci{ 149bf215546Sopenharmony_ci unsigned i, offset = 0; 150bf215546Sopenharmony_ci 151bf215546Sopenharmony_ci assert(elements && num_elements); 152bf215546Sopenharmony_ci 153bf215546Sopenharmony_ci for ( i = 0; i < num_elements; ++i ) { 154bf215546Sopenharmony_ci elements[i].src_offset = offset; 155bf215546Sopenharmony_ci elements[i].instance_divisor = 1; 156bf215546Sopenharmony_ci elements[i].vertex_buffer_index = vertex_buffer_index; 157bf215546Sopenharmony_ci offset += util_format_get_blocksize(elements[i].src_format); 158bf215546Sopenharmony_ci } 159bf215546Sopenharmony_ci} 160bf215546Sopenharmony_ci 161bf215546Sopenharmony_civoid * 162bf215546Sopenharmony_civl_vb_get_ves_ycbcr(struct pipe_context *pipe) 163bf215546Sopenharmony_ci{ 164bf215546Sopenharmony_ci struct pipe_vertex_element vertex_elems[NUM_VS_INPUTS]; 165bf215546Sopenharmony_ci 166bf215546Sopenharmony_ci assert(pipe); 167bf215546Sopenharmony_ci 168bf215546Sopenharmony_ci memset(&vertex_elems, 0, sizeof(vertex_elems)); 169bf215546Sopenharmony_ci vertex_elems[VS_I_RECT] = vl_vb_get_quad_vertex_element(); 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ci /* Position element */ 172bf215546Sopenharmony_ci vertex_elems[VS_I_VPOS].src_format = PIPE_FORMAT_R8G8B8A8_USCALED; 173bf215546Sopenharmony_ci 174bf215546Sopenharmony_ci /* block num element */ 175bf215546Sopenharmony_ci vertex_elems[VS_I_BLOCK_NUM].src_format = PIPE_FORMAT_R32_FLOAT; 176bf215546Sopenharmony_ci 177bf215546Sopenharmony_ci vl_vb_element_helper(&vertex_elems[VS_I_VPOS], 2, 1); 178bf215546Sopenharmony_ci 179bf215546Sopenharmony_ci return pipe->create_vertex_elements_state(pipe, 3, vertex_elems); 180bf215546Sopenharmony_ci} 181bf215546Sopenharmony_ci 182bf215546Sopenharmony_civoid * 183bf215546Sopenharmony_civl_vb_get_ves_mv(struct pipe_context *pipe) 184bf215546Sopenharmony_ci{ 185bf215546Sopenharmony_ci struct pipe_vertex_element vertex_elems[NUM_VS_INPUTS]; 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_ci assert(pipe); 188bf215546Sopenharmony_ci 189bf215546Sopenharmony_ci memset(&vertex_elems, 0, sizeof(vertex_elems)); 190bf215546Sopenharmony_ci vertex_elems[VS_I_RECT] = vl_vb_get_quad_vertex_element(); 191bf215546Sopenharmony_ci 192bf215546Sopenharmony_ci /* Position element */ 193bf215546Sopenharmony_ci vertex_elems[VS_I_VPOS].src_format = PIPE_FORMAT_R16G16_SSCALED; 194bf215546Sopenharmony_ci 195bf215546Sopenharmony_ci vl_vb_element_helper(&vertex_elems[VS_I_VPOS], 1, 1); 196bf215546Sopenharmony_ci 197bf215546Sopenharmony_ci /* motion vector TOP element */ 198bf215546Sopenharmony_ci vertex_elems[VS_I_MV_TOP].src_format = PIPE_FORMAT_R16G16B16A16_SSCALED; 199bf215546Sopenharmony_ci 200bf215546Sopenharmony_ci /* motion vector BOTTOM element */ 201bf215546Sopenharmony_ci vertex_elems[VS_I_MV_BOTTOM].src_format = PIPE_FORMAT_R16G16B16A16_SSCALED; 202bf215546Sopenharmony_ci 203bf215546Sopenharmony_ci vl_vb_element_helper(&vertex_elems[VS_I_MV_TOP], 2, 2); 204bf215546Sopenharmony_ci 205bf215546Sopenharmony_ci return pipe->create_vertex_elements_state(pipe, NUM_VS_INPUTS, vertex_elems); 206bf215546Sopenharmony_ci} 207bf215546Sopenharmony_ci 208bf215546Sopenharmony_cibool 209bf215546Sopenharmony_civl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe, 210bf215546Sopenharmony_ci unsigned width, unsigned height) 211bf215546Sopenharmony_ci{ 212bf215546Sopenharmony_ci unsigned i, size; 213bf215546Sopenharmony_ci 214bf215546Sopenharmony_ci assert(buffer); 215bf215546Sopenharmony_ci 216bf215546Sopenharmony_ci buffer->width = width; 217bf215546Sopenharmony_ci buffer->height = height; 218bf215546Sopenharmony_ci 219bf215546Sopenharmony_ci size = width * height; 220bf215546Sopenharmony_ci 221bf215546Sopenharmony_ci for (i = 0; i < VL_NUM_COMPONENTS; ++i) { 222bf215546Sopenharmony_ci buffer->ycbcr[i].resource = pipe_buffer_create 223bf215546Sopenharmony_ci ( 224bf215546Sopenharmony_ci pipe->screen, 225bf215546Sopenharmony_ci PIPE_BIND_VERTEX_BUFFER, 226bf215546Sopenharmony_ci PIPE_USAGE_STREAM, 227bf215546Sopenharmony_ci sizeof(struct vl_ycbcr_block) * size * 4 228bf215546Sopenharmony_ci ); 229bf215546Sopenharmony_ci if (!buffer->ycbcr[i].resource) 230bf215546Sopenharmony_ci goto error_ycbcr; 231bf215546Sopenharmony_ci } 232bf215546Sopenharmony_ci 233bf215546Sopenharmony_ci for (i = 0; i < VL_MAX_REF_FRAMES; ++i) { 234bf215546Sopenharmony_ci buffer->mv[i].resource = pipe_buffer_create 235bf215546Sopenharmony_ci ( 236bf215546Sopenharmony_ci pipe->screen, 237bf215546Sopenharmony_ci PIPE_BIND_VERTEX_BUFFER, 238bf215546Sopenharmony_ci PIPE_USAGE_STREAM, 239bf215546Sopenharmony_ci sizeof(struct vl_motionvector) * size 240bf215546Sopenharmony_ci ); 241bf215546Sopenharmony_ci if (!buffer->mv[i].resource) 242bf215546Sopenharmony_ci goto error_mv; 243bf215546Sopenharmony_ci } 244bf215546Sopenharmony_ci 245bf215546Sopenharmony_ci return true; 246bf215546Sopenharmony_ci 247bf215546Sopenharmony_cierror_mv: 248bf215546Sopenharmony_ci for (i = 0; i < VL_NUM_COMPONENTS; ++i) 249bf215546Sopenharmony_ci pipe_resource_reference(&buffer->mv[i].resource, NULL); 250bf215546Sopenharmony_ci 251bf215546Sopenharmony_cierror_ycbcr: 252bf215546Sopenharmony_ci for (i = 0; i < VL_NUM_COMPONENTS; ++i) 253bf215546Sopenharmony_ci pipe_resource_reference(&buffer->ycbcr[i].resource, NULL); 254bf215546Sopenharmony_ci return false; 255bf215546Sopenharmony_ci} 256bf215546Sopenharmony_ci 257bf215546Sopenharmony_ciunsigned 258bf215546Sopenharmony_civl_vb_attributes_per_plock(struct vl_vertex_buffer *buffer) 259bf215546Sopenharmony_ci{ 260bf215546Sopenharmony_ci return 1; 261bf215546Sopenharmony_ci} 262bf215546Sopenharmony_ci 263bf215546Sopenharmony_cistruct pipe_vertex_buffer 264bf215546Sopenharmony_civl_vb_get_ycbcr(struct vl_vertex_buffer *buffer, int component) 265bf215546Sopenharmony_ci{ 266bf215546Sopenharmony_ci struct pipe_vertex_buffer buf; 267bf215546Sopenharmony_ci 268bf215546Sopenharmony_ci assert(buffer); 269bf215546Sopenharmony_ci 270bf215546Sopenharmony_ci buf.stride = sizeof(struct vl_ycbcr_block); 271bf215546Sopenharmony_ci buf.buffer_offset = 0; 272bf215546Sopenharmony_ci buf.buffer.resource = buffer->ycbcr[component].resource; 273bf215546Sopenharmony_ci buf.is_user_buffer = false; 274bf215546Sopenharmony_ci 275bf215546Sopenharmony_ci return buf; 276bf215546Sopenharmony_ci} 277bf215546Sopenharmony_ci 278bf215546Sopenharmony_cistruct pipe_vertex_buffer 279bf215546Sopenharmony_civl_vb_get_mv(struct vl_vertex_buffer *buffer, int motionvector) 280bf215546Sopenharmony_ci{ 281bf215546Sopenharmony_ci struct pipe_vertex_buffer buf; 282bf215546Sopenharmony_ci 283bf215546Sopenharmony_ci assert(buffer); 284bf215546Sopenharmony_ci 285bf215546Sopenharmony_ci buf.stride = sizeof(struct vl_motionvector); 286bf215546Sopenharmony_ci buf.buffer_offset = 0; 287bf215546Sopenharmony_ci buf.buffer.resource = buffer->mv[motionvector].resource; 288bf215546Sopenharmony_ci buf.is_user_buffer = false; 289bf215546Sopenharmony_ci 290bf215546Sopenharmony_ci return buf; 291bf215546Sopenharmony_ci} 292bf215546Sopenharmony_ci 293bf215546Sopenharmony_civoid 294bf215546Sopenharmony_civl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe) 295bf215546Sopenharmony_ci{ 296bf215546Sopenharmony_ci unsigned i; 297bf215546Sopenharmony_ci 298bf215546Sopenharmony_ci assert(buffer && pipe); 299bf215546Sopenharmony_ci 300bf215546Sopenharmony_ci for (i = 0; i < VL_NUM_COMPONENTS; ++i) { 301bf215546Sopenharmony_ci buffer->ycbcr[i].vertex_stream = pipe_buffer_map 302bf215546Sopenharmony_ci ( 303bf215546Sopenharmony_ci pipe, 304bf215546Sopenharmony_ci buffer->ycbcr[i].resource, 305bf215546Sopenharmony_ci PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, 306bf215546Sopenharmony_ci &buffer->ycbcr[i].transfer 307bf215546Sopenharmony_ci ); 308bf215546Sopenharmony_ci } 309bf215546Sopenharmony_ci 310bf215546Sopenharmony_ci for (i = 0; i < VL_MAX_REF_FRAMES; ++i) { 311bf215546Sopenharmony_ci buffer->mv[i].vertex_stream = pipe_buffer_map 312bf215546Sopenharmony_ci ( 313bf215546Sopenharmony_ci pipe, 314bf215546Sopenharmony_ci buffer->mv[i].resource, 315bf215546Sopenharmony_ci PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE, 316bf215546Sopenharmony_ci &buffer->mv[i].transfer 317bf215546Sopenharmony_ci ); 318bf215546Sopenharmony_ci } 319bf215546Sopenharmony_ci 320bf215546Sopenharmony_ci} 321bf215546Sopenharmony_ci 322bf215546Sopenharmony_cistruct vl_ycbcr_block * 323bf215546Sopenharmony_civl_vb_get_ycbcr_stream(struct vl_vertex_buffer *buffer, int component) 324bf215546Sopenharmony_ci{ 325bf215546Sopenharmony_ci assert(buffer); 326bf215546Sopenharmony_ci assert(component < VL_NUM_COMPONENTS); 327bf215546Sopenharmony_ci 328bf215546Sopenharmony_ci return buffer->ycbcr[component].vertex_stream; 329bf215546Sopenharmony_ci} 330bf215546Sopenharmony_ci 331bf215546Sopenharmony_ciunsigned 332bf215546Sopenharmony_civl_vb_get_mv_stream_stride(struct vl_vertex_buffer *buffer) 333bf215546Sopenharmony_ci{ 334bf215546Sopenharmony_ci assert(buffer); 335bf215546Sopenharmony_ci 336bf215546Sopenharmony_ci return buffer->width; 337bf215546Sopenharmony_ci} 338bf215546Sopenharmony_ci 339bf215546Sopenharmony_cistruct vl_motionvector * 340bf215546Sopenharmony_civl_vb_get_mv_stream(struct vl_vertex_buffer *buffer, int ref_frame) 341bf215546Sopenharmony_ci{ 342bf215546Sopenharmony_ci assert(buffer); 343bf215546Sopenharmony_ci assert(ref_frame < VL_MAX_REF_FRAMES); 344bf215546Sopenharmony_ci 345bf215546Sopenharmony_ci return buffer->mv[ref_frame].vertex_stream; 346bf215546Sopenharmony_ci} 347bf215546Sopenharmony_ci 348bf215546Sopenharmony_civoid 349bf215546Sopenharmony_civl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe) 350bf215546Sopenharmony_ci{ 351bf215546Sopenharmony_ci unsigned i; 352bf215546Sopenharmony_ci 353bf215546Sopenharmony_ci assert(buffer && pipe); 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_ci for (i = 0; i < VL_NUM_COMPONENTS; ++i) { 356bf215546Sopenharmony_ci if (buffer->ycbcr[i].transfer) 357bf215546Sopenharmony_ci pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer); 358bf215546Sopenharmony_ci } 359bf215546Sopenharmony_ci 360bf215546Sopenharmony_ci for (i = 0; i < VL_MAX_REF_FRAMES; ++i) { 361bf215546Sopenharmony_ci if (buffer->mv[i].transfer) 362bf215546Sopenharmony_ci pipe_buffer_unmap(pipe, buffer->mv[i].transfer); 363bf215546Sopenharmony_ci } 364bf215546Sopenharmony_ci} 365bf215546Sopenharmony_ci 366bf215546Sopenharmony_civoid 367bf215546Sopenharmony_civl_vb_cleanup(struct vl_vertex_buffer *buffer) 368bf215546Sopenharmony_ci{ 369bf215546Sopenharmony_ci unsigned i; 370bf215546Sopenharmony_ci 371bf215546Sopenharmony_ci assert(buffer); 372bf215546Sopenharmony_ci 373bf215546Sopenharmony_ci for (i = 0; i < VL_NUM_COMPONENTS; ++i) { 374bf215546Sopenharmony_ci pipe_resource_reference(&buffer->ycbcr[i].resource, NULL); 375bf215546Sopenharmony_ci } 376bf215546Sopenharmony_ci 377bf215546Sopenharmony_ci for (i = 0; i < VL_MAX_REF_FRAMES; ++i) { 378bf215546Sopenharmony_ci pipe_resource_reference(&buffer->mv[i].resource, NULL); 379bf215546Sopenharmony_ci } 380bf215546Sopenharmony_ci} 381