Lines Matching refs:screen
80 struct etna_screen *screen = etna_screen(pscreen); in etna_screen_destroy() local
82 if (screen->pipe) in etna_screen_destroy()
83 etna_pipe_del(screen->pipe); in etna_screen_destroy()
85 if (screen->gpu) in etna_screen_destroy()
86 etna_gpu_del(screen->gpu); in etna_screen_destroy()
88 if (screen->ro) in etna_screen_destroy()
89 FREE(screen->ro); in etna_screen_destroy()
91 if (screen->dev) in etna_screen_destroy()
92 etna_device_del(screen->dev); in etna_screen_destroy()
94 FREE(screen); in etna_screen_destroy()
124 struct etna_screen *screen = etna_screen(pscreen); in etna_screen_get_param() local
143 return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD; in etna_screen_get_param()
159 return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0); in etna_screen_get_param()
291 int log2_max_tex_size = util_last_bit(screen->specs.max_texture_size); in etna_screen_get_param()
324 return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0); in etna_screen_get_param()
357 struct etna_screen *screen = etna_screen(pscreen); in etna_screen_get_paramf() local
368 return util_last_bit(screen->specs.max_texture_size); in etna_screen_get_paramf()
385 struct etna_screen *screen = etna_screen(pscreen); in etna_screen_get_shader_param() local
414 return shader == PIPE_SHADER_FRAGMENT ? screen->specs.max_varyings in etna_screen_get_shader_param()
415 : screen->specs.vertex_max_elements; in etna_screen_get_shader_param()
432 return VIV_FEATURE(screen, chipMinorFeatures0, HAS_SQRT_TRIG); in etna_screen_get_shader_param()
440 ? screen->specs.fragment_sampler_count in etna_screen_get_shader_param()
441 : screen->specs.vertex_sampler_count; in etna_screen_get_shader_param()
476 gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt, in gpu_supports_texure_format() argument
482 supported = VIV_FEATURE(screen, chipFeatures, ETC1_TEXTURE_COMPRESSION); in gpu_supports_texure_format()
485 supported = VIV_FEATURE(screen, chipFeatures, DXT_TEXTURE_COMPRESSION); in gpu_supports_texure_format()
488 supported = VIV_FEATURE(screen, chipMinorFeatures1, HALTI0); in gpu_supports_texure_format()
491 supported = VIV_FEATURE(screen, chipMinorFeatures1, HALTI0); in gpu_supports_texure_format()
500 supported = VIV_FEATURE(screen, chipMinorFeatures2, HALTI1); in gpu_supports_texure_format()
504 supported = screen->specs.tex_astc; in gpu_supports_texure_format()
511 return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0); in gpu_supports_texure_format()
522 struct etna_screen *screen = etna_screen(pscreen); in etna_screen_is_format_supported() local
557 if (!gpu_supports_texure_format(screen, fmt, format)) in etna_screen_is_format_supported()
573 VIV_FEATURE(screen, chipFeatures, 32_BIT_INDICES))) { in etna_screen_is_format_supported()
605 struct etna_screen *screen = etna_screen(pscreen); in etna_screen_query_dmabuf_modifiers() local
618 if ((screen->specs.pixel_pipes == 1 || screen->specs.single_buffer) && in etna_screen_query_dmabuf_modifiers()
633 etna_get_specs(struct etna_screen *screen) in etna_get_specs() argument
638 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_INSTRUCTION_COUNT, &val)) { in etna_get_specs()
644 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_VERTEX_OUTPUT_BUFFER_SIZE, in etna_get_specs()
649 screen->specs.vertex_output_buffer_size = val; in etna_get_specs()
651 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_VERTEX_CACHE_SIZE, &val)) { in etna_get_specs()
655 screen->specs.vertex_cache_size = val; in etna_get_specs()
657 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_SHADER_CORE_COUNT, &val)) { in etna_get_specs()
661 screen->specs.shader_core_count = val; in etna_get_specs()
663 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_STREAM_COUNT, &val)) { in etna_get_specs()
667 screen->specs.stream_count = val; in etna_get_specs()
669 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_REGISTER_MAX, &val)) { in etna_get_specs()
673 screen->specs.max_registers = val; in etna_get_specs()
675 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_PIXEL_PIPES, &val)) { in etna_get_specs()
679 screen->specs.pixel_pipes = val; in etna_get_specs()
681 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_NUM_CONSTANTS, &val)) { in etna_get_specs()
689 screen->specs.num_constants = val; in etna_get_specs()
693 if (VIV_FEATURE(screen, chipMinorFeatures5, HALTI5)) in etna_get_specs()
694 screen->specs.halti = 5; /* New GC7000/GC8x00 */ in etna_get_specs()
695 else if (VIV_FEATURE(screen, chipMinorFeatures5, HALTI4)) in etna_get_specs()
696 screen->specs.halti = 4; /* Old GC7000/GC7400 */ in etna_get_specs()
697 else if (VIV_FEATURE(screen, chipMinorFeatures5, HALTI3)) in etna_get_specs()
698 screen->specs.halti = 3; /* None? */ in etna_get_specs()
699 else if (VIV_FEATURE(screen, chipMinorFeatures4, HALTI2)) in etna_get_specs()
700 screen->specs.halti = 2; /* GC2500/GC3000/GC5000/GC6400 */ in etna_get_specs()
701 else if (VIV_FEATURE(screen, chipMinorFeatures2, HALTI1)) in etna_get_specs()
702 screen->specs.halti = 1; /* GC900/GC4000/GC7000UL */ in etna_get_specs()
703 else if (VIV_FEATURE(screen, chipMinorFeatures1, HALTI0)) in etna_get_specs()
704 screen->specs.halti = 0; /* GC880/GC2000/GC7000TM */ in etna_get_specs()
706 screen->specs.halti = -1; /* GC7000nanolite / pre-GC2000 except GC880 */ in etna_get_specs()
707 if (screen->specs.halti >= 0) in etna_get_specs()
708 DBG("etnaviv: GPU arch: HALTI%d\n", screen->specs.halti); in etna_get_specs()
712 screen->specs.can_supertile = in etna_get_specs()
713 VIV_FEATURE(screen, chipMinorFeatures0, SUPER_TILED); in etna_get_specs()
714 screen->specs.bits_per_tile = in etna_get_specs()
715 VIV_FEATURE(screen, chipMinorFeatures0, 2BITPERTILE) ? 2 : 4; in etna_get_specs()
716 screen->specs.ts_clear_value = in etna_get_specs()
717 VIV_FEATURE(screen, chipMinorFeatures0, 2BITPERTILE) ? 0x55555555 in etna_get_specs()
721 screen->specs.vertex_sampler_offset = 8; in etna_get_specs()
722 screen->specs.fragment_sampler_count = 8; in etna_get_specs()
723 screen->specs.vertex_sampler_count = 4; in etna_get_specs()
724 screen->specs.vs_need_z_div = in etna_get_specs()
725 screen->model < 0x1000 && screen->model != 0x880; in etna_get_specs()
726 screen->specs.has_sin_cos_sqrt = in etna_get_specs()
727 VIV_FEATURE(screen, chipMinorFeatures0, HAS_SQRT_TRIG); in etna_get_specs()
728 screen->specs.has_sign_floor_ceil = in etna_get_specs()
729 VIV_FEATURE(screen, chipMinorFeatures0, HAS_SIGN_FLOOR_CEIL); in etna_get_specs()
730 screen->specs.has_shader_range_registers = in etna_get_specs()
731 screen->model >= 0x1000 || screen->model == 0x880; in etna_get_specs()
732 screen->specs.npot_tex_any_wrap = in etna_get_specs()
733 VIV_FEATURE(screen, chipMinorFeatures1, NON_POWER_OF_TWO); in etna_get_specs()
734 screen->specs.has_new_transcendentals = in etna_get_specs()
735 VIV_FEATURE(screen, chipMinorFeatures3, HAS_FAST_TRANSCENDENTALS); in etna_get_specs()
736 screen->specs.has_halti2_instructions = in etna_get_specs()
737 VIV_FEATURE(screen, chipMinorFeatures4, HALTI2); in etna_get_specs()
739 if (screen->specs.halti >= 5) { in etna_get_specs()
741 screen->specs.vs_offset = 0; in etna_get_specs()
742 screen->specs.ps_offset = 0; in etna_get_specs()
743 screen->specs.max_instructions = 0; /* Do not program shaders manually */ in etna_get_specs()
744 screen->specs.has_icache = true; in etna_get_specs()
745 } else if (VIV_FEATURE(screen, chipMinorFeatures3, INSTRUCTION_CACHE)) { in etna_get_specs()
752 screen->specs.vs_offset = 0xC000; in etna_get_specs()
757 screen->specs.ps_offset = 0x8000 + 0x1000; in etna_get_specs()
758 screen->specs.max_instructions = 256; /* maximum number instructions for non-icache use */ in etna_get_specs()
759 screen->specs.has_icache = true; in etna_get_specs()
762 screen->specs.vs_offset = 0xC000; in etna_get_specs()
763 screen->specs.ps_offset = 0xD000; /* like vivante driver */ in etna_get_specs()
764 screen->specs.max_instructions = 256; in etna_get_specs()
766 screen->specs.vs_offset = 0x4000; in etna_get_specs()
767 screen->specs.ps_offset = 0x6000; in etna_get_specs()
768 screen->specs.max_instructions = instruction_count / 2; in etna_get_specs()
770 screen->specs.has_icache = false; in etna_get_specs()
773 if (VIV_FEATURE(screen, chipMinorFeatures1, HALTI0)) { in etna_get_specs()
774 screen->specs.max_varyings = 12; in etna_get_specs()
775 screen->specs.vertex_max_elements = 16; in etna_get_specs()
777 screen->specs.max_varyings = 8; in etna_get_specs()
781 screen->specs.vertex_max_elements = 10; in etna_get_specs()
787 if (screen->specs.max_varyings > ETNA_NUM_VARYINGS) in etna_get_specs()
788 screen->specs.max_varyings = ETNA_NUM_VARYINGS; in etna_get_specs()
791 if (screen->model < chipModel_GC4000) { in etna_get_specs()
792 screen->specs.max_vs_uniforms = 168; in etna_get_specs()
793 screen->specs.max_ps_uniforms = 64; in etna_get_specs()
795 screen->specs.max_vs_uniforms = 256; in etna_get_specs()
796 screen->specs.max_ps_uniforms = 256; in etna_get_specs()
799 if (screen->specs.halti >= 5) { in etna_get_specs()
800 screen->specs.has_unified_uniforms = true; in etna_get_specs()
801 screen->specs.vs_uniforms_offset = VIVS_SH_HALTI5_UNIFORMS_MIRROR(0); in etna_get_specs()
802 screen->specs.ps_uniforms_offset = VIVS_SH_HALTI5_UNIFORMS(screen->specs.max_vs_uniforms*4); in etna_get_specs()
803 } else if (screen->specs.halti >= 1) { in etna_get_specs()
806 screen->specs.has_unified_uniforms = true; in etna_get_specs()
807 screen->specs.vs_uniforms_offset = VIVS_SH_UNIFORMS(0); in etna_get_specs()
812 screen->specs.ps_uniforms_offset = VIVS_SH_UNIFORMS(screen->specs.max_vs_uniforms*4); in etna_get_specs()
814 screen->specs.has_unified_uniforms = false; in etna_get_specs()
815 screen->specs.vs_uniforms_offset = VIVS_VS_UNIFORMS(0); in etna_get_specs()
816 screen->specs.ps_uniforms_offset = VIVS_PS_UNIFORMS(0); in etna_get_specs()
819 screen->specs.max_texture_size = in etna_get_specs()
820 VIV_FEATURE(screen, chipMinorFeatures0, TEXTURE_8K) ? 8192 : 2048; in etna_get_specs()
821 screen->specs.max_rendertarget_size = in etna_get_specs()
822 VIV_FEATURE(screen, chipMinorFeatures0, RENDERTARGET_8K) ? 8192 : 2048; in etna_get_specs()
824 screen->specs.single_buffer = VIV_FEATURE(screen, chipMinorFeatures4, SINGLE_BUFFER); in etna_get_specs()
825 if (screen->specs.single_buffer) in etna_get_specs()
826 DBG("etnaviv: Single buffer mode enabled with %d pixel pipes\n", screen->specs.pixel_pipes); in etna_get_specs()
828 screen->specs.tex_astc = VIV_FEATURE(screen, chipMinorFeatures4, TEXTURE_ASTC); in etna_get_specs()
830 screen->specs.use_blt = VIV_FEATURE(screen, chipMinorFeatures5, BLT_ENGINE); in etna_get_specs()
842 struct etna_screen *screen = etna_screen(pscreen); in etna_screen_bo_from_handle() local
846 bo = etna_bo_from_name(screen->dev, whandle->handle); in etna_screen_bo_from_handle()
848 bo = etna_bo_from_dmabuf(screen->dev, whandle->handle); in etna_screen_bo_from_handle()
868 struct etna_screen *screen = CALLOC_STRUCT(etna_screen); in etna_screen_create() local
873 if (!screen) in etna_screen_create()
876 pscreen = &screen->base; in etna_screen_create()
877 screen->dev = dev; in etna_screen_create()
878 screen->gpu = gpu; in etna_screen_create()
879 screen->ro = renderonly_dup(ro); in etna_screen_create()
880 screen->refcnt = 1; in etna_screen_create()
882 if (!screen->ro) { in etna_screen_create()
887 version = drmGetVersion(screen->ro->gpu_fd); in etna_screen_create()
888 screen->drm_version = ETNA_DRM_VERSION(version->version_major, in etna_screen_create()
897 screen->pipe = etna_pipe_new(gpu, ETNA_PIPE_3D); in etna_screen_create()
898 if (!screen->pipe) { in etna_screen_create()
903 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_MODEL, &val)) { in etna_screen_create()
907 screen->model = val; in etna_screen_create()
909 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_REVISION, &val)) { in etna_screen_create()
913 screen->revision = val; in etna_screen_create()
915 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_0, &val)) { in etna_screen_create()
919 screen->features[0] = val; in etna_screen_create()
921 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_1, &val)) { in etna_screen_create()
925 screen->features[1] = val; in etna_screen_create()
927 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_2, &val)) { in etna_screen_create()
931 screen->features[2] = val; in etna_screen_create()
933 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_3, &val)) { in etna_screen_create()
937 screen->features[3] = val; in etna_screen_create()
939 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_4, &val)) { in etna_screen_create()
943 screen->features[4] = val; in etna_screen_create()
945 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_5, &val)) { in etna_screen_create()
949 screen->features[5] = val; in etna_screen_create()
951 if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_6, &val)) { in etna_screen_create()
955 screen->features[6] = val; in etna_screen_create()
957 if (!etna_get_specs(screen)) in etna_screen_create()
962 screen->features[viv_chipFeatures] |= chipFeatures_NO_EARLY_Z; in etna_screen_create()
964 screen->features[viv_chipFeatures] &= ~chipFeatures_FAST_CLEAR; in etna_screen_create()
966 screen->features[viv_chipMinorFeatures1] &= ~chipMinorFeatures1_AUTO_DISABLE; in etna_screen_create()
968 screen->specs.can_supertile = 0; in etna_screen_create()
988 slab_create_parent(&screen->transfer_pool, sizeof(struct etna_transfer), 16); in etna_screen_create()