2 * Copyright © 2014 Broadcom
3 * Copyright (C) 2012 Rob Clark <robclark@freedesktop.org>
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 #include "util/u_memory.h"
26 #include "util/u_format.h"
27 #include "util/u_inlines.h"
28 #include "util/u_surface.h"
29 #include "util/u_blitter.h"
31 #include "vc4_screen.h"
32 #include "vc4_context.h"
33 #include "vc4_resource.h"
34 #include "vc4_tiling.h"
36 static bool miptree_debug
= false;
39 vc4_resource_bo_alloc(struct vc4_resource
*rsc
)
41 struct pipe_resource
*prsc
= &rsc
->base
.b
;
42 struct pipe_screen
*pscreen
= prsc
->screen
;
45 fprintf(stderr
, "alloc %p: size %d + offset %d -> %d\n",
48 rsc
->slices
[0].offset
,
49 rsc
->slices
[0].offset
+
51 rsc
->cube_map_stride
* (prsc
->array_size
- 1));
54 vc4_bo_unreference(&rsc
->bo
);
55 rsc
->bo
= vc4_bo_alloc(vc4_screen(pscreen
),
56 rsc
->slices
[0].offset
+
58 rsc
->cube_map_stride
* (prsc
->array_size
- 1),
63 vc4_resource_transfer_unmap(struct pipe_context
*pctx
,
64 struct pipe_transfer
*ptrans
)
66 struct vc4_context
*vc4
= vc4_context(pctx
);
67 struct vc4_transfer
*trans
= vc4_transfer(ptrans
);
68 struct pipe_resource
*prsc
= ptrans
->resource
;
69 struct vc4_resource
*rsc
= vc4_resource(prsc
);
70 struct vc4_resource_slice
*slice
= &rsc
->slices
[ptrans
->level
];
73 if (ptrans
->usage
& PIPE_TRANSFER_WRITE
) {
74 vc4_store_tiled_image(rsc
->bo
->map
+ slice
->offset
+
75 ptrans
->box
.z
* rsc
->cube_map_stride
,
77 trans
->map
, ptrans
->stride
,
78 slice
->tiling
, rsc
->cpp
,
84 pipe_resource_reference(&ptrans
->resource
, NULL
);
85 util_slab_free(&vc4
->transfer_pool
, ptrans
);
89 vc4_resource_transfer_map(struct pipe_context
*pctx
,
90 struct pipe_resource
*prsc
,
91 unsigned level
, unsigned usage
,
92 const struct pipe_box
*box
,
93 struct pipe_transfer
**pptrans
)
95 struct vc4_context
*vc4
= vc4_context(pctx
);
96 struct vc4_resource
*rsc
= vc4_resource(prsc
);
97 struct vc4_resource_slice
*slice
= &rsc
->slices
[level
];
98 struct vc4_transfer
*trans
;
99 struct pipe_transfer
*ptrans
;
100 enum pipe_format format
= prsc
->format
;
103 if (usage
& PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE
) {
104 vc4_resource_bo_alloc(rsc
);
105 } else if (!(usage
& PIPE_TRANSFER_UNSYNCHRONIZED
)) {
106 if (vc4_cl_references_bo(pctx
, rsc
->bo
)) {
107 if ((usage
& PIPE_TRANSFER_DISCARD_RANGE
) &&
108 prsc
->last_level
== 0 &&
109 prsc
->width0
== box
->width
&&
110 prsc
->height0
== box
->height
&&
111 prsc
->depth0
== box
->depth
) {
112 vc4_resource_bo_alloc(rsc
);
119 if (usage
& PIPE_TRANSFER_WRITE
)
122 trans
= util_slab_alloc(&vc4
->transfer_pool
);
126 /* XXX: Handle DONTBLOCK, DISCARD_RANGE, PERSISTENT, COHERENT. */
128 /* util_slab_alloc() doesn't zero: */
129 memset(trans
, 0, sizeof(*trans
));
130 ptrans
= &trans
->base
;
132 pipe_resource_reference(&ptrans
->resource
, prsc
);
133 ptrans
->level
= level
;
134 ptrans
->usage
= usage
;
137 /* Note that the current kernel implementation is synchronous, so no
138 * need to do syncing stuff here yet.
141 if (usage
& PIPE_TRANSFER_UNSYNCHRONIZED
)
142 buf
= vc4_bo_map_unsynchronized(rsc
->bo
);
144 buf
= vc4_bo_map(rsc
->bo
);
146 fprintf(stderr
, "Failed to map bo\n");
153 uint32_t utile_w
= vc4_utile_width(rsc
->cpp
);
154 uint32_t utile_h
= vc4_utile_height(rsc
->cpp
);
156 /* No direct mappings of tiled, since we need to manually
159 if (usage
& PIPE_TRANSFER_MAP_DIRECTLY
)
162 /* We need to align the box to utile boundaries, since that's
163 * what load/store operate on.
165 uint32_t box_start_x
= ptrans
->box
.x
& (utile_w
- 1);
166 uint32_t box_start_y
= ptrans
->box
.y
& (utile_h
- 1);
167 ptrans
->box
.width
+= box_start_x
;
168 ptrans
->box
.x
-= box_start_x
;
169 ptrans
->box
.height
+= box_start_y
;
170 ptrans
->box
.y
-= box_start_y
;
171 ptrans
->box
.width
= align(ptrans
->box
.width
, utile_w
);
172 ptrans
->box
.height
= align(ptrans
->box
.height
, utile_h
);
174 ptrans
->stride
= ptrans
->box
.width
* rsc
->cpp
;
175 ptrans
->layer_stride
= ptrans
->stride
;
177 trans
->map
= malloc(ptrans
->stride
* ptrans
->box
.height
);
178 if (usage
& PIPE_TRANSFER_READ
) {
179 vc4_load_tiled_image(trans
->map
, ptrans
->stride
,
180 buf
+ slice
->offset
+
181 box
->z
* rsc
->cube_map_stride
,
183 slice
->tiling
, rsc
->cpp
,
187 box_start_x
* rsc
->cpp
+
188 box_start_y
* ptrans
->stride
);
190 ptrans
->stride
= slice
->stride
;
191 ptrans
->layer_stride
= ptrans
->stride
;
193 return buf
+ slice
->offset
+
194 box
->y
/ util_format_get_blockheight(format
) * ptrans
->stride
+
195 box
->x
/ util_format_get_blockwidth(format
) * rsc
->cpp
+
196 box
->z
* rsc
->cube_map_stride
;
201 vc4_resource_transfer_unmap(pctx
, ptrans
);
206 vc4_resource_destroy(struct pipe_screen
*pscreen
,
207 struct pipe_resource
*prsc
)
209 struct vc4_resource
*rsc
= vc4_resource(prsc
);
210 pipe_resource_reference(&rsc
->shadow_parent
, NULL
);
211 vc4_bo_unreference(&rsc
->bo
);
216 vc4_resource_get_handle(struct pipe_screen
*pscreen
,
217 struct pipe_resource
*prsc
,
218 struct winsys_handle
*handle
)
220 struct vc4_resource
*rsc
= vc4_resource(prsc
);
222 return vc4_screen_bo_get_handle(pscreen
, rsc
->bo
, rsc
->slices
[0].stride
,
226 static const struct u_resource_vtbl vc4_resource_vtbl
= {
227 .resource_get_handle
= vc4_resource_get_handle
,
228 .resource_destroy
= vc4_resource_destroy
,
229 .transfer_map
= vc4_resource_transfer_map
,
230 .transfer_flush_region
= u_default_transfer_flush_region
,
231 .transfer_unmap
= vc4_resource_transfer_unmap
,
232 .transfer_inline_write
= u_default_transfer_inline_write
,
236 vc4_setup_slices(struct vc4_resource
*rsc
)
238 struct pipe_resource
*prsc
= &rsc
->base
.b
;
239 uint32_t width
= prsc
->width0
;
240 uint32_t height
= prsc
->height0
;
241 uint32_t pot_width
= util_next_power_of_two(width
);
242 uint32_t pot_height
= util_next_power_of_two(height
);
244 uint32_t utile_w
= vc4_utile_width(rsc
->cpp
);
245 uint32_t utile_h
= vc4_utile_height(rsc
->cpp
);
247 for (int i
= prsc
->last_level
; i
>= 0; i
--) {
248 struct vc4_resource_slice
*slice
= &rsc
->slices
[i
];
250 uint32_t level_width
, level_height
;
253 level_height
= height
;
255 level_width
= u_minify(pot_width
, i
);
256 level_height
= u_minify(pot_height
, i
);
260 slice
->tiling
= VC4_TILING_FORMAT_LINEAR
;
261 level_width
= align(level_width
, utile_w
);
263 if (vc4_size_is_lt(level_width
, level_height
,
265 slice
->tiling
= VC4_TILING_FORMAT_LT
;
266 level_width
= align(level_width
, utile_w
);
267 level_height
= align(level_height
, utile_h
);
269 slice
->tiling
= VC4_TILING_FORMAT_T
;
270 level_width
= align(level_width
,
272 level_height
= align(level_height
,
277 slice
->offset
= offset
;
278 slice
->stride
= level_width
* rsc
->cpp
;
279 slice
->size
= level_height
* slice
->stride
;
281 offset
+= slice
->size
;
284 static const char tiling_chars
[] = {
285 [VC4_TILING_FORMAT_LINEAR
] = 'R',
286 [VC4_TILING_FORMAT_LT
] = 'L',
287 [VC4_TILING_FORMAT_T
] = 'T'
290 "rsc setup %p (format %d), %dx%d: "
291 "level %d (%c) -> %dx%d, stride %d@0x%08x\n",
292 rsc
, rsc
->vc4_format
,
293 prsc
->width0
, prsc
->height0
,
294 i
, tiling_chars
[slice
->tiling
],
295 level_width
, level_height
,
296 slice
->stride
, slice
->offset
);
300 /* The texture base pointer that has to point to level 0 doesn't have
301 * intra-page bits, so we have to align it, and thus shift up all the
304 uint32_t page_align_offset
= (align(rsc
->slices
[0].offset
, 4096) -
305 rsc
->slices
[0].offset
);
306 if (page_align_offset
) {
307 for (int i
= 0; i
<= prsc
->last_level
; i
++)
308 rsc
->slices
[i
].offset
+= page_align_offset
;
311 /* Cube map faces appear as whole miptrees at a page-aligned offset
312 * from the first face's miptree.
314 if (prsc
->target
== PIPE_TEXTURE_CUBE
) {
315 rsc
->cube_map_stride
= align(rsc
->slices
[0].offset
+
316 rsc
->slices
[0].size
, 4096);
320 static struct vc4_resource
*
321 vc4_resource_setup(struct pipe_screen
*pscreen
,
322 const struct pipe_resource
*tmpl
)
324 struct vc4_resource
*rsc
= CALLOC_STRUCT(vc4_resource
);
327 struct pipe_resource
*prsc
= &rsc
->base
.b
;
331 pipe_reference_init(&prsc
->reference
, 1);
332 prsc
->screen
= pscreen
;
334 rsc
->base
.vtbl
= &vc4_resource_vtbl
;
335 rsc
->cpp
= util_format_get_blocksize(tmpl
->format
);
342 static enum vc4_texture_data_type
343 get_resource_texture_format(struct pipe_resource
*prsc
)
345 struct vc4_resource
*rsc
= vc4_resource(prsc
);
346 uint8_t format
= vc4_get_tex_format(prsc
->format
);
349 assert(format
== VC4_TEXTURE_TYPE_RGBA8888
);
350 return VC4_TEXTURE_TYPE_RGBA32R
;
356 struct pipe_resource
*
357 vc4_resource_create(struct pipe_screen
*pscreen
,
358 const struct pipe_resource
*tmpl
)
360 struct vc4_resource
*rsc
= vc4_resource_setup(pscreen
, tmpl
);
361 struct pipe_resource
*prsc
= &rsc
->base
.b
;
363 /* We have to make shared be untiled, since we don't have any way to
364 * communicate metadata about tiling currently.
366 if (tmpl
->target
== PIPE_BUFFER
||
367 (tmpl
->bind
& (PIPE_BIND_SCANOUT
|
370 PIPE_BIND_CURSOR
))) {
376 if (tmpl
->target
!= PIPE_BUFFER
)
377 rsc
->vc4_format
= get_resource_texture_format(prsc
);
379 vc4_setup_slices(rsc
);
380 vc4_resource_bo_alloc(rsc
);
386 vc4_resource_destroy(pscreen
, prsc
);
390 static struct pipe_resource
*
391 vc4_resource_from_handle(struct pipe_screen
*pscreen
,
392 const struct pipe_resource
*tmpl
,
393 struct winsys_handle
*handle
)
395 struct vc4_resource
*rsc
= vc4_resource_setup(pscreen
, tmpl
);
396 struct pipe_resource
*prsc
= &rsc
->base
.b
;
397 struct vc4_resource_slice
*slice
= &rsc
->slices
[0];
403 rsc
->bo
= vc4_screen_bo_from_handle(pscreen
, handle
);
407 if (!using_vc4_simulator
)
408 slice
->stride
= handle
->stride
;
410 slice
->stride
= align(prsc
->width0
* rsc
->cpp
, 16);
412 slice
->tiling
= VC4_TILING_FORMAT_LINEAR
;
414 rsc
->vc4_format
= get_resource_texture_format(prsc
);
418 "rsc import %p (format %d), %dx%d: "
419 "level 0 (R) -> stride %d@0x%08x\n",
420 rsc
, rsc
->vc4_format
,
421 prsc
->width0
, prsc
->height0
,
422 slice
->stride
, slice
->offset
);
428 vc4_resource_destroy(pscreen
, prsc
);
432 static struct pipe_surface
*
433 vc4_create_surface(struct pipe_context
*pctx
,
434 struct pipe_resource
*ptex
,
435 const struct pipe_surface
*surf_tmpl
)
437 struct vc4_surface
*surface
= CALLOC_STRUCT(vc4_surface
);
438 struct vc4_resource
*rsc
= vc4_resource(ptex
);
443 assert(surf_tmpl
->u
.tex
.first_layer
== surf_tmpl
->u
.tex
.last_layer
);
445 struct pipe_surface
*psurf
= &surface
->base
;
446 unsigned level
= surf_tmpl
->u
.tex
.level
;
448 pipe_reference_init(&psurf
->reference
, 1);
449 pipe_resource_reference(&psurf
->texture
, ptex
);
451 psurf
->context
= pctx
;
452 psurf
->format
= surf_tmpl
->format
;
453 psurf
->width
= u_minify(ptex
->width0
, level
);
454 psurf
->height
= u_minify(ptex
->height0
, level
);
455 psurf
->u
.tex
.level
= level
;
456 psurf
->u
.tex
.first_layer
= surf_tmpl
->u
.tex
.first_layer
;
457 psurf
->u
.tex
.last_layer
= surf_tmpl
->u
.tex
.last_layer
;
458 surface
->offset
= rsc
->slices
[level
].offset
;
459 surface
->tiling
= rsc
->slices
[level
].tiling
;
461 return &surface
->base
;
465 vc4_surface_destroy(struct pipe_context
*pctx
, struct pipe_surface
*psurf
)
467 pipe_resource_reference(&psurf
->texture
, NULL
);
471 /** Debug routine to dump the contents of an 8888 surface to the console */
473 vc4_dump_surface(struct pipe_surface
*psurf
)
478 struct pipe_resource
*prsc
= psurf
->texture
;
479 struct vc4_resource
*rsc
= vc4_resource(prsc
);
480 uint32_t *map
= vc4_bo_map(rsc
->bo
);
481 uint32_t stride
= rsc
->slices
[0].stride
/ 4;
482 uint32_t width
= psurf
->width
;
483 uint32_t height
= psurf
->height
;
484 uint32_t chunk_w
= width
/ 79;
485 uint32_t chunk_h
= height
/ 40;
486 uint32_t found_colors
[10];
487 uint32_t num_found_colors
= 0;
489 if (rsc
->vc4_format
!= VC4_TEXTURE_TYPE_RGBA32R
) {
490 fprintf(stderr
, "%s: Unsupported format %s\n",
491 __func__
, util_format_short_name(psurf
->format
));
495 for (int by
= 0; by
< height
; by
+= chunk_h
) {
496 for (int bx
= 0; bx
< width
; bx
+= chunk_w
) {
497 int all_found_color
= -1; /* nothing found */
499 for (int y
= by
; y
< MIN2(height
, by
+ chunk_h
); y
++) {
500 for (int x
= bx
; x
< MIN2(width
, bx
+ chunk_w
); x
++) {
501 uint32_t pix
= map
[y
* stride
+ x
];
504 for (i
= 0; i
< num_found_colors
; i
++) {
505 if (pix
== found_colors
[i
])
508 if (i
== num_found_colors
&&
510 ARRAY_SIZE(found_colors
)) {
511 found_colors
[num_found_colors
++] = pix
;
514 if (i
< num_found_colors
) {
515 if (all_found_color
== -1)
517 else if (i
!= all_found_color
)
518 all_found_color
= ARRAY_SIZE(found_colors
);
522 /* If all pixels for this chunk have a consistent
523 * value, then print a character for it. Either a
524 * fixed name (particularly common for piglit tests),
525 * or a runtime-generated number.
527 if (all_found_color
>= 0 &&
528 all_found_color
< ARRAY_SIZE(found_colors
)) {
529 static const struct {
541 for (i
= 0; i
< ARRAY_SIZE(named_colors
); i
++) {
542 if (named_colors
[i
].val
==
543 found_colors
[all_found_color
]) {
544 fprintf(stderr
, "%s",
549 /* For unnamed colors, print a number and the
550 * numbers will have values printed at the
553 if (i
== ARRAY_SIZE(named_colors
)) {
554 fprintf(stderr
, "%c",
555 '0' + all_found_color
);
558 /* If there's no consistent color, print this.
560 fprintf(stderr
, ".");
563 fprintf(stderr
, "\n");
566 for (int i
= 0; i
< num_found_colors
; i
++) {
567 fprintf(stderr
, "color %d: 0x%08x\n", i
, found_colors
[i
]);
572 vc4_flush_resource(struct pipe_context
*pctx
, struct pipe_resource
*resource
)
574 /* All calls to flush_resource are followed by a flush of the context,
575 * so there's nothing to do.
580 render_blit(struct pipe_context
*ctx
, struct pipe_blit_info
*info
)
582 struct vc4_context
*vc4
= vc4_context(ctx
);
584 if (!util_blitter_is_blit_supported(vc4
->blitter
, info
)) {
585 fprintf(stderr
, "blit unsupported %s -> %s",
586 util_format_short_name(info
->src
.resource
->format
),
587 util_format_short_name(info
->dst
.resource
->format
));
591 util_blitter_save_vertex_buffer_slot(vc4
->blitter
, vc4
->vertexbuf
.vb
);
592 util_blitter_save_vertex_elements(vc4
->blitter
, vc4
->vtx
);
593 util_blitter_save_vertex_shader(vc4
->blitter
, vc4
->prog
.bind_vs
);
594 util_blitter_save_rasterizer(vc4
->blitter
, vc4
->rasterizer
);
595 util_blitter_save_viewport(vc4
->blitter
, &vc4
->viewport
);
596 util_blitter_save_scissor(vc4
->blitter
, &vc4
->scissor
);
597 util_blitter_save_fragment_shader(vc4
->blitter
, vc4
->prog
.bind_fs
);
598 util_blitter_save_blend(vc4
->blitter
, vc4
->blend
);
599 util_blitter_save_depth_stencil_alpha(vc4
->blitter
, vc4
->zsa
);
600 util_blitter_save_stencil_ref(vc4
->blitter
, &vc4
->stencil_ref
);
601 util_blitter_save_sample_mask(vc4
->blitter
, vc4
->sample_mask
);
602 util_blitter_save_framebuffer(vc4
->blitter
, &vc4
->framebuffer
);
603 util_blitter_save_fragment_sampler_states(vc4
->blitter
,
604 vc4
->fragtex
.num_samplers
,
605 (void **)vc4
->fragtex
.samplers
);
606 util_blitter_save_fragment_sampler_views(vc4
->blitter
,
607 vc4
->fragtex
.num_textures
, vc4
->fragtex
.textures
);
609 util_blitter_blit(vc4
->blitter
, info
);
614 /* Optimal hardware path for blitting pixels.
615 * Scaling, format conversion, up- and downsampling (resolve) are allowed.
618 vc4_blit(struct pipe_context
*pctx
, const struct pipe_blit_info
*blit_info
)
620 struct pipe_blit_info info
= *blit_info
;
622 if (info
.src
.resource
->nr_samples
> 1 &&
623 info
.dst
.resource
->nr_samples
<= 1 &&
624 !util_format_is_depth_or_stencil(info
.src
.resource
->format
) &&
625 !util_format_is_pure_integer(info
.src
.resource
->format
)) {
626 fprintf(stderr
, "color resolve unimplemented");
630 if (util_try_blit_via_copy_region(pctx
, &info
)) {
634 if (info
.mask
& PIPE_MASK_S
) {
635 fprintf(stderr
, "cannot blit stencil, skipping");
636 info
.mask
&= ~PIPE_MASK_S
;
639 render_blit(pctx
, &info
);
643 vc4_update_shadow_baselevel_texture(struct pipe_context
*pctx
,
644 struct pipe_sampler_view
*view
)
646 struct vc4_resource
*shadow
= vc4_resource(view
->texture
);
647 struct vc4_resource
*orig
= vc4_resource(shadow
->shadow_parent
);
650 if (shadow
->writes
== orig
->writes
)
653 for (int i
= 0; i
<= shadow
->base
.b
.last_level
; i
++) {
654 struct pipe_box box
= {
658 .width
= u_minify(shadow
->base
.b
.width0
, i
),
659 .height
= u_minify(shadow
->base
.b
.height0
, i
),
663 util_resource_copy_region(pctx
,
664 &shadow
->base
.b
, i
, 0, 0, 0,
666 view
->u
.tex
.first_level
+ i
,
670 shadow
->writes
= orig
->writes
;
674 * Converts a 4-byte index buffer to 2 bytes.
676 * Since GLES2 only has support for 1 and 2-byte indices, the hardware doesn't
677 * include 4-byte index support, and we have to shrink it down.
679 * There's no fallback support for when indices end up being larger than 2^16,
680 * though it will at least assertion fail. Also, if the original index data
681 * was in user memory, it would be nice to not have uploaded it to a VBO
682 * before translating.
685 vc4_update_shadow_index_buffer(struct pipe_context
*pctx
,
686 const struct pipe_index_buffer
*ib
)
688 struct vc4_resource
*shadow
= vc4_resource(ib
->buffer
);
689 struct vc4_resource
*orig
= vc4_resource(shadow
->shadow_parent
);
690 uint32_t count
= shadow
->base
.b
.width0
/ 2;
692 if (shadow
->writes
== orig
->writes
)
695 struct pipe_transfer
*src_transfer
;
696 uint32_t *src
= pipe_buffer_map_range(pctx
, &orig
->base
.b
,
699 PIPE_TRANSFER_READ
, &src_transfer
);
701 struct pipe_transfer
*dst_transfer
;
702 uint16_t *dst
= pipe_buffer_map_range(pctx
, &shadow
->base
.b
,
705 PIPE_TRANSFER_WRITE
, &dst_transfer
);
707 for (int i
= 0; i
< count
; i
++) {
708 uint32_t src_index
= src
[i
];
709 assert(src_index
<= 0xffff);
713 pctx
->transfer_unmap(pctx
, dst_transfer
);
714 pctx
->transfer_unmap(pctx
, src_transfer
);
716 shadow
->writes
= orig
->writes
;
720 vc4_resource_screen_init(struct pipe_screen
*pscreen
)
722 pscreen
->resource_create
= vc4_resource_create
;
723 pscreen
->resource_from_handle
= vc4_resource_from_handle
;
724 pscreen
->resource_get_handle
= u_resource_get_handle_vtbl
;
725 pscreen
->resource_destroy
= u_resource_destroy_vtbl
;
729 vc4_resource_context_init(struct pipe_context
*pctx
)
731 pctx
->transfer_map
= u_transfer_map_vtbl
;
732 pctx
->transfer_flush_region
= u_transfer_flush_region_vtbl
;
733 pctx
->transfer_unmap
= u_transfer_unmap_vtbl
;
734 pctx
->transfer_inline_write
= u_transfer_inline_write_vtbl
;
735 pctx
->create_surface
= vc4_create_surface
;
736 pctx
->surface_destroy
= vc4_surface_destroy
;
737 pctx
->resource_copy_region
= util_resource_copy_region
;
738 pctx
->blit
= vc4_blit
;
739 pctx
->flush_resource
= vc4_flush_resource
;