diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-09-09 09:46:47 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-09-09 09:46:47 +0000 |
commit | 17251c8fe97e6c8f1f6e21767313ce4bfa80a547 (patch) | |
tree | 89369bcb8fa98db8d7510cb0b94f7dfcc39e2eac /lib/mesa/src/gallium/drivers | |
parent | ac84aa63606be1381cde78da15d054e26a4e1ab3 (diff) |
Import Mesa 21.1.8
Diffstat (limited to 'lib/mesa/src/gallium/drivers')
13 files changed, 164 insertions, 58 deletions
diff --git a/lib/mesa/src/gallium/drivers/iris/iris_context.h b/lib/mesa/src/gallium/drivers/iris/iris_context.h index a7dde354c..a273b6765 100644 --- a/lib/mesa/src/gallium/drivers/iris/iris_context.h +++ b/lib/mesa/src/gallium/drivers/iris/iris_context.h @@ -205,10 +205,15 @@ struct iris_base_prog_key { unsigned program_string_id; }; +/** + * Note, we need to take care to have padding explicitly declared + * for key since we will directly memcmp the whole struct. + */ struct iris_vue_prog_key { struct iris_base_prog_key base; unsigned nr_userclip_plane_consts:4; + unsigned padding:28; }; struct iris_vs_prog_key { diff --git a/lib/mesa/src/gallium/drivers/iris/iris_state.c b/lib/mesa/src/gallium/drivers/iris/iris_state.c index e493eea0b..9571aed33 100644 --- a/lib/mesa/src/gallium/drivers/iris/iris_state.c +++ b/lib/mesa/src/gallium/drivers/iris/iris_state.c @@ -6905,7 +6905,8 @@ iris_upload_gpgpu_walker(struct iris_context *ice, const unsigned threads = DIV_ROUND_UP(group_size, simd_size); - if (stage_dirty & IRIS_STAGE_DIRTY_CS) { + if ((stage_dirty & IRIS_STAGE_DIRTY_CS) || + cs_prog_data->local_size[0] == 0 /* Variable local group size */) { /* The MEDIA_VFE_STATE documentation for Gfx8+ says: * * "A stalling PIPE_CONTROL is required before MEDIA_VFE_STATE unless diff --git a/lib/mesa/src/gallium/drivers/lima/lima_draw.c b/lib/mesa/src/gallium/drivers/lima/lima_draw.c index fc218eea5..3b3b276b2 100644 --- a/lib/mesa/src/gallium/drivers/lima/lima_draw.c +++ b/lib/mesa/src/gallium/drivers/lima/lima_draw.c @@ -72,14 +72,14 @@ lima_clip_scissor_to_viewport(struct lima_context *ctx) viewport_left = MAX2(ctx->viewport.left, 0); cscissor->minx = MAX2(cscissor->minx, viewport_left); - viewport_right = MIN2(ctx->viewport.right, fb->base.width); + viewport_right = MIN2(MAX2(ctx->viewport.right, 0), fb->base.width); cscissor->maxx = MIN2(cscissor->maxx, viewport_right); if (cscissor->minx > cscissor->maxx) cscissor->minx = cscissor->maxx; viewport_bottom = MAX2(ctx->viewport.bottom, 0); cscissor->miny = MAX2(cscissor->miny, viewport_bottom); - viewport_top = MIN2(ctx->viewport.top, fb->base.height); + viewport_top = MIN2(MAX2(ctx->viewport.top, 0), fb->base.height); cscissor->maxy = MIN2(cscissor->maxy, viewport_top); if (cscissor->miny > cscissor->maxy) cscissor->miny = cscissor->maxy; @@ -195,6 +195,7 @@ enum lima_attrib_type { LIMA_ATTRIB_FLOAT = 0x000, LIMA_ATTRIB_I32 = 0x001, LIMA_ATTRIB_U32 = 0x002, + LIMA_ATTRIB_FP16 = 0x003, LIMA_ATTRIB_I16 = 0x004, LIMA_ATTRIB_U16 = 0x005, LIMA_ATTRIB_I8 = 0x006, @@ -217,7 +218,10 @@ lima_pipe_format_to_attrib_type(enum pipe_format format) switch (c->type) { case UTIL_FORMAT_TYPE_FLOAT: - return LIMA_ATTRIB_FLOAT; + if (c->size == 16) + return LIMA_ATTRIB_FP16; + else + return LIMA_ATTRIB_FLOAT; case UTIL_FORMAT_TYPE_FIXED: return LIMA_ATTRIB_FIXED; case UTIL_FORMAT_TYPE_SIGNED: diff --git a/lib/mesa/src/gallium/drivers/lima/lima_resource.c b/lib/mesa/src/gallium/drivers/lima/lima_resource.c index d16a0b0b7..a8954eb72 100644 --- a/lib/mesa/src/gallium/drivers/lima/lima_resource.c +++ b/lib/mesa/src/gallium/drivers/lima/lima_resource.c @@ -412,9 +412,8 @@ lima_resource_get_handle(struct pipe_screen *pscreen, else handle->modifier = DRM_FORMAT_MOD_LINEAR; - if (handle->type == WINSYS_HANDLE_TYPE_KMS && screen->ro && - renderonly_get_handle(res->scanout, handle)) - return true; + if (handle->type == WINSYS_HANDLE_TYPE_KMS && screen->ro) + return renderonly_get_handle(res->scanout, handle); if (!lima_bo_export(res->bo, handle)) return false; @@ -424,6 +423,35 @@ lima_resource_get_handle(struct pipe_screen *pscreen, return true; } +static bool +lima_resource_get_param(struct pipe_screen *pscreen, + struct pipe_context *pctx, + struct pipe_resource *pres, + unsigned plane, unsigned layer, unsigned level, + enum pipe_resource_param param, + unsigned usage, uint64_t *value) +{ + struct lima_resource *res = lima_resource(pres); + + switch (param) { + case PIPE_RESOURCE_PARAM_STRIDE: + *value = res->levels[level].stride; + return true; + case PIPE_RESOURCE_PARAM_OFFSET: + *value = res->levels[level].offset; + return true; + case PIPE_RESOURCE_PARAM_MODIFIER: + if (res->tiled) + *value = DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED; + else + *value = DRM_FORMAT_MOD_LINEAR; + + return true; + default: + return false; + } +} + static void get_scissor_from_box(struct pipe_scissor_state *s, const struct pipe_box *b, int h) @@ -519,6 +547,7 @@ lima_resource_screen_init(struct lima_screen *screen) screen->base.resource_from_handle = lima_resource_from_handle; screen->base.resource_destroy = lima_resource_destroy; screen->base.resource_get_handle = lima_resource_get_handle; + screen->base.resource_get_param = lima_resource_get_param; screen->base.set_damage_region = lima_resource_set_damage_region; } diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt index 8f16479af..44fc9081f 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt +++ b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt @@ -6,7 +6,6 @@ api/clenqueuemigratememobjects: skip api/clgetextensionfunctionaddressforplatform: skip api/clgetkernelarginfo: skip api/cllinkprogram: skip -api/clsetkernelarg/set kernel argument for cl_int3: fail interop/egl_khr_cl_event2: skip program/build/include-directories: fail program/build/math-intrinsics: fail diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt index d4507a5c2..919b13a84 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt +++ b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt @@ -474,12 +474,6 @@ spec/arb_internalformat_query/misc. api error checks: skip spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-frag: fail spec/arb_post_depth_coverage/arb_post_depth_coverage-multisampling: fail spec/arb_program_interface_query/arb_program_interface_query-getprogramresourceindex/'vs_input2[1][0]' on gl_program_input: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_unsigned_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_unsigned_int64_arb: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_unsigned_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_unsigned_int64_arb: fail spec/arb_sample_locations/test: skip spec/arb_sample_shading/builtin-gl-num-samples 16: skip spec/arb_sample_shading/builtin-gl-num-samples 32: skip diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c b/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c index 703512d01..38c1319a4 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c +++ b/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c @@ -139,6 +139,17 @@ llvmpipe_get_query_result(struct pipe_context *pipe, } } break; + case PIPE_QUERY_TIME_ELAPSED: { + uint64_t start = (uint64_t)-1, end = 0; + for (i = 0; i < num_threads; i++) { + if (pq->start[i] && pq->start[i] < start) + start = pq->start[i]; + if (pq->end[i] && pq->end[i] > end) + end = pq->end[i]; + } + *result = end - start; + break; + } case PIPE_QUERY_TIMESTAMP_DISJOINT: { struct pipe_query_data_timestamp_disjoint *td = (struct pipe_query_data_timestamp_disjoint *)vresult; @@ -260,6 +271,17 @@ llvmpipe_get_query_result_resource(struct pipe_context *pipe, } } break; + case PIPE_QUERY_TIME_ELAPSED: { + uint64_t start = (uint64_t)-1, end = 0; + for (i = 0; i < num_threads; i++) { + if (pq->start[i] && pq->start[i] < start) + start = pq->start[i]; + if (pq->end[i] && pq->end[i] > end) + end = pq->end[i]; + } + value = end - start; + break; + } case PIPE_QUERY_SO_STATISTICS: value = pq->num_primitives_written[0]; value2 = pq->num_primitives_generated[0]; diff --git a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp index 54d3cd794..f1c6e85d6 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -1292,7 +1292,7 @@ Converter::parseNIR() info->prop.cp.numThreads[0] = nir->info.cs.local_size[0]; info->prop.cp.numThreads[1] = nir->info.cs.local_size[1]; info->prop.cp.numThreads[2] = nir->info.cs.local_size[2]; - info_out->bin.smemSize += nir->info.shared_size; + info_out->bin.smemSize = std::max(info_out->bin.smemSize, nir->info.shared_size); break; case Program::TYPE_FRAGMENT: info_out->prop.fp.earlyFragTests = nir->info.fs.early_fragment_tests; diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c b/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c index c189eec26..0e1f43efb 100644 --- a/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c +++ b/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c @@ -157,13 +157,14 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, if (handle->type == WINSYS_HANDLE_TYPE_SHARED) { return false; } else if (handle->type == WINSYS_HANDLE_TYPE_KMS) { - if (renderonly_get_handle(scanout, handle)) + if (dev->ro) { + return renderonly_get_handle(scanout, handle); + } else { + handle->handle = rsrc->image.data.bo->gem_handle; + handle->stride = rsrc->image.layout.slices[0].line_stride; + handle->offset = rsrc->image.layout.slices[0].offset; return true; - - handle->handle = rsrc->image.data.bo->gem_handle; - handle->stride = rsrc->image.layout.slices[0].line_stride; - handle->offset = rsrc->image.layout.slices[0].offset; - return TRUE; + } } else if (handle->type == WINSYS_HANDLE_TYPE_FD) { if (scanout) { struct drm_prime_handle args = { @@ -195,6 +196,30 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, return false; } +static bool +panfrost_resource_get_param(struct pipe_screen *pscreen, + struct pipe_context *pctx, struct pipe_resource *prsc, + unsigned plane, unsigned layer, unsigned level, + enum pipe_resource_param param, + unsigned usage, uint64_t *value) +{ + struct panfrost_resource *rsrc = (struct panfrost_resource *) prsc; + + switch (param) { + case PIPE_RESOURCE_PARAM_STRIDE: + *value = rsrc->image.layout.slices[level].line_stride; + return true; + case PIPE_RESOURCE_PARAM_OFFSET: + *value = rsrc->image.layout.slices[level].offset; + return true; + case PIPE_RESOURCE_PARAM_MODIFIER: + *value = rsrc->image.layout.modifier; + return true; + default: + return false; + } +} + static void panfrost_flush_resource(struct pipe_context *pctx, struct pipe_resource *prsc) { @@ -1303,6 +1328,7 @@ panfrost_resource_screen_init(struct pipe_screen *pscreen) pscreen->resource_destroy = u_transfer_helper_resource_destroy; pscreen->resource_from_handle = panfrost_resource_from_handle; pscreen->resource_get_handle = panfrost_resource_get_handle; + pscreen->resource_get_param = panfrost_resource_get_param; pscreen->transfer_helper = u_transfer_helper_create(&transfer_vtbl, true, false, fake_rgtc, true); diff --git a/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c b/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c index 602ba6d84..cc56d02da 100644 --- a/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c +++ b/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c @@ -397,6 +397,21 @@ v3d_resource_destroy(struct pipe_screen *pscreen, free(rsc); } +static uint64_t +v3d_resource_modifier(struct v3d_resource *rsc) +{ + if (rsc->tiled) { + /* A shared tiled buffer should always be allocated as UIF, + * not UBLINEAR or LT. + */ + assert(rsc->slices[0].tiling == VC5_TILING_UIF_XOR || + rsc->slices[0].tiling == VC5_TILING_UIF_NO_XOR); + return DRM_FORMAT_MOD_BROADCOM_UIF; + } else { + return DRM_FORMAT_MOD_LINEAR; + } +} + static bool v3d_resource_get_handle(struct pipe_screen *pscreen, struct pipe_context *pctx, @@ -410,6 +425,7 @@ v3d_resource_get_handle(struct pipe_screen *pscreen, whandle->stride = rsc->slices[0].stride; whandle->offset = 0; + whandle->modifier = v3d_resource_modifier(rsc); /* If we're passing some reference to our BO out to some other part of * the system, then we can't do any optimizations about only us being @@ -417,26 +433,16 @@ v3d_resource_get_handle(struct pipe_screen *pscreen, */ bo->private = false; - if (rsc->tiled) { - /* A shared tiled buffer should always be allocated as UIF, - * not UBLINEAR or LT. - */ - assert(rsc->slices[0].tiling == VC5_TILING_UIF_XOR || - rsc->slices[0].tiling == VC5_TILING_UIF_NO_XOR); - whandle->modifier = DRM_FORMAT_MOD_BROADCOM_UIF; - } else { - whandle->modifier = DRM_FORMAT_MOD_LINEAR; - } - switch (whandle->type) { case WINSYS_HANDLE_TYPE_SHARED: return v3d_bo_flink(bo, &whandle->handle); case WINSYS_HANDLE_TYPE_KMS: if (screen->ro) { - assert(rsc->scanout); - bool ok = renderonly_get_handle(rsc->scanout, whandle); - whandle->stride = rsc->slices[0].stride; - return ok; + if (renderonly_get_handle(rsc->scanout, whandle)) { + whandle->stride = rsc->slices[0].stride; + return true; + } + return false; } whandle->handle = bo->handle; return true; @@ -448,6 +454,30 @@ v3d_resource_get_handle(struct pipe_screen *pscreen, return false; } +static bool +v3d_resource_get_param(struct pipe_screen *pscreen, + struct pipe_context *pctx, struct pipe_resource *prsc, + unsigned plane, unsigned layer, unsigned level, + enum pipe_resource_param param, + unsigned usage, uint64_t *value) +{ + struct v3d_resource *rsc = v3d_resource(prsc); + + switch (param) { + case PIPE_RESOURCE_PARAM_STRIDE: + *value = rsc->slices[level].stride; + return true; + case PIPE_RESOURCE_PARAM_OFFSET: + *value = 0; + return true; + case PIPE_RESOURCE_PARAM_MODIFIER: + *value = v3d_resource_modifier(rsc); + return true; + default: + return false; + } +} + #define PAGE_UB_ROWS (VC5_UIFCFG_PAGE_SIZE / VC5_UIFBLOCK_ROW_SIZE) #define PAGE_UB_ROWS_TIMES_1_5 ((PAGE_UB_ROWS * 3) >> 1) #define PAGE_CACHE_UB_ROWS (VC5_PAGE_CACHE_SIZE / VC5_UIFBLOCK_ROW_SIZE) @@ -929,10 +959,6 @@ v3d_resource_from_handle(struct pipe_screen *pscreen, renderonly_create_gpu_import_for_resource(prsc, screen->ro, NULL); - if (!rsc->scanout) { - fprintf(stderr, "Failed to create scanout resource.\n"); - goto fail; - } } if (rsc->tiled && whandle->stride != slice->stride) { @@ -1152,6 +1178,7 @@ v3d_resource_screen_init(struct pipe_screen *pscreen) pscreen->resource_create = u_transfer_helper_resource_create; pscreen->resource_from_handle = v3d_resource_from_handle; pscreen->resource_get_handle = v3d_resource_get_handle; + pscreen->resource_get_param = v3d_resource_get_param; pscreen->resource_destroy = u_transfer_helper_resource_destroy; pscreen->transfer_helper = u_transfer_helper_create(&transfer_vtbl, true, false, diff --git a/lib/mesa/src/gallium/drivers/zink/zink_compiler.c b/lib/mesa/src/gallium/drivers/zink/zink_compiler.c index cff1f6d67..c91d97dc7 100644 --- a/lib/mesa/src/gallium/drivers/zink/zink_compiler.c +++ b/lib/mesa/src/gallium/drivers/zink/zink_compiler.c @@ -746,7 +746,7 @@ unbreak_bos(nir_shader *shader) const struct glsl_type *type = glsl_without_array(var->type); if (type_is_counter(type)) continue; - unsigned size = glsl_count_attribute_slots(type, false); + unsigned size = glsl_count_attribute_slots(glsl_type_is_array(var->type) ? var->type : type, false); if (var->data.mode == nir_var_mem_ubo) max_ubo_size = MAX2(max_ubo_size, size); else diff --git a/lib/mesa/src/gallium/drivers/zink/zink_extensions.py b/lib/mesa/src/gallium/drivers/zink/zink_extensions.py index 656cfdf17..e55bb8415 100644 --- a/lib/mesa/src/gallium/drivers/zink/zink_extensions.py +++ b/lib/mesa/src/gallium/drivers/zink/zink_extensions.py @@ -25,8 +25,8 @@ from xml.etree import ElementTree from typing import List,Tuple class Version: - device_version : Tuple[int, int, int] = (1,0,0) - struct_version : Tuple[int, int] = (1,0) + device_version = (1,0,0) + struct_version = (1,0) def __init__(self, version, struct=()): self.device_version = version @@ -59,16 +59,16 @@ class Version: + '_' + struct) class Extension: - name : str = None - alias : str = None - is_required : bool = False - is_nonstandard : bool = False - enable_conds : List[str] = None + name = None + alias = None + is_required = False + is_nonstandard = False + enable_conds = None # these are specific to zink_device_info.py: - has_properties : bool = False - has_features : bool = False - guard : bool = False + has_properties = False + has_features = False + guard = False # these are specific to zink_instance.py: core_since : Version = None @@ -147,14 +147,14 @@ Layer = Extension class ExtensionRegistryEntry: # type of extension - right now it's either "instance" or "device" - ext_type : str = "" + ext_type = "" # the version in which the extension is promoted to core VK - promoted_in : Version = None + promoted_in = None # functions added by the extension are referred to as "commands" in the registry - commands : List[str] = None - constants : List[str] = None - features_struct : str = None - properties_struct : str = None + commands = None + constants = None + features_struct = None + properties_struct = None class ExtensionRegistry: # key = extension name, value = registry entry diff --git a/lib/mesa/src/gallium/drivers/zink/zink_format.c b/lib/mesa/src/gallium/drivers/zink/zink_format.c index 18b6d4ef6..1578bd479 100644 --- a/lib/mesa/src/gallium/drivers/zink/zink_format.c +++ b/lib/mesa/src/gallium/drivers/zink/zink_format.c @@ -77,7 +77,6 @@ static const VkFormat formats[PIPE_FORMAT_COUNT] = { MAP_FORMAT_NORM(R8G8B8A8) MAP_FORMAT_SCALED(R8G8B8A8) MAP_FORMAT_INT(R8G8B8A8) - MAP_FORMAT_SRGB(R8G8B8A8) MAP_FORMAT_NORM(B8G8R8A8) MAP_FORMAT_SCALED(B8G8R8A8) MAP_FORMAT_INT(B8G8R8A8) |