mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
v3d: Stop calling deprecated util_framebuffer_init
We remove all v3d usages of create_surface hooks. See https://gitlab.freedesktop.org/mesa/mesa/-/issues/13262 Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35288>
This commit is contained in:
parent
680b6d0e9b
commit
5e4b66e226
9 changed files with 199 additions and 196 deletions
|
|
@ -139,6 +139,23 @@ v3d_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
info->mask = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
v3d_set_blit_surface(struct pipe_surface *psurf,
|
||||
struct pipe_context *pctx,
|
||||
struct pipe_resource *prsc,
|
||||
enum pipe_format format,
|
||||
unsigned level,
|
||||
int16_t layer)
|
||||
{
|
||||
memset(psurf, 0, sizeof(*psurf));
|
||||
psurf->context = pctx;
|
||||
psurf->format = format;
|
||||
psurf->level = level;
|
||||
psurf->first_layer = layer;
|
||||
psurf->last_layer = layer;
|
||||
pipe_resource_reference(&psurf->texture, prsc);
|
||||
}
|
||||
|
||||
/* Implement stencil blits by reinterpreting the stencil data as an RGBA8888
|
||||
* or R8 texture.
|
||||
*/
|
||||
|
|
@ -170,14 +187,10 @@ v3d_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
}
|
||||
|
||||
/* Initialize the surface. */
|
||||
struct pipe_surface dst_tmpl = {
|
||||
.format = dst_format,
|
||||
.first_layer = info->dst.box.z,
|
||||
.last_layer = info->dst.box.z,
|
||||
.level = info->dst.level,
|
||||
};
|
||||
struct pipe_surface *dst_surf =
|
||||
ctx->create_surface(ctx, &dst->base, &dst_tmpl);
|
||||
struct pipe_surface dst_surf;
|
||||
v3d_set_blit_surface(&dst_surf, ctx, &dst->base,
|
||||
dst_format, info->dst.level,
|
||||
info->dst.box.z);
|
||||
|
||||
/* Initialize the sampler view. */
|
||||
struct pipe_sampler_view src_tmpl = {
|
||||
|
|
@ -204,7 +217,7 @@ v3d_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
|
||||
v3d_blitter_save(v3d, info->render_condition_enable ?
|
||||
V3D_BLIT_COND : V3D_BLIT);
|
||||
util_blitter_blit_generic(v3d->blitter, dst_surf, &info->dst.box,
|
||||
util_blitter_blit_generic(v3d->blitter, &dst_surf, &info->dst.box,
|
||||
src_view, &info->src.box,
|
||||
src->base.width0, src->base.height0,
|
||||
PIPE_MASK_R,
|
||||
|
|
@ -212,7 +225,7 @@ v3d_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
info->scissor_enable ? &info->scissor : NULL,
|
||||
info->alpha_blend, false, 0, NULL);
|
||||
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
pipe_resource_reference(&dst_surf.texture, NULL);
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
|
||||
info->mask &= ~PIPE_MASK_S;
|
||||
|
|
@ -288,23 +301,6 @@ v3d_tfu_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static struct pipe_surface *
|
||||
v3d_get_blit_surface(struct pipe_context *pctx,
|
||||
struct pipe_resource *prsc,
|
||||
enum pipe_format format,
|
||||
unsigned level,
|
||||
int16_t layer)
|
||||
{
|
||||
struct pipe_surface tmpl;
|
||||
|
||||
tmpl.format = format;
|
||||
tmpl.level = level;
|
||||
tmpl.first_layer = layer;
|
||||
tmpl.last_layer = layer;
|
||||
|
||||
return pctx->create_surface(pctx, prsc, &tmpl);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_tile_unaligned(unsigned size, unsigned tile_size)
|
||||
{
|
||||
|
|
@ -423,8 +419,8 @@ v3d_tlb_blit_fast(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
/* Find which color attachment in the job is the blit source */
|
||||
int idx = -1;
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
if (!job->cbufs[i] ||
|
||||
job->cbufs[i]->texture != info->src.resource) {
|
||||
if (!job->cbufs[i].texture ||
|
||||
job->cbufs[i].texture != info->src.resource) {
|
||||
continue;
|
||||
}
|
||||
idx = i;
|
||||
|
|
@ -434,13 +430,13 @@ v3d_tlb_blit_fast(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
if (idx < 0)
|
||||
return;
|
||||
|
||||
struct pipe_surface *dbuf =
|
||||
v3d_get_blit_surface(pctx, info->dst.resource,
|
||||
info->dst.format, info->dst.level,
|
||||
info->dst.box.z);
|
||||
struct pipe_surface dbuf;
|
||||
v3d_set_blit_surface(&dbuf, pctx, info->dst.resource,
|
||||
info->dst.format, info->dst.level,
|
||||
info->dst.box.z);
|
||||
|
||||
/* The job's RT setup must be compatible with the blit buffer. */
|
||||
struct pipe_surface *spsurf = job->cbufs[idx];
|
||||
struct pipe_surface *spsurf = &job->cbufs[idx];
|
||||
uint8_t sinternal_bpp, rinternal_bpp;
|
||||
uint8_t sinternal_type;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
|
|
@ -449,7 +445,7 @@ v3d_tlb_blit_fast(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
&sinternal_bpp);
|
||||
uint8_t rinternal_type;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
dbuf->format,
|
||||
dbuf.format,
|
||||
&rinternal_type,
|
||||
&rinternal_bpp);
|
||||
if (sinternal_bpp < rinternal_bpp)
|
||||
|
|
@ -494,16 +490,20 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
|
||||
v3d_flush_jobs_writing_resource(v3d, info->src.resource, V3D_FLUSH_DEFAULT, false);
|
||||
|
||||
struct pipe_surface *dst_surf =
|
||||
v3d_get_blit_surface(pctx, info->dst.resource, info->dst.format, info->dst.level, info->dst.box.z);
|
||||
struct pipe_surface *src_surf =
|
||||
v3d_get_blit_surface(pctx, info->src.resource, info->src.format, info->src.level, info->src.box.z);
|
||||
struct pipe_surface dst_surf, src_surf;
|
||||
v3d_set_blit_surface(&dst_surf, pctx, info->dst.resource,
|
||||
info->dst.format, info->dst.level,
|
||||
info->dst.box.z);
|
||||
v3d_set_blit_surface(&src_surf, pctx, info->src.resource,
|
||||
info->src.format, info->src.level,
|
||||
info->src.box.z);
|
||||
|
||||
bool is_color_blit = info->mask & PIPE_MASK_RGBA;
|
||||
bool is_depth_blit = info->mask & PIPE_MASK_Z;
|
||||
bool is_stencil_blit = info->mask & PIPE_MASK_S;
|
||||
|
||||
struct pipe_surface *surfaces[V3D_MAX_DRAW_BUFFERS] = { 0 };
|
||||
struct pipe_surface surfaces[V3D_MAX_DRAW_BUFFERS];
|
||||
memset(&surfaces[0], 0, sizeof(surfaces));
|
||||
if (is_color_blit)
|
||||
surfaces[0] = dst_surf;
|
||||
|
||||
|
|
@ -514,8 +514,9 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
|
||||
uint32_t tile_width, tile_height, max_bpp;
|
||||
v3d_get_tile_buffer_size(devinfo, msaa, double_buffer,
|
||||
is_color_blit ? 1 : 0, surfaces, src_surf,
|
||||
&tile_width, &tile_height, &max_bpp);
|
||||
is_color_blit ? 1 : 0, &surfaces[0],
|
||||
&src_surf, &tile_width, &tile_height,
|
||||
&max_bpp);
|
||||
|
||||
int dst_surface_width = u_minify(info->dst.resource->width0,
|
||||
info->dst.level);
|
||||
|
|
@ -527,16 +528,16 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
info->dst.box.x + info->dst.box.width != dst_surface_width) ||
|
||||
(is_tile_unaligned(info->dst.box.height, tile_height) &&
|
||||
info->dst.box.y + info->dst.box.height != dst_surface_height)) {
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
pipe_surface_reference(&src_surf, NULL);
|
||||
pipe_resource_reference(&dst_surf.texture, NULL);
|
||||
pipe_resource_reference(&src_surf.texture, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
struct v3d_job *job = v3d_get_job(v3d,
|
||||
is_color_blit ? 1u : 0u,
|
||||
surfaces,
|
||||
is_color_blit ? NULL : dst_surf,
|
||||
src_surf);
|
||||
&surfaces[0],
|
||||
is_color_blit ? NULL : &dst_surf,
|
||||
&src_surf);
|
||||
job->msaa = msaa;
|
||||
job->double_buffer = double_buffer;
|
||||
job->can_use_double_buffer = !job->msaa && V3D_DBG(DOUBLE_BUFFER);
|
||||
|
|
@ -554,9 +555,9 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
* match, so we know the blit involves the same tiles on both surfaces.
|
||||
*/
|
||||
uint16_t dst_width, dst_height;
|
||||
pipe_surface_size(dst_surf, &dst_width, &dst_height);
|
||||
pipe_surface_size(&dst_surf, &dst_width, &dst_height);
|
||||
uint16_t src_width, src_height;
|
||||
pipe_surface_size(src_surf, &src_width, &src_height);
|
||||
pipe_surface_size(&src_surf, &src_width, &src_height);
|
||||
job->draw_width = MIN2(dst_width, src_width);
|
||||
job->draw_height = MIN2(dst_height, src_height);
|
||||
|
||||
|
|
@ -588,8 +589,8 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
|
||||
v3d_job_submit(v3d, job);
|
||||
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
pipe_surface_reference(&src_surf, NULL);
|
||||
pipe_resource_reference(&dst_surf.texture, NULL);
|
||||
pipe_resource_reference(&src_surf.texture, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -808,22 +809,14 @@ v3d_sand8_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
v3d_blitter_save(v3d, info->render_condition_enable ?
|
||||
V3D_BLIT_COND : V3D_BLIT);
|
||||
|
||||
struct pipe_surface dst_tmpl;
|
||||
util_blitter_default_dst_texture(&dst_tmpl, info->dst.resource,
|
||||
info->dst.level, info->dst.box.z);
|
||||
struct pipe_surface dst_surf;
|
||||
/* Although the src textures are cpp=1 or cpp=2, the dst texture
|
||||
* uses a cpp=4 dst texture. So, all read/write texture ops will
|
||||
* be done using 32-bit read and writes.
|
||||
*/
|
||||
dst_tmpl.format = PIPE_FORMAT_R8G8B8A8_UNORM;
|
||||
struct pipe_surface *dst_surf =
|
||||
pctx->create_surface(pctx, info->dst.resource, &dst_tmpl);
|
||||
if (!dst_surf) {
|
||||
fprintf(stderr, "Failed to create YUV dst surface\n");
|
||||
util_blitter_unset_running_flag(v3d->blitter);
|
||||
return;
|
||||
}
|
||||
|
||||
v3d_set_blit_surface(&dst_surf, pctx, info->dst.resource,
|
||||
PIPE_FORMAT_R8G8B8A8_UNORM, info->dst.level,
|
||||
info->dst.box.z);
|
||||
uint32_t sand8_stride = src->sand_col128_stride;
|
||||
|
||||
/* Adjust the dimensions of dst luma/chroma to match src
|
||||
|
|
@ -831,7 +824,7 @@ v3d_sand8_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
* account the UIF microtile layouts.
|
||||
*/
|
||||
uint16_t width, height;
|
||||
pipe_surface_size(dst_surf, &width, &height);
|
||||
pipe_surface_size(&dst_surf, &width, &height);
|
||||
width = align(width, 8) / 2;
|
||||
if (src->cpp == 1)
|
||||
height /= 2;
|
||||
|
|
@ -863,7 +856,7 @@ v3d_sand8_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 0, 0, NULL);
|
||||
pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 0, NULL);
|
||||
|
||||
util_blitter_custom_shader(v3d->blitter, dst_surf, width, height,
|
||||
util_blitter_custom_shader(v3d->blitter, &dst_surf, width, height,
|
||||
v3d_get_sand8_vs(pctx),
|
||||
v3d_get_sand8_fs(pctx, src->cpp));
|
||||
|
||||
|
|
@ -874,7 +867,7 @@ v3d_sand8_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
pctx->set_constant_buffer(pctx, PIPE_SHADER_FRAGMENT, 1, true,
|
||||
&saved_fs_cb1);
|
||||
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
pipe_resource_reference(&dst_surf.texture, NULL);
|
||||
|
||||
info->mask &= ~PIPE_MASK_RGBA;
|
||||
}
|
||||
|
|
@ -1131,20 +1124,10 @@ v3d_sand30_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
v3d_blitter_save(v3d, info->render_condition_enable ?
|
||||
V3D_BLIT_COND : V3D_BLIT);
|
||||
|
||||
struct pipe_surface dst_tmpl;
|
||||
util_blitter_default_dst_texture(&dst_tmpl, info->dst.resource,
|
||||
info->dst.level, info->dst.box.z);
|
||||
|
||||
dst_tmpl.format = PIPE_FORMAT_R16G16B16A16_UINT;
|
||||
|
||||
struct pipe_surface *dst_surf =
|
||||
pctx->create_surface(pctx, info->dst.resource, &dst_tmpl);
|
||||
if (!dst_surf) {
|
||||
fprintf(stderr, "Failed to create YUV dst surface\n");
|
||||
util_blitter_unset_running_flag(v3d->blitter);
|
||||
return;
|
||||
}
|
||||
|
||||
struct pipe_surface dst_surf;
|
||||
v3d_set_blit_surface(&dst_surf, pctx, info->dst.resource,
|
||||
PIPE_FORMAT_R16G16B16A16_UINT, info->dst.level,
|
||||
info->dst.box.z);
|
||||
uint32_t sand30_stride = src->sand_col128_stride;
|
||||
|
||||
/* Adjust the dimensions of dst luma/chroma to match src
|
||||
|
|
@ -1152,7 +1135,7 @@ v3d_sand30_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
* account the UIF microtile layouts.
|
||||
*/
|
||||
uint16_t width, height;
|
||||
pipe_surface_size(dst_surf, &width, &height);
|
||||
pipe_surface_size(&dst_surf, &width, &height);
|
||||
height /= 2;
|
||||
width = align(width, 8);
|
||||
if (src->cpp == 2)
|
||||
|
|
@ -1186,7 +1169,7 @@ v3d_sand30_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
NULL);
|
||||
pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 0, NULL);
|
||||
|
||||
util_blitter_custom_shader(v3d->blitter, dst_surf, width, height,
|
||||
util_blitter_custom_shader(v3d->blitter, &dst_surf, width, height,
|
||||
v3d_get_sand30_vs(pctx),
|
||||
v3d_get_sand30_fs(pctx));
|
||||
|
||||
|
|
@ -1196,7 +1179,7 @@ v3d_sand30_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
/* Restore cb1 (util_blitter doesn't handle this one). */
|
||||
pctx->set_constant_buffer(pctx, PIPE_SHADER_FRAGMENT, 1, true,
|
||||
&saved_fs_cb1);
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
pipe_resource_reference(&dst_surf.texture, NULL);
|
||||
|
||||
info->mask &= ~PIPE_MASK_RGBA;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -126,13 +126,13 @@ v3d_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
|
|||
return;
|
||||
|
||||
struct v3d_job *job = entry->data;
|
||||
if (job->key.zsbuf && job->key.zsbuf->texture == prsc) {
|
||||
if (job->zsbuf.texture && job->zsbuf.texture == prsc) {
|
||||
job->store &= ~(PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
if (job->cbufs[i] && job->cbufs[i]->texture == prsc) {
|
||||
if (job->cbufs[i].texture && job->cbufs[i].texture == prsc) {
|
||||
job->store &= ~(PIPE_CLEAR_COLOR0 << i);
|
||||
return;
|
||||
}
|
||||
|
|
@ -258,7 +258,7 @@ v3d_get_tile_buffer_size(const struct v3d_device_info *devinfo,
|
|||
bool is_msaa,
|
||||
bool double_buffer,
|
||||
uint32_t nr_cbufs,
|
||||
struct pipe_surface **cbufs,
|
||||
struct pipe_surface *cbufs,
|
||||
struct pipe_surface *bbuf,
|
||||
uint32_t *tile_width,
|
||||
uint32_t *tile_height,
|
||||
|
|
@ -270,10 +270,10 @@ v3d_get_tile_buffer_size(const struct v3d_device_info *devinfo,
|
|||
uint32_t total_bpp = 0;
|
||||
*max_bpp = 0;
|
||||
for (int i = 0; i < nr_cbufs; i++) {
|
||||
if (cbufs[i]) {
|
||||
if (cbufs[i].texture) {
|
||||
uint8_t internal_bpp;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
cbufs[i]->format,
|
||||
cbufs[i].format,
|
||||
NULL,
|
||||
&internal_bpp);
|
||||
*max_bpp = MAX2(*max_bpp, internal_bpp);
|
||||
|
|
@ -281,8 +281,8 @@ v3d_get_tile_buffer_size(const struct v3d_device_info *devinfo,
|
|||
max_cbuf_idx = MAX2(i, max_cbuf_idx);
|
||||
}
|
||||
}
|
||||
|
||||
if (bbuf) {
|
||||
assert(bbuf);
|
||||
if (bbuf->texture) {
|
||||
uint8_t internal_bpp;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
bbuf->format,
|
||||
|
|
@ -327,7 +327,6 @@ v3d_context_destroy(struct pipe_context *pctx)
|
|||
|
||||
slab_destroy_child(&v3d->transfer_pool);
|
||||
|
||||
util_framebuffer_init(pctx, NULL, v3d->fb_cbufs, &v3d->fb_zsbuf);
|
||||
util_unreference_framebuffer_state(&v3d->framebuffer);
|
||||
|
||||
if (v3d->sand8_blit_vs)
|
||||
|
|
|
|||
|
|
@ -305,9 +305,9 @@ struct v3d_ssbo_stateobj {
|
|||
|
||||
/* Hash table key for v3d->jobs */
|
||||
struct v3d_job_key {
|
||||
struct pipe_surface *cbufs[V3D_MAX_DRAW_BUFFERS];
|
||||
struct pipe_surface *zsbuf;
|
||||
struct pipe_surface *bbuf;
|
||||
struct pipe_surface cbufs[V3D_MAX_DRAW_BUFFERS];
|
||||
struct pipe_surface zsbuf;
|
||||
struct pipe_surface bbuf;
|
||||
};
|
||||
|
||||
enum v3d_ez_state {
|
||||
|
|
@ -385,10 +385,10 @@ struct v3d_job {
|
|||
* blit destination surface.
|
||||
*/
|
||||
uint32_t nr_cbufs;
|
||||
struct pipe_surface *cbufs[V3D_MAX_DRAW_BUFFERS];
|
||||
struct pipe_surface *zsbuf;
|
||||
struct pipe_surface *bbuf;
|
||||
struct pipe_surface *dbuf;
|
||||
struct pipe_surface cbufs[V3D_MAX_DRAW_BUFFERS];
|
||||
struct pipe_surface zsbuf;
|
||||
struct pipe_surface bbuf;
|
||||
struct pipe_surface dbuf;
|
||||
/** @} */
|
||||
/** @{
|
||||
* Bounding box of the scissor across all queued drawing.
|
||||
|
|
@ -634,7 +634,6 @@ struct v3d_context {
|
|||
} blend_color;
|
||||
struct pipe_stencil_ref stencil_ref;
|
||||
unsigned sample_mask;
|
||||
PIPE_FB_SURFACES; //STOP USING THIS
|
||||
struct pipe_framebuffer_state framebuffer;
|
||||
|
||||
/* Per render target, whether we should swap the R and B fields in the
|
||||
|
|
@ -789,7 +788,7 @@ struct v3d_job *v3d_job_create(struct v3d_context *v3d);
|
|||
void v3d_job_free(struct v3d_context *v3d, struct v3d_job *job);
|
||||
struct v3d_job *v3d_get_job(struct v3d_context *v3d,
|
||||
uint32_t nr_cbufs,
|
||||
struct pipe_surface **cbufs,
|
||||
struct pipe_surface *cbufs,
|
||||
struct pipe_surface *zsbuf,
|
||||
struct pipe_surface *bbuf);
|
||||
struct v3d_job *v3d_get_job_for_fbo(struct v3d_context *v3d);
|
||||
|
|
@ -867,7 +866,7 @@ void v3d_get_tile_buffer_size(const struct v3d_device_info *devinfo,
|
|||
bool is_msaa,
|
||||
bool double_buffer,
|
||||
uint32_t nr_cbufs,
|
||||
struct pipe_surface **cbufs,
|
||||
struct pipe_surface *cbufs,
|
||||
struct pipe_surface *bbuf,
|
||||
uint32_t *tile_width,
|
||||
uint32_t *tile_height,
|
||||
|
|
|
|||
|
|
@ -58,27 +58,27 @@ v3d_job_free(struct v3d_context *v3d, struct v3d_job *job)
|
|||
}
|
||||
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
if (job->cbufs[i]) {
|
||||
if (job->cbufs[i].texture) {
|
||||
_mesa_hash_table_remove_key(v3d->write_jobs,
|
||||
job->cbufs[i]->texture);
|
||||
pipe_surface_reference(&job->cbufs[i], NULL);
|
||||
job->cbufs[i].texture);
|
||||
pipe_resource_reference(&job->cbufs[i].texture, NULL);
|
||||
}
|
||||
}
|
||||
if (job->zsbuf) {
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture);
|
||||
if (job->zsbuf.texture) {
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf.texture);
|
||||
if (rsc->separate_stencil)
|
||||
_mesa_hash_table_remove_key(v3d->write_jobs,
|
||||
&rsc->separate_stencil->base);
|
||||
|
||||
_mesa_hash_table_remove_key(v3d->write_jobs,
|
||||
job->zsbuf->texture);
|
||||
pipe_surface_reference(&job->zsbuf, NULL);
|
||||
job->zsbuf.texture);
|
||||
pipe_resource_reference(&job->zsbuf.texture, NULL);
|
||||
}
|
||||
if (job->bbuf)
|
||||
pipe_surface_reference(&job->bbuf, NULL);
|
||||
if (job->bbuf.texture)
|
||||
pipe_resource_reference(&job->bbuf.texture, NULL);
|
||||
|
||||
if (job->dbuf)
|
||||
pipe_surface_reference(&job->dbuf, NULL);
|
||||
if (job->dbuf.texture)
|
||||
pipe_resource_reference(&job->dbuf.texture, NULL);
|
||||
|
||||
if (v3d->job == job)
|
||||
v3d->job = NULL;
|
||||
|
|
@ -290,6 +290,28 @@ v3d_flush_jobs_reading_resource(struct v3d_context *v3d,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
v3d_job_attach_surface(struct pipe_surface *job_psurf,
|
||||
struct pipe_surface *src_psurf)
|
||||
{
|
||||
assert(job_psurf);
|
||||
if (src_psurf) {
|
||||
/* Texture reference counter needs to be updated before
|
||||
* assigning the struct pipe_surface to avoid leaks of
|
||||
* textures from previously attached surfaces. The follow up
|
||||
* assignment would just overwrite the same pointer for the
|
||||
* texture field.
|
||||
*/
|
||||
pipe_resource_reference(&job_psurf->texture,
|
||||
src_psurf->texture);
|
||||
*job_psurf = *src_psurf;
|
||||
} else {
|
||||
pipe_resource_reference(&job_psurf->texture,
|
||||
NULL);
|
||||
memset(job_psurf, 0, sizeof(*job_psurf));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a v3d_job structure for tracking V3D rendering to a particular FBO.
|
||||
*
|
||||
|
|
@ -301,25 +323,20 @@ v3d_flush_jobs_reading_resource(struct v3d_context *v3d,
|
|||
struct v3d_job *
|
||||
v3d_get_job(struct v3d_context *v3d,
|
||||
uint32_t nr_cbufs,
|
||||
struct pipe_surface **cbufs,
|
||||
struct pipe_surface *cbufs,
|
||||
struct pipe_surface *zsbuf,
|
||||
struct pipe_surface *bbuf)
|
||||
{
|
||||
/* Return the existing job for this FBO if we have one */
|
||||
struct v3d_job_key local_key = {
|
||||
.cbufs = {
|
||||
cbufs[0],
|
||||
cbufs[1],
|
||||
cbufs[2],
|
||||
cbufs[3],
|
||||
cbufs[4],
|
||||
cbufs[5],
|
||||
cbufs[6],
|
||||
cbufs[7],
|
||||
},
|
||||
.zsbuf = zsbuf,
|
||||
.bbuf = bbuf,
|
||||
};
|
||||
struct v3d_job_key local_key;
|
||||
memset(&local_key, 0, sizeof(local_key));
|
||||
memcpy(&local_key.cbufs[0], &cbufs[0],
|
||||
sizeof(struct pipe_surface) * nr_cbufs);
|
||||
if (zsbuf)
|
||||
local_key.zsbuf = *zsbuf;
|
||||
if (bbuf)
|
||||
local_key.bbuf = *bbuf;
|
||||
|
||||
struct hash_entry *entry = _mesa_hash_table_search(v3d->jobs,
|
||||
&local_key);
|
||||
if (entry)
|
||||
|
|
@ -332,36 +349,36 @@ v3d_get_job(struct v3d_context *v3d,
|
|||
job->nr_cbufs = nr_cbufs;
|
||||
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
if (cbufs[i]) {
|
||||
v3d_flush_jobs_reading_resource(v3d, cbufs[i]->texture,
|
||||
if (cbufs[i].texture) {
|
||||
v3d_flush_jobs_reading_resource(v3d, cbufs[i].texture,
|
||||
V3D_FLUSH_DEFAULT,
|
||||
false);
|
||||
pipe_surface_reference(&job->cbufs[i], cbufs[i]);
|
||||
v3d_job_attach_surface(&job->cbufs[i], &cbufs[i]);
|
||||
|
||||
if (cbufs[i]->texture->nr_samples > 1)
|
||||
if (cbufs[i].texture->nr_samples > 1)
|
||||
job->msaa = true;
|
||||
}
|
||||
}
|
||||
if (zsbuf) {
|
||||
if (zsbuf && zsbuf->texture) {
|
||||
v3d_flush_jobs_reading_resource(v3d, zsbuf->texture,
|
||||
V3D_FLUSH_DEFAULT,
|
||||
false);
|
||||
pipe_surface_reference(&job->zsbuf, zsbuf);
|
||||
v3d_job_attach_surface(&job->zsbuf, zsbuf);
|
||||
if (zsbuf->texture->nr_samples > 1)
|
||||
job->msaa = true;
|
||||
}
|
||||
if (bbuf) {
|
||||
pipe_surface_reference(&job->bbuf, bbuf);
|
||||
if (bbuf && bbuf->texture) {
|
||||
v3d_job_attach_surface(&job->bbuf, bbuf);
|
||||
if (bbuf->texture->nr_samples > 1)
|
||||
job->msaa = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
if (cbufs[i])
|
||||
if (cbufs[i].texture)
|
||||
_mesa_hash_table_insert(v3d->write_jobs,
|
||||
cbufs[i]->texture, job);
|
||||
cbufs[i].texture, job);
|
||||
}
|
||||
if (zsbuf) {
|
||||
if (zsbuf && zsbuf->texture) {
|
||||
_mesa_hash_table_insert(v3d->write_jobs, zsbuf->texture, job);
|
||||
|
||||
struct v3d_resource *rsc = v3d_resource(zsbuf->texture);
|
||||
|
|
@ -396,8 +413,8 @@ v3d_get_job_for_fbo(struct v3d_context *v3d)
|
|||
return v3d->job;
|
||||
|
||||
uint32_t nr_cbufs = v3d->framebuffer.nr_cbufs;
|
||||
struct pipe_surface **cbufs = v3d->fb_cbufs;
|
||||
struct pipe_surface *zsbuf = v3d->fb_zsbuf;
|
||||
struct pipe_surface *cbufs = &v3d->framebuffer.cbufs[0];
|
||||
struct pipe_surface *zsbuf = &v3d->framebuffer.zsbuf;
|
||||
struct v3d_job *job = v3d_get_job(v3d, nr_cbufs, cbufs, zsbuf, NULL);
|
||||
|
||||
if (v3d->framebuffer.samples >= 1) {
|
||||
|
|
@ -407,7 +424,7 @@ v3d_get_job_for_fbo(struct v3d_context *v3d)
|
|||
|
||||
v3d_get_tile_buffer_size(&v3d->screen->devinfo,
|
||||
job->msaa, job->double_buffer,
|
||||
job->nr_cbufs, job->cbufs, job->bbuf,
|
||||
job->nr_cbufs, &job->cbufs[0], &job->bbuf,
|
||||
&job->tile_desc.width,
|
||||
&job->tile_desc.height,
|
||||
&job->internal_bpp);
|
||||
|
|
@ -422,8 +439,8 @@ v3d_get_job_for_fbo(struct v3d_context *v3d)
|
|||
* contents before drawing.
|
||||
*/
|
||||
for (int i = 0; i < nr_cbufs; i++) {
|
||||
if (cbufs[i]) {
|
||||
struct v3d_resource *rsc = v3d_resource(cbufs[i]->texture);
|
||||
if (cbufs[i].texture) {
|
||||
struct v3d_resource *rsc = v3d_resource(cbufs[i].texture);
|
||||
if (!rsc->writes)
|
||||
job->clear_tlb |= PIPE_CLEAR_COLOR0 << i;
|
||||
if (rsc->invalidated) {
|
||||
|
|
@ -433,7 +450,7 @@ v3d_get_job_for_fbo(struct v3d_context *v3d)
|
|||
}
|
||||
}
|
||||
|
||||
if (zsbuf) {
|
||||
if (zsbuf->texture) {
|
||||
struct v3d_resource *rsc = v3d_resource(zsbuf->texture);
|
||||
if (!rsc->writes)
|
||||
job->clear_tlb |= PIPE_CLEAR_DEPTH;
|
||||
|
|
@ -599,7 +616,7 @@ enable_double_buffer_mode(struct v3d_job *job)
|
|||
job->double_buffer = true;
|
||||
v3d_get_tile_buffer_size(&job->v3d->screen->devinfo,
|
||||
job->msaa, job->double_buffer,
|
||||
job->nr_cbufs, job->cbufs, job->bbuf,
|
||||
job->nr_cbufs, &job->cbufs[0], &job->bbuf,
|
||||
&job->tile_desc.width, &job->tile_desc.height,
|
||||
&job->internal_bpp);
|
||||
|
||||
|
|
|
|||
|
|
@ -624,7 +624,8 @@ v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
|
|||
key->swap_color_rb = v3d->swap_color_rb;
|
||||
key->can_earlyz_with_discard = s->info.fs.uses_discard &&
|
||||
!s->info.fs.uses_fbfetch_output &&
|
||||
(!v3d->zsa || !job->zsbuf || !v3d->zsa->base.depth_enabled ||
|
||||
(!v3d->zsa || !job->zsbuf.texture ||
|
||||
!v3d->zsa->base.depth_enabled ||
|
||||
!v3d->zsa->base.depth_writemask) &&
|
||||
!(v3d->active_queries && v3d->current_oq);
|
||||
|
||||
|
|
|
|||
|
|
@ -935,7 +935,7 @@ v3d_update_job_ez(struct v3d_context *v3d, struct v3d_job *job)
|
|||
job->decided_global_ez_enable = true;
|
||||
job->global_ez_zsa_decision_state = v3d->zsa;
|
||||
|
||||
if (!job->zsbuf) {
|
||||
if (!job->zsbuf.texture) {
|
||||
job->first_ez_state = V3D_EZ_DISABLED;
|
||||
job->ez_state = V3D_EZ_DISABLED;
|
||||
return;
|
||||
|
|
@ -946,12 +946,12 @@ v3d_update_job_ez(struct v3d_context *v3d, struct v3d_job *job)
|
|||
* buffer is 16-bit and multisampled. Disable early-Z in these
|
||||
* cases.
|
||||
*/
|
||||
bool needs_depth_load = v3d->zsa && job->zsbuf &&
|
||||
bool needs_depth_load = v3d->zsa && job->zsbuf.texture &&
|
||||
v3d->zsa->base.depth_enabled &&
|
||||
(PIPE_CLEAR_DEPTH & ~job->clear_tlb);
|
||||
if (needs_depth_load) {
|
||||
if (job->zsbuf->texture->format == PIPE_FORMAT_Z16_UNORM &&
|
||||
job->zsbuf->texture->nr_samples > 0) {
|
||||
if (job->zsbuf.texture->format == PIPE_FORMAT_Z16_UNORM &&
|
||||
job->zsbuf.texture->nr_samples > 0) {
|
||||
perf_debug("Loading 16-bit multisampled depth buffer "
|
||||
"disables early-Z tests\n");
|
||||
job->first_ez_state = V3D_EZ_DISABLED;
|
||||
|
|
@ -1066,8 +1066,8 @@ v3d_update_job_tlb_load_store(struct v3d_job *job) {
|
|||
uint32_t no_load_mask =
|
||||
job->clear_tlb | job->clear_draw | job->invalidated_load;
|
||||
|
||||
if (v3d->zsa && job->zsbuf && v3d->zsa->base.depth_enabled) {
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture);
|
||||
if (v3d->zsa && job->zsbuf.texture && v3d->zsa->base.depth_enabled) {
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf.texture);
|
||||
v3d_job_add_bo(job, rsc->bo);
|
||||
job->load |= PIPE_CLEAR_DEPTH & ~no_load_mask;
|
||||
if (v3d->zsa->base.depth_writemask)
|
||||
|
|
@ -1075,8 +1075,9 @@ v3d_update_job_tlb_load_store(struct v3d_job *job) {
|
|||
rsc->initialized_buffers |= PIPE_CLEAR_DEPTH;
|
||||
}
|
||||
|
||||
if (v3d->zsa && job->zsbuf && v3d->zsa->base.stencil[0].enabled) {
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture);
|
||||
if (v3d->zsa && job->zsbuf.texture &&
|
||||
v3d->zsa->base.stencil[0].enabled) {
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf.texture);
|
||||
if (rsc->separate_stencil)
|
||||
rsc = rsc->separate_stencil;
|
||||
|
||||
|
|
@ -1094,9 +1095,9 @@ v3d_update_job_tlb_load_store(struct v3d_job *job) {
|
|||
uint32_t bit = PIPE_CLEAR_COLOR0 << i;
|
||||
int blend_rt = v3d->blend->base.independent_blend_enable ? i : 0;
|
||||
|
||||
if (job->store & bit || !job->cbufs[i])
|
||||
if (job->store & bit || !job->cbufs[i].texture)
|
||||
continue;
|
||||
struct v3d_resource *rsc = v3d_resource(job->cbufs[i]->texture);
|
||||
struct v3d_resource *rsc = v3d_resource(job->cbufs[i].texture);
|
||||
job->load |= bit & ~no_load_mask;
|
||||
|
||||
if (v3d->blend->base.rt[blend_rt].colormask)
|
||||
|
|
@ -1684,8 +1685,8 @@ v3d_tlb_clear(struct v3d_job *job, unsigned buffers,
|
|||
if (devinfo->ver == 42 &&
|
||||
buffers & PIPE_CLEAR_DEPTHSTENCIL &&
|
||||
(buffers & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL &&
|
||||
job->zsbuf &&
|
||||
util_format_is_depth_and_stencil(job->zsbuf->texture->format)) {
|
||||
job->zsbuf.texture &&
|
||||
util_format_is_depth_and_stencil(job->zsbuf.texture->format)) {
|
||||
buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
|
||||
}
|
||||
|
||||
|
|
@ -1694,7 +1695,7 @@ v3d_tlb_clear(struct v3d_job *job, unsigned buffers,
|
|||
if (!(buffers & bit))
|
||||
continue;
|
||||
|
||||
struct pipe_surface *psurf = v3d->fb_cbufs[i];
|
||||
struct pipe_surface *psurf = &v3d->framebuffer.cbufs[i];
|
||||
struct v3d_resource *rsc = v3d_resource(psurf->texture);
|
||||
|
||||
union util_color uc;
|
||||
|
|
|
|||
|
|
@ -391,8 +391,8 @@ v3dX(emit_state)(struct pipe_context *pctx)
|
|||
if (v3d->dirty & V3D_DIRTY_RASTERIZER &&
|
||||
v3d->rasterizer->base.offset_tri) {
|
||||
if (v3d->screen->devinfo.ver == 42 &&
|
||||
job->zsbuf &&
|
||||
job->zsbuf->format == PIPE_FORMAT_Z16_UNORM) {
|
||||
job->zsbuf.texture &&
|
||||
job->zsbuf.format == PIPE_FORMAT_Z16_UNORM) {
|
||||
cl_emit_prepacked_sized(&job->bcl,
|
||||
v3d->rasterizer->depth_offset_z16,
|
||||
cl_packet_length(DEPTH_OFFSET));
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ store_general(struct v3d_job *job,
|
|||
/* We are resolving from a MSAA blit buffer or we are
|
||||
* resolving directly from TLB to a resolve buffer
|
||||
*/
|
||||
assert((job->bbuf && job->bbuf->texture->nr_samples > 1) ||
|
||||
(job->dbuf && job->dbuf->texture->nr_samples <= 1));
|
||||
assert((job->bbuf.texture && job->bbuf.texture->nr_samples > 1) ||
|
||||
(job->dbuf.texture && job->dbuf.texture->nr_samples <= 1));
|
||||
store.decimate_mode = V3D_DECIMATE_MODE_4X;
|
||||
} else {
|
||||
store.decimate_mode = V3D_DECIMATE_MODE_SAMPLE_0;
|
||||
|
|
@ -191,20 +191,21 @@ v3d_rcl_emit_loads(struct v3d_job *job, struct v3d_cl *cl, int layer)
|
|||
/* When blitting, no color or zs buffer is loaded; instead the blit
|
||||
* source buffer is loaded for the aspects that we are going to blit.
|
||||
*/
|
||||
assert(!job->bbuf || job->load == 0);
|
||||
assert(!job->bbuf || job->nr_cbufs <= 1);
|
||||
assert(!job->bbuf.texture || job->load == 0);
|
||||
assert(!job->bbuf.texture || job->nr_cbufs <= 1);
|
||||
|
||||
uint32_t loads_pending = job->bbuf ? job->store : job->load;
|
||||
uint32_t loads_pending = job->bbuf.texture ? job->store : job->load;
|
||||
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
uint32_t bit = PIPE_CLEAR_COLOR0 << i;
|
||||
if (!(loads_pending & bit))
|
||||
continue;
|
||||
|
||||
struct pipe_surface *psurf = job->bbuf ? job->bbuf : job->cbufs[i];
|
||||
assert(!job->bbuf || i == 0);
|
||||
struct pipe_surface *psurf =
|
||||
job->bbuf.texture ? &job->bbuf : &job->cbufs[i];
|
||||
assert(!job->bbuf.texture || i == 0);
|
||||
|
||||
if (!psurf)
|
||||
if (!psurf->texture)
|
||||
continue;
|
||||
|
||||
load_general(cl, psurf, RENDER_TARGET_0 + i, layer,
|
||||
|
|
@ -213,7 +214,8 @@ v3d_rcl_emit_loads(struct v3d_job *job, struct v3d_cl *cl, int layer)
|
|||
|
||||
if (loads_pending & PIPE_CLEAR_DEPTHSTENCIL) {
|
||||
assert(!job->early_zs_clear);
|
||||
struct pipe_surface *src = job->bbuf ? job->bbuf : job->zsbuf;
|
||||
struct pipe_surface *src =
|
||||
job->bbuf.texture ? &job->bbuf : &job->zsbuf;
|
||||
struct v3d_resource *rsc = v3d_resource(src->texture);
|
||||
|
||||
if (rsc->separate_stencil &&
|
||||
|
|
@ -252,19 +254,20 @@ v3d_rcl_emit_stores(struct v3d_job *job, struct v3d_cl *cl, int layer)
|
|||
* perspective. Non-MSAA surfaces will use
|
||||
* STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED.
|
||||
*/
|
||||
assert((!job->bbuf && !job->dbuf) || job->nr_cbufs <= 1);
|
||||
assert((!job->bbuf.texture && !job->dbuf.texture) ||
|
||||
job->nr_cbufs <= 1);
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
struct pipe_surface *psurf = job->cbufs[i];
|
||||
if (!psurf)
|
||||
struct pipe_surface *psurf = &job->cbufs[i];
|
||||
if (!psurf->texture)
|
||||
continue;
|
||||
|
||||
uint32_t bit = PIPE_CLEAR_COLOR0 << i;
|
||||
if (job->blit_tlb & bit) {
|
||||
assert(job->dbuf);
|
||||
assert(job->dbuf.texture);
|
||||
bool blit_resolve =
|
||||
job->dbuf->texture->nr_samples <= 1 &&
|
||||
job->dbuf.texture->nr_samples <= 1 &&
|
||||
psurf->texture->nr_samples > 1;
|
||||
store_general(job, cl, job->dbuf, layer,
|
||||
store_general(job, cl, &job->dbuf, layer,
|
||||
RENDER_TARGET_0 + i, bit, NULL,
|
||||
false, blit_resolve);
|
||||
}
|
||||
|
|
@ -273,18 +276,19 @@ v3d_rcl_emit_stores(struct v3d_job *job, struct v3d_cl *cl, int layer)
|
|||
continue;
|
||||
|
||||
bool blit_resolve =
|
||||
job->bbuf && job->bbuf->texture->nr_samples > 1 &&
|
||||
job->bbuf.texture &&
|
||||
job->bbuf.texture->nr_samples > 1 &&
|
||||
psurf->texture->nr_samples <= 1;
|
||||
store_general(job, cl, psurf, layer, RENDER_TARGET_0 + i, bit,
|
||||
&stores_pending, general_color_clear, blit_resolve);
|
||||
}
|
||||
|
||||
if (job->store & PIPE_CLEAR_DEPTHSTENCIL && job->zsbuf) {
|
||||
if (job->store & PIPE_CLEAR_DEPTHSTENCIL && job->zsbuf.texture) {
|
||||
assert(!job->early_zs_clear);
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture);
|
||||
struct v3d_resource *rsc = v3d_resource(job->zsbuf.texture);
|
||||
if (rsc->separate_stencil) {
|
||||
if (job->store & PIPE_CLEAR_DEPTH) {
|
||||
store_general(job, cl, job->zsbuf, layer,
|
||||
store_general(job, cl, &job->zsbuf, layer,
|
||||
Z, PIPE_CLEAR_DEPTH,
|
||||
&stores_pending,
|
||||
general_color_clear,
|
||||
|
|
@ -292,14 +296,14 @@ v3d_rcl_emit_stores(struct v3d_job *job, struct v3d_cl *cl, int layer)
|
|||
}
|
||||
|
||||
if (job->store & PIPE_CLEAR_STENCIL) {
|
||||
store_general(job, cl, job->zsbuf, layer,
|
||||
store_general(job, cl, &job->zsbuf, layer,
|
||||
STENCIL, PIPE_CLEAR_STENCIL,
|
||||
&stores_pending,
|
||||
general_color_clear,
|
||||
false);
|
||||
}
|
||||
} else {
|
||||
store_general(job, cl, job->zsbuf, layer,
|
||||
store_general(job, cl, &job->zsbuf, layer,
|
||||
zs_buffer_from_pipe_bits(job->store),
|
||||
job->store & PIPE_CLEAR_DEPTHSTENCIL,
|
||||
&stores_pending, general_color_clear,
|
||||
|
|
@ -438,10 +442,10 @@ v3d_setup_render_target(struct v3d_job *job,
|
|||
uint32_t *rt_bpp,
|
||||
uint32_t *rt_type_clamp)
|
||||
{
|
||||
if (!job->cbufs[cbuf])
|
||||
if (!job->cbufs[cbuf].texture)
|
||||
return;
|
||||
struct v3d_device_info *devinfo = &job->v3d->screen->devinfo;
|
||||
struct pipe_surface *psurf = job->cbufs[cbuf];
|
||||
struct pipe_surface *psurf = &job->cbufs[cbuf];
|
||||
uint8_t sinternal_bpp;
|
||||
uint8_t sinternal_type;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
|
|
@ -449,8 +453,8 @@ v3d_setup_render_target(struct v3d_job *job,
|
|||
&sinternal_type,
|
||||
&sinternal_bpp);
|
||||
*rt_bpp = sinternal_bpp;
|
||||
if (job->bbuf) {
|
||||
struct pipe_surface *bsurf = job->bbuf;
|
||||
if (job->bbuf.texture) {
|
||||
struct pipe_surface *bsurf = &job->bbuf;
|
||||
uint8_t binternal_bpp;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
bsurf->format,
|
||||
|
|
@ -471,11 +475,11 @@ v3d_setup_render_target(struct v3d_job *job,
|
|||
uint32_t *rt_type,
|
||||
uint32_t *rt_clamp)
|
||||
{
|
||||
if (!job->cbufs[cbuf])
|
||||
if (!job->cbufs[cbuf].texture)
|
||||
return;
|
||||
|
||||
struct v3d_device_info *devinfo = &job->v3d->screen->devinfo;
|
||||
struct pipe_surface *psurf = job->cbufs[cbuf];
|
||||
struct pipe_surface *psurf = &job->cbufs[cbuf];
|
||||
uint8_t sinternal_bpp;
|
||||
uint8_t sinternal_type;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
|
|
@ -483,8 +487,8 @@ v3d_setup_render_target(struct v3d_job *job,
|
|||
&sinternal_type,
|
||||
&sinternal_bpp);
|
||||
*rt_bpp = sinternal_bpp;
|
||||
if (job->bbuf) {
|
||||
struct pipe_surface *bsurf = job->bbuf;
|
||||
if (job->bbuf.texture) {
|
||||
struct pipe_surface *bsurf = &job->bbuf;
|
||||
uint8_t binternal_bpp;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
bsurf->format,
|
||||
|
|
@ -686,10 +690,10 @@ v3dX(emit_rcl)(struct v3d_job *job)
|
|||
* optional updates to the previous HW state.
|
||||
*/
|
||||
cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_COMMON, config) {
|
||||
if (job->zsbuf) {
|
||||
if (job->zsbuf.texture) {
|
||||
uint8_t internal_type;
|
||||
v3d_format_get_internal_type_and_bpp(devinfo,
|
||||
job->zsbuf->format,
|
||||
job->zsbuf.format,
|
||||
&internal_type,
|
||||
NULL);
|
||||
config.internal_depth_type = internal_type;
|
||||
|
|
@ -716,7 +720,7 @@ v3dX(emit_rcl)(struct v3d_job *job)
|
|||
config.early_z_disable = true;
|
||||
}
|
||||
|
||||
assert(job->zsbuf || config.early_z_disable);
|
||||
assert(job->zsbuf.texture || config.early_z_disable);
|
||||
|
||||
job->early_zs_clear = (job->clear_tlb & PIPE_CLEAR_DEPTHSTENCIL) &&
|
||||
!(job->load & PIPE_CLEAR_DEPTHSTENCIL) &&
|
||||
|
|
@ -763,8 +767,8 @@ v3dX(emit_rcl)(struct v3d_job *job)
|
|||
}
|
||||
#endif
|
||||
for (int i = 0; i < job->nr_cbufs; i++) {
|
||||
struct pipe_surface *psurf = job->cbufs[i];
|
||||
if (!psurf) {
|
||||
struct pipe_surface *psurf = &job->cbufs[i];
|
||||
if (!psurf->texture) {
|
||||
#if V3D_VERSION >= 71
|
||||
cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_RENDER_TARGET_PART1, rt) {
|
||||
rt.render_target_number = i;
|
||||
|
|
|
|||
|
|
@ -519,7 +519,6 @@ v3d_set_framebuffer_state(struct pipe_context *pctx,
|
|||
|
||||
v3d->job = NULL;
|
||||
|
||||
util_framebuffer_init(pctx, framebuffer, v3d->fb_cbufs, &v3d->fb_zsbuf);
|
||||
util_copy_framebuffer_state(cso, framebuffer);
|
||||
|
||||
v3d->swap_color_rb = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue