mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
panfrost: Style main Gallium driver
$ astyle *.c *.h --style=linux -s8 Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
e4bd6fbe51
commit
a2d0ea92ba
27 changed files with 785 additions and 785 deletions
|
|
@ -65,10 +65,10 @@
|
||||||
|
|
||||||
static struct panfrost_blend_shader *
|
static struct panfrost_blend_shader *
|
||||||
panfrost_get_blend_shader(
|
panfrost_get_blend_shader(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct panfrost_blend_state *blend,
|
struct panfrost_blend_state *blend,
|
||||||
enum pipe_format fmt,
|
enum pipe_format fmt,
|
||||||
unsigned rt)
|
unsigned rt)
|
||||||
{
|
{
|
||||||
/* Prevent NULL collision issues.. */
|
/* Prevent NULL collision issues.. */
|
||||||
assert(fmt != 0);
|
assert(fmt != 0);
|
||||||
|
|
@ -116,10 +116,10 @@ panfrost_create_blend_state(struct pipe_context *pipe,
|
||||||
|
|
||||||
rt->has_fixed_function =
|
rt->has_fixed_function =
|
||||||
panfrost_make_fixed_blend_mode(
|
panfrost_make_fixed_blend_mode(
|
||||||
&blend->rt[c],
|
&blend->rt[c],
|
||||||
&rt->equation,
|
&rt->equation,
|
||||||
&rt->constant_mask,
|
&rt->constant_mask,
|
||||||
blend->rt[c].colormask);
|
blend->rt[c].colormask);
|
||||||
|
|
||||||
/* Regardless if that works, we also need to initialize
|
/* Regardless if that works, we also need to initialize
|
||||||
* the blend shaders */
|
* the blend shaders */
|
||||||
|
|
@ -222,10 +222,9 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti)
|
||||||
/* First, we'll try a fixed function path */
|
/* First, we'll try a fixed function path */
|
||||||
if (rt->has_fixed_function && panfrost_can_fixed_blend(fmt)) {
|
if (rt->has_fixed_function && panfrost_can_fixed_blend(fmt)) {
|
||||||
if (panfrost_blend_constant(
|
if (panfrost_blend_constant(
|
||||||
&final.equation.constant,
|
&final.equation.constant,
|
||||||
ctx->blend_color.color,
|
ctx->blend_color.color,
|
||||||
rt->constant_mask))
|
rt->constant_mask)) {
|
||||||
{
|
|
||||||
/* There's an equation and suitable constant, so we're good to go */
|
/* There's an equation and suitable constant, so we're good to go */
|
||||||
final.is_shader = false;
|
final.is_shader = false;
|
||||||
final.equation.equation = &rt->equation;
|
final.equation.equation = &rt->equation;
|
||||||
|
|
@ -247,7 +246,7 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti)
|
||||||
memcpy(patch, ctx->blend_color.color, sizeof(float) * 4);
|
memcpy(patch, ctx->blend_color.color, sizeof(float) * 4);
|
||||||
|
|
||||||
final.shader.gpu = panfrost_upload_transient(
|
final.shader.gpu = panfrost_upload_transient(
|
||||||
ctx, shader->shader.cpu, shader->size);
|
ctx, shader->shader.cpu, shader->size);
|
||||||
} else {
|
} else {
|
||||||
/* No need to specialize further, use the preuploaded */
|
/* No need to specialize further, use the preuploaded */
|
||||||
final.shader.gpu = shader->shader.gpu;
|
final.shader.gpu = shader->shader.gpu;
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,9 @@ nir_make_options(const struct pipe_blend_state *blend, unsigned nr_cbufs)
|
||||||
|
|
||||||
struct panfrost_blend_shader
|
struct panfrost_blend_shader
|
||||||
panfrost_compile_blend_shader(
|
panfrost_compile_blend_shader(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct pipe_blend_state *cso,
|
struct pipe_blend_state *cso,
|
||||||
enum pipe_format format)
|
enum pipe_format format)
|
||||||
{
|
{
|
||||||
struct panfrost_blend_shader res;
|
struct panfrost_blend_shader res;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
|
|
||||||
struct panfrost_blend_shader
|
struct panfrost_blend_shader
|
||||||
panfrost_compile_blend_shader(
|
panfrost_compile_blend_shader(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct pipe_blend_state *cso,
|
struct pipe_blend_state *cso,
|
||||||
enum pipe_format format);
|
enum pipe_format format);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -117,19 +117,19 @@ panfrost_can_fixed_blend(enum pipe_format format)
|
||||||
|
|
||||||
/* Certain special formats are, too */
|
/* Certain special formats are, too */
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case PIPE_FORMAT_B5G6R5_UNORM:
|
case PIPE_FORMAT_B5G6R5_UNORM:
|
||||||
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
||||||
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
||||||
case PIPE_FORMAT_R10G10B10X2_UNORM:
|
case PIPE_FORMAT_R10G10B10X2_UNORM:
|
||||||
case PIPE_FORMAT_B10G10R10X2_UNORM:
|
case PIPE_FORMAT_B10G10R10X2_UNORM:
|
||||||
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
||||||
case PIPE_FORMAT_B4G4R4X4_UNORM:
|
case PIPE_FORMAT_B4G4R4X4_UNORM:
|
||||||
case PIPE_FORMAT_A4R4_UNORM:
|
case PIPE_FORMAT_A4R4_UNORM:
|
||||||
case PIPE_FORMAT_R4A4_UNORM:
|
case PIPE_FORMAT_R4A4_UNORM:
|
||||||
case PIPE_FORMAT_A4B4G4R4_UNORM:
|
case PIPE_FORMAT_A4B4G4R4_UNORM:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,14 +241,14 @@ panfrost_make_fixed_blend_part(unsigned func, unsigned src_factor, unsigned dst_
|
||||||
/* Make sure that the blend function is representible */
|
/* Make sure that the blend function is representible */
|
||||||
|
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case PIPE_BLEND_ADD:
|
case PIPE_BLEND_ADD:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* TODO: Reenable subtraction modes when those fixed */
|
/* TODO: Reenable subtraction modes when those fixed */
|
||||||
case PIPE_BLEND_SUBTRACT:
|
case PIPE_BLEND_SUBTRACT:
|
||||||
case PIPE_BLEND_REVERSE_SUBTRACT:
|
case PIPE_BLEND_REVERSE_SUBTRACT:
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
part.clip_modifier = MALI_BLEND_MOD_NORMAL;
|
part.clip_modifier = MALI_BLEND_MOD_NORMAL;
|
||||||
|
|
@ -273,7 +273,7 @@ panfrost_make_fixed_blend_part(unsigned func, unsigned src_factor, unsigned dst_
|
||||||
} else if (src_factor == dst_factor) {
|
} else if (src_factor == dst_factor) {
|
||||||
/* XXX: Why? */
|
/* XXX: Why? */
|
||||||
part.dominant = func == PIPE_BLEND_ADD ?
|
part.dominant = func == PIPE_BLEND_ADD ?
|
||||||
MALI_BLEND_DOM_DESTINATION : MALI_BLEND_DOM_SOURCE;
|
MALI_BLEND_DOM_DESTINATION : MALI_BLEND_DOM_SOURCE;
|
||||||
|
|
||||||
part.nondominant_mode = MALI_BLEND_NON_MIRROR;
|
part.nondominant_mode = MALI_BLEND_NON_MIRROR;
|
||||||
} else if (src_factor == complement_factor(dst_factor)) {
|
} else if (src_factor == complement_factor(dst_factor)) {
|
||||||
|
|
@ -352,10 +352,10 @@ panfrost_constant_mask(unsigned *factors, unsigned num_factors)
|
||||||
|
|
||||||
bool
|
bool
|
||||||
panfrost_make_fixed_blend_mode(
|
panfrost_make_fixed_blend_mode(
|
||||||
const struct pipe_rt_blend_state *blend,
|
const struct pipe_rt_blend_state *blend,
|
||||||
struct mali_blend_equation *out,
|
struct mali_blend_equation *out,
|
||||||
unsigned *constant_mask,
|
unsigned *constant_mask,
|
||||||
unsigned colormask)
|
unsigned colormask)
|
||||||
{
|
{
|
||||||
/* Gallium and Mali represent colour masks identically. XXX: Static
|
/* Gallium and Mali represent colour masks identically. XXX: Static
|
||||||
* assert for future proof */
|
* assert for future proof */
|
||||||
|
|
@ -387,13 +387,13 @@ panfrost_make_fixed_blend_mode(
|
||||||
unsigned alpha_mode = 0;
|
unsigned alpha_mode = 0;
|
||||||
|
|
||||||
if (!panfrost_make_fixed_blend_part(
|
if (!panfrost_make_fixed_blend_part(
|
||||||
blend->rgb_func, blend->rgb_src_factor, blend->rgb_dst_factor,
|
blend->rgb_func, blend->rgb_src_factor, blend->rgb_dst_factor,
|
||||||
&rgb_mode))
|
&rgb_mode))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!panfrost_make_fixed_blend_part(
|
if (!panfrost_make_fixed_blend_part(
|
||||||
blend->alpha_func, blend->alpha_src_factor, blend->alpha_dst_factor,
|
blend->alpha_func, blend->alpha_src_factor, blend->alpha_dst_factor,
|
||||||
&alpha_mode))
|
&alpha_mode))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
out->rgb_mode = rgb_mode;
|
out->rgb_mode = rgb_mode;
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ struct panfrost_blend_state;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
panfrost_make_fixed_blend_mode(
|
panfrost_make_fixed_blend_mode(
|
||||||
const struct pipe_rt_blend_state *blend,
|
const struct pipe_rt_blend_state *blend,
|
||||||
struct mali_blend_equation *out,
|
struct mali_blend_equation *out,
|
||||||
unsigned *constant_mask,
|
unsigned *constant_mask,
|
||||||
unsigned colormask);
|
unsigned colormask);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
panfrost_can_fixed_blend(enum pipe_format format);
|
panfrost_can_fixed_blend(enum pipe_format format);
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_blitter_save(
|
panfrost_blitter_save(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct blitter_context *blitter)
|
struct blitter_context *blitter)
|
||||||
{
|
{
|
||||||
|
|
||||||
util_blitter_save_vertex_buffer_slot(blitter, ctx->vertex_buffers);
|
util_blitter_save_vertex_buffer_slot(blitter, ctx->vertex_buffers);
|
||||||
|
|
@ -46,30 +46,30 @@ panfrost_blitter_save(
|
||||||
util_blitter_save_blend(blitter, ctx->blend);
|
util_blitter_save_blend(blitter, ctx->blend);
|
||||||
util_blitter_save_depth_stencil_alpha(blitter, ctx->depth_stencil);
|
util_blitter_save_depth_stencil_alpha(blitter, ctx->depth_stencil);
|
||||||
util_blitter_save_stencil_ref(blitter, &ctx->stencil_ref);
|
util_blitter_save_stencil_ref(blitter, &ctx->stencil_ref);
|
||||||
util_blitter_save_so_targets(blitter, 0, NULL);
|
util_blitter_save_so_targets(blitter, 0, NULL);
|
||||||
|
|
||||||
/* For later */
|
/* For later */
|
||||||
// util_blitter_save_sample_mask(blitter, ctx->sample_mask);
|
// util_blitter_save_sample_mask(blitter, ctx->sample_mask);
|
||||||
|
|
||||||
util_blitter_save_framebuffer(blitter, &ctx->pipe_framebuffer);
|
util_blitter_save_framebuffer(blitter, &ctx->pipe_framebuffer);
|
||||||
util_blitter_save_fragment_sampler_states(blitter,
|
util_blitter_save_fragment_sampler_states(blitter,
|
||||||
ctx->sampler_count[PIPE_SHADER_FRAGMENT],
|
ctx->sampler_count[PIPE_SHADER_FRAGMENT],
|
||||||
(void **)(&ctx->samplers[PIPE_SHADER_FRAGMENT]));
|
(void **)(&ctx->samplers[PIPE_SHADER_FRAGMENT]));
|
||||||
util_blitter_save_fragment_sampler_views(blitter,
|
util_blitter_save_fragment_sampler_views(blitter,
|
||||||
ctx->sampler_view_count[PIPE_SHADER_FRAGMENT],
|
ctx->sampler_view_count[PIPE_SHADER_FRAGMENT],
|
||||||
(struct pipe_sampler_view **)&ctx->sampler_views[PIPE_SHADER_FRAGMENT]);
|
(struct pipe_sampler_view **)&ctx->sampler_views[PIPE_SHADER_FRAGMENT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
panfrost_u_blitter_blit(struct pipe_context *pipe,
|
panfrost_u_blitter_blit(struct pipe_context *pipe,
|
||||||
const struct pipe_blit_info *info)
|
const struct pipe_blit_info *info)
|
||||||
{
|
{
|
||||||
struct panfrost_context *ctx = pan_context(pipe);
|
struct panfrost_context *ctx = pan_context(pipe);
|
||||||
|
|
||||||
if (!util_blitter_is_blit_supported(ctx->blitter, info)) {
|
if (!util_blitter_is_blit_supported(ctx->blitter, info)) {
|
||||||
fprintf(stderr, "blit unsupported %s -> %s\n",
|
fprintf(stderr, "blit unsupported %s -> %s\n",
|
||||||
util_format_short_name(info->src.resource->format),
|
util_format_short_name(info->src.resource->format),
|
||||||
util_format_short_name(info->dst.resource->format));
|
util_format_short_name(info->dst.resource->format));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,22 +114,22 @@ panfrost_blit_wallpaper(struct panfrost_context *ctx)
|
||||||
unsigned layer = surf->u.tex.first_layer;
|
unsigned layer = surf->u.tex.first_layer;
|
||||||
assert(surf->u.tex.last_layer == layer);
|
assert(surf->u.tex.last_layer == layer);
|
||||||
|
|
||||||
binfo.src.resource = binfo.dst.resource = ctx->pipe_framebuffer.cbufs[0]->texture;
|
binfo.src.resource = binfo.dst.resource = ctx->pipe_framebuffer.cbufs[0]->texture;
|
||||||
binfo.src.level = binfo.dst.level = level;
|
binfo.src.level = binfo.dst.level = level;
|
||||||
binfo.src.box.x = binfo.dst.box.x = 0;
|
binfo.src.box.x = binfo.dst.box.x = 0;
|
||||||
binfo.src.box.y = binfo.dst.box.y = 0;
|
binfo.src.box.y = binfo.dst.box.y = 0;
|
||||||
binfo.src.box.z = binfo.dst.box.z = layer;
|
binfo.src.box.z = binfo.dst.box.z = layer;
|
||||||
binfo.src.box.width = binfo.dst.box.width = ctx->pipe_framebuffer.width;
|
binfo.src.box.width = binfo.dst.box.width = ctx->pipe_framebuffer.width;
|
||||||
binfo.src.box.height = binfo.dst.box.height = ctx->pipe_framebuffer.height;
|
binfo.src.box.height = binfo.dst.box.height = ctx->pipe_framebuffer.height;
|
||||||
binfo.src.box.depth = binfo.dst.box.depth = 1;
|
binfo.src.box.depth = binfo.dst.box.depth = 1;
|
||||||
|
|
||||||
binfo.src.format = binfo.dst.format = ctx->pipe_framebuffer.cbufs[0]->format;
|
binfo.src.format = binfo.dst.format = ctx->pipe_framebuffer.cbufs[0]->format;
|
||||||
|
|
||||||
assert(ctx->pipe_framebuffer.nr_cbufs == 1);
|
assert(ctx->pipe_framebuffer.nr_cbufs == 1);
|
||||||
binfo.mask = PIPE_MASK_RGBA;
|
binfo.mask = PIPE_MASK_RGBA;
|
||||||
binfo.filter = PIPE_TEX_FILTER_LINEAR;
|
binfo.filter = PIPE_TEX_FILTER_LINEAR;
|
||||||
binfo.scissor_enable = FALSE;
|
binfo.scissor_enable = FALSE;
|
||||||
|
|
||||||
util_blitter_blit(ctx->blitter_wallpaper, &binfo);
|
util_blitter_blit(ctx->blitter_wallpaper, &binfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,27 +52,27 @@
|
||||||
//#define DRY_RUN
|
//#define DRY_RUN
|
||||||
|
|
||||||
static enum mali_job_type
|
static enum mali_job_type
|
||||||
panfrost_job_type_for_pipe(enum pipe_shader_type type)
|
panfrost_job_type_for_pipe(enum pipe_shader_type type) {
|
||||||
{
|
switch (type)
|
||||||
switch (type) {
|
{
|
||||||
case PIPE_SHADER_VERTEX:
|
case PIPE_SHADER_VERTEX:
|
||||||
return JOB_TYPE_VERTEX;
|
return JOB_TYPE_VERTEX;
|
||||||
|
|
||||||
case PIPE_SHADER_FRAGMENT:
|
case PIPE_SHADER_FRAGMENT:
|
||||||
/* Note: JOB_TYPE_FRAGMENT is different.
|
/* Note: JOB_TYPE_FRAGMENT is different.
|
||||||
* JOB_TYPE_FRAGMENT actually executes the
|
* JOB_TYPE_FRAGMENT actually executes the
|
||||||
* fragment shader, but JOB_TYPE_TILER is how you
|
* fragment shader, but JOB_TYPE_TILER is how you
|
||||||
* specify it*/
|
* specify it*/
|
||||||
return JOB_TYPE_TILER;
|
return JOB_TYPE_TILER;
|
||||||
|
|
||||||
case PIPE_SHADER_GEOMETRY:
|
case PIPE_SHADER_GEOMETRY:
|
||||||
return JOB_TYPE_GEOMETRY;
|
return JOB_TYPE_GEOMETRY;
|
||||||
|
|
||||||
case PIPE_SHADER_COMPUTE:
|
case PIPE_SHADER_COMPUTE:
|
||||||
return JOB_TYPE_COMPUTE;
|
return JOB_TYPE_COMPUTE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Unsupported shader stage");
|
unreachable("Unsupported shader stage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,10 +80,10 @@ panfrost_job_type_for_pipe(enum pipe_shader_type type)
|
||||||
|
|
||||||
static struct midgard_tiler_descriptor
|
static struct midgard_tiler_descriptor
|
||||||
panfrost_emit_midg_tiler(
|
panfrost_emit_midg_tiler(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
unsigned width,
|
unsigned width,
|
||||||
unsigned height,
|
unsigned height,
|
||||||
unsigned vertex_count)
|
unsigned vertex_count)
|
||||||
{
|
{
|
||||||
struct midgard_tiler_descriptor t = {};
|
struct midgard_tiler_descriptor t = {};
|
||||||
|
|
||||||
|
|
@ -93,17 +93,17 @@ panfrost_emit_midg_tiler(
|
||||||
/* Compute the polygon header size and use that to offset the body */
|
/* Compute the polygon header size and use that to offset the body */
|
||||||
|
|
||||||
unsigned header_size = panfrost_tiler_header_size(
|
unsigned header_size = panfrost_tiler_header_size(
|
||||||
width, height, t.hierarchy_mask);
|
width, height, t.hierarchy_mask);
|
||||||
|
|
||||||
unsigned body_size = panfrost_tiler_body_size(
|
unsigned body_size = panfrost_tiler_body_size(
|
||||||
width, height, t.hierarchy_mask);
|
width, height, t.hierarchy_mask);
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
|
|
||||||
unsigned total_size = header_size + body_size;
|
unsigned total_size = header_size + body_size;
|
||||||
|
|
||||||
if (t.hierarchy_mask) {
|
if (t.hierarchy_mask) {
|
||||||
assert(ctx->tiler_polygon_list.bo->size >= total_size);
|
assert(ctx->tiler_polygon_list.bo->size >= total_size);
|
||||||
|
|
||||||
/* Specify allocated tiler structures */
|
/* Specify allocated tiler structures */
|
||||||
t.polygon_list = ctx->tiler_polygon_list.bo->gpu;
|
t.polygon_list = ctx->tiler_polygon_list.bo->gpu;
|
||||||
|
|
@ -147,7 +147,7 @@ panfrost_emit_sfbd(struct panfrost_context *ctx, unsigned vertex_count)
|
||||||
.clear_flags = 0x1000,
|
.clear_flags = 0x1000,
|
||||||
.unknown_address_0 = ctx->scratchpad.bo->gpu,
|
.unknown_address_0 = ctx->scratchpad.bo->gpu,
|
||||||
.tiler = panfrost_emit_midg_tiler(ctx,
|
.tiler = panfrost_emit_midg_tiler(ctx,
|
||||||
width, height, vertex_count),
|
width, height, vertex_count),
|
||||||
};
|
};
|
||||||
|
|
||||||
return framebuffer;
|
return framebuffer;
|
||||||
|
|
@ -175,7 +175,7 @@ panfrost_emit_mfbd(struct panfrost_context *ctx, unsigned vertex_count)
|
||||||
|
|
||||||
.scratchpad = ctx->scratchpad.bo->gpu,
|
.scratchpad = ctx->scratchpad.bo->gpu,
|
||||||
.tiler = panfrost_emit_midg_tiler(ctx,
|
.tiler = panfrost_emit_midg_tiler(ctx,
|
||||||
width, height, vertex_count)
|
width, height, vertex_count)
|
||||||
};
|
};
|
||||||
|
|
||||||
return framebuffer;
|
return framebuffer;
|
||||||
|
|
@ -228,8 +228,8 @@ static void
|
||||||
panfrost_attach_vt_framebuffer(struct panfrost_context *ctx)
|
panfrost_attach_vt_framebuffer(struct panfrost_context *ctx)
|
||||||
{
|
{
|
||||||
mali_ptr framebuffer = ctx->require_sfbd ?
|
mali_ptr framebuffer = ctx->require_sfbd ?
|
||||||
panfrost_attach_vt_sfbd(ctx) :
|
panfrost_attach_vt_sfbd(ctx) :
|
||||||
panfrost_attach_vt_mfbd(ctx);
|
panfrost_attach_vt_mfbd(ctx);
|
||||||
|
|
||||||
ctx->payload_vertex.postfix.framebuffer = framebuffer;
|
ctx->payload_vertex.postfix.framebuffer = framebuffer;
|
||||||
ctx->payload_tiler.postfix.framebuffer = framebuffer;
|
ctx->payload_tiler.postfix.framebuffer = framebuffer;
|
||||||
|
|
@ -242,7 +242,7 @@ static void
|
||||||
panfrost_invalidate_frame(struct panfrost_context *ctx)
|
panfrost_invalidate_frame(struct panfrost_context *ctx)
|
||||||
{
|
{
|
||||||
unsigned transient_count = ctx->transient_pools[ctx->cmdstream_i].entry_index*ctx->transient_pools[0].entry_size + ctx->transient_pools[ctx->cmdstream_i].entry_offset;
|
unsigned transient_count = ctx->transient_pools[ctx->cmdstream_i].entry_index*ctx->transient_pools[0].entry_size + ctx->transient_pools[ctx->cmdstream_i].entry_offset;
|
||||||
DBG("Uploaded transient %d bytes\n", transient_count);
|
DBG("Uploaded transient %d bytes\n", transient_count);
|
||||||
|
|
||||||
/* Rotate cmdstream */
|
/* Rotate cmdstream */
|
||||||
if ((++ctx->cmdstream_i) == (sizeof(ctx->transient_pools) / sizeof(ctx->transient_pools[0])))
|
if ((++ctx->cmdstream_i) == (sizeof(ctx->transient_pools) / sizeof(ctx->transient_pools[0])))
|
||||||
|
|
@ -280,7 +280,7 @@ static void
|
||||||
panfrost_emit_vertex_payload(struct panfrost_context *ctx)
|
panfrost_emit_vertex_payload(struct panfrost_context *ctx)
|
||||||
{
|
{
|
||||||
struct midgard_payload_vertex_tiler payload = {
|
struct midgard_payload_vertex_tiler payload = {
|
||||||
.gl_enables = 0x4 | (ctx->is_t6xx ? 0 : 0x2),
|
.gl_enables = 0x4 | (ctx->is_t6xx ? 0 : 0x2),
|
||||||
};
|
};
|
||||||
|
|
||||||
memcpy(&ctx->payload_vertex, &payload, sizeof(payload));
|
memcpy(&ctx->payload_vertex, &payload, sizeof(payload));
|
||||||
|
|
@ -461,9 +461,9 @@ panfrost_default_shader_backend(struct panfrost_context *ctx)
|
||||||
.unknown2_4 = MALI_NO_MSAA | 0x4e0,
|
.unknown2_4 = MALI_NO_MSAA | 0x4e0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ctx->is_t6xx) {
|
if (ctx->is_t6xx) {
|
||||||
shader.unknown2_4 |= 0x10;
|
shader.unknown2_4 |= 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pipe_stencil_state default_stencil = {
|
struct pipe_stencil_state default_stencil = {
|
||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
|
|
@ -521,10 +521,10 @@ panfrost_vertex_tiler_job(struct panfrost_context *ctx, bool is_tiler)
|
||||||
|
|
||||||
static mali_ptr
|
static mali_ptr
|
||||||
panfrost_emit_varyings(
|
panfrost_emit_varyings(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
union mali_attr *slot,
|
union mali_attr *slot,
|
||||||
unsigned stride,
|
unsigned stride,
|
||||||
unsigned count)
|
unsigned count)
|
||||||
{
|
{
|
||||||
mali_ptr varying_address = ctx->varying_mem.bo->gpu + ctx->varying_height;
|
mali_ptr varying_address = ctx->varying_mem.bo->gpu + ctx->varying_height;
|
||||||
|
|
||||||
|
|
@ -548,8 +548,8 @@ panfrost_emit_point_coord(union mali_attr *slot)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_emit_varying_descriptor(
|
panfrost_emit_varying_descriptor(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
unsigned vertex_count)
|
unsigned vertex_count)
|
||||||
{
|
{
|
||||||
/* Load the shaders */
|
/* Load the shaders */
|
||||||
|
|
||||||
|
|
@ -563,7 +563,7 @@ panfrost_emit_varying_descriptor(
|
||||||
size_t fs_size = sizeof(struct mali_attr_meta) * fs->tripipe->varying_count;
|
size_t fs_size = sizeof(struct mali_attr_meta) * fs->tripipe->varying_count;
|
||||||
|
|
||||||
struct panfrost_transfer trans = panfrost_allocate_transient(ctx,
|
struct panfrost_transfer trans = panfrost_allocate_transient(ctx,
|
||||||
vs_size + fs_size);
|
vs_size + fs_size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assign ->src_offset now that we know about all the general purpose
|
* Assign ->src_offset now that we know about all the general purpose
|
||||||
|
|
@ -640,14 +640,14 @@ panfrost_emit_varying_descriptor(
|
||||||
/* fp32 vec4 gl_Position */
|
/* fp32 vec4 gl_Position */
|
||||||
ctx->payload_tiler.postfix.position_varying =
|
ctx->payload_tiler.postfix.position_varying =
|
||||||
panfrost_emit_varyings(ctx, &varyings[idx++],
|
panfrost_emit_varyings(ctx, &varyings[idx++],
|
||||||
sizeof(float) * 4, vertex_count);
|
sizeof(float) * 4, vertex_count);
|
||||||
|
|
||||||
|
|
||||||
if (vs->writes_point_size || fs->reads_point_coord) {
|
if (vs->writes_point_size || fs->reads_point_coord) {
|
||||||
/* fp16 vec1 gl_PointSize */
|
/* fp16 vec1 gl_PointSize */
|
||||||
ctx->payload_tiler.primitive_size.pointer =
|
ctx->payload_tiler.primitive_size.pointer =
|
||||||
panfrost_emit_varyings(ctx, &varyings[idx++],
|
panfrost_emit_varyings(ctx, &varyings[idx++],
|
||||||
2, vertex_count);
|
2, vertex_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs->reads_point_coord) {
|
if (fs->reads_point_coord) {
|
||||||
|
|
@ -771,8 +771,8 @@ panfrost_upload_sampler_descriptors(struct panfrost_context *ctx)
|
||||||
|
|
||||||
static mali_ptr
|
static mali_ptr
|
||||||
panfrost_upload_tex(
|
panfrost_upload_tex(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct panfrost_sampler_view *view)
|
struct panfrost_sampler_view *view)
|
||||||
{
|
{
|
||||||
if (!view)
|
if (!view)
|
||||||
return (mali_ptr) NULL;
|
return (mali_ptr) NULL;
|
||||||
|
|
@ -798,7 +798,7 @@ panfrost_upload_tex(
|
||||||
bool is_zs = rsrc->base.bind & PIPE_BIND_DEPTH_STENCIL;
|
bool is_zs = rsrc->base.bind & PIPE_BIND_DEPTH_STENCIL;
|
||||||
unsigned afbc_bit = (is_afbc && !is_zs) ? 1 : 0;
|
unsigned afbc_bit = (is_afbc && !is_zs) ? 1 : 0;
|
||||||
|
|
||||||
/* Add the BO to the job so it's retained until the job is done. */
|
/* Add the BO to the job so it's retained until the job is done. */
|
||||||
struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
|
struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
|
||||||
panfrost_job_add_bo(job, rsrc->bo);
|
panfrost_job_add_bo(job, rsrc->bo);
|
||||||
|
|
||||||
|
|
@ -821,7 +821,7 @@ panfrost_upload_tex(
|
||||||
}
|
}
|
||||||
|
|
||||||
return panfrost_upload_transient(ctx, &view->hw,
|
return panfrost_upload_transient(ctx, &view->hw,
|
||||||
sizeof(struct mali_texture_descriptor));
|
sizeof(struct mali_texture_descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -858,7 +858,7 @@ struct sysval_uniform {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void panfrost_upload_viewport_scale_sysval(struct panfrost_context *ctx,
|
static void panfrost_upload_viewport_scale_sysval(struct panfrost_context *ctx,
|
||||||
struct sysval_uniform *uniform)
|
struct sysval_uniform *uniform)
|
||||||
{
|
{
|
||||||
const struct pipe_viewport_state *vp = &ctx->pipe_viewport;
|
const struct pipe_viewport_state *vp = &ctx->pipe_viewport;
|
||||||
|
|
||||||
|
|
@ -868,7 +868,7 @@ static void panfrost_upload_viewport_scale_sysval(struct panfrost_context *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void panfrost_upload_viewport_offset_sysval(struct panfrost_context *ctx,
|
static void panfrost_upload_viewport_offset_sysval(struct panfrost_context *ctx,
|
||||||
struct sysval_uniform *uniform)
|
struct sysval_uniform *uniform)
|
||||||
{
|
{
|
||||||
const struct pipe_viewport_state *vp = &ctx->pipe_viewport;
|
const struct pipe_viewport_state *vp = &ctx->pipe_viewport;
|
||||||
|
|
||||||
|
|
@ -944,9 +944,9 @@ panfrost_map_constant_buffer_cpu(struct panfrost_constant_buffer *buf, unsigned
|
||||||
|
|
||||||
static mali_ptr
|
static mali_ptr
|
||||||
panfrost_map_constant_buffer_gpu(
|
panfrost_map_constant_buffer_gpu(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct panfrost_constant_buffer *buf,
|
struct panfrost_constant_buffer *buf,
|
||||||
unsigned index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
struct pipe_constant_buffer *cb = &buf->cb[index];
|
struct pipe_constant_buffer *cb = &buf->cb[index];
|
||||||
struct panfrost_resource *rsrc = pan_resource(cb->buffer);
|
struct panfrost_resource *rsrc = pan_resource(cb->buffer);
|
||||||
|
|
@ -976,9 +976,9 @@ panfrost_ubo_count(struct panfrost_context *ctx, enum pipe_shader_type stage)
|
||||||
|
|
||||||
static mali_ptr
|
static mali_ptr
|
||||||
panfrost_patch_shader_state(
|
panfrost_patch_shader_state(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct panfrost_shader_state *ss,
|
struct panfrost_shader_state *ss,
|
||||||
enum pipe_shader_type stage)
|
enum pipe_shader_type stage)
|
||||||
{
|
{
|
||||||
ss->tripipe->texture_count = ctx->sampler_view_count[stage];
|
ss->tripipe->texture_count = ctx->sampler_view_count[stage];
|
||||||
ss->tripipe->sampler_count = ctx->sampler_count[stage];
|
ss->tripipe->sampler_count = ctx->sampler_count[stage];
|
||||||
|
|
@ -1016,7 +1016,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
|
||||||
SET_BIT(ctx->fragment_shader_core.unknown2_4, MALI_NO_MSAA, !msaa);
|
SET_BIT(ctx->fragment_shader_core.unknown2_4, MALI_NO_MSAA, !msaa);
|
||||||
}
|
}
|
||||||
|
|
||||||
panfrost_job_set_requirements(ctx, job);
|
panfrost_job_set_requirements(ctx, job);
|
||||||
|
|
||||||
if (ctx->occlusion_query) {
|
if (ctx->occlusion_query) {
|
||||||
ctx->payload_tiler.gl_enables |= MALI_OCCLUSION_QUERY | MALI_OCCLUSION_PRECISE;
|
ctx->payload_tiler.gl_enables |= MALI_OCCLUSION_QUERY | MALI_OCCLUSION_PRECISE;
|
||||||
|
|
@ -1111,13 +1111,13 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
|
||||||
ctx->fragment_shader_core.midgard1.flags |= 0x400;
|
ctx->fragment_shader_core.midgard1.flags |= 0x400;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we're using the default blend descriptor (fast path) */
|
/* Check if we're using the default blend descriptor (fast path) */
|
||||||
|
|
||||||
bool no_blending =
|
bool no_blending =
|
||||||
!blend.is_shader &&
|
!blend.is_shader &&
|
||||||
(blend.equation.equation->rgb_mode == 0x122) &&
|
(blend.equation.equation->rgb_mode == 0x122) &&
|
||||||
(blend.equation.equation->alpha_mode == 0x122) &&
|
(blend.equation.equation->alpha_mode == 0x122) &&
|
||||||
(blend.equation.equation->color_mask == 0xf);
|
(blend.equation.equation->color_mask == 0xf);
|
||||||
|
|
||||||
/* Even on MFBD, the shader descriptor gets blend shaders. It's
|
/* Even on MFBD, the shader descriptor gets blend shaders. It's
|
||||||
* *also* copied to the blend_meta appended (by convention),
|
* *also* copied to the blend_meta appended (by convention),
|
||||||
|
|
@ -1396,8 +1396,8 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
|
||||||
|
|
||||||
ctx->payload_tiler.postfix.viewport =
|
ctx->payload_tiler.postfix.viewport =
|
||||||
panfrost_upload_transient(ctx,
|
panfrost_upload_transient(ctx,
|
||||||
&view,
|
&view,
|
||||||
sizeof(struct mali_viewport));
|
sizeof(struct mali_viewport));
|
||||||
|
|
||||||
ctx->dirty = 0;
|
ctx->dirty = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1413,7 +1413,7 @@ panfrost_queue_draw(struct panfrost_context *ctx)
|
||||||
/* If rasterizer discard is enable, only submit the vertex */
|
/* If rasterizer discard is enable, only submit the vertex */
|
||||||
|
|
||||||
bool rasterizer_discard = ctx->rasterizer
|
bool rasterizer_discard = ctx->rasterizer
|
||||||
&& ctx->rasterizer->base.rasterizer_discard;
|
&& ctx->rasterizer->base.rasterizer_discard;
|
||||||
|
|
||||||
struct panfrost_transfer vertex = panfrost_vertex_tiler_job(ctx, false);
|
struct panfrost_transfer vertex = panfrost_vertex_tiler_job(ctx, false);
|
||||||
struct panfrost_transfer tiler;
|
struct panfrost_transfer tiler;
|
||||||
|
|
@ -1435,7 +1435,7 @@ panfrost_queue_draw(struct panfrost_context *ctx)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_submit_frame(struct panfrost_context *ctx, bool flush_immediate,
|
panfrost_submit_frame(struct panfrost_context *ctx, bool flush_immediate,
|
||||||
struct pipe_fence_handle **fence,
|
struct pipe_fence_handle **fence,
|
||||||
struct panfrost_job *job)
|
struct panfrost_job *job)
|
||||||
{
|
{
|
||||||
struct pipe_context *gallium = (struct pipe_context *) ctx;
|
struct pipe_context *gallium = (struct pipe_context *) ctx;
|
||||||
|
|
@ -1462,11 +1462,11 @@ panfrost_submit_frame(struct panfrost_context *ctx, bool flush_immediate,
|
||||||
static void
|
static void
|
||||||
panfrost_draw_wallpaper(struct pipe_context *pipe)
|
panfrost_draw_wallpaper(struct pipe_context *pipe)
|
||||||
{
|
{
|
||||||
struct panfrost_context *ctx = pan_context(pipe);
|
struct panfrost_context *ctx = pan_context(pipe);
|
||||||
|
|
||||||
/* Nothing to reload? TODO: MRT wallpapers */
|
/* Nothing to reload? TODO: MRT wallpapers */
|
||||||
if (ctx->pipe_framebuffer.cbufs[0] == NULL)
|
if (ctx->pipe_framebuffer.cbufs[0] == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check if the buffer has any content on it worth preserving */
|
/* Check if the buffer has any content on it worth preserving */
|
||||||
|
|
||||||
|
|
@ -1497,8 +1497,8 @@ panfrost_flush(
|
||||||
/* Nothing to do! */
|
/* Nothing to do! */
|
||||||
if (!job->last_job.gpu && !job->clear) return;
|
if (!job->last_job.gpu && !job->clear) return;
|
||||||
|
|
||||||
if (!job->clear)
|
if (!job->clear)
|
||||||
panfrost_draw_wallpaper(&ctx->base);
|
panfrost_draw_wallpaper(&ctx->base);
|
||||||
|
|
||||||
/* Whether to stall the pipeline for immediately correct results. Since
|
/* Whether to stall the pipeline for immediately correct results. Since
|
||||||
* pipelined rendering is quite broken right now (to be fixed by the
|
* pipelined rendering is quite broken right now (to be fixed by the
|
||||||
|
|
@ -1612,7 +1612,7 @@ panfrost_draw_vbo(
|
||||||
unsigned primitive_index = (1 << (info->index_size * 8)) - 1;
|
unsigned primitive_index = (1 << (info->index_size * 8)) - 1;
|
||||||
|
|
||||||
if (info->primitive_restart && info->index_size
|
if (info->primitive_restart && info->index_size
|
||||||
&& info->restart_index != primitive_index) {
|
&& info->restart_index != primitive_index) {
|
||||||
util_draw_vbo_without_prim_restart(pipe, info);
|
util_draw_vbo_without_prim_restart(pipe, info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1716,10 +1716,10 @@ panfrost_draw_vbo(
|
||||||
* vertex_count, 1) */
|
* vertex_count, 1) */
|
||||||
|
|
||||||
panfrost_pack_work_groups_fused(
|
panfrost_pack_work_groups_fused(
|
||||||
&ctx->payload_vertex.prefix,
|
&ctx->payload_vertex.prefix,
|
||||||
&ctx->payload_tiler.prefix,
|
&ctx->payload_tiler.prefix,
|
||||||
1, vertex_count, info->instance_count,
|
1, vertex_count, info->instance_count,
|
||||||
1, 1, 1);
|
1, 1, 1);
|
||||||
|
|
||||||
ctx->payload_tiler.prefix.unknown_draw = draw_flags;
|
ctx->payload_tiler.prefix.unknown_draw = draw_flags;
|
||||||
|
|
||||||
|
|
@ -1808,7 +1808,7 @@ panfrost_bind_rasterizer_state(
|
||||||
/* Point sprites are emulated */
|
/* Point sprites are emulated */
|
||||||
|
|
||||||
struct panfrost_shader_state *variant =
|
struct panfrost_shader_state *variant =
|
||||||
ctx->fs ? &ctx->fs->variants[ctx->fs->active_variant] : NULL;
|
ctx->fs ? &ctx->fs->variants[ctx->fs->active_variant] : NULL;
|
||||||
|
|
||||||
if (ctx->rasterizer->base.sprite_coord_enable || (variant && variant->point_sprite_mask))
|
if (ctx->rasterizer->base.sprite_coord_enable || (variant && variant->point_sprite_mask))
|
||||||
ctx->base.bind_fs_state(&ctx->base, ctx->fs);
|
ctx->base.bind_fs_state(&ctx->base, ctx->fs);
|
||||||
|
|
@ -1964,9 +1964,9 @@ panfrost_bind_sampler_states(
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
panfrost_variant_matches(
|
panfrost_variant_matches(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct panfrost_shader_state *variant,
|
struct panfrost_shader_state *variant,
|
||||||
enum pipe_shader_type type)
|
enum pipe_shader_type type)
|
||||||
{
|
{
|
||||||
struct pipe_rasterizer_state *rasterizer = &ctx->rasterizer->base;
|
struct pipe_rasterizer_state *rasterizer = &ctx->rasterizer->base;
|
||||||
struct pipe_alpha_state *alpha = &ctx->depth_stencil->alpha;
|
struct pipe_alpha_state *alpha = &ctx->depth_stencil->alpha;
|
||||||
|
|
@ -1989,7 +1989,7 @@ panfrost_variant_matches(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_fragment && rasterizer && (rasterizer->sprite_coord_enable |
|
if (is_fragment && rasterizer && (rasterizer->sprite_coord_enable |
|
||||||
variant->point_sprite_mask)) {
|
variant->point_sprite_mask)) {
|
||||||
/* Ensure the same varyings are turned to point sprites */
|
/* Ensure the same varyings are turned to point sprites */
|
||||||
if (rasterizer->sprite_coord_enable != variant->point_sprite_mask)
|
if (rasterizer->sprite_coord_enable != variant->point_sprite_mask)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2044,7 +2044,7 @@ panfrost_bind_shader_state(
|
||||||
assert(variants->variant_count < MAX_SHADER_VARIANTS);
|
assert(variants->variant_count < MAX_SHADER_VARIANTS);
|
||||||
|
|
||||||
struct panfrost_shader_state *v =
|
struct panfrost_shader_state *v =
|
||||||
&variants->variants[variant];
|
&variants->variants[variant];
|
||||||
|
|
||||||
v->base = hwcso;
|
v->base = hwcso;
|
||||||
|
|
||||||
|
|
@ -2078,7 +2078,7 @@ panfrost_bind_shader_state(
|
||||||
|
|
||||||
if (!shader_state->compiled) {
|
if (!shader_state->compiled) {
|
||||||
panfrost_shader_compile(ctx, shader_state->tripipe, NULL,
|
panfrost_shader_compile(ctx, shader_state->tripipe, NULL,
|
||||||
panfrost_job_type_for_pipe(type), shader_state);
|
panfrost_job_type_for_pipe(type), shader_state);
|
||||||
|
|
||||||
shader_state->compiled = true;
|
shader_state->compiled = true;
|
||||||
}
|
}
|
||||||
|
|
@ -2144,28 +2144,28 @@ panfrost_set_stencil_ref(
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum mali_texture_type
|
static enum mali_texture_type
|
||||||
panfrost_translate_texture_type(enum pipe_texture_target t)
|
panfrost_translate_texture_type(enum pipe_texture_target t) {
|
||||||
{
|
switch (t)
|
||||||
switch (t) {
|
{
|
||||||
case PIPE_BUFFER:
|
case PIPE_BUFFER:
|
||||||
case PIPE_TEXTURE_1D:
|
case PIPE_TEXTURE_1D:
|
||||||
case PIPE_TEXTURE_1D_ARRAY:
|
case PIPE_TEXTURE_1D_ARRAY:
|
||||||
return MALI_TEX_1D;
|
return MALI_TEX_1D;
|
||||||
|
|
||||||
case PIPE_TEXTURE_2D:
|
case PIPE_TEXTURE_2D:
|
||||||
case PIPE_TEXTURE_2D_ARRAY:
|
case PIPE_TEXTURE_2D_ARRAY:
|
||||||
case PIPE_TEXTURE_RECT:
|
case PIPE_TEXTURE_RECT:
|
||||||
return MALI_TEX_2D;
|
return MALI_TEX_2D;
|
||||||
|
|
||||||
case PIPE_TEXTURE_3D:
|
case PIPE_TEXTURE_3D:
|
||||||
return MALI_TEX_3D;
|
return MALI_TEX_3D;
|
||||||
|
|
||||||
case PIPE_TEXTURE_CUBE:
|
case PIPE_TEXTURE_CUBE:
|
||||||
case PIPE_TEXTURE_CUBE_ARRAY:
|
case PIPE_TEXTURE_CUBE_ARRAY:
|
||||||
return MALI_TEX_CUBE;
|
return MALI_TEX_CUBE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Unknown target");
|
unreachable("Unknown target");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2209,18 +2209,18 @@ panfrost_create_sampler_view(
|
||||||
unsigned usage2_layout = 0x10;
|
unsigned usage2_layout = 0x10;
|
||||||
|
|
||||||
switch (prsrc->layout) {
|
switch (prsrc->layout) {
|
||||||
case PAN_AFBC:
|
case PAN_AFBC:
|
||||||
usage2_layout |= 0x8 | 0x4;
|
usage2_layout |= 0x8 | 0x4;
|
||||||
break;
|
break;
|
||||||
case PAN_TILED:
|
case PAN_TILED:
|
||||||
usage2_layout |= 0x1;
|
usage2_layout |= 0x1;
|
||||||
break;
|
break;
|
||||||
case PAN_LINEAR:
|
case PAN_LINEAR:
|
||||||
usage2_layout |= is_depth ? 0x1 : 0x2;
|
usage2_layout |= is_depth ? 0x1 : 0x2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we need to set a custom stride by computing the "expected"
|
/* Check if we need to set a custom stride by computing the "expected"
|
||||||
|
|
@ -2508,8 +2508,8 @@ panfrost_destroy(struct pipe_context *pipe)
|
||||||
|
|
||||||
static struct pipe_query *
|
static struct pipe_query *
|
||||||
panfrost_create_query(struct pipe_context *pipe,
|
panfrost_create_query(struct pipe_context *pipe,
|
||||||
unsigned type,
|
unsigned type,
|
||||||
unsigned index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
struct panfrost_query *q = rzalloc(pipe, struct panfrost_query);
|
struct panfrost_query *q = rzalloc(pipe, struct panfrost_query);
|
||||||
|
|
||||||
|
|
@ -2532,21 +2532,20 @@ panfrost_begin_query(struct pipe_context *pipe, struct pipe_query *q)
|
||||||
struct panfrost_query *query = (struct panfrost_query *) q;
|
struct panfrost_query *query = (struct panfrost_query *) q;
|
||||||
|
|
||||||
switch (query->type) {
|
switch (query->type) {
|
||||||
case PIPE_QUERY_OCCLUSION_COUNTER:
|
case PIPE_QUERY_OCCLUSION_COUNTER:
|
||||||
case PIPE_QUERY_OCCLUSION_PREDICATE:
|
case PIPE_QUERY_OCCLUSION_PREDICATE:
|
||||||
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
|
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: {
|
||||||
{
|
/* Allocate a word for the query results to be stored */
|
||||||
/* Allocate a word for the query results to be stored */
|
query->transfer = panfrost_allocate_chunk(ctx, sizeof(unsigned), HEAP_DESCRIPTOR);
|
||||||
query->transfer = panfrost_allocate_chunk(ctx, sizeof(unsigned), HEAP_DESCRIPTOR);
|
|
||||||
|
|
||||||
ctx->occlusion_query = query;
|
ctx->occlusion_query = query;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DBG("Skipping query %d\n", query->type);
|
DBG("Skipping query %d\n", query->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2575,24 +2574,24 @@ panfrost_get_query_result(struct pipe_context *pipe,
|
||||||
panfrost_flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);
|
panfrost_flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);
|
||||||
|
|
||||||
switch (query->type) {
|
switch (query->type) {
|
||||||
case PIPE_QUERY_OCCLUSION_COUNTER:
|
case PIPE_QUERY_OCCLUSION_COUNTER:
|
||||||
case PIPE_QUERY_OCCLUSION_PREDICATE:
|
case PIPE_QUERY_OCCLUSION_PREDICATE:
|
||||||
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: {
|
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: {
|
||||||
/* Read back the query results */
|
/* Read back the query results */
|
||||||
unsigned *result = (unsigned *) query->transfer.cpu;
|
unsigned *result = (unsigned *) query->transfer.cpu;
|
||||||
unsigned passed = *result;
|
unsigned passed = *result;
|
||||||
|
|
||||||
if (query->type == PIPE_QUERY_OCCLUSION_COUNTER) {
|
if (query->type == PIPE_QUERY_OCCLUSION_COUNTER) {
|
||||||
vresult->u64 = passed;
|
vresult->u64 = passed;
|
||||||
} else {
|
} else {
|
||||||
vresult->b = !!passed;
|
vresult->b = !!passed;
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
DBG("Skipped query get %d\n", query->type);
|
break;
|
||||||
break;
|
}
|
||||||
|
default:
|
||||||
|
DBG("Skipped query get %d\n", query->type);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2600,9 +2599,9 @@ panfrost_get_query_result(struct pipe_context *pipe,
|
||||||
|
|
||||||
static struct pipe_stream_output_target *
|
static struct pipe_stream_output_target *
|
||||||
panfrost_create_stream_output_target(struct pipe_context *pctx,
|
panfrost_create_stream_output_target(struct pipe_context *pctx,
|
||||||
struct pipe_resource *prsc,
|
struct pipe_resource *prsc,
|
||||||
unsigned buffer_offset,
|
unsigned buffer_offset,
|
||||||
unsigned buffer_size)
|
unsigned buffer_size)
|
||||||
{
|
{
|
||||||
struct pipe_stream_output_target *target;
|
struct pipe_stream_output_target *target;
|
||||||
|
|
||||||
|
|
@ -2623,7 +2622,7 @@ panfrost_create_stream_output_target(struct pipe_context *pctx,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_stream_output_target_destroy(struct pipe_context *pctx,
|
panfrost_stream_output_target_destroy(struct pipe_context *pctx,
|
||||||
struct pipe_stream_output_target *target)
|
struct pipe_stream_output_target *target)
|
||||||
{
|
{
|
||||||
pipe_resource_reference(&target->buffer, NULL);
|
pipe_resource_reference(&target->buffer, NULL);
|
||||||
ralloc_free(target);
|
ralloc_free(target);
|
||||||
|
|
@ -2631,9 +2630,9 @@ panfrost_stream_output_target_destroy(struct pipe_context *pctx,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_set_stream_output_targets(struct pipe_context *pctx,
|
panfrost_set_stream_output_targets(struct pipe_context *pctx,
|
||||||
unsigned num_targets,
|
unsigned num_targets,
|
||||||
struct pipe_stream_output_target **targets,
|
struct pipe_stream_output_target **targets,
|
||||||
const unsigned *offsets)
|
const unsigned *offsets)
|
||||||
{
|
{
|
||||||
/* STUB */
|
/* STUB */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ struct panfrost_context {
|
||||||
* there's no real advantage to doing so */
|
* there's no real advantage to doing so */
|
||||||
bool require_sfbd;
|
bool require_sfbd;
|
||||||
|
|
||||||
uint32_t out_sync;
|
uint32_t out_sync;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Corresponds to the CSO */
|
/* Corresponds to the CSO */
|
||||||
|
|
@ -336,24 +336,24 @@ panfrost_shader_compile(struct panfrost_context *ctx, struct mali_shader_meta *m
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_pack_work_groups_compute(
|
panfrost_pack_work_groups_compute(
|
||||||
struct mali_vertex_tiler_prefix *out,
|
struct mali_vertex_tiler_prefix *out,
|
||||||
unsigned num_x,
|
unsigned num_x,
|
||||||
unsigned num_y,
|
unsigned num_y,
|
||||||
unsigned num_z,
|
unsigned num_z,
|
||||||
unsigned size_x,
|
unsigned size_x,
|
||||||
unsigned size_y,
|
unsigned size_y,
|
||||||
unsigned size_z);
|
unsigned size_z);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_pack_work_groups_fused(
|
panfrost_pack_work_groups_fused(
|
||||||
struct mali_vertex_tiler_prefix *vertex,
|
struct mali_vertex_tiler_prefix *vertex,
|
||||||
struct mali_vertex_tiler_prefix *tiler,
|
struct mali_vertex_tiler_prefix *tiler,
|
||||||
unsigned num_x,
|
unsigned num_x,
|
||||||
unsigned num_y,
|
unsigned num_y,
|
||||||
unsigned num_z,
|
unsigned num_z,
|
||||||
unsigned size_x,
|
unsigned size_x,
|
||||||
unsigned size_y,
|
unsigned size_y,
|
||||||
unsigned size_z);
|
unsigned size_z);
|
||||||
|
|
||||||
/* Instancing */
|
/* Instancing */
|
||||||
|
|
||||||
|
|
@ -370,8 +370,8 @@ struct pan_shift_odd {
|
||||||
|
|
||||||
struct pan_shift_odd
|
struct pan_shift_odd
|
||||||
panfrost_padded_vertex_count(
|
panfrost_padded_vertex_count(
|
||||||
unsigned vertex_count,
|
unsigned vertex_count,
|
||||||
bool primitive_pot);
|
bool primitive_pot);
|
||||||
|
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
|
|
|
||||||
|
|
@ -129,12 +129,12 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, struct panfrost_bo *bo)
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_drm_allocate_slab(struct panfrost_screen *screen,
|
panfrost_drm_allocate_slab(struct panfrost_screen *screen,
|
||||||
struct panfrost_memory *mem,
|
struct panfrost_memory *mem,
|
||||||
size_t pages,
|
size_t pages,
|
||||||
bool same_va,
|
bool same_va,
|
||||||
int extra_flags,
|
int extra_flags,
|
||||||
int commit_count,
|
int commit_count,
|
||||||
int extent)
|
int extent)
|
||||||
{
|
{
|
||||||
// TODO cache allocations
|
// TODO cache allocations
|
||||||
// TODO properly handle errors
|
// TODO properly handle errors
|
||||||
|
|
@ -153,19 +153,19 @@ panfrost_drm_free_slab(struct panfrost_screen *screen, struct panfrost_memory *m
|
||||||
struct panfrost_bo *
|
struct panfrost_bo *
|
||||||
panfrost_drm_import_bo(struct panfrost_screen *screen, int fd)
|
panfrost_drm_import_bo(struct panfrost_screen *screen, int fd)
|
||||||
{
|
{
|
||||||
struct panfrost_bo *bo = rzalloc(screen, struct panfrost_bo);
|
struct panfrost_bo *bo = rzalloc(screen, struct panfrost_bo);
|
||||||
struct drm_panfrost_get_bo_offset get_bo_offset = {0,};
|
struct drm_panfrost_get_bo_offset get_bo_offset = {0,};
|
||||||
int ret;
|
int ret;
|
||||||
unsigned gem_handle;
|
unsigned gem_handle;
|
||||||
|
|
||||||
ret = drmPrimeFDToHandle(screen->fd, fd, &gem_handle);
|
ret = drmPrimeFDToHandle(screen->fd, fd, &gem_handle);
|
||||||
assert(!ret);
|
assert(!ret);
|
||||||
|
|
||||||
get_bo_offset.handle = gem_handle;
|
get_bo_offset.handle = gem_handle;
|
||||||
ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_BO_OFFSET, &get_bo_offset);
|
ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_BO_OFFSET, &get_bo_offset);
|
||||||
assert(!ret);
|
assert(!ret);
|
||||||
|
|
||||||
bo->gem_handle = gem_handle;
|
bo->gem_handle = gem_handle;
|
||||||
bo->gpu = (mali_ptr) get_bo_offset.offset;
|
bo->gpu = (mali_ptr) get_bo_offset.offset;
|
||||||
bo->size = lseek(fd, 0, SEEK_END);
|
bo->size = lseek(fd, 0, SEEK_END);
|
||||||
assert(bo->size > 0);
|
assert(bo->size > 0);
|
||||||
|
|
@ -205,25 +205,25 @@ panfrost_drm_submit_job(struct panfrost_context *ctx, u64 job_desc, int reqs)
|
||||||
|
|
||||||
submit.out_sync = ctx->out_sync;
|
submit.out_sync = ctx->out_sync;
|
||||||
|
|
||||||
submit.jc = job_desc;
|
submit.jc = job_desc;
|
||||||
submit.requirements = reqs;
|
submit.requirements = reqs;
|
||||||
|
|
||||||
bo_handles = calloc(job->bos->entries, sizeof(*bo_handles));
|
bo_handles = calloc(job->bos->entries, sizeof(*bo_handles));
|
||||||
assert(bo_handles);
|
assert(bo_handles);
|
||||||
|
|
||||||
set_foreach(job->bos, entry) {
|
set_foreach(job->bos, entry) {
|
||||||
struct panfrost_bo *bo = (struct panfrost_bo *)entry->key;
|
struct panfrost_bo *bo = (struct panfrost_bo *)entry->key;
|
||||||
assert(bo->gem_handle > 0);
|
assert(bo->gem_handle > 0);
|
||||||
bo_handles[submit.bo_handle_count++] = bo->gem_handle;
|
bo_handles[submit.bo_handle_count++] = bo->gem_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
submit.bo_handles = (u64) (uintptr_t) bo_handles;
|
submit.bo_handles = (u64) (uintptr_t) bo_handles;
|
||||||
ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
||||||
free(bo_handles);
|
free(bo_handles);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fprintf(stderr, "Error submitting: %m\n");
|
fprintf(stderr, "Error submitting: %m\n");
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trace the job if we're doing that */
|
/* Trace the job if we're doing that */
|
||||||
if (pan_debug & PAN_DBG_TRACE) {
|
if (pan_debug & PAN_DBG_TRACE) {
|
||||||
|
|
@ -232,13 +232,13 @@ panfrost_drm_submit_job(struct panfrost_context *ctx, u64 job_desc, int reqs)
|
||||||
pandecode_replay_jc(submit.jc, FALSE);
|
pandecode_replay_jc(submit.jc, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, bool is_scanout)
|
panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, bool is_scanout)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
|
struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
|
||||||
|
|
||||||
|
|
@ -296,18 +296,18 @@ panfrost_fence_create(struct panfrost_context *ctx)
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_drm_force_flush_fragment(struct panfrost_context *ctx,
|
panfrost_drm_force_flush_fragment(struct panfrost_context *ctx,
|
||||||
struct pipe_fence_handle **fence)
|
struct pipe_fence_handle **fence)
|
||||||
{
|
{
|
||||||
struct pipe_context *gallium = (struct pipe_context *) ctx;
|
struct pipe_context *gallium = (struct pipe_context *) ctx;
|
||||||
struct panfrost_screen *screen = pan_screen(gallium->screen);
|
struct panfrost_screen *screen = pan_screen(gallium->screen);
|
||||||
|
|
||||||
if (!screen->last_fragment_flushed) {
|
if (!screen->last_fragment_flushed) {
|
||||||
drmSyncobjWait(screen->fd, &ctx->out_sync, 1, INT64_MAX, 0, NULL);
|
drmSyncobjWait(screen->fd, &ctx->out_sync, 1, INT64_MAX, 0, NULL);
|
||||||
screen->last_fragment_flushed = true;
|
screen->last_fragment_flushed = true;
|
||||||
|
|
||||||
/* The job finished up, so we're safe to clean it up now */
|
/* The job finished up, so we're safe to clean it up now */
|
||||||
panfrost_free_job(ctx, screen->last_job);
|
panfrost_free_job(ctx, screen->last_job);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fence) {
|
if (fence) {
|
||||||
struct panfrost_fence *f = panfrost_fence_create(ctx);
|
struct panfrost_fence *f = panfrost_fence_create(ctx);
|
||||||
|
|
@ -322,11 +322,11 @@ panfrost_drm_query_gpu_version(struct panfrost_screen *screen)
|
||||||
struct drm_panfrost_get_param get_param = {0,};
|
struct drm_panfrost_get_param get_param = {0,};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
get_param.param = DRM_PANFROST_PARAM_GPU_PROD_ID;
|
get_param.param = DRM_PANFROST_PARAM_GPU_PROD_ID;
|
||||||
ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_PARAM, &get_param);
|
ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_PARAM, &get_param);
|
||||||
assert(!ret);
|
assert(!ret);
|
||||||
|
|
||||||
return get_param.value;
|
return get_param.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -341,8 +341,8 @@ panfrost_drm_init_context(struct panfrost_context *ctx)
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_drm_fence_reference(struct pipe_screen *screen,
|
panfrost_drm_fence_reference(struct pipe_screen *screen,
|
||||||
struct pipe_fence_handle **ptr,
|
struct pipe_fence_handle **ptr,
|
||||||
struct pipe_fence_handle *fence)
|
struct pipe_fence_handle *fence)
|
||||||
{
|
{
|
||||||
struct panfrost_fence **p = (struct panfrost_fence **)ptr;
|
struct panfrost_fence **p = (struct panfrost_fence **)ptr;
|
||||||
struct panfrost_fence *f = (struct panfrost_fence *)fence;
|
struct panfrost_fence *f = (struct panfrost_fence *)fence;
|
||||||
|
|
@ -357,9 +357,9 @@ panfrost_drm_fence_reference(struct pipe_screen *screen,
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
panfrost_drm_fence_finish(struct pipe_screen *pscreen,
|
panfrost_drm_fence_finish(struct pipe_screen *pscreen,
|
||||||
struct pipe_context *ctx,
|
struct pipe_context *ctx,
|
||||||
struct pipe_fence_handle *fence,
|
struct pipe_fence_handle *fence,
|
||||||
uint64_t timeout)
|
uint64_t timeout)
|
||||||
{
|
{
|
||||||
struct panfrost_screen *screen = pan_screen(pscreen);
|
struct panfrost_screen *screen = pan_screen(pscreen);
|
||||||
struct panfrost_fence *f = (struct panfrost_fence *)fence;
|
struct panfrost_fence *f = (struct panfrost_fence *)fence;
|
||||||
|
|
|
||||||
|
|
@ -90,42 +90,43 @@ static unsigned
|
||||||
panfrost_translate_channel_width(unsigned size)
|
panfrost_translate_channel_width(unsigned size)
|
||||||
{
|
{
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 4:
|
case 4:
|
||||||
return MALI_CHANNEL_4;
|
return MALI_CHANNEL_4;
|
||||||
case 8:
|
case 8:
|
||||||
return MALI_CHANNEL_8;
|
return MALI_CHANNEL_8;
|
||||||
case 16:
|
case 16:
|
||||||
return MALI_CHANNEL_16;
|
return MALI_CHANNEL_16;
|
||||||
case 32:
|
case 32:
|
||||||
return MALI_CHANNEL_32;
|
return MALI_CHANNEL_32;
|
||||||
default:
|
default:
|
||||||
unreachable("Invalid width");
|
unreachable("Invalid width");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
panfrost_translate_channel_type(unsigned type, unsigned size, bool norm) {
|
panfrost_translate_channel_type(unsigned type, unsigned size, bool norm)
|
||||||
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case UTIL_FORMAT_TYPE_UNSIGNED:
|
case UTIL_FORMAT_TYPE_UNSIGNED:
|
||||||
return norm ? MALI_FORMAT_UNORM : MALI_FORMAT_UINT;
|
return norm ? MALI_FORMAT_UNORM : MALI_FORMAT_UINT;
|
||||||
|
|
||||||
case UTIL_FORMAT_TYPE_SIGNED:
|
case UTIL_FORMAT_TYPE_SIGNED:
|
||||||
return norm ? MALI_FORMAT_SNORM : MALI_FORMAT_SINT;
|
return norm ? MALI_FORMAT_SNORM : MALI_FORMAT_SINT;
|
||||||
|
|
||||||
case UTIL_FORMAT_TYPE_FLOAT:
|
case UTIL_FORMAT_TYPE_FLOAT:
|
||||||
if (size == 16) {
|
if (size == 16) {
|
||||||
/* With FLOAT, fp16 */
|
/* With FLOAT, fp16 */
|
||||||
return MALI_FORMAT_SINT;
|
return MALI_FORMAT_SINT;
|
||||||
} else if (size == 32) {
|
} else if (size == 32) {
|
||||||
/* With FLOAT< fp32 */
|
/* With FLOAT< fp32 */
|
||||||
return MALI_FORMAT_UNORM;
|
return MALI_FORMAT_UNORM;
|
||||||
} else {
|
} else {
|
||||||
assert(0);
|
assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Invalid type");
|
unreachable("Invalid type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,12 +134,12 @@ panfrost_translate_channel_type(unsigned type, unsigned size, bool norm) {
|
||||||
* description */
|
* description */
|
||||||
|
|
||||||
enum mali_format
|
enum mali_format
|
||||||
panfrost_find_format(const struct util_format_description *desc)
|
panfrost_find_format(const struct util_format_description *desc) {
|
||||||
{
|
|
||||||
/* Find first non-VOID channel */
|
/* Find first non-VOID channel */
|
||||||
struct util_format_channel_description chan = desc->channel[0];
|
struct util_format_channel_description chan = desc->channel[0];
|
||||||
|
|
||||||
for (unsigned c = 0; c < 4; ++c) {
|
for (unsigned c = 0; c < 4; ++c)
|
||||||
|
{
|
||||||
if (desc->channel[c].type == UTIL_FORMAT_TYPE_VOID)
|
if (desc->channel[c].type == UTIL_FORMAT_TYPE_VOID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -147,94 +148,96 @@ panfrost_find_format(const struct util_format_description *desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for special formats */
|
/* Check for special formats */
|
||||||
switch (desc->format) {
|
switch (desc->format)
|
||||||
case PIPE_FORMAT_YV12:
|
{
|
||||||
case PIPE_FORMAT_YV16:
|
case PIPE_FORMAT_YV12:
|
||||||
case PIPE_FORMAT_IYUV:
|
case PIPE_FORMAT_YV16:
|
||||||
case PIPE_FORMAT_NV21:
|
case PIPE_FORMAT_IYUV:
|
||||||
fprintf(stderr, "YUV format type %s (%d) is not yet supported, but it's probably close to NV12!\n", desc->name, desc->format);
|
case PIPE_FORMAT_NV21:
|
||||||
assert(0);
|
fprintf(stderr, "YUV format type %s (%d) is not yet supported, but it's probably close to NV12!\n", desc->name, desc->format);
|
||||||
break;
|
assert(0);
|
||||||
|
break;
|
||||||
|
|
||||||
case PIPE_FORMAT_NV12:
|
case PIPE_FORMAT_NV12:
|
||||||
return MALI_NV12;
|
return MALI_NV12;
|
||||||
|
|
||||||
case PIPE_FORMAT_R10G10B10X2_UNORM:
|
case PIPE_FORMAT_R10G10B10X2_UNORM:
|
||||||
case PIPE_FORMAT_B10G10R10X2_UNORM:
|
case PIPE_FORMAT_B10G10R10X2_UNORM:
|
||||||
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
||||||
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
||||||
return MALI_RGB10_A2_UNORM;
|
return MALI_RGB10_A2_UNORM;
|
||||||
|
|
||||||
case PIPE_FORMAT_R10G10B10X2_SNORM:
|
case PIPE_FORMAT_R10G10B10X2_SNORM:
|
||||||
case PIPE_FORMAT_R10G10B10A2_SNORM:
|
case PIPE_FORMAT_R10G10B10A2_SNORM:
|
||||||
case PIPE_FORMAT_B10G10R10A2_SNORM:
|
case PIPE_FORMAT_B10G10R10A2_SNORM:
|
||||||
return MALI_RGB10_A2_SNORM;
|
return MALI_RGB10_A2_SNORM;
|
||||||
|
|
||||||
case PIPE_FORMAT_R10G10B10A2_UINT:
|
case PIPE_FORMAT_R10G10B10A2_UINT:
|
||||||
case PIPE_FORMAT_B10G10R10A2_UINT:
|
case PIPE_FORMAT_B10G10R10A2_UINT:
|
||||||
return MALI_RGB10_A2UI;
|
return MALI_RGB10_A2UI;
|
||||||
|
|
||||||
/* TODO: ZS isn't really special case */
|
/* TODO: ZS isn't really special case */
|
||||||
case PIPE_FORMAT_Z32_UNORM:
|
case PIPE_FORMAT_Z32_UNORM:
|
||||||
return MALI_Z32_UNORM;
|
return MALI_Z32_UNORM;
|
||||||
|
|
||||||
case PIPE_FORMAT_B5G6R5_UNORM:
|
case PIPE_FORMAT_B5G6R5_UNORM:
|
||||||
return MALI_RGB565;
|
return MALI_RGB565;
|
||||||
|
|
||||||
case PIPE_FORMAT_B5G5R5A1_UNORM:
|
case PIPE_FORMAT_B5G5R5A1_UNORM:
|
||||||
return MALI_RGB5_A1_UNORM;
|
return MALI_RGB5_A1_UNORM;
|
||||||
|
|
||||||
case PIPE_FORMAT_A1B5G5R5_UNORM:
|
case PIPE_FORMAT_A1B5G5R5_UNORM:
|
||||||
case PIPE_FORMAT_X1B5G5R5_UNORM:
|
case PIPE_FORMAT_X1B5G5R5_UNORM:
|
||||||
/* Not supported - this is backwards from OpenGL! */
|
/* Not supported - this is backwards from OpenGL! */
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PIPE_FORMAT_R32_FIXED:
|
case PIPE_FORMAT_R32_FIXED:
|
||||||
return MALI_R32_FIXED;
|
return MALI_R32_FIXED;
|
||||||
case PIPE_FORMAT_R32G32_FIXED:
|
case PIPE_FORMAT_R32G32_FIXED:
|
||||||
return MALI_RG32_FIXED;
|
return MALI_RG32_FIXED;
|
||||||
case PIPE_FORMAT_R32G32B32_FIXED:
|
case PIPE_FORMAT_R32G32B32_FIXED:
|
||||||
return MALI_RGB32_FIXED;
|
return MALI_RGB32_FIXED;
|
||||||
case PIPE_FORMAT_R32G32B32A32_FIXED:
|
case PIPE_FORMAT_R32G32B32A32_FIXED:
|
||||||
return MALI_RGBA32_FIXED;
|
return MALI_RGBA32_FIXED;
|
||||||
|
|
||||||
case PIPE_FORMAT_R11G11B10_FLOAT:
|
case PIPE_FORMAT_R11G11B10_FLOAT:
|
||||||
return MALI_R11F_G11F_B10F;
|
return MALI_R11F_G11F_B10F;
|
||||||
case PIPE_FORMAT_R9G9B9E5_FLOAT:
|
case PIPE_FORMAT_R9G9B9E5_FLOAT:
|
||||||
return MALI_R9F_G9F_B9F_E5F;
|
return MALI_R9F_G9F_B9F_E5F;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Fallthrough to default */
|
/* Fallthrough to default */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Formats must match in channel count */
|
/* Formats must match in channel count */
|
||||||
assert(desc->nr_channels >= 1 && desc->nr_channels <= 4);
|
assert(desc->nr_channels >= 1 && desc->nr_channels <= 4);
|
||||||
unsigned format = MALI_NR_CHANNELS(desc->nr_channels);
|
unsigned format = MALI_NR_CHANNELS(desc->nr_channels);
|
||||||
|
|
||||||
switch (chan.type) {
|
switch (chan.type)
|
||||||
case UTIL_FORMAT_TYPE_UNSIGNED:
|
{
|
||||||
case UTIL_FORMAT_TYPE_SIGNED:
|
case UTIL_FORMAT_TYPE_UNSIGNED:
|
||||||
case UTIL_FORMAT_TYPE_FIXED:
|
case UTIL_FORMAT_TYPE_SIGNED:
|
||||||
/* Channel width */
|
case UTIL_FORMAT_TYPE_FIXED:
|
||||||
format |= panfrost_translate_channel_width(chan.size);
|
/* Channel width */
|
||||||
|
format |= panfrost_translate_channel_width(chan.size);
|
||||||
|
|
||||||
/* Channel type */
|
/* Channel type */
|
||||||
format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
|
format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UTIL_FORMAT_TYPE_FLOAT:
|
case UTIL_FORMAT_TYPE_FLOAT:
|
||||||
/* Float formats use a special width and encode width
|
/* Float formats use a special width and encode width
|
||||||
* with type mixed */
|
* with type mixed */
|
||||||
|
|
||||||
format |= MALI_CHANNEL_FLOAT;
|
format |= MALI_CHANNEL_FLOAT;
|
||||||
format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
|
format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("%s\n", util_format_name(desc->format));
|
printf("%s\n", util_format_name(desc->format));
|
||||||
unreachable("Invalid format type");
|
unreachable("Invalid format type");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (enum mali_format) format;
|
return (enum mali_format) format;
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ mali_ptr
|
||||||
panfrost_fragment_job(struct panfrost_context *ctx, bool has_draws)
|
panfrost_fragment_job(struct panfrost_context *ctx, bool has_draws)
|
||||||
{
|
{
|
||||||
mali_ptr framebuffer = ctx->require_sfbd ?
|
mali_ptr framebuffer = ctx->require_sfbd ?
|
||||||
panfrost_sfbd_fragment(ctx, has_draws) :
|
panfrost_sfbd_fragment(ctx, has_draws) :
|
||||||
panfrost_mfbd_fragment(ctx, has_draws);
|
panfrost_mfbd_fragment(ctx, has_draws);
|
||||||
|
|
||||||
/* Mark the affected buffers as initialized, since we're writing to it */
|
/* Mark the affected buffers as initialized, since we're writing to it */
|
||||||
struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
|
struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,8 @@ static struct pan_shift_odd
|
||||||
panfrost_small_padded_vertex_count(unsigned idx)
|
panfrost_small_padded_vertex_count(unsigned idx)
|
||||||
{
|
{
|
||||||
return pan_factored(
|
return pan_factored(
|
||||||
small_lut[idx].pot,
|
small_lut[idx].pot,
|
||||||
small_lut[idx].odd);
|
small_lut[idx].odd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pan_shift_odd
|
static struct pan_shift_odd
|
||||||
|
|
@ -144,15 +144,15 @@ panfrost_large_padded_vertex_count(uint32_t vertex_count)
|
||||||
|
|
||||||
struct pan_shift_odd
|
struct pan_shift_odd
|
||||||
panfrost_padded_vertex_count(
|
panfrost_padded_vertex_count(
|
||||||
unsigned vertex_count,
|
unsigned vertex_count,
|
||||||
bool pot)
|
bool pot)
|
||||||
{
|
{
|
||||||
assert(vertex_count > 0);
|
assert(vertex_count > 0);
|
||||||
|
|
||||||
if (vertex_count < 20) {
|
if (vertex_count < 20) {
|
||||||
/* Add an off-by-one if it won't align naturally (quirk of the hardware) */
|
/* Add an off-by-one if it won't align naturally (quirk of the hardware) */
|
||||||
//if (!pot)
|
//if (!pot)
|
||||||
// vertex_count++;
|
// vertex_count++;
|
||||||
|
|
||||||
return panfrost_small_padded_vertex_count(vertex_count);
|
return panfrost_small_padded_vertex_count(vertex_count);
|
||||||
} else
|
} else
|
||||||
|
|
@ -164,13 +164,13 @@ panfrost_padded_vertex_count(
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
panfrost_vertex_instanced(
|
panfrost_vertex_instanced(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_resource *rsrc,
|
struct panfrost_resource *rsrc,
|
||||||
unsigned divisor,
|
unsigned divisor,
|
||||||
union mali_attr *attrs,
|
union mali_attr *attrs,
|
||||||
mali_ptr addr,
|
mali_ptr addr,
|
||||||
unsigned vertex_count,
|
unsigned vertex_count,
|
||||||
unsigned instance_count)
|
unsigned instance_count)
|
||||||
{
|
{
|
||||||
/* First, grab the padded vertex count */
|
/* First, grab the padded vertex count */
|
||||||
|
|
||||||
|
|
@ -328,7 +328,7 @@ panfrost_emit_vertex_data(struct panfrost_job *batch)
|
||||||
attrs[k++].elements |= MALI_ATTR_LINEAR;
|
attrs[k++].elements |= MALI_ATTR_LINEAR;
|
||||||
} else {
|
} else {
|
||||||
k += panfrost_vertex_instanced(
|
k += panfrost_vertex_instanced(
|
||||||
batch, rsrc, divisor, &attrs[k], addr, vertex_count, instanced_count);
|
batch, rsrc, divisor, &attrs[k], addr, vertex_count, instanced_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,13 @@
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_pack_work_groups_compute(
|
panfrost_pack_work_groups_compute(
|
||||||
struct mali_vertex_tiler_prefix *out,
|
struct mali_vertex_tiler_prefix *out,
|
||||||
unsigned num_x,
|
unsigned num_x,
|
||||||
unsigned num_y,
|
unsigned num_y,
|
||||||
unsigned num_z,
|
unsigned num_z,
|
||||||
unsigned size_x,
|
unsigned size_x,
|
||||||
unsigned size_y,
|
unsigned size_y,
|
||||||
unsigned size_z)
|
unsigned size_z)
|
||||||
{
|
{
|
||||||
/* First of all, all 6 values are off-by-one (strictly positive).
|
/* First of all, all 6 values are off-by-one (strictly positive).
|
||||||
* Account for that, first by ensuring all values are strictly positive
|
* Account for that, first by ensuring all values are strictly positive
|
||||||
|
|
@ -104,14 +104,14 @@ panfrost_pack_work_groups_compute(
|
||||||
/* Packs vertex/tiler descriptors simultaneously */
|
/* Packs vertex/tiler descriptors simultaneously */
|
||||||
void
|
void
|
||||||
panfrost_pack_work_groups_fused(
|
panfrost_pack_work_groups_fused(
|
||||||
struct mali_vertex_tiler_prefix *vertex,
|
struct mali_vertex_tiler_prefix *vertex,
|
||||||
struct mali_vertex_tiler_prefix *tiler,
|
struct mali_vertex_tiler_prefix *tiler,
|
||||||
unsigned num_x,
|
unsigned num_x,
|
||||||
unsigned num_y,
|
unsigned num_y,
|
||||||
unsigned num_z,
|
unsigned num_z,
|
||||||
unsigned size_x,
|
unsigned size_x,
|
||||||
unsigned size_y,
|
unsigned size_y,
|
||||||
unsigned size_z)
|
unsigned size_z)
|
||||||
{
|
{
|
||||||
panfrost_pack_work_groups_compute(vertex, num_x, num_y, num_z, size_x, size_y, size_z);
|
panfrost_pack_work_groups_compute(vertex, num_x, num_y, num_z, size_x, size_y, size_z);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ panfrost_free_job(struct panfrost_context *ctx, struct panfrost_job *job)
|
||||||
|
|
||||||
struct panfrost_job *
|
struct panfrost_job *
|
||||||
panfrost_get_job(struct panfrost_context *ctx,
|
panfrost_get_job(struct panfrost_context *ctx,
|
||||||
struct pipe_surface **cbufs, struct pipe_surface *zsbuf)
|
struct pipe_surface **cbufs, struct pipe_surface *zsbuf)
|
||||||
{
|
{
|
||||||
/* Lookup the job first */
|
/* Lookup the job first */
|
||||||
|
|
||||||
|
|
@ -141,11 +141,11 @@ panfrost_job_add_bo(struct panfrost_job *job, struct panfrost_bo *bo)
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_flush_jobs_writing_resource(struct panfrost_context *panfrost,
|
panfrost_flush_jobs_writing_resource(struct panfrost_context *panfrost,
|
||||||
struct pipe_resource *prsc)
|
struct pipe_resource *prsc)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
struct hash_entry *entry = _mesa_hash_table_search(panfrost->write_jobs,
|
struct hash_entry *entry = _mesa_hash_table_search(panfrost->write_jobs,
|
||||||
prsc);
|
prsc);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
struct panfrost_job *job = entry->data;
|
struct panfrost_job *job = entry->data;
|
||||||
panfrost_job_submit(panfrost, job);
|
panfrost_job_submit(panfrost, job);
|
||||||
|
|
@ -175,7 +175,7 @@ panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_job *job)
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_job_set_requirements(struct panfrost_context *ctx,
|
panfrost_job_set_requirements(struct panfrost_context *ctx,
|
||||||
struct panfrost_job *job)
|
struct panfrost_job *job)
|
||||||
{
|
{
|
||||||
if (ctx->rasterizer && ctx->rasterizer->base.multisample)
|
if (ctx->rasterizer && ctx->rasterizer->base.multisample)
|
||||||
job->requirements |= PAN_REQ_MSAA;
|
job->requirements |= PAN_REQ_MSAA;
|
||||||
|
|
@ -217,10 +217,10 @@ pan_pack_color(uint32_t *packed, const union pipe_color_union *color, enum pipe_
|
||||||
|
|
||||||
if (util_format_is_rgba8_variant(desc)) {
|
if (util_format_is_rgba8_variant(desc)) {
|
||||||
pan_pack_color_32(packed,
|
pan_pack_color_32(packed,
|
||||||
(float_to_ubyte(clear_alpha) << 24) |
|
(float_to_ubyte(clear_alpha) << 24) |
|
||||||
(float_to_ubyte(color->f[2]) << 16) |
|
(float_to_ubyte(color->f[2]) << 16) |
|
||||||
(float_to_ubyte(color->f[1]) << 8) |
|
(float_to_ubyte(color->f[1]) << 8) |
|
||||||
(float_to_ubyte(color->f[0]) << 0));
|
(float_to_ubyte(color->f[0]) << 0));
|
||||||
} else if (format == PIPE_FORMAT_B5G6R5_UNORM) {
|
} else if (format == PIPE_FORMAT_B5G6R5_UNORM) {
|
||||||
/* First, we convert the components to R5, G6, B5 separately */
|
/* First, we convert the components to R5, G6, B5 separately */
|
||||||
unsigned r5 = CLAMP(color->f[0], 0.0, 1.0) * 31.0;
|
unsigned r5 = CLAMP(color->f[0], 0.0, 1.0) * 31.0;
|
||||||
|
|
@ -279,10 +279,10 @@ pan_pack_color(uint32_t *packed, const union pipe_color_union *color, enum pipe_
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_job_clear(struct panfrost_context *ctx,
|
panfrost_job_clear(struct panfrost_context *ctx,
|
||||||
struct panfrost_job *job,
|
struct panfrost_job *job,
|
||||||
unsigned buffers,
|
unsigned buffers,
|
||||||
const union pipe_color_union *color,
|
const union pipe_color_union *color,
|
||||||
double depth, unsigned stencil)
|
double depth, unsigned stencil)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (buffers & PIPE_CLEAR_COLOR) {
|
if (buffers & PIPE_CLEAR_COLOR) {
|
||||||
|
|
@ -311,13 +311,13 @@ panfrost_job_clear(struct panfrost_context *ctx,
|
||||||
* would emit a quad instead and we wouldn't go down this code path) */
|
* would emit a quad instead and we wouldn't go down this code path) */
|
||||||
|
|
||||||
panfrost_job_union_scissor(job, 0, 0,
|
panfrost_job_union_scissor(job, 0, 0,
|
||||||
ctx->pipe_framebuffer.width,
|
ctx->pipe_framebuffer.width,
|
||||||
ctx->pipe_framebuffer.height);
|
ctx->pipe_framebuffer.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_flush_jobs_reading_resource(struct panfrost_context *panfrost,
|
panfrost_flush_jobs_reading_resource(struct panfrost_context *panfrost,
|
||||||
struct pipe_resource *prsc)
|
struct pipe_resource *prsc)
|
||||||
{
|
{
|
||||||
struct panfrost_resource *rsc = pan_resource(prsc);
|
struct panfrost_resource *rsc = pan_resource(prsc);
|
||||||
|
|
||||||
|
|
@ -351,8 +351,8 @@ panfrost_job_hash(const void *key)
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_job_union_scissor(struct panfrost_job *job,
|
panfrost_job_union_scissor(struct panfrost_job *job,
|
||||||
unsigned minx, unsigned miny,
|
unsigned minx, unsigned miny,
|
||||||
unsigned maxx, unsigned maxy)
|
unsigned maxx, unsigned maxy)
|
||||||
{
|
{
|
||||||
job->minx = MIN2(job->minx, minx);
|
job->minx = MIN2(job->minx, minx);
|
||||||
job->miny = MIN2(job->miny, miny);
|
job->miny = MIN2(job->miny, miny);
|
||||||
|
|
@ -368,6 +368,6 @@ panfrost_job_init(struct panfrost_context *ctx)
|
||||||
panfrost_job_compare);
|
panfrost_job_compare);
|
||||||
|
|
||||||
ctx->write_jobs = _mesa_hash_table_create(ctx,
|
ctx->write_jobs = _mesa_hash_table_create(ctx,
|
||||||
_mesa_hash_pointer,
|
_mesa_hash_pointer,
|
||||||
_mesa_key_pointer_equal);
|
_mesa_key_pointer_equal);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ panfrost_free_job(struct panfrost_context *ctx, struct panfrost_job *job);
|
||||||
|
|
||||||
struct panfrost_job *
|
struct panfrost_job *
|
||||||
panfrost_get_job(struct panfrost_context *ctx,
|
panfrost_get_job(struct panfrost_context *ctx,
|
||||||
struct pipe_surface **cbufs, struct pipe_surface *zsbuf);
|
struct pipe_surface **cbufs, struct pipe_surface *zsbuf);
|
||||||
|
|
||||||
struct panfrost_job *
|
struct panfrost_job *
|
||||||
panfrost_get_job_for_fbo(struct panfrost_context *ctx);
|
panfrost_get_job_for_fbo(struct panfrost_context *ctx);
|
||||||
|
|
@ -131,59 +131,59 @@ panfrost_job_add_bo(struct panfrost_job *job, struct panfrost_bo *bo);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_flush_jobs_writing_resource(struct panfrost_context *panfrost,
|
panfrost_flush_jobs_writing_resource(struct panfrost_context *panfrost,
|
||||||
struct pipe_resource *prsc);
|
struct pipe_resource *prsc);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_flush_jobs_reading_resource(struct panfrost_context *panfrost,
|
panfrost_flush_jobs_reading_resource(struct panfrost_context *panfrost,
|
||||||
struct pipe_resource *prsc);
|
struct pipe_resource *prsc);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_job *job);
|
panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_job *job);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_job_set_requirements(struct panfrost_context *ctx,
|
panfrost_job_set_requirements(struct panfrost_context *ctx,
|
||||||
struct panfrost_job *job);
|
struct panfrost_job *job);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_job_clear(struct panfrost_context *ctx,
|
panfrost_job_clear(struct panfrost_context *ctx,
|
||||||
struct panfrost_job *job,
|
struct panfrost_job *job,
|
||||||
unsigned buffers,
|
unsigned buffers,
|
||||||
const union pipe_color_union *color,
|
const union pipe_color_union *color,
|
||||||
double depth, unsigned stencil);
|
double depth, unsigned stencil);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_job_union_scissor(struct panfrost_job *job,
|
panfrost_job_union_scissor(struct panfrost_job *job,
|
||||||
unsigned minx, unsigned miny,
|
unsigned minx, unsigned miny,
|
||||||
unsigned maxx, unsigned maxy);
|
unsigned maxx, unsigned maxy);
|
||||||
|
|
||||||
/* Scoreboarding */
|
/* Scoreboarding */
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_compute_job(
|
panfrost_scoreboard_queue_compute_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer job);
|
struct panfrost_transfer job);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_vertex_job(
|
panfrost_scoreboard_queue_vertex_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer vertex,
|
struct panfrost_transfer vertex,
|
||||||
bool requires_tiling);
|
bool requires_tiling);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_tiler_job(
|
panfrost_scoreboard_queue_tiler_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer tiler);
|
struct panfrost_transfer tiler);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_fused_job(
|
panfrost_scoreboard_queue_fused_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer vertex,
|
struct panfrost_transfer vertex,
|
||||||
struct panfrost_transfer tiler);
|
struct panfrost_transfer tiler);
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_fused_job_prepend(
|
panfrost_scoreboard_queue_fused_job_prepend(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer vertex,
|
struct panfrost_transfer vertex,
|
||||||
struct panfrost_transfer tiler);
|
struct panfrost_transfer tiler);
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_link_batch(struct panfrost_job *batch);
|
panfrost_scoreboard_link_batch(struct panfrost_job *batch);
|
||||||
|
|
|
||||||
|
|
@ -89,87 +89,87 @@ panfrost_mfbd_format(struct pipe_surface *surf)
|
||||||
/* Set flags for alternative formats */
|
/* Set flags for alternative formats */
|
||||||
|
|
||||||
switch (linearized) {
|
switch (linearized) {
|
||||||
case PIPE_FORMAT_B5G6R5_UNORM:
|
case PIPE_FORMAT_B5G6R5_UNORM:
|
||||||
fmt.unk1 = 0x14000000;
|
fmt.unk1 = 0x14000000;
|
||||||
fmt.nr_channels = MALI_POSITIVE(2);
|
fmt.nr_channels = MALI_POSITIVE(2);
|
||||||
fmt.unk3 |= 0x1;
|
fmt.unk3 |= 0x1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PIPE_FORMAT_A4B4G4R4_UNORM:
|
case PIPE_FORMAT_A4B4G4R4_UNORM:
|
||||||
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
||||||
fmt.unk1 = 0x10000000;
|
fmt.unk1 = 0x10000000;
|
||||||
fmt.unk3 = 0x5;
|
fmt.unk3 = 0x5;
|
||||||
fmt.nr_channels = MALI_POSITIVE(1);
|
fmt.nr_channels = MALI_POSITIVE(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
||||||
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
||||||
case PIPE_FORMAT_R10G10B10X2_UNORM:
|
case PIPE_FORMAT_R10G10B10X2_UNORM:
|
||||||
case PIPE_FORMAT_B10G10R10X2_UNORM:
|
case PIPE_FORMAT_B10G10R10X2_UNORM:
|
||||||
fmt.unk1 = 0x08000000;
|
fmt.unk1 = 0x08000000;
|
||||||
fmt.unk3 = 0x6;
|
fmt.unk3 = 0x6;
|
||||||
fmt.nr_channels = MALI_POSITIVE(1);
|
fmt.nr_channels = MALI_POSITIVE(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Generic 8-bit */
|
/* Generic 8-bit */
|
||||||
case PIPE_FORMAT_R8_UINT:
|
case PIPE_FORMAT_R8_UINT:
|
||||||
case PIPE_FORMAT_R8_SINT:
|
case PIPE_FORMAT_R8_SINT:
|
||||||
fmt.unk1 = 0x80000000;
|
fmt.unk1 = 0x80000000;
|
||||||
fmt.unk3 = 0x0;
|
fmt.unk3 = 0x0;
|
||||||
fmt.nr_channels = MALI_POSITIVE(1);
|
fmt.nr_channels = MALI_POSITIVE(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Generic 32-bit */
|
/* Generic 32-bit */
|
||||||
case PIPE_FORMAT_R11G11B10_FLOAT:
|
case PIPE_FORMAT_R11G11B10_FLOAT:
|
||||||
case PIPE_FORMAT_R8G8B8A8_UINT:
|
case PIPE_FORMAT_R8G8B8A8_UINT:
|
||||||
case PIPE_FORMAT_R8G8B8A8_SINT:
|
case PIPE_FORMAT_R8G8B8A8_SINT:
|
||||||
case PIPE_FORMAT_R16G16_FLOAT:
|
case PIPE_FORMAT_R16G16_FLOAT:
|
||||||
case PIPE_FORMAT_R16G16_UINT:
|
case PIPE_FORMAT_R16G16_UINT:
|
||||||
case PIPE_FORMAT_R16G16_SINT:
|
case PIPE_FORMAT_R16G16_SINT:
|
||||||
case PIPE_FORMAT_R32_FLOAT:
|
case PIPE_FORMAT_R32_FLOAT:
|
||||||
case PIPE_FORMAT_R32_UINT:
|
case PIPE_FORMAT_R32_UINT:
|
||||||
case PIPE_FORMAT_R32_SINT:
|
case PIPE_FORMAT_R32_SINT:
|
||||||
case PIPE_FORMAT_R10G10B10A2_UINT:
|
case PIPE_FORMAT_R10G10B10A2_UINT:
|
||||||
fmt.unk1 = 0x88000000;
|
fmt.unk1 = 0x88000000;
|
||||||
fmt.unk3 = 0x0;
|
fmt.unk3 = 0x0;
|
||||||
fmt.nr_channels = MALI_POSITIVE(4);
|
fmt.nr_channels = MALI_POSITIVE(4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Generic 16-bit */
|
/* Generic 16-bit */
|
||||||
case PIPE_FORMAT_R8G8_UINT:
|
case PIPE_FORMAT_R8G8_UINT:
|
||||||
case PIPE_FORMAT_R8G8_SINT:
|
case PIPE_FORMAT_R8G8_SINT:
|
||||||
case PIPE_FORMAT_R16_FLOAT:
|
case PIPE_FORMAT_R16_FLOAT:
|
||||||
case PIPE_FORMAT_R16_UINT:
|
case PIPE_FORMAT_R16_UINT:
|
||||||
case PIPE_FORMAT_R16_SINT:
|
case PIPE_FORMAT_R16_SINT:
|
||||||
case PIPE_FORMAT_B5G5R5A1_UNORM:
|
case PIPE_FORMAT_B5G5R5A1_UNORM:
|
||||||
fmt.unk1 = 0x84000000;
|
fmt.unk1 = 0x84000000;
|
||||||
fmt.unk3 = 0x0;
|
fmt.unk3 = 0x0;
|
||||||
fmt.nr_channels = MALI_POSITIVE(2);
|
fmt.nr_channels = MALI_POSITIVE(2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Generic 64-bit */
|
/* Generic 64-bit */
|
||||||
case PIPE_FORMAT_R32G32_FLOAT:
|
case PIPE_FORMAT_R32G32_FLOAT:
|
||||||
case PIPE_FORMAT_R32G32_SINT:
|
case PIPE_FORMAT_R32G32_SINT:
|
||||||
case PIPE_FORMAT_R32G32_UINT:
|
case PIPE_FORMAT_R32G32_UINT:
|
||||||
case PIPE_FORMAT_R16G16B16A16_FLOAT:
|
case PIPE_FORMAT_R16G16B16A16_FLOAT:
|
||||||
case PIPE_FORMAT_R16G16B16A16_SINT:
|
case PIPE_FORMAT_R16G16B16A16_SINT:
|
||||||
case PIPE_FORMAT_R16G16B16A16_UINT:
|
case PIPE_FORMAT_R16G16B16A16_UINT:
|
||||||
fmt.unk1 = 0x8c000000;
|
fmt.unk1 = 0x8c000000;
|
||||||
fmt.unk3 = 0x1;
|
fmt.unk3 = 0x1;
|
||||||
fmt.nr_channels = MALI_POSITIVE(2);
|
fmt.nr_channels = MALI_POSITIVE(2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Generic 128-bit */
|
/* Generic 128-bit */
|
||||||
case PIPE_FORMAT_R32G32B32A32_FLOAT:
|
case PIPE_FORMAT_R32G32B32A32_FLOAT:
|
||||||
case PIPE_FORMAT_R32G32B32A32_SINT:
|
case PIPE_FORMAT_R32G32B32A32_SINT:
|
||||||
case PIPE_FORMAT_R32G32B32A32_UINT:
|
case PIPE_FORMAT_R32G32B32A32_UINT:
|
||||||
fmt.unk1 = 0x90000000;
|
fmt.unk1 = 0x90000000;
|
||||||
fmt.unk3 = 0x1;
|
fmt.unk3 = 0x1;
|
||||||
fmt.nr_channels = MALI_POSITIVE(4);
|
fmt.nr_channels = MALI_POSITIVE(4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Invalid format rendering");
|
unreachable("Invalid format rendering");
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt;
|
return fmt;
|
||||||
|
|
@ -178,11 +178,11 @@ panfrost_mfbd_format(struct pipe_surface *surf)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_mfbd_clear(
|
panfrost_mfbd_clear(
|
||||||
struct panfrost_job *job,
|
struct panfrost_job *job,
|
||||||
struct bifrost_framebuffer *fb,
|
struct bifrost_framebuffer *fb,
|
||||||
struct bifrost_fb_extra *fbx,
|
struct bifrost_fb_extra *fbx,
|
||||||
struct bifrost_render_target *rts,
|
struct bifrost_render_target *rts,
|
||||||
unsigned rt_count)
|
unsigned rt_count)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < rt_count; ++i) {
|
for (unsigned i = 0; i < rt_count; ++i) {
|
||||||
if (!(job->clear & (PIPE_CLEAR_COLOR0 << i)))
|
if (!(job->clear & (PIPE_CLEAR_COLOR0 << i)))
|
||||||
|
|
@ -205,8 +205,8 @@ panfrost_mfbd_clear(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_mfbd_set_cbuf(
|
panfrost_mfbd_set_cbuf(
|
||||||
struct bifrost_render_target *rt,
|
struct bifrost_render_target *rt,
|
||||||
struct pipe_surface *surf)
|
struct pipe_surface *surf)
|
||||||
{
|
{
|
||||||
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
||||||
|
|
||||||
|
|
@ -249,9 +249,9 @@ panfrost_mfbd_set_cbuf(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_mfbd_set_zsbuf(
|
panfrost_mfbd_set_zsbuf(
|
||||||
struct bifrost_framebuffer *fb,
|
struct bifrost_framebuffer *fb,
|
||||||
struct bifrost_fb_extra *fbx,
|
struct bifrost_fb_extra *fbx,
|
||||||
struct pipe_surface *surf)
|
struct pipe_surface *surf)
|
||||||
{
|
{
|
||||||
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
||||||
|
|
||||||
|
|
@ -303,11 +303,11 @@ panfrost_mfbd_set_zsbuf(
|
||||||
|
|
||||||
static mali_ptr
|
static mali_ptr
|
||||||
panfrost_mfbd_upload(
|
panfrost_mfbd_upload(
|
||||||
struct panfrost_context *ctx,
|
struct panfrost_context *ctx,
|
||||||
struct bifrost_framebuffer *fb,
|
struct bifrost_framebuffer *fb,
|
||||||
struct bifrost_fb_extra *fbx,
|
struct bifrost_fb_extra *fbx,
|
||||||
struct bifrost_render_target *rts,
|
struct bifrost_render_target *rts,
|
||||||
unsigned cbufs)
|
unsigned cbufs)
|
||||||
{
|
{
|
||||||
off_t offset = 0;
|
off_t offset = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,94 +33,94 @@
|
||||||
#define DEFINE_CASE(name) case MALI_## name: return "MALI_" #name
|
#define DEFINE_CASE(name) case MALI_## name: return "MALI_" #name
|
||||||
char *pandecode_format_name(enum mali_format format)
|
char *pandecode_format_name(enum mali_format format)
|
||||||
{
|
{
|
||||||
static char unk_format_str[5];
|
static char unk_format_str[5];
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
DEFINE_CASE(RGB565);
|
DEFINE_CASE(RGB565);
|
||||||
DEFINE_CASE(RGB5_A1_UNORM);
|
DEFINE_CASE(RGB5_A1_UNORM);
|
||||||
DEFINE_CASE(RGB10_A2_UNORM);
|
DEFINE_CASE(RGB10_A2_UNORM);
|
||||||
DEFINE_CASE(RGB10_A2_SNORM);
|
DEFINE_CASE(RGB10_A2_SNORM);
|
||||||
DEFINE_CASE(RGB10_A2UI);
|
DEFINE_CASE(RGB10_A2UI);
|
||||||
DEFINE_CASE(RGB10_A2I);
|
DEFINE_CASE(RGB10_A2I);
|
||||||
DEFINE_CASE(NV12);
|
DEFINE_CASE(NV12);
|
||||||
DEFINE_CASE(Z32_UNORM);
|
DEFINE_CASE(Z32_UNORM);
|
||||||
DEFINE_CASE(R32_FIXED);
|
DEFINE_CASE(R32_FIXED);
|
||||||
DEFINE_CASE(RG32_FIXED);
|
DEFINE_CASE(RG32_FIXED);
|
||||||
DEFINE_CASE(RGB32_FIXED);
|
DEFINE_CASE(RGB32_FIXED);
|
||||||
DEFINE_CASE(RGBA32_FIXED);
|
DEFINE_CASE(RGBA32_FIXED);
|
||||||
DEFINE_CASE(R11F_G11F_B10F);
|
DEFINE_CASE(R11F_G11F_B10F);
|
||||||
DEFINE_CASE(R9F_G9F_B9F_E5F);
|
DEFINE_CASE(R9F_G9F_B9F_E5F);
|
||||||
DEFINE_CASE(VARYING_POS);
|
DEFINE_CASE(VARYING_POS);
|
||||||
DEFINE_CASE(VARYING_DISCARD);
|
DEFINE_CASE(VARYING_DISCARD);
|
||||||
|
|
||||||
DEFINE_CASE(R8_SNORM);
|
DEFINE_CASE(R8_SNORM);
|
||||||
DEFINE_CASE(R16_SNORM);
|
DEFINE_CASE(R16_SNORM);
|
||||||
DEFINE_CASE(R32_SNORM);
|
DEFINE_CASE(R32_SNORM);
|
||||||
DEFINE_CASE(RG8_SNORM);
|
DEFINE_CASE(RG8_SNORM);
|
||||||
DEFINE_CASE(RG16_SNORM);
|
DEFINE_CASE(RG16_SNORM);
|
||||||
DEFINE_CASE(RG32_SNORM);
|
DEFINE_CASE(RG32_SNORM);
|
||||||
DEFINE_CASE(RGB8_SNORM);
|
DEFINE_CASE(RGB8_SNORM);
|
||||||
DEFINE_CASE(RGB16_SNORM);
|
DEFINE_CASE(RGB16_SNORM);
|
||||||
DEFINE_CASE(RGB32_SNORM);
|
DEFINE_CASE(RGB32_SNORM);
|
||||||
DEFINE_CASE(RGBA8_SNORM);
|
DEFINE_CASE(RGBA8_SNORM);
|
||||||
DEFINE_CASE(RGBA16_SNORM);
|
DEFINE_CASE(RGBA16_SNORM);
|
||||||
DEFINE_CASE(RGBA32_SNORM);
|
DEFINE_CASE(RGBA32_SNORM);
|
||||||
|
|
||||||
DEFINE_CASE(R8UI);
|
DEFINE_CASE(R8UI);
|
||||||
DEFINE_CASE(R16UI);
|
DEFINE_CASE(R16UI);
|
||||||
DEFINE_CASE(R32UI);
|
DEFINE_CASE(R32UI);
|
||||||
DEFINE_CASE(RG8UI);
|
DEFINE_CASE(RG8UI);
|
||||||
DEFINE_CASE(RG16UI);
|
DEFINE_CASE(RG16UI);
|
||||||
DEFINE_CASE(RG32UI);
|
DEFINE_CASE(RG32UI);
|
||||||
DEFINE_CASE(RGB8UI);
|
DEFINE_CASE(RGB8UI);
|
||||||
DEFINE_CASE(RGB16UI);
|
DEFINE_CASE(RGB16UI);
|
||||||
DEFINE_CASE(RGB32UI);
|
DEFINE_CASE(RGB32UI);
|
||||||
DEFINE_CASE(RGBA8UI);
|
DEFINE_CASE(RGBA8UI);
|
||||||
DEFINE_CASE(RGBA16UI);
|
DEFINE_CASE(RGBA16UI);
|
||||||
DEFINE_CASE(RGBA32UI);
|
DEFINE_CASE(RGBA32UI);
|
||||||
|
|
||||||
DEFINE_CASE(R8_UNORM);
|
DEFINE_CASE(R8_UNORM);
|
||||||
DEFINE_CASE(R16_UNORM);
|
DEFINE_CASE(R16_UNORM);
|
||||||
DEFINE_CASE(R32_UNORM);
|
DEFINE_CASE(R32_UNORM);
|
||||||
DEFINE_CASE(R32F);
|
DEFINE_CASE(R32F);
|
||||||
DEFINE_CASE(RG8_UNORM);
|
DEFINE_CASE(RG8_UNORM);
|
||||||
DEFINE_CASE(RG16_UNORM);
|
DEFINE_CASE(RG16_UNORM);
|
||||||
DEFINE_CASE(RG32_UNORM);
|
DEFINE_CASE(RG32_UNORM);
|
||||||
DEFINE_CASE(RG32F);
|
DEFINE_CASE(RG32F);
|
||||||
DEFINE_CASE(RGB8_UNORM);
|
DEFINE_CASE(RGB8_UNORM);
|
||||||
DEFINE_CASE(RGB16_UNORM);
|
DEFINE_CASE(RGB16_UNORM);
|
||||||
DEFINE_CASE(RGB32_UNORM);
|
DEFINE_CASE(RGB32_UNORM);
|
||||||
DEFINE_CASE(RGB32F);
|
DEFINE_CASE(RGB32F);
|
||||||
DEFINE_CASE(RGBA4_UNORM);
|
DEFINE_CASE(RGBA4_UNORM);
|
||||||
DEFINE_CASE(RGBA8_UNORM);
|
DEFINE_CASE(RGBA8_UNORM);
|
||||||
DEFINE_CASE(RGBA16_UNORM);
|
DEFINE_CASE(RGBA16_UNORM);
|
||||||
DEFINE_CASE(RGBA32_UNORM);
|
DEFINE_CASE(RGBA32_UNORM);
|
||||||
DEFINE_CASE(RGBA32F);
|
DEFINE_CASE(RGBA32F);
|
||||||
|
|
||||||
DEFINE_CASE(R8I);
|
DEFINE_CASE(R8I);
|
||||||
DEFINE_CASE(R16I);
|
DEFINE_CASE(R16I);
|
||||||
DEFINE_CASE(R32I);
|
DEFINE_CASE(R32I);
|
||||||
DEFINE_CASE(RG8I);
|
DEFINE_CASE(RG8I);
|
||||||
DEFINE_CASE(R16F);
|
DEFINE_CASE(R16F);
|
||||||
DEFINE_CASE(RG16I);
|
DEFINE_CASE(RG16I);
|
||||||
DEFINE_CASE(RG32I);
|
DEFINE_CASE(RG32I);
|
||||||
DEFINE_CASE(RG16F);
|
DEFINE_CASE(RG16F);
|
||||||
DEFINE_CASE(RGB8I);
|
DEFINE_CASE(RGB8I);
|
||||||
DEFINE_CASE(RGB16I);
|
DEFINE_CASE(RGB16I);
|
||||||
DEFINE_CASE(RGB32I);
|
DEFINE_CASE(RGB32I);
|
||||||
DEFINE_CASE(RGB16F);
|
DEFINE_CASE(RGB16F);
|
||||||
DEFINE_CASE(RGBA8I);
|
DEFINE_CASE(RGBA8I);
|
||||||
DEFINE_CASE(RGBA16I);
|
DEFINE_CASE(RGBA16I);
|
||||||
DEFINE_CASE(RGBA32I);
|
DEFINE_CASE(RGBA32I);
|
||||||
DEFINE_CASE(RGBA16F);
|
DEFINE_CASE(RGBA16F);
|
||||||
|
|
||||||
DEFINE_CASE(RGBA4);
|
DEFINE_CASE(RGBA4);
|
||||||
DEFINE_CASE(RGBA8_2);
|
DEFINE_CASE(RGBA8_2);
|
||||||
DEFINE_CASE(RGB10_A2_2);
|
DEFINE_CASE(RGB10_A2_2);
|
||||||
default:
|
default:
|
||||||
snprintf(unk_format_str, sizeof(unk_format_str), "0x%02x", format);
|
snprintf(unk_format_str, sizeof(unk_format_str), "0x%02x", format);
|
||||||
return unk_format_str;
|
return unk_format_str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DEFINE_CASE
|
#undef DEFINE_CASE
|
||||||
|
|
|
||||||
|
|
@ -70,15 +70,15 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
|
||||||
pipe_reference_init(&prsc->reference, 1);
|
pipe_reference_init(&prsc->reference, 1);
|
||||||
prsc->screen = pscreen;
|
prsc->screen = pscreen;
|
||||||
|
|
||||||
rsc->bo = panfrost_drm_import_bo(screen, whandle->handle);
|
rsc->bo = panfrost_drm_import_bo(screen, whandle->handle);
|
||||||
rsc->slices[0].stride = whandle->stride;
|
rsc->slices[0].stride = whandle->stride;
|
||||||
rsc->slices[0].initialized = true;
|
rsc->slices[0].initialized = true;
|
||||||
|
|
||||||
if (screen->ro) {
|
if (screen->ro) {
|
||||||
rsc->scanout =
|
rsc->scanout =
|
||||||
renderonly_create_gpu_import_for_resource(prsc, screen->ro, NULL);
|
renderonly_create_gpu_import_for_resource(prsc, screen->ro, NULL);
|
||||||
/* failure is expected in some cases.. */
|
/* failure is expected in some cases.. */
|
||||||
}
|
}
|
||||||
|
|
||||||
return prsc;
|
return prsc;
|
||||||
}
|
}
|
||||||
|
|
@ -96,16 +96,16 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
|
||||||
|
|
||||||
handle->modifier = DRM_FORMAT_MOD_INVALID;
|
handle->modifier = DRM_FORMAT_MOD_INVALID;
|
||||||
|
|
||||||
if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
|
if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
|
} else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
|
||||||
if (renderonly_get_handle(scanout, handle))
|
if (renderonly_get_handle(scanout, handle))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
handle->handle = rsrc->bo->gem_handle;
|
handle->handle = rsrc->bo->gem_handle;
|
||||||
handle->stride = rsrc->slices[0].stride;
|
handle->stride = rsrc->slices[0].stride;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (handle->type == WINSYS_HANDLE_TYPE_FD) {
|
} else if (handle->type == WINSYS_HANDLE_TYPE_FD) {
|
||||||
if (scanout) {
|
if (scanout) {
|
||||||
struct drm_prime_handle args = {
|
struct drm_prime_handle args = {
|
||||||
.handle = scanout->handle,
|
.handle = scanout->handle,
|
||||||
|
|
@ -129,10 +129,10 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
|
||||||
handle->handle = fd;
|
handle->handle = fd;
|
||||||
handle->stride = rsrc->slices[0].stride;
|
handle->stride = rsrc->slices[0].stride;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -197,7 +197,7 @@ panfrost_create_scanout_res(struct pipe_screen *screen,
|
||||||
struct pipe_resource *res;
|
struct pipe_resource *res;
|
||||||
|
|
||||||
scanout = renderonly_scanout_for_resource(&scanout_templat,
|
scanout = renderonly_scanout_for_resource(&scanout_templat,
|
||||||
pscreen->ro, &handle);
|
pscreen->ro, &handle);
|
||||||
if (!scanout)
|
if (!scanout)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -225,9 +225,9 @@ panfrost_create_scanout_res(struct pipe_screen *screen,
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
panfrost_compute_checksum_sizes(
|
panfrost_compute_checksum_sizes(
|
||||||
struct panfrost_slice *slice,
|
struct panfrost_slice *slice,
|
||||||
unsigned width,
|
unsigned width,
|
||||||
unsigned height)
|
unsigned height)
|
||||||
{
|
{
|
||||||
unsigned aligned_width = ALIGN_POT(width, CHECKSUM_TILE_WIDTH);
|
unsigned aligned_width = ALIGN_POT(width, CHECKSUM_TILE_WIDTH);
|
||||||
unsigned aligned_height = ALIGN_POT(height, CHECKSUM_TILE_HEIGHT);
|
unsigned aligned_height = ALIGN_POT(height, CHECKSUM_TILE_HEIGHT);
|
||||||
|
|
@ -259,7 +259,7 @@ panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size)
|
||||||
* makes code a lot simpler */
|
* makes code a lot simpler */
|
||||||
|
|
||||||
bool renderable = res->bind &
|
bool renderable = res->bind &
|
||||||
(PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL);
|
(PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL);
|
||||||
bool afbc = pres->layout == PAN_AFBC;
|
bool afbc = pres->layout == PAN_AFBC;
|
||||||
bool tiled = pres->layout == PAN_TILED;
|
bool tiled = pres->layout == PAN_TILED;
|
||||||
bool should_align = renderable || tiled;
|
bool should_align = renderable || tiled;
|
||||||
|
|
@ -322,7 +322,7 @@ panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size)
|
||||||
slice->checksum_offset = offset;
|
slice->checksum_offset = offset;
|
||||||
|
|
||||||
unsigned size = panfrost_compute_checksum_sizes(
|
unsigned size = panfrost_compute_checksum_sizes(
|
||||||
slice, width, height);
|
slice, width, height);
|
||||||
|
|
||||||
offset += size;
|
offset += size;
|
||||||
}
|
}
|
||||||
|
|
@ -351,7 +351,7 @@ panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size)
|
||||||
static void
|
static void
|
||||||
panfrost_resource_create_bo(struct panfrost_screen *screen, struct panfrost_resource *pres)
|
panfrost_resource_create_bo(struct panfrost_screen *screen, struct panfrost_resource *pres)
|
||||||
{
|
{
|
||||||
struct pipe_resource *res = &pres->base;
|
struct pipe_resource *res = &pres->base;
|
||||||
|
|
||||||
/* Based on the usage, figure out what storing will be used. There are
|
/* Based on the usage, figure out what storing will be used. There are
|
||||||
* various tradeoffs:
|
* various tradeoffs:
|
||||||
|
|
@ -400,17 +400,17 @@ panfrost_resource_create(struct pipe_screen *screen,
|
||||||
{
|
{
|
||||||
/* Make sure we're familiar */
|
/* Make sure we're familiar */
|
||||||
switch (template->target) {
|
switch (template->target) {
|
||||||
case PIPE_BUFFER:
|
case PIPE_BUFFER:
|
||||||
case PIPE_TEXTURE_1D:
|
case PIPE_TEXTURE_1D:
|
||||||
case PIPE_TEXTURE_2D:
|
case PIPE_TEXTURE_2D:
|
||||||
case PIPE_TEXTURE_3D:
|
case PIPE_TEXTURE_3D:
|
||||||
case PIPE_TEXTURE_CUBE:
|
case PIPE_TEXTURE_CUBE:
|
||||||
case PIPE_TEXTURE_RECT:
|
case PIPE_TEXTURE_RECT:
|
||||||
case PIPE_TEXTURE_2D_ARRAY:
|
case PIPE_TEXTURE_2D_ARRAY:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG("Unknown texture target %d\n", template->target);
|
DBG("Unknown texture target %d\n", template->target);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (template->bind &
|
if (template->bind &
|
||||||
|
|
@ -453,14 +453,14 @@ panfrost_resource_destroy(struct pipe_screen *screen,
|
||||||
struct panfrost_screen *pscreen = pan_screen(screen);
|
struct panfrost_screen *pscreen = pan_screen(screen);
|
||||||
struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
|
struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
|
||||||
|
|
||||||
if (rsrc->scanout)
|
if (rsrc->scanout)
|
||||||
renderonly_scanout_destroy(rsrc->scanout, pscreen->ro);
|
renderonly_scanout_destroy(rsrc->scanout, pscreen->ro);
|
||||||
|
|
||||||
if (rsrc->bo)
|
if (rsrc->bo)
|
||||||
panfrost_bo_unreference(screen, rsrc->bo);
|
panfrost_bo_unreference(screen, rsrc->bo);
|
||||||
|
|
||||||
util_range_destroy(&rsrc->valid_buffer_range);
|
util_range_destroy(&rsrc->valid_buffer_range);
|
||||||
ralloc_free(rsrc);
|
ralloc_free(rsrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
|
@ -507,8 +507,8 @@ panfrost_transfer_map(struct pipe_context *pctx,
|
||||||
/* TODO: reallocate */
|
/* TODO: reallocate */
|
||||||
//printf("debug: Missed reallocate\n");
|
//printf("debug: Missed reallocate\n");
|
||||||
} else if ((usage & PIPE_TRANSFER_WRITE)
|
} else if ((usage & PIPE_TRANSFER_WRITE)
|
||||||
&& resource->target == PIPE_BUFFER
|
&& resource->target == PIPE_BUFFER
|
||||||
&& !util_ranges_intersect(&rsrc->valid_buffer_range, box->x, box->x + box->width)) {
|
&& !util_ranges_intersect(&rsrc->valid_buffer_range, box->x, box->x + box->width)) {
|
||||||
/* No flush for writes to uninitialized */
|
/* No flush for writes to uninitialized */
|
||||||
} else if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
|
} else if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
|
||||||
if (usage & PIPE_TRANSFER_WRITE) {
|
if (usage & PIPE_TRANSFER_WRITE) {
|
||||||
|
|
@ -538,12 +538,12 @@ panfrost_transfer_map(struct pipe_context *pctx,
|
||||||
DBG("Unimplemented: reads from AFBC");
|
DBG("Unimplemented: reads from AFBC");
|
||||||
} else if (rsrc->layout == PAN_TILED) {
|
} else if (rsrc->layout == PAN_TILED) {
|
||||||
panfrost_load_tiled_image(
|
panfrost_load_tiled_image(
|
||||||
transfer->map,
|
transfer->map,
|
||||||
bo->cpu + rsrc->slices[level].offset,
|
bo->cpu + rsrc->slices[level].offset,
|
||||||
box,
|
box,
|
||||||
transfer->base.stride,
|
transfer->base.stride,
|
||||||
rsrc->slices[level].stride,
|
rsrc->slices[level].stride,
|
||||||
util_format_get_blocksize(resource->format));
|
util_format_get_blocksize(resource->format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -559,10 +559,10 @@ panfrost_transfer_map(struct pipe_context *pctx,
|
||||||
rsrc->slices[level].initialized = true;
|
rsrc->slices[level].initialized = true;
|
||||||
|
|
||||||
return bo->cpu
|
return bo->cpu
|
||||||
+ rsrc->slices[level].offset
|
+ rsrc->slices[level].offset
|
||||||
+ transfer->base.box.z * rsrc->cubemap_stride
|
+ transfer->base.box.z * rsrc->cubemap_stride
|
||||||
+ transfer->base.box.y * rsrc->slices[level].stride
|
+ transfer->base.box.y * rsrc->slices[level].stride
|
||||||
+ transfer->base.box.x * bytes_per_pixel;
|
+ transfer->base.box.x * bytes_per_pixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -588,20 +588,20 @@ panfrost_transfer_unmap(struct pipe_context *pctx,
|
||||||
assert(transfer->box.depth == 1);
|
assert(transfer->box.depth == 1);
|
||||||
|
|
||||||
panfrost_store_tiled_image(
|
panfrost_store_tiled_image(
|
||||||
bo->cpu + prsrc->slices[level].offset,
|
bo->cpu + prsrc->slices[level].offset,
|
||||||
trans->map,
|
trans->map,
|
||||||
&transfer->box,
|
&transfer->box,
|
||||||
prsrc->slices[level].stride,
|
prsrc->slices[level].stride,
|
||||||
transfer->stride,
|
transfer->stride,
|
||||||
util_format_get_blocksize(prsrc->base.format));
|
util_format_get_blocksize(prsrc->base.format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
util_range_add(&prsrc->valid_buffer_range,
|
util_range_add(&prsrc->valid_buffer_range,
|
||||||
transfer->box.x,
|
transfer->box.x,
|
||||||
transfer->box.x + transfer->box.width);
|
transfer->box.x + transfer->box.width);
|
||||||
|
|
||||||
/* Derefence the resource */
|
/* Derefence the resource */
|
||||||
pipe_resource_reference(&transfer->resource, NULL);
|
pipe_resource_reference(&transfer->resource, NULL);
|
||||||
|
|
@ -612,15 +612,15 @@ panfrost_transfer_unmap(struct pipe_context *pctx,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_transfer_flush_region(struct pipe_context *pctx,
|
panfrost_transfer_flush_region(struct pipe_context *pctx,
|
||||||
struct pipe_transfer *transfer,
|
struct pipe_transfer *transfer,
|
||||||
const struct pipe_box *box)
|
const struct pipe_box *box)
|
||||||
{
|
{
|
||||||
struct panfrost_resource *rsc = pan_resource(transfer->resource);
|
struct panfrost_resource *rsc = pan_resource(transfer->resource);
|
||||||
|
|
||||||
if (transfer->resource->target == PIPE_BUFFER) {
|
if (transfer->resource->target == PIPE_BUFFER) {
|
||||||
util_range_add(&rsc->valid_buffer_range,
|
util_range_add(&rsc->valid_buffer_range,
|
||||||
transfer->box.x + box->x,
|
transfer->box.x + box->x,
|
||||||
transfer->box.x + box->x + box->width);
|
transfer->box.x + box->x + box->width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -679,20 +679,19 @@ panfrost_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *pr
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum pipe_format
|
static enum pipe_format
|
||||||
panfrost_resource_get_internal_format(struct pipe_resource *prsrc)
|
panfrost_resource_get_internal_format(struct pipe_resource *prsrc) {
|
||||||
{
|
|
||||||
return prsrc->format;
|
return prsrc->format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
panfrost_generate_mipmap(
|
panfrost_generate_mipmap(
|
||||||
struct pipe_context *pctx,
|
struct pipe_context *pctx,
|
||||||
struct pipe_resource *prsrc,
|
struct pipe_resource *prsrc,
|
||||||
enum pipe_format format,
|
enum pipe_format format,
|
||||||
unsigned base_level,
|
unsigned base_level,
|
||||||
unsigned last_level,
|
unsigned last_level,
|
||||||
unsigned first_layer,
|
unsigned first_layer,
|
||||||
unsigned last_layer)
|
unsigned last_layer)
|
||||||
{
|
{
|
||||||
struct panfrost_context *ctx = pan_context(pctx);
|
struct panfrost_context *ctx = pan_context(pctx);
|
||||||
struct panfrost_resource *rsrc = pan_resource(prsrc);
|
struct panfrost_resource *rsrc = pan_resource(prsrc);
|
||||||
|
|
@ -720,10 +719,10 @@ panfrost_generate_mipmap(
|
||||||
/* We've flushed the original buffer if needed, now trigger a blit */
|
/* We've flushed the original buffer if needed, now trigger a blit */
|
||||||
|
|
||||||
bool blit_res = util_gen_mipmap(
|
bool blit_res = util_gen_mipmap(
|
||||||
pctx, prsrc, format,
|
pctx, prsrc, format,
|
||||||
base_level, last_level,
|
base_level, last_level,
|
||||||
first_layer, last_layer,
|
first_layer, last_layer,
|
||||||
PIPE_TEX_FILTER_LINEAR);
|
PIPE_TEX_FILTER_LINEAR);
|
||||||
|
|
||||||
/* If the blit was successful, flush once more. If it wasn't, well, let
|
/* If the blit was successful, flush once more. If it wasn't, well, let
|
||||||
* the state tracker deal with it. */
|
* the state tracker deal with it. */
|
||||||
|
|
@ -738,8 +737,8 @@ panfrost_generate_mipmap(
|
||||||
|
|
||||||
mali_ptr
|
mali_ptr
|
||||||
panfrost_get_texture_address(
|
panfrost_get_texture_address(
|
||||||
struct panfrost_resource *rsrc,
|
struct panfrost_resource *rsrc,
|
||||||
unsigned level, unsigned face)
|
unsigned level, unsigned face)
|
||||||
{
|
{
|
||||||
unsigned level_offset = rsrc->slices[level].offset;
|
unsigned level_offset = rsrc->slices[level].offset;
|
||||||
unsigned face_offset = face * rsrc->cubemap_stride;
|
unsigned face_offset = face * rsrc->cubemap_stride;
|
||||||
|
|
@ -781,20 +780,20 @@ panfrost_resource_screen_init(struct panfrost_screen *pscreen)
|
||||||
pscreen->base.resource_from_handle = panfrost_resource_from_handle;
|
pscreen->base.resource_from_handle = panfrost_resource_from_handle;
|
||||||
pscreen->base.resource_get_handle = panfrost_resource_get_handle;
|
pscreen->base.resource_get_handle = panfrost_resource_get_handle;
|
||||||
pscreen->base.transfer_helper = u_transfer_helper_create(&transfer_vtbl,
|
pscreen->base.transfer_helper = u_transfer_helper_create(&transfer_vtbl,
|
||||||
true, false,
|
true, false,
|
||||||
true, true);
|
true, true);
|
||||||
|
|
||||||
pb_slabs_init(&pscreen->slabs,
|
pb_slabs_init(&pscreen->slabs,
|
||||||
MIN_SLAB_ENTRY_SIZE,
|
MIN_SLAB_ENTRY_SIZE,
|
||||||
MAX_SLAB_ENTRY_SIZE,
|
MAX_SLAB_ENTRY_SIZE,
|
||||||
|
|
||||||
3, /* Number of heaps */
|
3, /* Number of heaps */
|
||||||
|
|
||||||
pscreen,
|
pscreen,
|
||||||
|
|
||||||
panfrost_slab_can_reclaim,
|
panfrost_slab_can_reclaim,
|
||||||
panfrost_slab_alloc,
|
panfrost_slab_alloc,
|
||||||
panfrost_slab_free);
|
panfrost_slab_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ struct panfrost_resource {
|
||||||
static inline struct panfrost_resource *
|
static inline struct panfrost_resource *
|
||||||
pan_resource(struct pipe_resource *p)
|
pan_resource(struct pipe_resource *p)
|
||||||
{
|
{
|
||||||
return (struct panfrost_resource *)p;
|
return (struct panfrost_resource *)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct panfrost_gtransfer {
|
struct panfrost_gtransfer {
|
||||||
|
|
@ -100,13 +100,13 @@ struct panfrost_gtransfer {
|
||||||
static inline struct panfrost_gtransfer *
|
static inline struct panfrost_gtransfer *
|
||||||
pan_transfer(struct pipe_transfer *p)
|
pan_transfer(struct pipe_transfer *p)
|
||||||
{
|
{
|
||||||
return (struct panfrost_gtransfer *)p;
|
return (struct panfrost_gtransfer *)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
mali_ptr
|
mali_ptr
|
||||||
panfrost_get_texture_address(
|
panfrost_get_texture_address(
|
||||||
struct panfrost_resource *rsrc,
|
struct panfrost_resource *rsrc,
|
||||||
unsigned level, unsigned face);
|
unsigned level, unsigned face);
|
||||||
|
|
||||||
void panfrost_resource_screen_init(struct panfrost_screen *screen);
|
void panfrost_resource_screen_init(struct panfrost_screen *screen);
|
||||||
void panfrost_resource_screen_deinit(struct panfrost_screen *screen);
|
void panfrost_resource_screen_deinit(struct panfrost_screen *screen);
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,8 @@ job_descriptor_header(struct panfrost_transfer t)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_assign_index(
|
panfrost_assign_index(
|
||||||
struct panfrost_job *job,
|
struct panfrost_job *job,
|
||||||
struct panfrost_transfer transfer)
|
struct panfrost_transfer transfer)
|
||||||
{
|
{
|
||||||
/* Assign the index */
|
/* Assign the index */
|
||||||
unsigned index = ++job->job_index;
|
unsigned index = ++job->job_index;
|
||||||
|
|
@ -133,8 +133,8 @@ panfrost_assign_index(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_add_dependency(
|
panfrost_add_dependency(
|
||||||
struct panfrost_transfer depender,
|
struct panfrost_transfer depender,
|
||||||
struct panfrost_transfer dependent)
|
struct panfrost_transfer dependent)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mali_job_descriptor_header *first =
|
struct mali_job_descriptor_header *first =
|
||||||
|
|
@ -161,8 +161,8 @@ panfrost_add_dependency(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_scoreboard_queue_job_internal(
|
panfrost_scoreboard_queue_job_internal(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer job)
|
struct panfrost_transfer job)
|
||||||
{
|
{
|
||||||
panfrost_assign_index(batch, job);
|
panfrost_assign_index(batch, job);
|
||||||
|
|
||||||
|
|
@ -178,8 +178,8 @@ panfrost_scoreboard_queue_job_internal(
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_compute_job(
|
panfrost_scoreboard_queue_compute_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer job)
|
struct panfrost_transfer job)
|
||||||
{
|
{
|
||||||
panfrost_scoreboard_queue_job_internal(batch, job);
|
panfrost_scoreboard_queue_job_internal(batch, job);
|
||||||
|
|
||||||
|
|
@ -196,9 +196,9 @@ panfrost_scoreboard_queue_compute_job(
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_vertex_job(
|
panfrost_scoreboard_queue_vertex_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer vertex,
|
struct panfrost_transfer vertex,
|
||||||
bool requires_tiling)
|
bool requires_tiling)
|
||||||
{
|
{
|
||||||
panfrost_scoreboard_queue_compute_job(batch, vertex);
|
panfrost_scoreboard_queue_compute_job(batch, vertex);
|
||||||
|
|
||||||
|
|
@ -211,8 +211,8 @@ panfrost_scoreboard_queue_vertex_job(
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_tiler_job(
|
panfrost_scoreboard_queue_tiler_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer tiler)
|
struct panfrost_transfer tiler)
|
||||||
{
|
{
|
||||||
panfrost_scoreboard_queue_compute_job(batch, tiler);
|
panfrost_scoreboard_queue_compute_job(batch, tiler);
|
||||||
|
|
||||||
|
|
@ -230,9 +230,9 @@ panfrost_scoreboard_queue_tiler_job(
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_fused_job(
|
panfrost_scoreboard_queue_fused_job(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer vertex,
|
struct panfrost_transfer vertex,
|
||||||
struct panfrost_transfer tiler)
|
struct panfrost_transfer tiler)
|
||||||
{
|
{
|
||||||
panfrost_scoreboard_queue_vertex_job(batch, vertex, true);
|
panfrost_scoreboard_queue_vertex_job(batch, vertex, true);
|
||||||
panfrost_scoreboard_queue_tiler_job(batch, tiler);
|
panfrost_scoreboard_queue_tiler_job(batch, tiler);
|
||||||
|
|
@ -244,9 +244,9 @@ panfrost_scoreboard_queue_fused_job(
|
||||||
|
|
||||||
void
|
void
|
||||||
panfrost_scoreboard_queue_fused_job_prepend(
|
panfrost_scoreboard_queue_fused_job_prepend(
|
||||||
struct panfrost_job *batch,
|
struct panfrost_job *batch,
|
||||||
struct panfrost_transfer vertex,
|
struct panfrost_transfer vertex,
|
||||||
struct panfrost_transfer tiler)
|
struct panfrost_transfer tiler)
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
assert(batch->last_tiler.gpu);
|
assert(batch->last_tiler.gpu);
|
||||||
|
|
@ -390,8 +390,8 @@ panfrost_scoreboard_link_batch(struct panfrost_job *batch)
|
||||||
unsigned arr_size = BITSET_WORDS(node_count);
|
unsigned arr_size = BITSET_WORDS(node_count);
|
||||||
|
|
||||||
for (unsigned node_n_1 = __bitset_ffs(no_incoming, arr_size);
|
for (unsigned node_n_1 = __bitset_ffs(no_incoming, arr_size);
|
||||||
(node_n_1 != 0);
|
(node_n_1 != 0);
|
||||||
node_n_1 = __bitset_ffs(no_incoming, arr_size)) {
|
node_n_1 = __bitset_ffs(no_incoming, arr_size)) {
|
||||||
|
|
||||||
unsigned node_n = node_n_1 - 1;
|
unsigned node_n = node_n_1 - 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,11 @@
|
||||||
#include "midgard/midgard_compile.h"
|
#include "midgard/midgard_compile.h"
|
||||||
|
|
||||||
static const struct debug_named_value debug_options[] = {
|
static const struct debug_named_value debug_options[] = {
|
||||||
{"msgs", PAN_DBG_MSGS, "Print debug messages"},
|
{"msgs", PAN_DBG_MSGS, "Print debug messages"},
|
||||||
{"trace", PAN_DBG_TRACE, "Trace the command stream"},
|
{"trace", PAN_DBG_TRACE, "Trace the command stream"},
|
||||||
{"deqp", PAN_DBG_DEQP, "Hacks for dEQP"},
|
{"deqp", PAN_DBG_DEQP, "Hacks for dEQP"},
|
||||||
/* ^^ If Rob can do it, so can I */
|
/* ^^ If Rob can do it, so can I */
|
||||||
DEBUG_NAMED_VALUE_END
|
DEBUG_NAMED_VALUE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
DEBUG_GET_ONCE_FLAGS_OPTION(pan_debug, "PAN_MESA_DEBUG", debug_options, 0)
|
DEBUG_GET_ONCE_FLAGS_OPTION(pan_debug, "PAN_MESA_DEBUG", debug_options, 0)
|
||||||
|
|
@ -226,7 +226,7 @@ panfrost_get_shader_param(struct pipe_screen *screen,
|
||||||
enum pipe_shader_cap param)
|
enum pipe_shader_cap param)
|
||||||
{
|
{
|
||||||
if (shader != PIPE_SHADER_VERTEX &&
|
if (shader != PIPE_SHADER_VERTEX &&
|
||||||
shader != PIPE_SHADER_FRAGMENT) {
|
shader != PIPE_SHADER_FRAGMENT) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -405,7 +405,7 @@ panfrost_is_format_supported( struct pipe_screen *screen,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN &&
|
if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN &&
|
||||||
format_desc->layout != UTIL_FORMAT_LAYOUT_OTHER) {
|
format_desc->layout != UTIL_FORMAT_LAYOUT_OTHER) {
|
||||||
/* Compressed formats not yet hooked up. */
|
/* Compressed formats not yet hooked up. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -468,7 +468,7 @@ panfrost_create_screen(int fd, struct renderonly *ro)
|
||||||
{
|
{
|
||||||
struct panfrost_screen *screen = rzalloc(NULL, struct panfrost_screen);
|
struct panfrost_screen *screen = rzalloc(NULL, struct panfrost_screen);
|
||||||
|
|
||||||
pan_debug = debug_get_option_pan_debug();
|
pan_debug = debug_get_option_pan_debug();
|
||||||
|
|
||||||
if (!screen)
|
if (!screen)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -494,19 +494,19 @@ panfrost_create_screen(int fd, struct renderonly *ro)
|
||||||
|
|
||||||
switch (screen->gpu_id) {
|
switch (screen->gpu_id) {
|
||||||
#ifdef __LP64__
|
#ifdef __LP64__
|
||||||
case 0x820: /* T820 */
|
case 0x820: /* T820 */
|
||||||
case 0x860: /* T860 */
|
case 0x860: /* T860 */
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
case 0x750: /* T760 */
|
case 0x750: /* T760 */
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Fail to load against untested models */
|
/* Fail to load against untested models */
|
||||||
debug_printf("panfrost: Unsupported model %X",
|
debug_printf("panfrost: Unsupported model %X",
|
||||||
screen->gpu_id);
|
screen->gpu_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pan_debug & PAN_DBG_TRACE)
|
if (pan_debug & PAN_DBG_TRACE)
|
||||||
|
|
@ -528,7 +528,7 @@ panfrost_create_screen(int fd, struct renderonly *ro)
|
||||||
screen->base.fence_reference = panfrost_fence_reference;
|
screen->base.fence_reference = panfrost_fence_reference;
|
||||||
screen->base.fence_finish = panfrost_fence_finish;
|
screen->base.fence_finish = panfrost_fence_finish;
|
||||||
|
|
||||||
screen->last_fragment_flushed = true;
|
screen->last_fragment_flushed = true;
|
||||||
screen->last_job = NULL;
|
screen->last_job = NULL;
|
||||||
|
|
||||||
panfrost_resource_screen_init(screen);
|
panfrost_resource_screen_init(screen);
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,14 @@ struct panfrost_screen {
|
||||||
/* While we're busy building up the job for frame N, the GPU is
|
/* While we're busy building up the job for frame N, the GPU is
|
||||||
* still busy executing frame N-1. So hold a reference to
|
* still busy executing frame N-1. So hold a reference to
|
||||||
* yesterjob */
|
* yesterjob */
|
||||||
int last_fragment_flushed;
|
int last_fragment_flushed;
|
||||||
struct panfrost_job *last_job;
|
struct panfrost_job *last_job;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct panfrost_screen *
|
static inline struct panfrost_screen *
|
||||||
pan_screen(struct pipe_screen *p)
|
pan_screen(struct pipe_screen *p)
|
||||||
{
|
{
|
||||||
return (struct panfrost_screen *)p;
|
return (struct panfrost_screen *)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ panfrost_sfbd_format(struct pipe_surface *surf)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_sfbd_clear(
|
panfrost_sfbd_clear(
|
||||||
struct panfrost_job *job,
|
struct panfrost_job *job,
|
||||||
struct mali_single_framebuffer *sfbd)
|
struct mali_single_framebuffer *sfbd)
|
||||||
{
|
{
|
||||||
struct panfrost_context *ctx = job->ctx;
|
struct panfrost_context *ctx = job->ctx;
|
||||||
|
|
||||||
|
|
@ -86,8 +86,8 @@ panfrost_sfbd_clear(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panfrost_sfbd_set_cbuf(
|
panfrost_sfbd_set_cbuf(
|
||||||
struct mali_single_framebuffer *fb,
|
struct mali_single_framebuffer *fb,
|
||||||
struct pipe_surface *surf)
|
struct pipe_surface *surf)
|
||||||
{
|
{
|
||||||
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -277,8 +277,8 @@ panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask)
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
panfrost_choose_hierarchy_mask(
|
panfrost_choose_hierarchy_mask(
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
unsigned vertex_count)
|
unsigned vertex_count)
|
||||||
{
|
{
|
||||||
/* If there is no geometry, we don't bother enabling anything */
|
/* If there is no geometry, we don't bother enabling anything */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask);
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
panfrost_choose_hierarchy_mask(
|
panfrost_choose_hierarchy_mask(
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
unsigned vertex_count);
|
unsigned vertex_count);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue