diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c index 9ead3d90b8b..e218f21ceb8 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -448,7 +448,7 @@ etna_emit_state(struct etna_context *ctx) if (unlikely(dirty & (ETNA_DIRTY_FRAMEBUFFER))) { /*0140C*/ EMIT_STATE(PE_DEPTH_NORMALIZE, ctx->framebuffer.PE_DEPTH_NORMALIZE); - if (screen->specs.halti < 0 || screen->model == 0x880) { + if (screen->specs.halti < 0 || screen->info->model == 0x880) { /*01410*/ EMIT_STATE_RELOC(PE_DEPTH_ADDR, &ctx->framebuffer.PE_DEPTH_ADDR); } @@ -485,7 +485,7 @@ etna_emit_state(struct etna_context *ctx) /*0142C*/ EMIT_STATE(PE_COLOR_FORMAT, val); } if (unlikely(dirty & (ETNA_DIRTY_FRAMEBUFFER))) { - if (screen->specs.halti >= 0 && screen->model != 0x880) { + if (screen->specs.halti >= 0 && screen->info->model != 0x880) { /*01434*/ EMIT_STATE(PE_COLOR_STRIDE, ctx->framebuffer.PE_COLOR_STRIDE); /*01454*/ EMIT_STATE(PE_HDEPTH_CONTROL, ctx->framebuffer.PE_HDEPTH_CONTROL); /*01460*/ EMIT_STATE_RELOC(PE_PIPE_COLOR_ADDR(0), &ctx->framebuffer.PE_PIPE_COLOR_ADDR[0]); diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 9c66d0ec983..57a6dd35af7 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -124,8 +124,8 @@ etna_screen_get_name(struct pipe_screen *pscreen) struct etna_screen *priv = etna_screen(pscreen); static char buffer[128]; - snprintf(buffer, sizeof(buffer), "Vivante GC%x rev %04x", priv->model, - priv->revision); + snprintf(buffer, sizeof(buffer), "Vivante GC%x rev %04x", priv->info->model, + priv->info->revision); return buffer; } @@ -794,15 +794,15 @@ etna_determine_uniform_limits(struct etna_screen *screen) * gcmCONFIGUREUNIFORMS in the Vivante kernel driver file * drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h. */ - if (screen->model == chipModel_GC2000 && - (screen->revision == 0x5118 || screen->revision == 0x5140)) { + if (screen->info->model == chipModel_GC2000 && + (screen->info->revision == 0x5118 || screen->info->revision == 0x5140)) { screen->specs.max_vs_uniforms = 256; screen->specs.max_ps_uniforms = 64; } else if (screen->specs.num_constants == 320) { screen->specs.max_vs_uniforms = 256; screen->specs.max_ps_uniforms = 64; } else if (screen->specs.num_constants > 256 && - screen->model == chipModel_GC1000) { + screen->info->model == chipModel_GC1000) { /* All GC1000 series chips can only support 64 uniforms for ps on non-unified const mode. */ screen->specs.max_vs_uniforms = 256; screen->specs.max_ps_uniforms = 64; @@ -832,7 +832,7 @@ etna_determine_sampler_limits(struct etna_screen *screen) screen->specs.vertex_sampler_count = 4; } - if (screen->model == 0x400) + if (screen->info->model == 0x400) screen->specs.vertex_sampler_count = 0; } @@ -963,13 +963,13 @@ etna_get_specs(struct etna_screen *screen) screen->specs.bits_per_tile == 4 ? 0x11111111 : 0x55555555; screen->specs.vs_need_z_div = - screen->model < 0x1000 && screen->model != 0x880; + screen->info->model < 0x1000 && screen->info->model != 0x880; screen->specs.has_sin_cos_sqrt = VIV_FEATURE(screen, chipMinorFeatures0, HAS_SQRT_TRIG); screen->specs.has_sign_floor_ceil = VIV_FEATURE(screen, chipMinorFeatures0, HAS_SIGN_FLOOR_CEIL); screen->specs.has_shader_range_registers = - screen->model >= 0x1000 || screen->model == 0x880; + screen->info->model >= 0x1000 || screen->info->model == 0x880; screen->specs.npot_tex_any_wrap = VIV_FEATURE(screen, chipMinorFeatures1, NON_POWER_OF_TWO); screen->specs.has_new_transcendentals = @@ -981,7 +981,7 @@ etna_get_specs(struct etna_screen *screen) screen->specs.v4_compression = VIV_FEATURE(screen, chipMinorFeatures6, V4_COMPRESSION); screen->specs.seamless_cube_map = - (screen->model != 0x880) && /* Seamless cubemap is broken on GC880? */ + (screen->info->model != 0x880) && /* Seamless cubemap is broken on GC880? */ VIV_FEATURE(screen, chipMinorFeatures2, SEAMLESS_CUBE_MAP); if (screen->specs.halti >= 5) { @@ -1140,6 +1140,7 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu, screen->dev = dev; screen->gpu = gpu; screen->ro = ro; + screen->info = etna_gpu_get_core_info(gpu); screen->drm_version = etnaviv_device_version(screen->dev); etna_mesa_debug = debug_get_option_etna_mesa_debug(); @@ -1153,18 +1154,6 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu, goto fail; } - if (etna_gpu_get_param(screen->gpu, ETNA_GPU_MODEL, &val)) { - DBG("could not get ETNA_GPU_MODEL"); - goto fail; - } - screen->model = val; - - if (etna_gpu_get_param(screen->gpu, ETNA_GPU_REVISION, &val)) { - DBG("could not get ETNA_GPU_REVISION"); - goto fail; - } - screen->revision = val; - if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_0, &val)) { DBG("could not get ETNA_GPU_FEATURES_0"); goto fail; diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.h b/src/gallium/drivers/etnaviv/etnaviv_screen.h index c664218d8e6..5d7dc7ba0fc 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.h +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.h @@ -28,6 +28,7 @@ #ifndef H_ETNAVIV_SCREEN #define H_ETNAVIV_SCREEN +#include "etna_core_info.h" #include "etnaviv_internal.h" #include "etnaviv_perfmon.h" @@ -81,8 +82,7 @@ struct etna_screen { struct util_dynarray supported_pm_queries; struct slab_parent_pool transfer_pool; - uint32_t model; - uint32_t revision; + struct etna_core_info *info; uint32_t features[VIV_FEATURES_WORD_COUNT]; struct etna_specs specs; diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c index c6ff3f37ce8..8ead29bee33 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c @@ -193,7 +193,7 @@ etna_set_framebuffer_state(struct pipe_context *pctx, cbuf->offset, cbuf->level->stride * 4); } - if (screen->specs.halti >= 0 && screen->model != 0x880) { + if (screen->specs.halti >= 0 && screen->info->model != 0x880) { /* Rendertargets on GPUs with more than a single pixel pipe must always * be multi-tiled, or single-buffer mode must be supported */ assert(screen->specs.pixel_pipes == 1 || @@ -276,7 +276,7 @@ etna_set_framebuffer_state(struct pipe_context *pctx, /* VIVS_PE_DEPTH_CONFIG_ONLY_DEPTH */ /* merged with depth_stencil_alpha */ - if (screen->specs.halti >= 0 && screen->model != 0x880) { + if (screen->specs.halti >= 0 && screen->info->model != 0x880) { for (int i = 0; i < screen->specs.pixel_pipes; i++) { cs->PE_PIPE_DEPTH_ADDR[i] = zsbuf->reloc[i]; cs->PE_PIPE_DEPTH_ADDR[i].flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE; diff --git a/src/gallium/drivers/etnaviv/meson.build b/src/gallium/drivers/etnaviv/meson.build index 23ee96f969e..f18f4ec874f 100644 --- a/src/gallium/drivers/etnaviv/meson.build +++ b/src/gallium/drivers/etnaviv/meson.build @@ -117,7 +117,7 @@ libetnaviv = static_library( inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_etnaviv, ], link_with: [libetnaviv_drm, libetnaviv_encode], - dependencies : [dep_libdrm, idep_nir_headers, idep_mesautil, idep_libetnaviv_decode], + dependencies : [dep_libdrm, idep_nir_headers, idep_mesautil, idep_libetnaviv_decode, idep_etna_common], ) driver_etnaviv = declare_dependency( diff --git a/src/gallium/winsys/etnaviv/drm/meson.build b/src/gallium/winsys/etnaviv/drm/meson.build index ab52587aac8..cbdd12a5b86 100644 --- a/src/gallium/winsys/etnaviv/drm/meson.build +++ b/src/gallium/winsys/etnaviv/drm/meson.build @@ -26,5 +26,5 @@ libetnavivdrm = static_library( inc_etnaviv, ], link_with: libetnaviv_drm, - dependencies : [dep_libdrm, idep_nir_headers, idep_mesautil], + dependencies : [dep_libdrm, idep_nir_headers, idep_mesautil, idep_etna_common], )