├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── attic ├── Makefile ├── Makefile.inc ├── README.md ├── cl │ ├── .gitignore │ ├── Makefile │ ├── README.md │ └── hello.c ├── driver │ ├── .gitignore │ ├── Makefile │ ├── etna_asm.c │ ├── etna_asm.h │ ├── etna_blend.c │ ├── etna_blend.h │ ├── etna_clear_blit.c │ ├── etna_clear_blit.h │ ├── etna_compiler.c │ ├── etna_compiler.h │ ├── etna_debug.h │ ├── etna_fence.c │ ├── etna_fence.h │ ├── etna_internal.h │ ├── etna_pipe.c │ ├── etna_pipe.h │ ├── etna_rasterizer.c │ ├── etna_rasterizer.h │ ├── etna_resource.c │ ├── etna_resource.h │ ├── etna_screen.c │ ├── etna_screen.h │ ├── etna_shader.c │ ├── etna_shader.h │ ├── etna_surface.c │ ├── etna_surface.h │ ├── etna_texture.c │ ├── etna_texture.h │ ├── etna_transfer.c │ ├── etna_transfer.h │ ├── etna_translate.h │ ├── etna_zsa.c │ └── etna_zsa.h ├── egl │ ├── .gitignore │ ├── Makefile │ ├── clear_surface.c │ ├── cube.c │ ├── cube_companion.c │ ├── cube_companion_idx.c │ ├── cube_x11.c │ ├── displacement.c │ ├── eglinfo.c │ ├── es2gears.c │ ├── exec_egl2.sh │ ├── glut_test.c │ ├── particle_system_x11.c │ ├── ps_sandbox.c │ ├── simple_texture_cubemap.c │ └── stencil_test.c ├── etnaviv │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── etna.c │ ├── etna.h │ ├── etna_bo.c │ ├── etna_bo.h │ ├── etna_fb.c │ ├── etna_fb.h │ ├── etna_queue.c │ ├── etna_queue.h │ ├── etna_rs.c │ ├── etna_rs.h │ ├── etna_tex.c │ ├── etna_tex.h │ ├── etna_util.h │ ├── viv.c │ ├── viv.h │ ├── viv_internal.h │ ├── viv_profile.c │ └── viv_profile.h ├── fb │ ├── .gitignore │ ├── Makefile │ ├── alpha_blend.c │ ├── cube_companion.c │ ├── cubemap_sphere.c │ ├── displacement.c │ ├── downsample_test.c │ ├── etna_gears.c │ ├── exec_fb.sh │ ├── mip_cube.c │ ├── particle_system.c │ ├── ps_sandbox.c │ ├── rotate_cube.c │ ├── stencil_test.c │ ├── sync_cubox.sh │ ├── sync_gcw.sh │ └── viv_profile.c ├── fb_old │ ├── .gitignore │ ├── Makefile │ ├── cube_companion.c │ ├── etna_test.c │ ├── fbtest.c │ ├── mip_cube_raw.c │ ├── rotate_cube.c │ └── rstests.c ├── fb_rawshader │ ├── .gitignore │ ├── Makefile │ ├── alpha_blend.c │ ├── alpha_blend_vs.asm │ ├── cube_companion.c │ ├── cube_companion_ps.asm │ ├── cube_companion_vs.asm │ ├── cubemap_sphere.c │ ├── cubemap_sphere_ps.asm │ ├── cubemap_sphere_vs.asm │ ├── displacement.c │ ├── displacement_ps.asm │ ├── displacement_vs.asm │ ├── etna_gears.c │ ├── etna_gears_ps.asm │ ├── etna_gears_vs.asm │ ├── exec_fb.sh │ ├── mip_cube.c │ ├── mip_cube_ps.asm │ ├── mip_cube_vs.asm │ ├── particle_system.c │ ├── particle_system_ps.asm │ ├── particle_system_vs.asm │ ├── rotate_cube.c │ ├── shader.bin │ ├── stencil_test.c │ ├── stencil_test_ps.asm │ └── stencil_test_vs.asm ├── lib │ ├── dds.c │ ├── dds.h │ ├── dump_gl_screen.c │ ├── dump_gl_screen.h │ ├── eglutil.c │ ├── eglutil.h │ ├── elf_hook.c │ ├── elf_hook.h │ ├── esShader.c │ ├── esShader.h │ ├── esShapes.c │ ├── esShapes.h │ ├── esTransform.c │ ├── esTransform.h │ ├── esUtil.c │ ├── esUtil.h │ ├── esWindow.c │ ├── esWindow.h │ ├── etna_bswap.c │ ├── etna_bswap.h │ ├── etna_rawshader.c │ ├── etna_rawshader.h │ ├── fbdemos.c │ ├── fbdemos.h │ ├── flightrecorder.cpp │ ├── flightrecorder.h │ ├── interval.h │ ├── interval_test.cpp │ ├── read_png.c │ ├── read_png.h │ ├── viv_hook.c │ ├── viv_hook.h │ ├── write_bmp.c │ └── write_bmp.h ├── minigallium │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── auxiliary │ │ ├── cso_cache │ │ │ ├── cso_cache.c │ │ │ ├── cso_cache.h │ │ │ ├── cso_context.c │ │ │ ├── cso_context.h │ │ │ ├── cso_hash.c │ │ │ └── cso_hash.h │ │ ├── os │ │ │ ├── os_memory.h │ │ │ ├── os_memory_aligned.h │ │ │ ├── os_memory_debug.h │ │ │ ├── os_memory_stdc.h │ │ │ ├── os_misc.c │ │ │ ├── os_misc.h │ │ │ ├── os_mman.h │ │ │ ├── os_thread.h │ │ │ ├── os_time.c │ │ │ └── os_time.h │ │ ├── tgsi │ │ │ ├── tgsi_build.c │ │ │ ├── tgsi_build.h │ │ │ ├── tgsi_dump.c │ │ │ ├── tgsi_dump.h │ │ │ ├── tgsi_exec.c │ │ │ ├── tgsi_exec.h │ │ │ ├── tgsi_info.c │ │ │ ├── tgsi_info.h │ │ │ ├── tgsi_iterate.c │ │ │ ├── tgsi_iterate.h │ │ │ ├── tgsi_opcode_tmp.h │ │ │ ├── tgsi_parse.c │ │ │ ├── tgsi_parse.h │ │ │ ├── tgsi_sanity.c │ │ │ ├── tgsi_sanity.h │ │ │ ├── tgsi_scan.c │ │ │ ├── tgsi_scan.h │ │ │ ├── tgsi_strings.c │ │ │ ├── tgsi_strings.h │ │ │ ├── tgsi_text.c │ │ │ ├── tgsi_text.h │ │ │ ├── tgsi_transform.c │ │ │ ├── tgsi_transform.h │ │ │ ├── tgsi_ureg.c │ │ │ ├── tgsi_ureg.h │ │ │ ├── tgsi_util.c │ │ │ └── tgsi_util.h │ │ ├── translate │ │ │ ├── translate.c │ │ │ ├── translate.h │ │ │ ├── translate_cache.c │ │ │ ├── translate_cache.h │ │ │ ├── translate_generic.c │ │ │ └── translate_sse.c │ │ └── util │ │ │ ├── dbghelp.h │ │ │ ├── texcompress_etc_tmp.h │ │ │ ├── texcompress_rgtc_tmp.h │ │ │ ├── u_atomic.h │ │ │ ├── u_bitmask.c │ │ │ ├── u_bitmask.h │ │ │ ├── u_blit.c │ │ │ ├── u_blit.h │ │ │ ├── u_blitter.c │ │ │ ├── u_blitter.h │ │ │ ├── u_box.h │ │ │ ├── u_cache.c │ │ │ ├── u_cache.h │ │ │ ├── u_caps.c │ │ │ ├── u_caps.h │ │ │ ├── u_clear.h │ │ │ ├── u_cpu_detect.c │ │ │ ├── u_cpu_detect.h │ │ │ ├── u_debug.c │ │ │ ├── u_debug.h │ │ │ ├── u_debug_describe.c │ │ │ ├── u_debug_describe.h │ │ │ ├── u_debug_memory.c │ │ │ ├── u_debug_refcnt.c │ │ │ ├── u_debug_refcnt.h │ │ │ ├── u_debug_stack.c │ │ │ ├── u_debug_stack.h │ │ │ ├── u_debug_symbol.c │ │ │ ├── u_debug_symbol.h │ │ │ ├── u_dirty_flags.h │ │ │ ├── u_dirty_surfaces.h │ │ │ ├── u_dl.c │ │ │ ├── u_dl.h │ │ │ ├── u_double_list.h │ │ │ ├── u_draw.c │ │ │ ├── u_draw.h │ │ │ ├── u_draw_quad.c │ │ │ ├── u_draw_quad.h │ │ │ ├── u_dual_blend.h │ │ │ ├── u_dump.h │ │ │ ├── u_dump_defines.c │ │ │ ├── u_dump_state.c │ │ │ ├── u_dynarray.h │ │ │ ├── u_fifo.h │ │ │ ├── u_format.c │ │ │ ├── u_format.csv │ │ │ ├── u_format.h │ │ │ ├── u_format_etc.c │ │ │ ├── u_format_etc.h │ │ │ ├── u_format_latc.c │ │ │ ├── u_format_latc.h │ │ │ ├── u_format_other.c │ │ │ ├── u_format_other.h │ │ │ ├── u_format_pack.py │ │ │ ├── u_format_parse.py │ │ │ ├── u_format_r11g11b10f.h │ │ │ ├── u_format_rgb9e5.h │ │ │ ├── u_format_rgtc.c │ │ │ ├── u_format_rgtc.h │ │ │ ├── u_format_s3tc.c │ │ │ ├── u_format_s3tc.h │ │ │ ├── u_format_srgb.c │ │ │ ├── u_format_srgb.h │ │ │ ├── u_format_srgb.py │ │ │ ├── u_format_table.c │ │ │ ├── u_format_table.py │ │ │ ├── u_format_tests.c │ │ │ ├── u_format_tests.h │ │ │ ├── u_format_yuv.c │ │ │ ├── u_format_yuv.h │ │ │ ├── u_format_zs.c │ │ │ ├── u_format_zs.h │ │ │ ├── u_framebuffer.c │ │ │ ├── u_framebuffer.h │ │ │ ├── u_gen_mipmap.c │ │ │ ├── u_gen_mipmap.h │ │ │ ├── u_half.h │ │ │ ├── u_handle_table.c │ │ │ ├── u_handle_table.h │ │ │ ├── u_hash.c │ │ │ ├── u_hash.h │ │ │ ├── u_hash_table.c │ │ │ ├── u_hash_table.h │ │ │ ├── u_helpers.c │ │ │ ├── u_helpers.h │ │ │ ├── u_index_modify.c │ │ │ ├── u_index_modify.h │ │ │ ├── u_init.h │ │ │ ├── u_inlines.h │ │ │ ├── u_keymap.c │ │ │ ├── u_keymap.h │ │ │ ├── u_linear.c │ │ │ ├── u_linear.h │ │ │ ├── u_linkage.c │ │ │ ├── u_linkage.h │ │ │ ├── u_math.c │ │ │ ├── u_math.h │ │ │ ├── u_memory.h │ │ │ ├── u_mm.c │ │ │ ├── u_mm.h │ │ │ ├── u_network.c │ │ │ ├── u_network.h │ │ │ ├── u_pack_color.h │ │ │ ├── u_pointer.h │ │ │ ├── u_prim.h │ │ │ ├── u_pstipple.c │ │ │ ├── u_pstipple.h │ │ │ ├── u_range.h │ │ │ ├── u_rect.h │ │ │ ├── u_resource.c │ │ │ ├── u_resource.h │ │ │ ├── u_ringbuffer.c │ │ │ ├── u_ringbuffer.h │ │ │ ├── u_sampler.c │ │ │ ├── u_sampler.h │ │ │ ├── u_simple_list.h │ │ │ ├── u_simple_shaders.c │ │ │ ├── u_simple_shaders.h │ │ │ ├── u_slab.c │ │ │ ├── u_slab.h │ │ │ ├── u_snprintf.c │ │ │ ├── u_split_prim.h │ │ │ ├── u_sse.h │ │ │ ├── u_staging.c │ │ │ ├── u_staging.h │ │ │ ├── u_string.h │ │ │ ├── u_suballoc.c │ │ │ ├── u_suballoc.h │ │ │ ├── u_surface.c │ │ │ ├── u_surface.h │ │ │ ├── u_surfaces.c │ │ │ ├── u_surfaces.h │ │ │ ├── u_texture.c │ │ │ ├── u_texture.h │ │ │ ├── u_tile.c │ │ │ ├── u_tile.h │ │ │ ├── u_time.h │ │ │ ├── u_transfer.c │ │ │ ├── u_transfer.h │ │ │ ├── u_upload_mgr.c │ │ │ ├── u_upload_mgr.h │ │ │ ├── u_vbuf.c │ │ │ ├── u_vbuf.h │ │ │ └── u_video.h │ ├── include │ │ ├── c99_compat.h │ │ ├── pipe │ │ │ ├── p_compiler.h │ │ │ ├── p_config.h │ │ │ ├── p_context.h │ │ │ ├── p_defines.h │ │ │ ├── p_format.h │ │ │ ├── p_screen.h │ │ │ ├── p_shader_tokens.h │ │ │ ├── p_state.h │ │ │ ├── p_video_enums.h │ │ │ └── p_video_state.h │ │ └── state_tracker │ │ │ └── graw.h │ ├── targets │ │ └── graw-null │ │ │ └── graw_util.c │ ├── test.c │ └── tgsi_testdata │ │ ├── cube_companion_frag.tgsi │ │ ├── cube_companion_vert.tgsi │ │ ├── cube_frag.tgsi │ │ ├── cube_vert.tgsi │ │ ├── cubemap_sphere_frag.tgsi │ │ ├── cubemap_sphere_vert.tgsi │ │ ├── displacement_frag.tgsi │ │ ├── displacement_vert.tgsi │ │ ├── etna_gears_ps.tgsi │ │ ├── etna_gears_vs.tgsi │ │ ├── particle_system_frag.tgsi │ │ ├── particle_system_vert.tgsi │ │ ├── stencil_test_frag.tgsi │ │ ├── stencil_test_vert.tgsi │ │ └── sun_fs_frag.tgsi ├── replay │ ├── .gitignore │ ├── Makefile │ ├── companion_cmd.h │ ├── companion_cmd_gc880.h │ ├── context_cmd.h │ ├── cube.c │ ├── cube_cmd.h │ ├── cube_cmd_gc880.h │ ├── cube_companion.c │ ├── cube_companion_gc880.c │ ├── cube_companion_replay.png │ ├── cube_etna.c │ ├── cube_etna2.c │ ├── cube_etna2_gc880.c │ ├── cube_etna_gc880.c │ ├── cube_gc880.c │ ├── cube_replay.png │ ├── debugscript.gdb │ ├── empty_screen_cmd.h │ ├── empty_screen_gc880.c │ ├── etna_test.c │ ├── exec_replay.sh │ ├── ps_sandbox_etna.c │ ├── sandbox.asm │ ├── test.c │ ├── viv_raw.c │ └── viv_raw.h ├── resources │ ├── README.md │ ├── amethyst256.png │ ├── attribution.txt │ ├── bigbuckbunny_yv12.yuv │ ├── companion.h │ ├── companion_array.c │ ├── companion_mesh.c │ ├── companion_texture.c │ ├── lavaetc1.dds │ ├── mipdxt1.dds │ ├── mipdxt5.dds │ ├── miprgba.dds │ ├── smoke.tga │ ├── test_image-dxt1a.dds │ ├── test_image-dxt1c.dds │ ├── test_image-dxt3.dds │ ├── wall1_a8.dds │ ├── wall1_l8.dds │ └── wani21_sr8.h ├── test2d │ ├── .gitignore │ ├── Makefile │ ├── bitblt2d.c │ ├── bitblt2d_alpha.c │ ├── bitblt2d_from_stream.c │ ├── bitblt2d_palette.c │ ├── bitblt2d_rotate.c │ ├── clear2d.c │ ├── filterblt2d.c │ ├── filterblt2d_fromplanar.c │ ├── line2d.c │ ├── line2d_patterned.c │ └── stretchblt2d.c └── utils │ ├── .gitignore │ ├── Makefile │ ├── viv_gpu_top.c │ ├── viv_info.c │ ├── viv_interpose.c │ ├── viv_registers.c │ ├── viv_reset.c │ ├── viv_throughput.c │ └── viv_watch.c ├── doc ├── 2d.md ├── blob_extensions.md ├── gpus_comparison.html ├── hardware.md ├── images │ ├── displacement.png │ ├── fsaa1.png │ ├── fsaa2.png │ ├── fsaa4.png │ ├── fsaa_result.png │ ├── mipmap.png │ └── supertile.png ├── isa.md ├── kernel_bugs.md ├── kernel_interface.md └── patents.md ├── envytools ├── .gitignore ├── CMakeLists.txt ├── include │ ├── colors.h │ ├── mask.h │ ├── rnn.h │ ├── rnndec.h │ ├── symtab.h │ ├── util.h │ ├── var.h │ └── yy.h ├── rnn │ ├── .gitignore │ ├── CMakeLists.txt │ ├── dedma.c │ ├── dedma.h │ ├── dedma_back.c │ ├── dedma_cache.c │ ├── demmio.c │ ├── expand.c │ ├── headergen.c │ ├── lookup.c │ ├── renouveau2rnn │ ├── rnn.c │ ├── rnn_path.h.in │ ├── rnncheck.c │ ├── rnndec.c │ ├── rules2rnn │ ├── text2xml │ ├── update.sed.sh │ └── xml2text └── util │ ├── .gitignore │ ├── CMakeLists.txt │ ├── aprintf.c │ ├── astr.c │ ├── colors.c │ ├── hash.c │ ├── mask.c │ ├── path.c │ ├── symtab.c │ ├── vardata.c │ ├── varinfo.c │ ├── varselect.c │ └── yy.c ├── rnndb ├── cmdstream.xml ├── common.xml ├── common_3d.xml ├── copyright.xml ├── gen_headers.sh ├── isa.xml ├── state.xml ├── state_2d.xml ├── state_3d.xml ├── state_blt.xml ├── state_hi.xml ├── state_vg.xml └── texdesc_3d.xml ├── src └── etnaviv │ ├── cmdstream.xml.h │ ├── common.xml.h │ ├── isa.xml.h │ ├── state.xml.h │ ├── state_2d.xml.h │ ├── state_3d.xml.h │ ├── state_hi.xml.h │ └── state_vg.xml.h └── tools ├── asm.py ├── bits_set.py ├── build_json.sh ├── data ├── gcs_hal_interface_arnova.json ├── gcs_hal_interface_dove.json ├── gcs_hal_interface_dove_old.json ├── gcs_hal_interface_imx6.json ├── gcs_hal_interface_imx6_v5_0_11_p4_25762.json ├── gcs_hal_interface_imx6_v5_0_11_p8_41671.json ├── gcs_hal_interface_imx6_v6.2.2.93313.json ├── gcs_hal_interface_imx8_v6.2.3.129602.json ├── gcs_hal_interface_imx8_v6.2.4.190076.json ├── gcs_hal_interface_imx_v6.2.4.p2.163672.json ├── gcs_hal_interface_v2.json ├── gcs_hal_interface_v4.json ├── gles2.xml ├── gpus.json └── viv_gallium_state.txt ├── deobfuscate-complex-vivante.pl ├── deobfuscate-simple-vivante.pl ├── deobfuscate-simple2-vivante.pl ├── detiler.py ├── disasm.py ├── dump_cmdstream.py ├── dump_mmt.py ├── dump_separate_cmdbuf.py ├── etnaviv ├── __init__.py ├── asm_common.py ├── asm_defs.py ├── auto_gcabi.py ├── counter.py ├── disasm.py ├── dump_cmdstream_util.py ├── dump_structure.py ├── extract_structure.py ├── floatutil.py ├── mmt.py ├── parse_command_buffer.py ├── parse_fdr.py ├── parse_proc_map.py ├── parse_rng.py ├── rangeutil.py ├── rng_describe_c.py ├── rnn_domain_visitor.py ├── stringutil.py ├── target_arch.py ├── textutil.py └── util.py ├── etnaviv_gdb.py ├── fdr_dump_mem.py ├── gen_weave_state.py ├── genmipmaps_etc1.py ├── genmipmaps_l8.py └── make_feature_comparison.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.bmp 2 | *.o 3 | *.pyc 4 | *.fdr 5 | *.swp 6 | *.so 7 | tags 8 | 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/galcore_headers"] 2 | path = attic/galcore_headers 3 | url = https://github.com/etnaviv/galcore_headers.git 4 | -------------------------------------------------------------------------------- /attic/Makefile: -------------------------------------------------------------------------------- 1 | TOP=. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | DIRS=minigallium etnaviv driver fb fb_rawshader replay test2d utils 6 | 7 | # only needed for reverse engineering/dumping 8 | # this needs a current EGL+OpenGL ES2 driver 9 | # use "make rev" 10 | DIRS_REV=egl 11 | 12 | .PHONY: all clean install rev $(DIRS) $(DIRS_REV) 13 | .NOTPARALLEL: 14 | 15 | all: CMD = all 16 | all: $(DIRS) 17 | 18 | rev: CMD = all 19 | rev: $(DIRS_REV) 20 | 21 | $(DIRS) $(DIRS_REV): 22 | $(MAKE) $(CMD) -C $@ 23 | 24 | install: CMD = install 25 | install: $(DIRS) 26 | 27 | clean: CMD = clean 28 | clean: $(DIRS) $(DIRS_REV) 29 | 30 | -------------------------------------------------------------------------------- /attic/Makefile.inc: -------------------------------------------------------------------------------- 1 | ifndef GCABI 2 | $(error GCABI is undefined. Consult the README.md file to set it according to your kernel) 3 | endif 4 | 5 | PLATFORM_GL_LIBS ?= -lEGL -lGLESv2 6 | 7 | CC = $(GCCPREFIX)gcc 8 | CXX = $(GCCPREFIX)g++ 9 | LD = $(GCCPREFIX)ld 10 | AR = $(GCCPREFIX)ar 11 | 12 | GCC_CFLAGS = -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE 13 | COMMON_FLAGS = -O2 -g3 -ggdb3 -Wall -Wmissing-prototypes \ 14 | -DGCABI_${GCABI} $(GCC_CFLAGS) -I$(TOP)/lib -I$(TOP)/galcore_headers/include_$(GCABI) \ 15 | -fPIC -pthread \ 16 | -I$(TOP)/minigallium/include -I$(TOP)/minigallium/auxiliary -I$(TOP) \ 17 | -fdiagnostics-show-option \ 18 | -Werror=missing-prototypes -Werror=missing-declarations -Werror=implicit-function-declaration \ 19 | -Werror=return-type 20 | 21 | CFLAGS += $(PLATFORM_CFLAGS) $(COMMON_FLAGS) -std=gnu99 22 | CXXFLAGS += $(PLATFORM_CXXFLAGS) $(COMMON_FLAGS) 23 | LDFLAGS += $(PLATFORM_LDFLAGS) $(COMMON_FLAGS) -lm 24 | 25 | -------------------------------------------------------------------------------- /attic/README.md: -------------------------------------------------------------------------------- 1 | Directory contents 2 | =================== 3 | 4 | Old etnaviv repository contents, most have not been touched in a long time, and 5 | are outdated. 6 | 7 | - `egl`: egl demos, to check GL functionality 8 | 9 | - `replay`: original replay command stream tests (very low level) 10 | 11 | - `etnaviv`: libetnaviv low-level command buffer handling library and register definition headers 12 | 13 | - `fb`: attempts at rendering to framebuffer using `etna_pipe` (high level gallium-like interface) 14 | 15 | - `fb_rawshader`: same as `fb`, but using manually assembled shaders. <GC1000 only. 16 | 17 | - `fb_old`: attempts at rendering to framebuffer using raw state queueing (lower level interface) 18 | 19 | - `lib`: C files shared between demos and tests, generic math and GL context utilities etc 20 | 21 | - `driver`: `etna_pipe` driver and generated hardware header files 22 | 23 | - `resources`: meshes, textures used in demos 24 | 25 | - `cl`: OpenCL test (like egl, for command stream interception) 26 | 27 | - `test2d`: 2D engine tests 28 | 29 | - `util`: Various utilities for developing, debugging and profiling for Vivante GPUS 30 | 31 | -------------------------------------------------------------------------------- /attic/cl/.gitignore: -------------------------------------------------------------------------------- 1 | hello 2 | 3 | -------------------------------------------------------------------------------- /attic/cl/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -I../resources 6 | CFLAGS += $(COMMON_FLAGS) 7 | CXXFLAGS += $(COMMON_FLAGS) 8 | LDFLAGS += 9 | 10 | GL_LIBS = $(PLATFORM_CL_LIBS) 11 | TARGETS = hello 12 | LIB_OBJS = ../lib/elf_hook.o ../lib/flightrecorder.o ../lib/viv_hook.o 13 | 14 | all: $(TARGETS) 15 | 16 | clean: 17 | rm -f *.o ../lib/*.o 18 | rm -f $(TARGETS) ${COMPANION_OBJS} 19 | 20 | hello: hello.o $(LIB_OBJS) 21 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 22 | 23 | 24 | -------------------------------------------------------------------------------- /attic/cl/README.md: -------------------------------------------------------------------------------- 1 | OpenCL 2 | ---------- 3 | 4 | This directory holds demos, similar to the `egl` directory for GLES2, can be used to intercept the GPU 5 | command stream while using OpenCL. 6 | 7 | - hello: very basic OpenCL program 8 | 9 | -------------------------------------------------------------------------------- /attic/driver/.gitignore: -------------------------------------------------------------------------------- 1 | libetnadriver.a 2 | 3 | -------------------------------------------------------------------------------- /attic/driver/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -DRAWSHADER 6 | LDFLAGS += 7 | DRIVER_OBJS = \ 8 | etna_asm.o \ 9 | etna_blend.o \ 10 | etna_clear_blit.o \ 11 | etna_compiler.o \ 12 | etna_fence.o \ 13 | etna_pipe.o \ 14 | etna_rasterizer.o \ 15 | etna_resource.o \ 16 | etna_screen.o \ 17 | etna_shader.o \ 18 | etna_surface.o \ 19 | etna_texture.o \ 20 | etna_transfer.o \ 21 | etna_zsa.o 22 | 23 | TARGETS = libetnadriver.a 24 | 25 | all: $(TARGETS) 26 | 27 | clean: 28 | rm -f $(DRIVER_OBJS) 29 | rm -f $(TARGETS) *.o 30 | 31 | libetnadriver.a: $(DRIVER_OBJS) 32 | $(AR) rcs $@ $^ 33 | 34 | 35 | -------------------------------------------------------------------------------- /attic/driver/etna_blend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Blending CSOs */ 24 | #ifndef H_ETNA_BLEND 25 | #define H_ETNA_BLEND 26 | 27 | struct pipe_context; 28 | 29 | void etna_pipe_blend_init(struct pipe_context *pipe); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /attic/driver/etna_clear_blit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Clearing and blitting functionality */ 24 | #ifndef H_ETNA_CLEAR_BLIT 25 | #define H_ETNA_CLEAR_BLIT 26 | 27 | #include 28 | 29 | struct etna_ctx; 30 | struct pipe_context; 31 | struct etna_surface; 32 | struct compiled_rs_state; 33 | 34 | void etna_rs_gen_clear_surface(struct etna_ctx *ctx, struct compiled_rs_state *rs_state, struct etna_surface *surf, uint32_t clear_value); 35 | 36 | void etna_pipe_clear_blit_init(struct pipe_context *pipe); 37 | 38 | void etna_pipe_clear_blit_destroy(struct pipe_context *pipe); 39 | 40 | #endif 41 | 42 | 43 | -------------------------------------------------------------------------------- /attic/driver/etna_fence.c: -------------------------------------------------------------------------------- 1 | #include "etna_fence.h" 2 | #include "etna_debug.h" 3 | #include "etna_screen.h" 4 | #include "util/u_memory.h" 5 | #include "util/u_inlines.h" 6 | #include "util/u_string.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | /** 13 | * Reference or unreference a fence. This is pretty much a no-op. 14 | */ 15 | static void etna_screen_fence_reference(struct pipe_screen *screen_h, 16 | struct pipe_fence_handle **ptr_h, 17 | struct pipe_fence_handle *fence_h) 18 | { 19 | *ptr_h = fence_h; 20 | } 21 | 22 | /** 23 | * Wait until the fence has been signalled for the specified timeout in nanoseconds, 24 | * or PIPE_TIMEOUT_INFINITE. 25 | */ 26 | static boolean etna_screen_fence_finish(struct pipe_screen *screen_h, 27 | struct pipe_fence_handle *fence_h, 28 | uint64_t timeout ) 29 | { 30 | struct etna_screen *screen = etna_screen(screen_h); 31 | uint32_t fence = PIPE_HANDLE_TO_ETNA_FENCE(fence_h); 32 | int rv; 33 | /* nanoseconds to milliseconds */ 34 | rv = viv_fence_finish(screen->dev, fence, 35 | timeout == PIPE_TIMEOUT_INFINITE ? VIV_WAIT_INDEFINITE : (timeout / 1000000ULL)); 36 | if(rv != VIV_STATUS_OK && rv != VIV_STATUS_TIMEOUT) 37 | { 38 | BUG("error waiting for fence %08x", fence); 39 | } 40 | return (rv != VIV_STATUS_TIMEOUT); 41 | } 42 | 43 | /** 44 | * Poll whether the fence has been signalled. 45 | */ 46 | static boolean etna_screen_fence_signalled(struct pipe_screen *screen_h, 47 | struct pipe_fence_handle *fence_h) 48 | { 49 | return etna_screen_fence_finish(screen_h, fence_h, 0); 50 | } 51 | 52 | void etna_screen_fence_init(struct pipe_screen *pscreen) 53 | { 54 | pscreen->fence_reference = etna_screen_fence_reference; 55 | pscreen->fence_signalled = etna_screen_fence_signalled; 56 | pscreen->fence_finish = etna_screen_fence_finish; 57 | } 58 | 59 | 60 | -------------------------------------------------------------------------------- /attic/driver/etna_fence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Functions dealing with fences */ 24 | #ifndef ETNA_FENCE_H_ 25 | #define ETNA_FENCE_H_ 26 | 27 | #include "pipe/p_state.h" 28 | 29 | struct pipe_screen; 30 | 31 | #define ETNA_FENCE_TO_PIPE_HANDLE(fence) ((struct pipe_fence_handle *)(fence)) 32 | #define PIPE_HANDLE_TO_ETNA_FENCE(fence) ((uint32_t)(fence)) 33 | 34 | void etna_screen_fence_init(struct pipe_screen *screen); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /attic/driver/etna_rasterizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Rasterizer CSOs */ 24 | #ifndef H_ETNA_RASTERIZER 25 | #define H_ETNA_RASTERIZER 26 | 27 | struct pipe_context; 28 | 29 | void etna_pipe_rasterizer_init(struct pipe_context *pipe); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /attic/driver/etna_resource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Resource handling. 24 | */ 25 | #ifndef H_ETNA_RESOURCE 26 | #define H_ETNA_RESOURCE 27 | 28 | #include "pipe/p_state.h" 29 | 30 | struct pipe_screen; 31 | struct etna_resource; 32 | 33 | void etna_resource_touch(struct pipe_context *pipe, struct pipe_resource *resource_); 34 | 35 | /* Allocate Tile Status for an etna resource. 36 | * Tile status is a cache of the clear status per tile. This means a smaller surface 37 | * has to be cleared which is faster. This is also called "fast clear". 38 | */ 39 | bool etna_screen_resource_alloc_ts(struct pipe_screen *screen, struct etna_resource *resource); 40 | 41 | void etna_screen_resource_init(struct pipe_screen *screen); 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /attic/driver/etna_screen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | #ifndef ETNA_SCREEN_H_ 24 | #define ETNA_SCREEN_H_ 25 | 26 | #include "etna_internal.h" 27 | 28 | #include "pipe/p_screen.h" 29 | #include "os/os_thread.h" 30 | 31 | struct viv_conn; 32 | struct etna_bo; 33 | 34 | #define ETNA_SCREEN_NAME_LEN (64) 35 | /* Gallium screen structure for etna driver. 36 | */ 37 | struct etna_screen { 38 | struct pipe_screen base; 39 | char name[ETNA_SCREEN_NAME_LEN]; 40 | struct viv_conn *dev; 41 | struct etna_pipe_specs specs; 42 | }; 43 | 44 | /* Resolve target. 45 | * Used by etna_screen_flush_frontbuffer 46 | */ 47 | struct etna_rs_target 48 | { 49 | unsigned rs_format; 50 | bool swap_rb; 51 | unsigned width, height; 52 | struct etna_bo *bo; 53 | size_t stride; 54 | struct pipe_fence_handle *fence; 55 | }; 56 | 57 | static INLINE struct etna_screen * 58 | etna_screen(struct pipe_screen *pscreen) 59 | { 60 | return (struct etna_screen *)pscreen; 61 | } 62 | 63 | struct pipe_screen * 64 | etna_screen_create(struct viv_conn *dev); 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /attic/driver/etna_shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Shader state handling. 24 | */ 25 | #ifndef H_ETNA_SHADER 26 | 27 | #include "pipe/p_state.h" 28 | 29 | struct etna_shader_object; 30 | struct compiled_shader_state; 31 | 32 | void etna_link_shaders(struct pipe_context *pipe, 33 | struct compiled_shader_state *cs, 34 | const struct etna_shader_object *vs, const struct etna_shader_object *fs); 35 | 36 | void etna_pipe_shader_init(struct pipe_context *pipe); 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /attic/driver/etna_surface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Surface handling */ 24 | #ifndef H_ETNA_SURFACE 25 | #define H_ETNA_SURFACE 26 | 27 | struct pipe_context; 28 | 29 | void etna_pipe_surface_init(struct pipe_context *pipe); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /attic/driver/etna_texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Texture CSOs */ 24 | #ifndef H_ETNA_TEXTURE 25 | #define H_ETNA_TEXTURE 26 | 27 | struct pipe_context; 28 | 29 | void etna_pipe_texture_init(struct pipe_context *pipe); 30 | 31 | #endif 32 | 33 | 34 | -------------------------------------------------------------------------------- /attic/driver/etna_transfer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Pipe memory transfer 24 | */ 25 | #ifndef H_ETNA_TRANSFER 26 | #define H_ETNA_TRANSFER 27 | 28 | #include "pipe/p_state.h" 29 | 30 | void etna_pipe_transfer_init(struct pipe_context *pipe); 31 | 32 | void etna_pipe_transfer_destroy(struct pipe_context *pc); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /attic/driver/etna_zsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Depth stencil alpha CSOs */ 24 | #ifndef H_ETNA_ZSA 25 | #define H_ETNA_ZSA 26 | 27 | struct pipe_context; 28 | 29 | void etna_pipe_zsa_init(struct pipe_context *pipe); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /attic/egl/.gitignore: -------------------------------------------------------------------------------- 1 | cube 2 | cube_companion 3 | ps_sandbox 4 | eglinfo 5 | cube_companion_idx 6 | cube_x11 7 | simple_texture_cubemap 8 | particle_system_x11 9 | stencil_test 10 | displacement 11 | clear_surface 12 | -------------------------------------------------------------------------------- /attic/egl/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -I../resources 6 | 7 | ifeq ($(USE_DIRECTFB),1) 8 | DIRECTFB_FLAGS = -DLINUX -DEGL_API_DFB -I/usr/include/directfb/ 9 | else 10 | DIRECTFB_FLAGS = 11 | endif 12 | 13 | CFLAGS += $(COMMON_FLAGS) $(DIRECTFB_FLAGS) 14 | CXXFLAGS += $(COMMON_FLAGS) $(DIRECTFB_FLAGS) 15 | LDFLAGS += -ldl 16 | 17 | GL_LIBS = $(PLATFORM_GL_LIBS) 18 | TARGETS = cube cube_companion ps_sandbox eglinfo cube_companion_idx simple_texture_cubemap displacement 19 | TARGETS_X11 = cube_x11 particle_system_x11 20 | LIB_OBJS = ../lib/esTransform.o ../lib/esShapes.o ../lib/elf_hook.o ../lib/flightrecorder.o ../lib/viv_hook.o ../lib/write_bmp.o ../lib/dump_gl_screen.o ../lib/eglutil.o 21 | COMPANION_OBJS = ../resources/companion_array.o ../resources/companion_mesh.o ../resources/companion_texture.o 22 | 23 | all: $(TARGETS) 24 | 25 | all_x11: $(TARGETS_X11) 26 | 27 | clean: 28 | rm -f *.o ../lib/*.o 29 | rm -f $(TARGETS) $(COMPANION_OBJS) $(TARGETS_X11) 30 | 31 | cube: cube.o $(LIB_OBJS) 32 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 33 | 34 | displacement: displacement.o ../lib/esShapes.o $(LIB_OBJS) 35 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 36 | 37 | 38 | cube_companion: cube_companion.o $(LIB_OBJS) $(COMPANION_OBJS) 39 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 40 | 41 | cube_companion_idx: cube_companion_idx.o $(LIB_OBJS) $(COMPANION_OBJS) 42 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 43 | 44 | ps_sandbox: ps_sandbox.o $(LIB_OBJS) 45 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 46 | 47 | simple_texture_cubemap: simple_texture_cubemap.o $(LIB_OBJS) 48 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 49 | 50 | eglinfo: eglinfo.o $(LIB_OBJS) 51 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 52 | 53 | stencil_test: stencil_test.o ${LIB_OBJS} 54 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) 55 | 56 | cube_x11: cube_x11.o ../lib/esUtil.o ../lib/esWindow.o $(LIB_OBJS) 57 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) -lX11 58 | 59 | particle_system_x11: particle_system_x11.o ../lib/esUtil.o ../lib/esWindow.o ../lib/esShader.o $(LIB_OBJS) 60 | $(CXX) $(CFLAGS) -o $@ $^ $(GL_LIBS) $(LDFLAGS) -lX11 61 | 62 | -------------------------------------------------------------------------------- /attic/egl/exec_egl2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build, upload, execute gles2 demo on device and fetch data log and resulting image 3 | DEMO=$1 4 | if [ -z "$DEMO" ]; then 5 | echo "Defaulting to cube" 6 | DEMO="cube" 7 | fi 8 | make ${DEMO} 9 | [ $? -ne 0 ] && exit 10 | 11 | adb push ${DEMO} /data/mine 12 | adb shell 'export LD_LIBRARY_PATH="/system/lib/egl";/data/mine/'"${DEMO}" 13 | adb pull /mnt/sdcard/egl2.fdr ${DEMO}.fdr 14 | adb pull /mnt/sdcard/egl2.bmp ${DEMO}.bmp 15 | -------------------------------------------------------------------------------- /attic/etnaviv/.gitignore: -------------------------------------------------------------------------------- 1 | libetnaviv.a 2 | 3 | -------------------------------------------------------------------------------- /attic/etnaviv/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += 6 | #-DDEBUG 7 | LDFLAGS += 8 | ETNAVIV_OBJS = etna.o viv.o viv_profile.o etna_bo.o etna_queue.o etna_tex.o etna_fb.o etna_rs.o 9 | 10 | ifeq ($(ETNAVIV_HOOK), 1) 11 | # Define ETNAVIV_HOOK=1 to enable hook mechanism 12 | # fdr will be written to ETNAVIV_FDR environment variable 13 | COMMON_FLAGS += -I../util -DETNAVIV_HOOK 14 | ETNAVIV_OBJS += ../lib/viv_hook.o ../lib/flightrecorder.o ../lib/elf_hook.o 15 | endif 16 | 17 | ifeq ($(ETNAVIV_PROFILER), 1) 18 | # Define ETNAVIV_PROFILER=1 if the kernel was built with VIVANTE_PROFILER 19 | # enabled 20 | COMMON_FLAGS += -DVIVANTE_PROFILER=1 21 | endif 22 | 23 | ifeq ($(ETNAVIV_DEBUG), 1) 24 | COMMON_FLAGS += -DDEBUG=1 25 | endif 26 | 27 | TARGETS = libetnaviv.a 28 | 29 | all: $(TARGETS) 30 | 31 | clean: 32 | rm -f $(ETNAVIV_OBJS) 33 | rm -f $(TARGETS) *.o 34 | 35 | libetnaviv.a: $(ETNAVIV_OBJS) 36 | $(AR) rcs $@ $^ 37 | 38 | test: test.o ../driver/etna_asm.o ../driver/etna_shader.o libminigallium.a 39 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 40 | 41 | -------------------------------------------------------------------------------- /attic/etnaviv/README.md: -------------------------------------------------------------------------------- 1 | libetnaviv 2 | ============== 3 | 4 | Library for 5 | 6 | a) ioctl (kernel interface) wrapping 7 | b) video memory management 8 | c) command buffer and event queue handling 9 | d) context / state delta handling (still incomplete) 10 | e) register description headers 11 | f) converting surfaces and textures from and to Vivante specific tiling formats 12 | 13 | Currently used only by the 3D driver in driver/. 14 | A future 2D, SVG or OpenCL driver can share this code. 15 | 16 | This library completely wraps the kernel interface, so that clients don't 17 | depend on the specific headers. 18 | 19 | -------------------------------------------------------------------------------- /attic/etnaviv/etna_fb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Convert framebuffer format to RS/PE format */ 24 | #ifndef H_ETNA_FB 25 | #define H_ETNA_FB 26 | 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | /* Determine the framebuffer format from Linux framebuffer info structure */ 35 | bool etna_fb_get_format(const struct fb_var_screeninfo *fb_var, unsigned *rs_format, bool *swap_rb); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /attic/etnaviv/etna_tex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Vivante specific surface tiling */ 24 | #ifndef H_ETNA_TEX 25 | #define H_ETNA_TEX 26 | 27 | #include 28 | 29 | /* texture or surface layout */ 30 | enum etna_surface_layout 31 | { 32 | ETNA_LAYOUT_LINEAR = 0, 33 | ETNA_LAYOUT_TILED = 1, 34 | ETNA_LAYOUT_SUPER_TILED = 1|2, /* both tiling and supertiling bit enabled */ 35 | ETNA_LAYOUT_MULTI_TILED = 4|1, /* multi pipe tiled */ 36 | ETNA_LAYOUT_MULTI_SUPERTILED = 4|1|2 /* multi pipe supertiled */ 37 | }; 38 | 39 | void etna_texture_tile(void *dest, void *src, unsigned basex, unsigned basey, unsigned dst_stride, unsigned width, unsigned height, unsigned src_stride, unsigned elmtsize); 40 | void etna_texture_untile(void *dest, void *src, unsigned basex, unsigned basey, unsigned src_stride, unsigned width, unsigned height, unsigned dst_stride, unsigned elmtsize); 41 | 42 | /* XXX from/to supertiling (can have different layouts, may be better to leave to RS) */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /attic/fb/.gitignore: -------------------------------------------------------------------------------- 1 | fbtest 2 | etna_test 3 | rotate_cube 4 | cube_companion 5 | mip_cube 6 | rstests 7 | alpha_blend 8 | cubemap_sphere 9 | stencil_test 10 | displacement 11 | particle_system 12 | etna_gears 13 | viv_profile 14 | viv_gpu_top 15 | ps_sandbox 16 | downsample_test 17 | 18 | -------------------------------------------------------------------------------- /attic/fb/exec_fb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build, upload, execute egl2 on device and fetch data log 3 | DEMO=$1 4 | if [ -z "$DEMO" ]; then 5 | DEMO="fbtest" 6 | echo "Defaulting to ${DEMO}" 7 | fi 8 | if [[ "$DEMO" == "ps_sandbox_etna" || "$DEMO" == "etna_test" ]]; then 9 | ARG="/data/mine/shader.bin" 10 | ../../tools/asm.py --isa-file ../../rnndb/isa.xml sandbox.asm -o shader.bin 11 | [ $? -ne 0 ] && exit 12 | adb push shader.bin ${ARG} 13 | fi 14 | if [[ "$DEMO" == "mip_cube" || "$DEMO" == "mip_cube_raw" ]]; then 15 | #TEX="miprgba" 16 | #TEX="mipdxt1" 17 | #TEX="test_image-dxt3" 18 | #TEX="mipdxt5" 19 | #TEX="test_image-dxt1a" 20 | #TEX="test_image-dxt1c" 21 | TEX="lavaetc1" 22 | adb push ../resources/${TEX}.dds /mnt/sdcard 23 | ARG="/mnt/sdcard/${TEX}.dds" 24 | fi 25 | if [[ "$DEMO" == "particle_system" ]]; then 26 | TEX="smoke" 27 | adb push ../resources/${TEX}.tga /mnt/sdcard 28 | ARG="/mnt/sdcard/${TEX}.tga" 29 | fi 30 | make ${DEMO} 31 | [ $? -ne 0 ] && exit 32 | adb push ${DEMO} /data/mine 33 | adb shell "/data/mine/${DEMO} ${ARG}" 34 | #adb pull /mnt/sdcard/egl2.fdr . 35 | #adb pull /mnt/sdcard/replay.bmp . 36 | -------------------------------------------------------------------------------- /attic/fb/sync_cubox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | TARGET=cubox 3 | 4 | rsync -zv alpha_blend cube_companion cubemap_sphere displacement etna_gears mip_cube particle_system rotate_cube stencil_test \ 5 | ps_sandbox downsample_test $TARGET: 6 | cd ../../../ 7 | rsync -zar --include \*/ \ 8 | --include \*.c \ 9 | --include \*.h \ 10 | --include \*.py \ 11 | --include \*.xml \ 12 | --exclude \* etna_viv cubox: 13 | 14 | -------------------------------------------------------------------------------- /attic/fb/sync_gcw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | TARGET=root@10.1.1.2 3 | 4 | rsync -zv alpha_blend cube_companion cubemap_sphere displacement etna_gears\ 5 | mip_cube particle_system rotate_cube stencil_test downsample_test ps_sandbox \ 6 | $TARGET: 7 | 8 | -------------------------------------------------------------------------------- /attic/fb/viv_profile.c: -------------------------------------------------------------------------------- 1 | /* Get info about vivante device */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | int main() 18 | { 19 | struct viv_conn *conn = 0; 20 | int rv; 21 | rv = viv_open(VIV_HW_3D, &conn); 22 | if(rv!=0) 23 | { 24 | fprintf(stderr, "Error opening device\n"); 25 | exit(1); 26 | } 27 | uint32_t num_profile_counters = viv_get_num_profile_counters(); 28 | 29 | uint32_t *counter_data = calloc(num_profile_counters, 4); 30 | if(viv_read_profile_counters_3d(conn, counter_data) != 0) 31 | { 32 | fprintf(stderr, "Error querying counters (probably unsupported with this kernel, or not built into libetnaviv)\n"); 33 | exit(1); 34 | } 35 | for(uint32_t c=0; cname, counter_data[c]); 39 | } 40 | 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /attic/fb_old/.gitignore: -------------------------------------------------------------------------------- 1 | fbtest 2 | etna_test 3 | rotate_cube 4 | cube_companion_msaa 5 | mip_cube 6 | rstests 7 | mip_cube_raw 8 | alpha_blend 9 | cubemap_sphere 10 | stencil_test 11 | 12 | -------------------------------------------------------------------------------- /attic/fb_old/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -I$(TOP)/resources -I$(TOP)/driver 6 | CFLAGS += $(COMMON_FLAGS) 7 | CXXFLAGS += $(COMMON_FLAGS) 8 | LDFLAGS += -lm ../driver/libetnadriver.a ../minigallium/libminigallium.a ../etnaviv/libetnaviv.a 9 | 10 | TARGETS = fbtest etna_test rotate_cube cube_companion rstests mip_cube_raw 11 | COMPANION_OBJS = ../resources/companion_array.o ../resources/companion_mesh.o ../resources/companion_texture.o 12 | ETNA_OBJS = ../lib/etna_bswap.o ../lib/fbdemos.o 13 | 14 | all: cube_companion_msaa 15 | 16 | clean: 17 | rm -f *.o ../lib/*.o 18 | rm -f $(TARGETS) 19 | 20 | fbtest: fbtest.o ../lib/write_bmp.o $(ETNA_OBJS) 21 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 22 | 23 | etna_test: etna_test.o ../lib/write_bmp.o $(ETNA_OBJS) 24 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 25 | 26 | rotate_cube: rotate_cube.o ../lib/write_bmp.o $(ETNA_OBJS) ../lib/esTransform.o 27 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 28 | 29 | mip_cube_raw: mip_cube_raw.o ../lib/write_bmp.o ../lib/esTransform.o ../lib/dds.o $(ETNA_OBJS) 30 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 31 | 32 | cube_companion_msaa: cube_companion.o ../lib/write_bmp.o ../lib/esTransform.o $(COMPANION_OBJS) $(ETNA_OBJS) 33 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 34 | 35 | rstests: rstests.o ../lib/write_bmp.o ../lib/esTransform.o $(COMPANION_OBJS) $(ETNA_OBJS) 36 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 37 | 38 | -------------------------------------------------------------------------------- /attic/fb_rawshader/.gitignore: -------------------------------------------------------------------------------- 1 | fbtest 2 | etna_test 3 | rotate_cube 4 | cube_companion 5 | mip_cube 6 | rstests 7 | alpha_blend 8 | cubemap_sphere 9 | stencil_test 10 | displacement 11 | particle_system 12 | etna_gears 13 | 14 | -------------------------------------------------------------------------------- /attic/fb_rawshader/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -I$(TOP)/resources -I$(TOP)/driver 6 | CFLAGS += -DDUMP 7 | CXXFLAGS += 8 | LDFLAGS += 9 | 10 | TARGETS = mip_cube cubemap_sphere stencil_test alpha_blend cube_companion particle_system displacement etna_gears rotate_cube 11 | COMPANION_OBJS = ../resources/companion_array.o ../resources/companion_mesh.o ../resources/companion_texture.o 12 | ETNA_OBJS = ../lib/fbdemos.o ../lib/etna_bswap.o ../lib/etna_rawshader.o ../driver/libetnadriver.a ../minigallium/libminigallium.a ../etnaviv/libetnaviv.a 13 | 14 | all: $(TARGETS) 15 | 16 | clean: 17 | rm -f *.o ../lib/*.o ../resources/*.o 18 | rm -f $(TARGETS) 19 | 20 | rotate_cube: rotate_cube.o ../lib/write_bmp.o $(ETNA_OBJS) ../lib/esTransform.o 21 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 22 | 23 | mip_cube: mip_cube.o ../lib/write_bmp.o ../lib/esTransform.o ../lib/dds.o $(ETNA_OBJS) 24 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 25 | 26 | cubemap_sphere: cubemap_sphere.o ../lib/write_bmp.o ../lib/esTransform.o ../lib/dds.o ../lib/esShapes.o $(ETNA_OBJS) 27 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 28 | 29 | cube_companion: cube_companion.o ../lib/write_bmp.o ../lib/esTransform.o $(COMPANION_OBJS) $(ETNA_OBJS) 30 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 31 | 32 | alpha_blend: alpha_blend.o ../lib/write_bmp.o ../lib/esTransform.o $(ETNA_OBJS) 33 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 34 | 35 | stencil_test: stencil_test.o ../lib/write_bmp.o ../lib/esTransform.o $(ETNA_OBJS) 36 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 37 | 38 | particle_system: particle_system.o ../lib/write_bmp.o ../lib/esUtil.o ../lib/esTransform.o $(ETNA_OBJS) 39 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 40 | 41 | displacement: displacement.o ../lib/write_bmp.o ../lib/esUtil.o ../lib/esTransform.o ../lib/esShapes.o $(ETNA_OBJS) 42 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 43 | 44 | etna_gears: etna_gears.o ../lib/write_bmp.o ../lib/esUtil.o ../lib/esTransform.o ../lib/esShapes.o $(ETNA_OBJS) 45 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 46 | 47 | -------------------------------------------------------------------------------- /attic/fb_rawshader/alpha_blend_vs.asm: -------------------------------------------------------------------------------- 1 | ; VS used for `alpha_blend` test 2 | 3 | ; compute output position using model-view-projection 4 | MUL t4, u0, t0.xxxx, void 5 | MAD t4, u1, t0.yyyy, t4 6 | MAD t4, u2, t0.zzzz, t4 7 | MAD t4, u3, t0.wwww, t4 8 | 9 | ; compute output color 10 | MOV t0, void, void, t2 ; t0 = vertex color 11 | MUL t0, t0, u12, void ; multiply in material color 12 | 13 | ; transform z of output vertex 14 | ADD t4.__z_, t4.zzzz, void, t4.wwww ; z = z + w 15 | MUL t4.__z_, t4.zzzz, u11.yyyy, void ; z = (z + w) * 0.5 16 | -------------------------------------------------------------------------------- /attic/fb_rawshader/cube_companion_ps.asm: -------------------------------------------------------------------------------- 1 | MUL t1, u0.xxxx, t1, void 2 | TEXLD t2, tex0, t2.xyyy, void, void 3 | MUL t1, t1, t2, void 4 | -------------------------------------------------------------------------------- /attic/fb_rawshader/cube_companion_vs.asm: -------------------------------------------------------------------------------- 1 | MOV t3.xy__, void, void, u4.wwww 2 | MOV t3.__z_, void, void, u5.wwww 3 | MUL t4, u0, t0.xxxx, void 4 | MAD t4, u1, t0.yyyy, t4 5 | MAD t4, u2, t0.zzzz, t4 6 | MAD t4, u3, t0.wwww, t4 7 | MUL t5.xyz_, u4.xyzz, t1.xxxx, void 8 | MAD t5.xyz_, u5.xyzz, t1.yyyy, t5.xyzz 9 | MAD t1.xyz_, u6.xyzz, t1.zzzz, t5.xyzz 10 | MUL t5, u7, t0.xxxx, void 11 | MAD t5, u8, t0.yyyy, t5 12 | MAD t5, u9, t0.zzzz, t5 13 | MAD t0, u10, t0.wwww, t5 14 | RCP t1.___w, void, void, t0.wwww 15 | MAD t0.xyz_, -t0.xyzz, t1.wwww, t3.xyzz 16 | DP3 t3.xyz_, t0.xyzz, t0.xyzz, void 17 | RSQ t3.xyz_, void, void, t3.xxxx 18 | MUL t0.xyz_, t0.xyzz, t3.xyzz, void 19 | DP3 t0.x___, t1.xyzz, t0.xyzz, void 20 | SELECT.LT t0.xyz_, u6.wwww, t0.xxxx, u6.wwww 21 | MOV t0.___w, void, void, u11.xxxx 22 | MOV t1.xy__, void, void, t2.xyyy 23 | ADD t4.__z_, t4.zzzz, void, t4.wwww 24 | MUL t4.__z_, t4.zzzz, u11.yyyy, void 25 | -------------------------------------------------------------------------------- /attic/fb_rawshader/cubemap_sphere_ps.asm: -------------------------------------------------------------------------------- 1 | ; ps program for cubemap_sphere 2 | MUL t1, u0.xxxx, t1, void 3 | TEXLD t2, tex0, t2.xyzz, void, void 4 | ;TEXLD t2, tex0, u1, void, void 5 | MUL t1, t1, t2, void 6 | -------------------------------------------------------------------------------- /attic/fb_rawshader/cubemap_sphere_vs.asm: -------------------------------------------------------------------------------- 1 | ; vertex program for cubemap_sphere 2 | MOV t3.xy__, void, void, u4.wwww 3 | MOV t3.__z_, void, void, u5.wwww 4 | MUL t4, u0, t0.xxxx, void 5 | MAD t4, u1, t0.yyyy, t4 6 | MAD t4, u2, t0.zzzz, t4 7 | MAD t4, u3, t0.wwww, t4 8 | MUL t5.xyz_, u4.xyzz, t1.xxxx, void 9 | MAD t5.xyz_, u5.xyzz, t1.yyyy, t5.xyzz 10 | MAD t1.xyz_, u6.xyzz, t1.zzzz, t5.xyzz 11 | MUL t5, u7, t0.xxxx, void 12 | MAD t5, u8, t0.yyyy, t5 13 | MAD t5, u9, t0.zzzz, t5 14 | MAD t0, u10, t0.wwww, t5 15 | RCP t1.___w, void, void, t0.wwww 16 | MAD t0.xyz_, -t0.xyzz, t1.wwww, t3.xyzz 17 | DP3 t3.xyz_, t0.xyzz, t0.xyzz, void 18 | RSQ t3.xyz_, void, void, t3.xxxx 19 | MUL t0.xyz_, t0.xyzz, t3.xyzz, void 20 | DP3 t0.x___, t1.xyzz, t0.xyzz, void 21 | SELECT.LT t0.xyz_, u6.wwww, t0.xxxx, u6.wwww 22 | MOV t0.___w, void, void, u11.xxxx 23 | ;MOV t1.xy__, void, void, t2.xyyy 24 | ADD t4.__z_, t4.zzzz, void, t4.wwww 25 | MUL t4.__z_, t4.zzzz, u11.yyyy, void 26 | -------------------------------------------------------------------------------- /attic/fb_rawshader/displacement_ps.asm: -------------------------------------------------------------------------------- 1 | NOP void, void, void, void 2 | -------------------------------------------------------------------------------- /attic/fb_rawshader/displacement_vs.asm: -------------------------------------------------------------------------------- 1 | ; test for vertex texture fetch 2 | ; this crashes the blob driver on my Arnova as it doesn't properly set up sampler 8 3 | ; so I wonder if this will work when I properly setup that sampler (it does!) 4 | ; u11.z scaling factor applied to displacement 5 | MOV t3.xy__, void, void, u4.wwww 6 | MOV t3.__z_, void, void, u5.wwww 7 | TEXLD t4, tex8, t0.xyyy, void, void 8 | MUL t4.x___, t4.x, u11.z, void ; apply scaling factor to displacement 9 | MUL t4.xyz_, t4.xxxx, t2.xyzz, void 10 | MOV t4.___w, void, void, u6.wwww 11 | ADD t4, t1, void, t4 12 | MUL t5, u0, t4.xxxx, void 13 | MAD t5, u1, t4.yyyy, t5 14 | MAD t5, u2, t4.zzzz, t5 15 | MAD t4, u3, t4.wwww, t5 16 | MUL t5.xyz_, u4.xyzz, t2.xxxx, void 17 | MAD t5.xyz_, u5.xyzz, t2.yyyy, t5.xyzz 18 | MAD t2.xyz_, u6.xyzz, t2.zzzz, t5.xyzz 19 | MUL t5, u7, t1.xxxx, void 20 | MAD t5, u8, t1.yyyy, t5 21 | MAD t5, u9, t1.zzzz, t5 22 | MAD t1, u10, t1.wwww, t5 23 | RCP t2.___w, void, void, t1.wwww 24 | MAD t1.xyz_, -t1.xyzz, t2.wwww, t3.xyzz 25 | DP3 t3.xyz_, t1.xyzz, t1.xyzz, void 26 | RSQ t3.xyz_, void, void, t3.xxxx 27 | MUL t1.xyz_, t1.xyzz, t3.xyzz, void 28 | DP3 t1.x___, t2.xyzz, t1.xyzz, void 29 | SELECT.LT t1.x___, u6.wwww, t1.xxxx, u6.wwww 30 | MOV t1._yz_, void, void, u6.wwww 31 | MOV t1.___w, void, void, u11.xxxx 32 | ADD t4.__z_, t4.zzzz, void, t4.wwww 33 | MUL t4.__z_, t4.zzzz, u11.yyyy, void 34 | -------------------------------------------------------------------------------- /attic/fb_rawshader/etna_gears_ps.asm: -------------------------------------------------------------------------------- 1 | ; etna_gears ps 2 | NOP void, void, void, void 3 | ; GLSL: 4 | ; 5 | ; precision mediump float; 6 | ; varying vec4 Color; 7 | ; 8 | ; void main(void) 9 | ; { 10 | ; gl_FragColor = Color; 11 | ; } 12 | 13 | -------------------------------------------------------------------------------- /attic/fb_rawshader/etna_gears_vs.asm: -------------------------------------------------------------------------------- 1 | ; etna_gears vs 2 | ; 3 | ; uniforms 4 | ; u0-u3 normal_matrix 5 | ; u4 lightsource_position 6 | ; u5 material_color 7 | ; u6-u9 modelviewprojection matrix 8 | ; 9 | ; constants 10 | ; u10.x 0.0 11 | ; u10.y 0.5 12 | ; 13 | ; inputs 14 | ; t0 normal 15 | ; t1 position 16 | ; 17 | ; output 18 | ; t0 color (4 comps) 19 | ; t1 position (4 comps) 20 | ; 21 | MUL t2, u0, t0.xxxx, void 22 | MAD t2, u1, t0.yyyy, t2 23 | MAD t0, u2, t0.zzzz, t2 24 | ADD t0, t0, void, u3 25 | DP3 t2.xyz_, t0.xyzz, t0.xyzz, void 26 | RSQ t2.xyz_, void, void, t2.xxxx 27 | MUL t0.xyz_, t0.xyzz, t2.xyzz, void 28 | DP3 t2.xyz_, u4.xyzz, u4.xyzz, void 29 | RSQ t2.xyz_, void, void, t2.xxxx 30 | MUL t2.xyz_, u4.xyzz, t2.xyzz, void 31 | DP3 t0.x___, t0.xyzz, t2.xyzz, void 32 | SELECT.LT t0.x___, t0.xxxx, u10.xxxx, t0.xxxx 33 | MUL t0, t0.xxxx, u5, void 34 | MUL t2, u6, t1.xxxx, void 35 | MAD t2, u7, t1.yyyy, t2 36 | MAD t1, u8, t1.zzzz, t2 37 | ADD t1, t1, void, u9 38 | ADD t1.__z_, t1.zzzz, void, t1.wwww 39 | MUL t1.__z_, t1.zzzz, u10.yyyy, void 40 | ; GLSL: 41 | ; attribute vec3 position; 42 | ; attribute vec3 normal; 43 | ; 44 | ; uniform mat4 ModelViewProjectionMatrix; 45 | ; uniform mat4 NormalMatrix; 46 | ; uniform vec4 LightSourcePosition; 47 | ; uniform vec4 MaterialColor; 48 | ; 49 | ; varying vec4 Color; 50 | ; 51 | ; void main(void) 52 | ; { 53 | ; // Transform the normal to eye coordinates 54 | ; vec3 N = normalize(vec3(NormalMatrix * vec4(normal, 1.0))); 55 | ; 56 | ; // The LightSourcePosition is actually its direction for directional light 57 | ; vec3 L = normalize(LightSourcePosition.xyz); 58 | ; 59 | ; // Multiply the diffuse value by the vertex color (which is fixed in this case) 60 | ; // to get the actual color that we will use to draw this vertex with 61 | ; float diffuse = max(dot(N, L), 0.0); 62 | ; Color = diffuse * MaterialColor; 63 | ; 64 | ; // Transform the position to clip coordinates 65 | ; gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0); 66 | ; }; 67 | ; 68 | -------------------------------------------------------------------------------- /attic/fb_rawshader/exec_fb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build, upload, execute egl2 on device and fetch data log 3 | DEMO=$1 4 | if [ -z "$DEMO" ]; then 5 | DEMO="fbtest" 6 | echo "Defaulting to ${DEMO}" 7 | fi 8 | if [[ "$DEMO" == "ps_sandbox_etna" || "$DEMO" == "etna_test" ]]; then 9 | ARG="/data/mine/shader.bin" 10 | ../../tools/asm.py --isa-file ../../rnndb/isa.xml sandbox.asm -o shader.bin 11 | [ $? -ne 0 ] && exit 12 | adb push shader.bin ${ARG} 13 | fi 14 | if [[ "$DEMO" == "mip_cube" || "$DEMO" == "mip_cube_raw" ]]; then 15 | #TEX="miprgba" 16 | #TEX="mipdxt1" 17 | #TEX="test_image-dxt3" 18 | #TEX="mipdxt5" 19 | #TEX="test_image-dxt1a" 20 | #TEX="test_image-dxt1c" 21 | TEX="lavaetc1" 22 | adb push ../resources/${TEX}.dds /mnt/sdcard 23 | ARG="/mnt/sdcard/${TEX}.dds" 24 | fi 25 | if [[ "$DEMO" == "particle_system" ]]; then 26 | TEX="smoke" 27 | adb push ../resources/${TEX}.tga /mnt/sdcard 28 | ARG="/mnt/sdcard/${TEX}.tga" 29 | fi 30 | make ${DEMO} 31 | [ $? -ne 0 ] && exit 32 | adb push ${DEMO} /data/mine 33 | adb shell "/data/mine/${DEMO} ${ARG}" 34 | #adb pull /mnt/sdcard/egl2.fdr . 35 | #adb pull /mnt/sdcard/replay.bmp . 36 | -------------------------------------------------------------------------------- /attic/fb_rawshader/mip_cube_ps.asm: -------------------------------------------------------------------------------- 1 | ; pixel shader for mip_cube_state 2 | MUL t1, u0.xxxx, t1, void 3 | TEXLD t2, tex0, t2.xyyy, void, void 4 | MUL t1, t1, t2, void 5 | -------------------------------------------------------------------------------- /attic/fb_rawshader/mip_cube_vs.asm: -------------------------------------------------------------------------------- 1 | ; vertex shader for mip_cube_state 2 | MOV t3.xy__, void, void, u4.wwww 3 | MOV t3.__z_, void, void, u5.wwww 4 | MUL t4, u0, t0.xxxx, void 5 | MAD t4, u1, t0.yyyy, t4 6 | MAD t4, u2, t0.zzzz, t4 7 | MAD t4, u3, t0.wwww, t4 8 | MUL t5.xyz_, u4.xyzz, t1.xxxx, void 9 | MAD t5.xyz_, u5.xyzz, t1.yyyy, t5.xyzz 10 | MAD t1.xyz_, u6.xyzz, t1.zzzz, t5.xyzz 11 | MUL t5, u7, t0.xxxx, void 12 | MAD t5, u8, t0.yyyy, t5 13 | MAD t5, u9, t0.zzzz, t5 14 | MAD t0, u10, t0.wwww, t5 15 | RCP t1.___w, void, void, t0.wwww 16 | MAD t0.xyz_, -t0.xyzz, t1.wwww, t3.xyzz 17 | DP3 t3.xyz_, t0.xyzz, t0.xyzz, void 18 | RSQ t3.xyz_, void, void, t3.xxxx 19 | MUL t0.xyz_, t0.xyzz, t3.xyzz, void 20 | DP3 t0.x___, t1.xyzz, t0.xyzz, void 21 | SELECT.LT t0.xyz_, u6.wwww, t0.xxxx, u6.wwww 22 | MOV t0.___w, void, void, u11.xxxx 23 | MOV t1.xy__, void, void, t2.xyyy 24 | ADD t4.__z_, t4.zzzz, void, t4.wwww 25 | MUL t4.__z_, t4.zzzz, u11.yyyy, void 26 | -------------------------------------------------------------------------------- /attic/fb_rawshader/particle_system_ps.asm: -------------------------------------------------------------------------------- 1 | ; ps for particle_system demo 2 | ; t1.xy should be marked as pointcoord x/y 3 | ; uniform inputs 4 | ; u0 u_color 5 | ADD t1._y__, u1.xxxx, void, -t1.yyyy 6 | TEXLD t1, tex0, t1.xyyy, void, void 7 | MUL t1, u0, t1, void 8 | MUL t1.___w, t1.wwww, t2.xxxx, void 9 | -------------------------------------------------------------------------------- /attic/fb_rawshader/particle_system_vs.asm: -------------------------------------------------------------------------------- 1 | ; fs for particle system demo 2 | ; different from the others in that it uses branching, and a .SAT modifier 3 | ; uniform inputs 4 | ; u0.x u_time 5 | ; u0.yzw u_centerPosition 6 | ; uniform constants 7 | ; u1.x 1.0 8 | ; u1.y -1000.0 9 | ; u1.z 0.0 10 | ; u1.w 40.0 11 | ; u2.x 0.5 12 | ; outputs 13 | ; t0 v_lifetime 14 | ; t1 position 15 | ; t2 pointsize 16 | BRANCH.GT void, u0.xxxx, t0.xxxx, label_5 17 | MAD t1.xyz_, u0.xxxx, t2.xyzz, t1.xyzz 18 | ADD t1.xyz_, t1.xyzz, void, u0.yzww 19 | MOV t1.___w, void, void, u1.xxxx 20 | BRANCH void, void, void, label_6 21 | label_5: 22 | MOV t1, void, void, u1.yyzz 23 | label_6: 24 | RCP t0.x___, void, void, t0.xxxx 25 | MOV t2, void, void, u0 26 | MAD t0.x___, -t2.xxxx, t0.xxxx, u1.xxxx 27 | MOV.SAT t0.x___, void, void, t0.xxxx 28 | MUL t0._y__, t0.xxxx, t0.xxxx, void 29 | MUL t2.x___, t0.yyyy, u1.wwww, void 30 | ADD t1.__z_, t1.zzzz, void, t1.wwww 31 | MUL t1.__z_, t1.zzzz, u2.xxxx, void 32 | -------------------------------------------------------------------------------- /attic/fb_rawshader/shader.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/fb_rawshader/shader.bin -------------------------------------------------------------------------------- /attic/fb_rawshader/stencil_test_ps.asm: -------------------------------------------------------------------------------- 1 | ; very simple flat-shaded pixel shader 2 | ; t1 = u0 3 | ; 2 temporary registers used (t0,t1) 4 | MOV t1, void, void, u0 5 | -------------------------------------------------------------------------------- /attic/fb_rawshader/stencil_test_vs.asm: -------------------------------------------------------------------------------- 1 | ; very basic vertex shader 2 | ; z = (z+w)/2 3 | ; 1 temporary register used (t0) 4 | ADD t0.__z_, t0.zzzz, void, t0.wwww 5 | MUL t0.__z_, t0.zzzz, u0.xxxx, void 6 | -------------------------------------------------------------------------------- /attic/lib/dds.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | #if !defined( DDS_H ) 24 | #define DDS_H 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | /* Formats */ 31 | #define FMT_A8R8G8B8 0 32 | #define FMT_X8R8G8B8 1 33 | #define FMT_R8G8B8 2 34 | #define FMT_A1R5G5B5 3 35 | #define FMT_X1R5G5B5 4 36 | #define FMT_R5G6B5 5 37 | #define FMT_DXT1 6 38 | #define FMT_DXT3 7 39 | #define FMT_DXT5 8 40 | #define FMT_ETC1 9 41 | #define FMT_A8 10 42 | #define FMT_L8 11 43 | #define FMT_A8L8 12 44 | 45 | typedef struct _dds_mipmap 46 | { 47 | unsigned int width, height, stride, size; 48 | void *data; 49 | size_t offset; 50 | } dds_mipmap; 51 | 52 | typedef struct _dds_texture 53 | { 54 | int fmt; 55 | unsigned int div_size; 56 | unsigned int block_bytes; 57 | int num_slices; /* number of faces or slices */ 58 | int num_mipmaps; /* number of mipmaps */ 59 | dds_mipmap **slices; 60 | void *data; 61 | size_t size; 62 | } dds_texture; 63 | 64 | bool dds_load(const char *filename, dds_texture **out); 65 | bool dds_load_file(FILE *f, dds_texture **out); 66 | void dds_free(dds_texture *tex); 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /attic/lib/dump_gl_screen.c: -------------------------------------------------------------------------------- 1 | #include "dump_gl_screen.h" 2 | #include "write_bmp.h" 3 | 4 | #include 5 | 6 | void dump_gl_screen(const char *filename, GLsizei width, GLsizei height) 7 | { 8 | void *data; 9 | 10 | if(width==0 || height==0) 11 | return; 12 | 13 | data = malloc(width * height * 4); 14 | if(!data) 15 | return; 16 | 17 | glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); 18 | 19 | bmp_dump32((char*)data, width, height, false, filename); 20 | free(data); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /attic/lib/dump_gl_screen.h: -------------------------------------------------------------------------------- 1 | #ifndef H_DUMP_GL_SCREEN 2 | #define H_DUMP_GL_SCREEN 3 | 4 | #include 5 | #include 6 | 7 | void dump_gl_screen(const char *filename, GLsizei width, GLsizei height); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /attic/lib/eglutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2012 Luc Verhaegen 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | #ifndef H_EGLUTIL 24 | #include 25 | 26 | /* Get string for EGL error */ 27 | char *eglStrError(EGLint error); 28 | 29 | /* Print basic information about EGL configuration */ 30 | void printEGLConfig(EGLDisplay display, EGLConfig config); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /attic/lib/elf_hook.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" 5 | { 6 | #endif 7 | 8 | int parse_maps(char *libname, char **fullpath, void **base); 9 | int symbol_library_info(const char *symbol, const char **fname, void **fbase); 10 | int get_module_base_address(char const *module_filename, void *handle, void **base); 11 | void *elf_hook(char const *module_filename, void const *module_address, char const *name, void const *substitution); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /attic/lib/esShapes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Book: OpenGL(R) ES 2.0 Programming Guide 3 | // Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner 4 | // ISBN-10: 0321502795 5 | // ISBN-13: 9780321502797 6 | // Publisher: Addison-Wesley Professional 7 | // URLs: http://safari.informit.com/9780321563835 8 | // http://www.opengles-book.com 9 | // 10 | 11 | /* 12 | * (c) 2009 Aaftab Munshi, Dan Ginsburg, Dave Shreiner 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a 15 | * copy of this software and associated documentation files (the "Software"), 16 | * to deal in the Software without restriction, including without limitation 17 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 18 | * and/or sell copies of the Software, and to permit persons to whom the 19 | * Software is furnished to do so, subject to the following conditions: 20 | * 21 | * The above copyright notice and this permission notice shall be included 22 | * in all copies or substantial portions of the Software. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 30 | * DEALINGS IN THE SOFTWARE. 31 | */ 32 | 33 | #ifndef ESSHAPES_H 34 | #define ESSHAPES_H 35 | 36 | /// 37 | // Includes 38 | // 39 | #include 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | #define ESUTIL_API 46 | 47 | int ESUTIL_API esGenSphere ( int numSlices, float radius, float **vertices, float **normals, 48 | float **texCoords, uint16_t **indices, int *numVertices_out ); 49 | int ESUTIL_API esGenCube ( float scale, float **vertices, float **normals, 50 | float **texCoords, uint16_t **indices, int *numVertices_out ); 51 | 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif // ESSHAPES_H 58 | 59 | -------------------------------------------------------------------------------- /attic/lib/esUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // Book: OpenGL(R) ES 2.0 Programming Guide 3 | // Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner 4 | // ISBN-10: 0321502795 5 | // ISBN-13: 9780321502797 6 | // Publisher: Addison-Wesley Professional 7 | // URLs: http://safari.informit.com/9780321563835 8 | // http://www.opengles-book.com 9 | // 10 | 11 | // 12 | /// \file ESUtil.h 13 | /// \brief A utility library for OpenGL ES. This library provides a 14 | /// basic common framework for the example applications in the 15 | /// OpenGL ES 2.0 Programming Guide. 16 | // 17 | #ifndef ESUTIL_H 18 | #define ESUTIL_H 19 | 20 | /// 21 | // Includes 22 | // 23 | #include 24 | 25 | #ifdef __cplusplus 26 | 27 | extern "C" { 28 | #endif 29 | 30 | /// 31 | // Macros 32 | // 33 | #define ESUTIL_API 34 | #define ESCALLBACK 35 | 36 | // 37 | /// \brief Log a message to the debug output for the platform 38 | /// \param formatStr Format string for error log. 39 | // 40 | void ESUTIL_API esLogMessage ( const char *formatStr, ... ); 41 | 42 | char* ESUTIL_API esLoadTGA ( char *fileName, int *width, int *height ); 43 | 44 | /* return current time (in seconds) */ 45 | double ESUTIL_API esNow(void); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif // ESUTIL_H 52 | -------------------------------------------------------------------------------- /attic/lib/interval_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "interval.h" 5 | 6 | typedef std::set > IntervalSet; 7 | 8 | void print_set(const IntervalSet &s) 9 | { 10 | for(IntervalSet::const_iterator i=s.begin(); i!=s.end(); ++i) 11 | { 12 | printf("%i-%i ", (int)i->start, (int)i->end); 13 | } 14 | printf("\n"); 15 | } 16 | 17 | int main() 18 | { 19 | IntervalSet s; 20 | s.insert(Interval(1,10)); 21 | s.insert(Interval(10,20)); 22 | s.insert(Interval(20,30)); 23 | s.insert(Interval(30,40)); 24 | 25 | print_set(s); 26 | 27 | printf("Matching intervals:\n"); 28 | std::pair ir = intersecting_intervals(s, Interval(10,25)); 29 | for(IntervalSet::const_iterator i=ir.first; i!=ir.second; ++i) 30 | { 31 | printf("%i-%i ", (int)i->start, (int)i->end); 32 | } 33 | printf("\n"); 34 | 35 | intervalset_merge(s, Interval(25, 50)); 36 | print_set(s); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /attic/lib/read_png.h: -------------------------------------------------------------------------------- 1 | #ifndef H_READ_PNG 2 | #define H_READ_PNG 3 | 4 | #include 5 | #include 6 | 7 | /* Read PNG, return pixels in A8R8G8B8 format */ 8 | bool read_png(char *name, int row_align, int *outStride, int *outWidth, int *outHeight, uint32_t **outData); 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /attic/lib/viv_hook.h: -------------------------------------------------------------------------------- 1 | #ifndef H_VIV_HOOK 2 | #define H_VIV_HOOK 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define VIV_NUM_FEATURE_WORDS (8) 9 | struct viv_hook_overrides { 10 | bool override_chip_model; 11 | uint32_t chip_model; 12 | bool override_chip_revision; 13 | uint32_t chip_revision; 14 | uint32_t features_clear[VIV_NUM_FEATURE_WORDS]; 15 | uint32_t features_set[VIV_NUM_FEATURE_WORDS]; 16 | uint32_t chip_flags_clear; 17 | uint32_t chip_flags_set; 18 | }; 19 | 20 | extern void the_hook(const char *filename); 21 | extern void close_hook(void); 22 | extern void hook_start_logging(const char *filename); 23 | extern void viv_hook_set_overrides(const struct viv_hook_overrides *overrides_in); 24 | extern void viv_hook_log_marker(const char *data, size_t size); 25 | 26 | extern int my_open(const char* path, int flags, ...); 27 | extern void *my_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); 28 | extern int my_munmap(void *addr, size_t length); 29 | extern int my_ioctl(int d, int request, void *ptr); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /attic/lib/write_bmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Luc Verhaegen 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | #ifndef BMP_DUMP_H 25 | #define BMP_DUMP_H 1 26 | #include 27 | /* write 32-bit image (y axis upwards) */ 28 | void bmp_dump32(char *buffer, unsigned width, unsigned height, bool bgra, const char *filename); 29 | /* write 32-bit image (y axis downwards) */ 30 | void bmp_dump32_noflip(char *buffer, unsigned width, unsigned height, bool bgra, const char *filename); 31 | /* write 32-bit image */ 32 | void bmp_dump32_ex(char *buffer, unsigned width, unsigned height, bool flip, bool bgra, bool alpha, const char *filename); 33 | 34 | #endif /* BMP_DUMP_H */ 35 | -------------------------------------------------------------------------------- /attic/minigallium/.gitignore: -------------------------------------------------------------------------------- 1 | test 2 | libminigallium.a 3 | 4 | -------------------------------------------------------------------------------- /attic/minigallium/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -Iauxiliary -Iinclude -DDEBUG 6 | LDFLAGS += 7 | GALLIUM_OBJS = auxiliary/tgsi/tgsi_dump.o \ 8 | auxiliary/tgsi/tgsi_iterate.o \ 9 | auxiliary/tgsi/tgsi_strings.o \ 10 | auxiliary/tgsi/tgsi_info.o \ 11 | auxiliary/tgsi/tgsi_parse.o \ 12 | auxiliary/tgsi/tgsi_text.o \ 13 | auxiliary/tgsi/tgsi_build.o \ 14 | auxiliary/tgsi/tgsi_sanity.o \ 15 | auxiliary/tgsi/tgsi_ureg.o \ 16 | auxiliary/tgsi/tgsi_util.o \ 17 | auxiliary/util/u_blitter.o \ 18 | auxiliary/util/u_debug.o \ 19 | auxiliary/util/u_format.o \ 20 | auxiliary/util/u_format_etc.o \ 21 | auxiliary/util/u_format_latc.o \ 22 | auxiliary/util/u_format_other.o \ 23 | auxiliary/util/u_format_rgtc.o \ 24 | auxiliary/util/u_format_s3tc.o \ 25 | auxiliary/util/u_format_srgb.o \ 26 | auxiliary/util/u_format_table.o \ 27 | auxiliary/util/u_format_tests.o \ 28 | auxiliary/util/u_format_yuv.o \ 29 | auxiliary/util/u_format_zs.o \ 30 | auxiliary/util/u_surface.o \ 31 | auxiliary/util/u_tile.o \ 32 | auxiliary/util/u_transfer.o \ 33 | auxiliary/util/u_slab.o \ 34 | auxiliary/util/u_helpers.o \ 35 | auxiliary/util/u_framebuffer.o \ 36 | auxiliary/util/u_simple_shaders.o \ 37 | auxiliary/util/u_bitmask.o \ 38 | auxiliary/util/u_debug_refcnt.o \ 39 | auxiliary/util/u_debug_describe.o \ 40 | auxiliary/util/u_debug_stack.o \ 41 | auxiliary/util/u_debug_memory.o \ 42 | auxiliary/util/u_debug_symbol.o \ 43 | auxiliary/util/u_upload_mgr.o \ 44 | auxiliary/util/u_draw.o \ 45 | auxiliary/util/u_draw_quad.o \ 46 | auxiliary/util/u_hash_table.o \ 47 | auxiliary/util/u_texture.o \ 48 | auxiliary/util/u_vbuf.o \ 49 | auxiliary/util/u_gen_mipmap.o \ 50 | auxiliary/os/os_misc.o \ 51 | auxiliary/cso_cache/cso_hash.o \ 52 | auxiliary/cso_cache/cso_cache.o \ 53 | auxiliary/cso_cache/cso_context.o \ 54 | auxiliary/translate/translate.o \ 55 | auxiliary/translate/translate_cache.o \ 56 | auxiliary/translate/translate_generic.o \ 57 | auxiliary/translate/translate_sse.o \ 58 | targets/graw-null/graw_util.o 59 | 60 | TARGETS = libminigallium.a 61 | 62 | all: $(TARGETS) 63 | 64 | clean: 65 | rm -f $(GALLIUM_OBJS) 66 | rm -f $(TARGETS) *.o 67 | 68 | libminigallium.a: $(GALLIUM_OBJS) 69 | $(AR) rcs $@ $^ 70 | 71 | test: test.o ../driver/etna_asm.o ../driver/etna_shader.o libminigallium.a 72 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 73 | 74 | -------------------------------------------------------------------------------- /attic/minigallium/README.md: -------------------------------------------------------------------------------- 1 | Subset of gallium, for tgsi support, tests and utilities. 2 | 3 | Keeping this within `etna_viv` tree for now for easy experimentation. 4 | 5 | Based on mesa/gallium commit a1b6e69 6 | 7 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/os/os_memory.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2010 Vmware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | 29 | /* 30 | * OS memory management abstractions 31 | */ 32 | 33 | 34 | #ifndef _OS_MEMORY_H_ 35 | #define _OS_MEMORY_H_ 36 | 37 | 38 | #include "pipe/p_config.h" 39 | #include "pipe/p_compiler.h" 40 | 41 | 42 | #if defined(PIPE_SUBSYSTEM_EMBEDDED) 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | void * 49 | os_malloc(size_t size); 50 | 51 | void * 52 | os_calloc(size_t count, size_t size); 53 | 54 | void 55 | os_free(void *ptr); 56 | 57 | void * 58 | os_realloc(void *ptr, size_t old_size, size_t new_size); 59 | 60 | void * 61 | os_malloc_aligned(size_t size, size_t alignment); 62 | 63 | void 64 | os_free_aligned(void *ptr); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #elif defined(PIPE_OS_WINDOWS) && defined(DEBUG) && !defined(DEBUG_MEMORY_IMPLEMENTATION) 71 | 72 | # include "os_memory_debug.h" 73 | 74 | #else 75 | 76 | # include "os_memory_stdc.h" 77 | 78 | #endif 79 | 80 | #endif /* _OS_MEMORY_H_ */ 81 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/os/os_memory_aligned.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008-2010 VMware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | 29 | /* 30 | * Memory alignment wrappers. 31 | */ 32 | 33 | 34 | #ifndef _OS_MEMORY_H_ 35 | #error "Must not be included directly. Include os_memory.h instead" 36 | #endif 37 | 38 | 39 | #include "pipe/p_compiler.h" 40 | 41 | 42 | /** 43 | * Return memory on given byte alignment 44 | */ 45 | static INLINE void * 46 | os_malloc_aligned(size_t size, size_t alignment) 47 | { 48 | char *ptr, *buf; 49 | 50 | ptr = (char *) os_malloc(size + alignment + sizeof(void *)); 51 | if (!ptr) 52 | return NULL; 53 | 54 | buf = (char *)(((uintptr_t)ptr + sizeof(void *) + alignment - 1) & ~((uintptr_t)(alignment - 1))); 55 | *(char **)(buf - sizeof(void *)) = ptr; 56 | 57 | return buf; 58 | } 59 | 60 | 61 | /** 62 | * Free memory returned by align_malloc(). 63 | */ 64 | static INLINE void 65 | os_free_aligned(void *ptr) 66 | { 67 | if (ptr) { 68 | void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); 69 | void *realAddr = *cubbyHole; 70 | os_free(realAddr); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/tgsi/tgsi_sanity.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef TGSI_SANITY_H 29 | #define TGSI_SANITY_H 30 | 31 | #if defined __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #include "pipe/p_compiler.h" 36 | 37 | struct tgsi_token; 38 | 39 | /* Check the given token stream for errors and common mistakes. 40 | * Diagnostic messages are printed out to the debug output, and is 41 | * controlled by the debug option TGSI_PRINT_SANITY (default false). 42 | * Returns TRUE if there are no errors, even though there could be some warnings. 43 | */ 44 | boolean 45 | tgsi_sanity_check( 46 | const struct tgsi_token *tokens ); 47 | 48 | #if defined __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* TGSI_SANITY_H */ 53 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/tgsi/tgsi_strings.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 | * Copyright 2012 VMware, Inc. 5 | * All Rights Reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the 9 | * "Software"), to deal in the Software without restriction, including 10 | * without limitation the rights to use, copy, modify, merge, publish, 11 | * distribute, sub license, and/or sell copies of the Software, and to 12 | * permit persons to whom the Software is furnished to do so, subject to 13 | * the following conditions: 14 | * 15 | * The above copyright notice and this permission notice (including the 16 | * next paragraph) shall be included in all copies or substantial portions 17 | * of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22 | * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | **************************************************************************/ 28 | 29 | #ifndef TGSI_STRINGS_H 30 | #define TGSI_STRINGS_H 31 | 32 | #include "pipe/p_shader_tokens.h" 33 | #include "pipe/p_state.h" 34 | 35 | 36 | #if defined __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | 41 | extern const char *tgsi_processor_type_names[4]; 42 | 43 | extern const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT]; 44 | 45 | extern const char *tgsi_texture_names[TGSI_TEXTURE_COUNT]; 46 | 47 | extern const char *tgsi_property_names[TGSI_PROPERTY_COUNT]; 48 | 49 | extern const char *tgsi_type_names[5]; 50 | 51 | extern const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT]; 52 | 53 | extern const char *tgsi_primitive_names[PIPE_PRIM_MAX]; 54 | 55 | extern const char *tgsi_fs_coord_origin_names[2]; 56 | 57 | extern const char *tgsi_fs_coord_pixel_center_names[2]; 58 | 59 | extern const char *tgsi_immediate_type_names[3]; 60 | 61 | 62 | const char * 63 | tgsi_file_name(unsigned file); 64 | 65 | 66 | #if defined __cplusplus 67 | } 68 | #endif 69 | 70 | 71 | #endif /* TGSI_STRINGS_H */ 72 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/tgsi/tgsi_text.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef TGSI_TEXT_H 29 | #define TGSI_TEXT_H 30 | 31 | #if defined __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #include "pipe/p_compiler.h" 36 | 37 | struct tgsi_token; 38 | 39 | boolean 40 | tgsi_text_translate( 41 | const char *text, 42 | struct tgsi_token *tokens, 43 | uint num_tokens ); 44 | 45 | #if defined __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* TGSI_TEXT_H */ 50 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/translate/translate.c: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | /* 29 | * Authors: 30 | * Keith Whitwell 31 | */ 32 | 33 | #include "pipe/p_config.h" 34 | #include "pipe/p_state.h" 35 | #include "translate.h" 36 | 37 | struct translate *translate_create( const struct translate_key *key ) 38 | { 39 | struct translate *translate = NULL; 40 | 41 | #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) 42 | translate = translate_sse2_create( key ); 43 | if (translate) 44 | return translate; 45 | #else 46 | (void)translate; 47 | #endif 48 | 49 | return translate_generic_create( key ); 50 | } 51 | 52 | boolean translate_is_output_format_supported(enum pipe_format format) 53 | { 54 | return translate_generic_is_output_format_supported(format); 55 | } 56 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/translate/translate_cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Tungsten Graphics, inc. 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * on the rights to use, copy, modify, merge, publish, distribute, sub 9 | * license, and/or sell copies of the Software, and to permit persons to whom 10 | * the Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 19 | * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 21 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 22 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | #ifndef _TRANSLATE_CACHE_H 25 | #define _TRANSLATE_CACHE_H 26 | 27 | 28 | /******************************************************************************* 29 | * Translate cache. 30 | * Simply used to cache created translates. Avoids unecessary creation of 31 | * translate's if one suitable for a given translate_key has already been 32 | * created. 33 | * 34 | * Note: this functionality depends and requires the CSO module. 35 | */ 36 | struct translate_cache; 37 | 38 | struct translate_key; 39 | struct translate; 40 | 41 | struct translate_cache *translate_cache_create( void ); 42 | void translate_cache_destroy(struct translate_cache *cache); 43 | 44 | /** 45 | * Will try to find a translate structure matched by the given key. 46 | * If such a structure doesn't exist in the cache the function 47 | * will automatically create it, insert it in the cache and 48 | * return the created version. 49 | * 50 | */ 51 | struct translate *translate_cache_find(struct translate_cache *cache, 52 | struct translate_key *key); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_box.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_BOX_INLINES_H 2 | #define UTIL_BOX_INLINES_H 3 | 4 | #include "pipe/p_state.h" 5 | 6 | static INLINE 7 | void u_box_1d( unsigned x, 8 | unsigned w, 9 | struct pipe_box *box ) 10 | { 11 | box->x = x; 12 | box->y = 0; 13 | box->z = 0; 14 | box->width = w; 15 | box->height = 1; 16 | box->depth = 1; 17 | } 18 | 19 | static INLINE 20 | void u_box_2d( unsigned x, 21 | unsigned y, 22 | unsigned w, 23 | unsigned h, 24 | struct pipe_box *box ) 25 | { 26 | box->x = x; 27 | box->y = y; 28 | box->z = 0; 29 | box->width = w; 30 | box->height = h; 31 | box->depth = 1; 32 | } 33 | 34 | static INLINE 35 | void u_box_origin_2d( unsigned w, 36 | unsigned h, 37 | struct pipe_box *box ) 38 | { 39 | box->x = 0; 40 | box->y = 0; 41 | box->z = 0; 42 | box->width = w; 43 | box->height = h; 44 | box->depth = 1; 45 | } 46 | 47 | static INLINE 48 | void u_box_2d_zslice( unsigned x, 49 | unsigned y, 50 | unsigned z, 51 | unsigned w, 52 | unsigned h, 53 | struct pipe_box *box ) 54 | { 55 | box->x = x; 56 | box->y = y; 57 | box->z = z; 58 | box->width = w; 59 | box->height = h; 60 | box->depth = 1; 61 | } 62 | 63 | static INLINE 64 | void u_box_3d( unsigned x, 65 | unsigned y, 66 | unsigned z, 67 | unsigned w, 68 | unsigned h, 69 | unsigned d, 70 | struct pipe_box *box ) 71 | { 72 | box->x = x; 73 | box->y = y; 74 | box->z = z; 75 | box->width = w; 76 | box->height = h; 77 | box->depth = d; 78 | } 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_debug_describe.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2010 Luca Barbieri 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the 14 | * next paragraph) shall be included in all copies or substantial 15 | * portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | **************************************************************************/ 26 | 27 | #ifndef U_DEBUG_DESCRIBE_H_ 28 | #define U_DEBUG_DESCRIBE_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | struct pipe_reference; 35 | struct pipe_resource; 36 | struct pipe_surface; 37 | struct pipe_sampler_view; 38 | 39 | /* a 256-byte buffer is necessary and sufficient */ 40 | void debug_describe_reference(char* buf, const struct pipe_reference*ptr); 41 | void debug_describe_resource(char* buf, const struct pipe_resource *ptr); 42 | void debug_describe_surface(char* buf, const struct pipe_surface *ptr); 43 | void debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr); 44 | void debug_describe_so_target(char* buf, 45 | const struct pipe_stream_output_target *ptr); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* U_DEBUG_DESCRIBE_H_ */ 52 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_debug_refcnt.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2010 Luca Barbieri 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the 14 | * next paragraph) shall be included in all copies or substantial 15 | * portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | **************************************************************************/ 26 | 27 | #ifndef U_DEBUG_REFCNT_H_ 28 | #define U_DEBUG_REFCNT_H_ 29 | 30 | #include "pipe/p_config.h" 31 | #include "pipe/p_state.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | typedef void (*debug_reference_descriptor)(char*, const struct pipe_reference*); 38 | 39 | #if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) 40 | 41 | extern int debug_refcnt_state; 42 | 43 | void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change); 44 | 45 | static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) 46 | { 47 | if (debug_refcnt_state >= 0) 48 | debug_reference_slowpath(p, get_desc, change); 49 | } 50 | 51 | #else 52 | 53 | static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) 54 | { 55 | } 56 | 57 | #endif 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* U_DEBUG_REFCNT_H_ */ 64 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_debug_stack.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2009 VMware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef U_DEBUG_STACK_H_ 29 | #define U_DEBUG_STACK_H_ 30 | 31 | 32 | /** 33 | * @file 34 | * Stack backtracing. 35 | * 36 | * @author Jose Fonseca 37 | */ 38 | 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | 45 | /** 46 | * Represent a frame from a stack backtrace. 47 | * 48 | * XXX: Do not change this. 49 | * 50 | * TODO: This should be refactored as a void * typedef. 51 | */ 52 | struct debug_stack_frame 53 | { 54 | const void *function; 55 | }; 56 | 57 | 58 | void 59 | debug_backtrace_capture(struct debug_stack_frame *backtrace, 60 | unsigned start_frame, 61 | unsigned nr_frames); 62 | 63 | void 64 | debug_backtrace_dump(const struct debug_stack_frame *backtrace, 65 | unsigned nr_frames); 66 | 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* U_DEBUG_STACK_H_ */ 73 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_debug_symbol.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2009 VMware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef U_DEBUG_SYMBOL_H_ 29 | #define U_DEBUG_SYMBOL_H_ 30 | 31 | 32 | /** 33 | * @file 34 | * Symbol lookup. 35 | * 36 | * @author Jose Fonseca 37 | */ 38 | 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | 45 | void 46 | debug_symbol_name(const void *addr, char* buf, unsigned size); 47 | 48 | const char* 49 | debug_symbol_name_cached(const void *addr); 50 | 51 | void 52 | debug_symbol_print(const void *addr); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* U_DEBUG_SYMBOL_H_ */ 59 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_dirty_flags.h: -------------------------------------------------------------------------------- 1 | #ifndef U_DIRTY_FLAGS_H 2 | #define U_DIRTY_FLAGS_H 3 | 4 | /* Here's a convenient list of dirty flags to use in a driver. Either 5 | * include it directly or use it as a starting point for your own 6 | * list. 7 | */ 8 | #define U_NEW_VIEWPORT 0x1 9 | #define U_NEW_RASTERIZER 0x2 10 | #define U_NEW_FS 0x4 11 | #define U_NEW_FS_CONSTANTS 0x8 12 | #define U_NEW_FS_SAMPLER_VIEW 0x10 13 | #define U_NEW_FS_SAMPLER_STATES 0x20 14 | #define U_NEW_VS 0x40 15 | #define U_NEW_VS_CONSTANTS 0x80 16 | #define U_NEW_VS_SAMPLER_VIEW 0x100 17 | #define U_NEW_VS_SAMPLER_STATES 0x200 18 | #define U_NEW_BLEND 0x400 19 | #define U_NEW_CLIP 0x800 20 | #define U_NEW_SCISSOR 0x1000 21 | #define U_NEW_POLYGON_STIPPLE 0x2000 22 | #define U_NEW_FRAMEBUFFER 0x4000 23 | #define U_NEW_VERTEX_ELEMENTS 0x8000 24 | #define U_NEW_VERTEX_BUFFER 0x10000 25 | #define U_NEW_QUERY 0x20000 26 | #define U_NEW_DEPTH_STENCIL 0x40000 27 | #define U_NEW_GS 0x80000 28 | #define U_NEW_GS_CONSTANTS 0x100000 29 | #define U_NEW_GS_SAMPLER_VIEW 0x200000 30 | #define U_NEW_GS_SAMPLER_STATES 0x400000 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_dl.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2009 VMware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 17 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 18 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * The above copyright notice and this permission notice (including the 23 | * next paragraph) shall be included in all copies or substantial portions 24 | * of the Software. 25 | * 26 | **************************************************************************/ 27 | 28 | 29 | #ifndef U_DL_H_ 30 | #define U_DL_H_ 31 | 32 | 33 | #include "pipe/p_config.h" 34 | 35 | 36 | #if defined(PIPE_OS_WINDOWS) 37 | # define UTIL_DL_EXT ".dll" 38 | # define UTIL_DL_PREFIX "" 39 | #elif defined(PIPE_OS_APPLE) 40 | # define UTIL_DL_EXT ".dylib" 41 | # define UTIL_DL_PREFIX "lib" 42 | #else 43 | # define UTIL_DL_EXT ".so" 44 | # define UTIL_DL_PREFIX "lib" 45 | #endif 46 | 47 | 48 | struct util_dl_library; 49 | 50 | 51 | typedef void (*util_dl_proc)(void); 52 | 53 | 54 | /** 55 | * Open a library dynamically. 56 | */ 57 | struct util_dl_library * 58 | util_dl_open(const char *filename); 59 | 60 | 61 | /** 62 | * Lookup a function in a library. 63 | */ 64 | util_dl_proc 65 | util_dl_get_proc_address(struct util_dl_library *library, 66 | const char *procname); 67 | 68 | 69 | /** 70 | * Close a library. 71 | */ 72 | void 73 | util_dl_close(struct util_dl_library *library); 74 | 75 | 76 | /** 77 | * Return most recent error message. 78 | */ 79 | const char * 80 | util_dl_error(void); 81 | 82 | 83 | #endif /* U_DL_H_ */ 84 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_draw_quad.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef U_DRAWQUAD_H 29 | #define U_DRAWQUAD_H 30 | 31 | 32 | #include "pipe/p_compiler.h" 33 | #include "pipe/p_context.h" 34 | 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | struct pipe_resource; 41 | struct cso_context; 42 | 43 | #include "util/u_draw.h" 44 | 45 | extern void 46 | util_draw_vertex_buffer(struct pipe_context *pipe, struct cso_context *cso, 47 | struct pipe_resource *vbuf, uint vbuf_slot, 48 | uint offset, uint prim_type, uint num_attribs, 49 | uint num_verts); 50 | 51 | void 52 | util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer, 53 | uint prim_type, uint num_verts, uint num_attribs); 54 | 55 | extern void 56 | util_draw_texquad(struct pipe_context *pipe, struct cso_context *cso, 57 | uint vbuf_slot, 58 | float x0, float y0, float x1, float y1, float z); 59 | 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_dual_blend.h: -------------------------------------------------------------------------------- 1 | #ifndef U_DUAL_BLEND_H 2 | #define U_DUAL_BLEND_H 3 | 4 | #include "pipe/p_state.h" 5 | 6 | static INLINE boolean util_blend_factor_is_dual_src(int factor) 7 | { 8 | return (factor == PIPE_BLENDFACTOR_SRC1_COLOR) || 9 | (factor == PIPE_BLENDFACTOR_SRC1_ALPHA) || 10 | (factor == PIPE_BLENDFACTOR_INV_SRC1_COLOR) || 11 | (factor == PIPE_BLENDFACTOR_INV_SRC1_ALPHA); 12 | } 13 | 14 | static INLINE boolean util_blend_state_is_dual(const struct pipe_blend_state *blend, 15 | int index) 16 | { 17 | if (util_blend_factor_is_dual_src(blend->rt[index].rgb_src_factor) || 18 | util_blend_factor_is_dual_src(blend->rt[index].alpha_src_factor) || 19 | util_blend_factor_is_dual_src(blend->rt[index].rgb_dst_factor) || 20 | util_blend_factor_is_dual_src(blend->rt[index].alpha_dst_factor)) 21 | return true; 22 | return false; 23 | } 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_format_etc.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2011 LunarG, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 17 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 18 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * The above copyright notice and this permission notice (including the 23 | * next paragraph) shall be included in all copies or substantial portions 24 | * of the Software. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef U_FORMAT_ETC1_H_ 29 | #define U_FORMAT_ETC1_H_ 30 | 31 | void 32 | util_format_etc1_rgb8_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); 33 | 34 | void 35 | util_format_etc1_rgb8_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); 36 | 37 | void 38 | util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); 39 | 40 | void 41 | util_format_etc1_rgb8_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); 42 | 43 | void 44 | util_format_etc1_rgb8_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); 45 | 46 | #endif /* U_FORMAT_ETC1_H_ */ 47 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_format_tests.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2010 VMware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 17 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 18 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * The above copyright notice and this permission notice (including the 23 | * next paragraph) shall be included in all copies or substantial portions 24 | * of the Software. 25 | * 26 | **************************************************************************/ 27 | 28 | 29 | #ifndef U_FORMAT_TESTS_H_ 30 | #define U_FORMAT_TESTS_H_ 31 | 32 | 33 | #include "pipe/p_compiler.h" 34 | #include "pipe/p_format.h" 35 | 36 | 37 | #define UTIL_FORMAT_MAX_PACKED_BYTES 16 38 | #define UTIL_FORMAT_MAX_UNPACKED_WIDTH 4 39 | #define UTIL_FORMAT_MAX_UNPACKED_HEIGHT 4 40 | 41 | 42 | /** 43 | * A (packed, unpacked) color pair. 44 | */ 45 | struct util_format_test_case 46 | { 47 | enum pipe_format format; 48 | 49 | /** 50 | * Mask of the bits that actually meaningful data. Used to mask out the 51 | * "X" channels. 52 | */ 53 | uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES]; 54 | 55 | uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES]; 56 | 57 | /** 58 | * RGBA. 59 | */ 60 | double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4]; 61 | }; 62 | 63 | 64 | extern const struct util_format_test_case 65 | util_format_test_cases[]; 66 | 67 | 68 | extern const unsigned util_format_nr_test_cases; 69 | 70 | 71 | #endif /* U_FORMAT_TESTS_H_ */ 72 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_framebuffer.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2009-2010 VMware, Inc. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sub license, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the 14 | * next paragraph) shall be included in all copies or substantial portions 15 | * of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 20 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 21 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | **************************************************************************/ 26 | 27 | 28 | #ifndef U_FRAMEBUFFER_H 29 | #define U_FRAMEBUFFER_H 30 | 31 | 32 | #include "pipe/p_compiler.h" 33 | #include "pipe/p_state.h" 34 | 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | extern boolean 41 | util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst, 42 | const struct pipe_framebuffer_state *src); 43 | 44 | extern void 45 | util_copy_framebuffer_state(struct pipe_framebuffer_state *dst, 46 | const struct pipe_framebuffer_state *src); 47 | 48 | 49 | extern void 50 | util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb); 51 | 52 | 53 | extern boolean 54 | util_framebuffer_min_size(const struct pipe_framebuffer_state *fb, 55 | unsigned *width, 56 | unsigned *height); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* U_FRAMEBUFFER_H */ 63 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_gen_mipmap.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef U_GENMIPMAP_H 29 | #define U_GENMIPMAP_H 30 | 31 | #include "pipe/p_state.h" 32 | 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | 39 | struct pipe_context; 40 | struct pipe_resource; 41 | struct cso_context; 42 | 43 | struct gen_mipmap_state; 44 | 45 | 46 | extern struct gen_mipmap_state * 47 | util_create_gen_mipmap(struct pipe_context *pipe, struct cso_context *cso); 48 | 49 | 50 | extern void 51 | util_destroy_gen_mipmap(struct gen_mipmap_state *ctx); 52 | 53 | 54 | extern void 55 | util_gen_mipmap(struct gen_mipmap_state *ctx, 56 | struct pipe_sampler_view *psv, 57 | uint layer, uint baseLevel, uint lastLevel, uint filter); 58 | 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_hash.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008 VMware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | /** 29 | * @file 30 | * Hash functions. 31 | * 32 | * @author Jose Fonseca 33 | */ 34 | 35 | #ifndef U_HASH_H_ 36 | #define U_HASH_H_ 37 | 38 | 39 | #include "pipe/p_compiler.h" 40 | 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | 47 | uint32_t 48 | util_hash_crc32(const void *data, size_t size); 49 | 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* U_HASH_H_ */ 56 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_helpers.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2012 Marek Olšák 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | #ifndef U_HELPERS_H 29 | #define U_HELPERS_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #include "pipe/p_state.h" 36 | 37 | void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, 38 | uint32_t *enabled_buffers, 39 | const struct pipe_vertex_buffer *src, 40 | unsigned start_slot, unsigned count); 41 | 42 | void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, 43 | unsigned *dst_count, 44 | const struct pipe_vertex_buffer *src, 45 | unsigned start_slot, unsigned count); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_network.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _U_NETWORK_H_ 3 | #define _U_NETWORK_H_ 4 | 5 | #include "pipe/p_compiler.h" 6 | 7 | #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) 8 | # define PIPE_HAVE_SOCKETS 9 | #elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \ 10 | defined(PIPE_OS_APPLE) || defined(PIPE_OS_SOLARIS) 11 | # define PIPE_HAVE_SOCKETS 12 | #endif 13 | 14 | boolean u_socket_init(void); 15 | void u_socket_stop(void); 16 | void u_socket_close(int s); 17 | int u_socket_listen_on_port(uint16_t portnum); 18 | int u_socket_accept(int s); 19 | int u_socket_connect(const char *host, uint16_t port); 20 | int u_socket_send(int s, void *data, size_t size); 21 | int u_socket_peek(int s, void *data, size_t size); 22 | int u_socket_recv(int s, void *data, size_t size); 23 | void u_socket_block(int s, boolean block); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_pstipple.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 | * Copyright 2010 VMware, Inc. 5 | * All Rights Reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the 9 | * "Software"), to deal in the Software without restriction, including 10 | * without limitation the rights to use, copy, modify, merge, publish, 11 | * distribute, sub license, and/or sell copies of the Software, and to 12 | * permit persons to whom the Software is furnished to do so, subject to 13 | * the following conditions: 14 | * 15 | * The above copyright notice and this permission notice (including the 16 | * next paragraph) shall be included in all copies or substantial portions 17 | * of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | **************************************************************************/ 28 | 29 | #ifndef U_PSTIPPLE_H 30 | #define U_PSTIPPLE_H 31 | 32 | #include "pipe/p_compiler.h" 33 | 34 | struct pipe_context; 35 | struct pipe_resource; 36 | struct pipe_shader_state; 37 | 38 | 39 | extern struct pipe_resource * 40 | util_pstipple_create_stipple_texture(struct pipe_context *pipe, 41 | const uint32_t pattern[32]); 42 | 43 | extern struct pipe_sampler_view * 44 | util_pstipple_create_sampler_view(struct pipe_context *pipe, 45 | struct pipe_resource *tex); 46 | 47 | extern void * 48 | util_pstipple_create_sampler(struct pipe_context *pipe); 49 | 50 | extern struct pipe_shader_state * 51 | util_pstipple_create_fragment_shader(struct pipe_context *pipe, 52 | struct pipe_shader_state *fs, 53 | unsigned *samplerUnitOut); 54 | 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_resource.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 VMware, Inc. 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sub license, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the 14 | * next paragraph) shall be included in all copies or substantial portions 15 | * of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 21 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | 27 | #include "pipe/p_defines.h" 28 | #include "pipe/p_state.h" 29 | #include "util/u_format.h" 30 | #include "util/u_math.h" 31 | #include "util/u_resource.h" 32 | 33 | 34 | /** 35 | * Return the size of the resource in bytes. 36 | */ 37 | unsigned 38 | util_resource_size(const struct pipe_resource *res) 39 | { 40 | unsigned width = res->width0; 41 | unsigned height = res->height0; 42 | unsigned depth = res->depth0; 43 | unsigned size = 0; 44 | unsigned level; 45 | 46 | for (level = 0; level <= res->last_level; level++) { 47 | unsigned slices; 48 | 49 | if (res->target == PIPE_TEXTURE_CUBE) 50 | slices = 6; 51 | else if (res->target == PIPE_TEXTURE_3D) 52 | slices = depth; 53 | else 54 | slices = res->array_size; 55 | 56 | size += (util_format_get_nblocksy(res->format, height) * 57 | util_format_get_stride(res->format, width) * slices); 58 | 59 | width = u_minify(width, 1); 60 | height = u_minify(height, 1); 61 | depth = u_minify(depth, 1); 62 | } 63 | 64 | return size; 65 | } 66 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_resource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 VMware, Inc. 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sub license, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the 14 | * next paragraph) shall be included in all copies or substantial portions 15 | * of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 21 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef U_RESOURCE_H 27 | #define U_RESOURCE_H 28 | 29 | #include "pipe/p_state.h" 30 | 31 | unsigned 32 | util_resource_size(const struct pipe_resource *res); 33 | 34 | /** 35 | * Return true if the resource is an array texture. 36 | * 37 | * Note that this function returns true for single-layered array textures. 38 | */ 39 | static INLINE boolean 40 | util_resource_is_array_texture(const struct pipe_resource *res) 41 | { 42 | switch (res->target) { 43 | case PIPE_TEXTURE_1D_ARRAY: 44 | case PIPE_TEXTURE_2D_ARRAY: 45 | case PIPE_TEXTURE_CUBE_ARRAY: 46 | return TRUE; 47 | default: 48 | return FALSE; 49 | } 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_ringbuffer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UTIL_RINGBUFFER_H 3 | #define UTIL_RINGBUFFER_H 4 | 5 | #include "pipe/p_compiler.h" 6 | #include "pipe/p_defines.h" /* only for pipe_error! */ 7 | 8 | /* Generic header 9 | */ 10 | struct util_packet { 11 | unsigned dwords:8; 12 | unsigned data24:24; 13 | }; 14 | 15 | struct util_ringbuffer; 16 | 17 | struct util_ringbuffer *util_ringbuffer_create( unsigned dwords ); 18 | 19 | void util_ringbuffer_destroy( struct util_ringbuffer *ring ); 20 | 21 | void util_ringbuffer_enqueue( struct util_ringbuffer *ring, 22 | const struct util_packet *packet ); 23 | 24 | enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring, 25 | struct util_packet *packet, 26 | unsigned max_dwords, 27 | boolean wait ); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_sampler.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2010 VMware, Inc. 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sub license, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the 15 | * next paragraph) shall be included in all copies or substantial portions 16 | * of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | 29 | #ifndef U_SAMPLER_H 30 | #define U_SAMPLER_H 31 | 32 | 33 | #include "pipe/p_defines.h" 34 | #include "pipe/p_format.h" 35 | #include "pipe/p_state.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | 42 | void 43 | u_sampler_view_default_template(struct pipe_sampler_view *view, 44 | const struct pipe_resource *texture, 45 | enum pipe_format format); 46 | 47 | void 48 | u_sampler_view_default_dx9_template(struct pipe_sampler_view *view, 49 | const struct pipe_resource *texture, 50 | enum pipe_format format); 51 | 52 | 53 | #ifdef __cplusplus 54 | } /* extern "C" { */ 55 | #endif 56 | 57 | #endif /* U_SAMPLER_H */ 58 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_suballoc.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2009 VMware, Inc. 4 | * Copyright 2012 Marek Olšák 5 | * All Rights Reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the 9 | * "Software"), to deal in the Software without restriction, including 10 | * without limitation the rights to use, copy, modify, merge, publish, 11 | * distribute, sub license, and/or sell copies of the Software, and to 12 | * permit persons to whom the Software is furnished to do so, subject to 13 | * the following conditions: 14 | * 15 | * The above copyright notice and this permission notice (including the 16 | * next paragraph) shall be included in all copies or substantial portions 17 | * of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22 | * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | **************************************************************************/ 28 | 29 | /* A simple allocator that suballocates memory from a large buffer. */ 30 | 31 | #ifndef U_SUBALLOC 32 | #define U_SUBALLOC 33 | 34 | struct u_suballocator; 35 | 36 | struct u_suballocator * 37 | u_suballocator_create(struct pipe_context *pipe, unsigned size, 38 | unsigned alignment, unsigned bind, unsigned usage, 39 | boolean zero_buffer_memory); 40 | 41 | void 42 | u_suballocator_destroy(struct u_suballocator *allocator); 43 | 44 | void 45 | u_suballocator_alloc(struct u_suballocator *allocator, unsigned size, 46 | unsigned *out_offset, struct pipe_resource **outbuf); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /attic/minigallium/auxiliary/util/u_texture.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2009 Marek Olšák 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sub license, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the 14 | * next paragraph) shall be included in all copies or substantial portions 15 | * of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 20 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 21 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | **************************************************************************/ 26 | 27 | #ifndef U_TEXTURE_H 28 | #define U_TEXTURE_H 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * Convert 2D texture coordinates of 4 vertices into cubemap coordinates 36 | * in the given face. 37 | * Coordinates must be in the range [0,1]. 38 | * 39 | * \param face Cubemap face. 40 | * \param in_st 4 pairs of 2D texture coordinates to convert. 41 | * \param in_stride Stride of in_st in floats. 42 | * \param out_str STR cubemap texture coordinates to compute. 43 | * \param out_stride Stride of out_str in floats. 44 | */ 45 | void util_map_texcoords2d_onto_cubemap(unsigned face, 46 | const float *in_st, unsigned in_stride, 47 | float *out_str, unsigned out_stride); 48 | 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /attic/minigallium/include/c99_compat.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/minigallium/include/c99_compat.h -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/cube_companion_frag.tgsi: -------------------------------------------------------------------------------- 1 | FRAG 2 | PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1 3 | DCL IN[0], GENERIC[0], PERSPECTIVE 4 | DCL IN[1], GENERIC[1], PERSPECTIVE 5 | DCL OUT[0], COLOR 6 | DCL SAMP[0] 7 | DCL TEMP[0..1], LOCAL 8 | IMM[0] FLT32 { 3.0000, 0.0000, 0.0000, 0.0000} 9 | 0: MUL TEMP[0], IMM[0].xxxx, IN[0] 10 | 1: TEX TEMP[1], IN[1].xyyy, SAMP[0], 2D 11 | 2: MUL TEMP[0], TEMP[0], TEMP[1] 12 | 3: MOV OUT[0], TEMP[0] 13 | 4: END 14 | 15 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/cube_companion_vert.tgsi: -------------------------------------------------------------------------------- 1 | VERT 2 | DCL IN[0] 3 | DCL IN[1] 4 | DCL IN[2] 5 | DCL OUT[0], POSITION 6 | DCL OUT[1], GENERIC[0] 7 | DCL OUT[2], GENERIC[1] 8 | DCL CONST[0..10] 9 | DCL TEMP[0..4], LOCAL 10 | IMM[0] FLT32 { 2.0000, 20.0000, 1.0000, 0.0000} 11 | 0: MUL TEMP[0], CONST[3], IN[2].xxxx 12 | 1: MAD TEMP[0], CONST[4], IN[2].yyyy, TEMP[0] 13 | 2: MAD TEMP[0], CONST[5], IN[2].zzzz, TEMP[0] 14 | 3: MAD TEMP[0], CONST[6], IN[2].wwww, TEMP[0] 15 | 4: MUL TEMP[1], CONST[7], IN[2].xxxx 16 | 5: MAD TEMP[1], CONST[8], IN[2].yyyy, TEMP[1] 17 | 6: MAD TEMP[1], CONST[9], IN[2].zzzz, TEMP[1] 18 | 7: MAD TEMP[1], CONST[10], IN[2].wwww, TEMP[1] 19 | 8: RCP TEMP[2].x, TEMP[1].wwww 20 | 9: MUL TEMP[1].xyz, TEMP[1].xyzz, TEMP[2].xxxx 21 | 10: ADD TEMP[1].xyz, IMM[0].xxyy, -TEMP[1].xyzz 22 | 11: MOV TEMP[2].w, IMM[0].zzzz 23 | 12: MUL TEMP[3].xyz, CONST[0].xyzz, IN[1].xxxx 24 | 13: MAD TEMP[3].xyz, CONST[1].xyzz, IN[1].yyyy, TEMP[3].xyzz 25 | 14: MAD TEMP[3].xyz, CONST[2].xyzz, IN[1].zzzz, TEMP[3].xyzz 26 | 15: DP3 TEMP[4].x, TEMP[1].xyzz, TEMP[1].xyzz 27 | 16: RSQ TEMP[4].x, TEMP[4].xxxx 28 | 17: MUL TEMP[1].xyz, TEMP[1].xyzz, TEMP[4].xxxx 29 | 18: DP3 TEMP[1].x, TEMP[3].xyzz, TEMP[1].xyzz 30 | 19: MAX TEMP[1].x, IMM[0].wwww, TEMP[1].xxxx 31 | 20: MOV TEMP[2].xyz, TEMP[1].xxxx 32 | 21: MOV TEMP[1].xy, IN[0].xyxx 33 | 22: MOV OUT[1], TEMP[2] 34 | 23: MOV OUT[0], TEMP[0] 35 | 24: MOV OUT[2], TEMP[1] 36 | 25: END 37 | 38 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/cube_frag.tgsi: -------------------------------------------------------------------------------- 1 | FRAG 2 | PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1 3 | DCL IN[0], GENERIC[0], PERSPECTIVE 4 | DCL OUT[0], COLOR 5 | 0: MOV OUT[0], IN[0] 6 | 1: END 7 | 8 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/cube_vert.tgsi: -------------------------------------------------------------------------------- 1 | VERT 2 | DCL IN[0] 3 | DCL IN[1] 4 | DCL IN[2] 5 | DCL OUT[0], POSITION 6 | DCL OUT[1], GENERIC[0] 7 | DCL CONST[0..10] 8 | DCL TEMP[0..4], LOCAL 9 | IMM[0] FLT32 { 2.0000, 20.0000, 1.0000, 0.0000} 10 | 0: MUL TEMP[0], CONST[3], IN[2].xxxx 11 | 1: MAD TEMP[0], CONST[4], IN[2].yyyy, TEMP[0] 12 | 2: MAD TEMP[0], CONST[5], IN[2].zzzz, TEMP[0] 13 | 3: MAD TEMP[0], CONST[6], IN[2].wwww, TEMP[0] 14 | 4: MUL TEMP[1], CONST[7], IN[2].xxxx 15 | 5: MAD TEMP[1], CONST[8], IN[2].yyyy, TEMP[1] 16 | 6: MAD TEMP[1], CONST[9], IN[2].zzzz, TEMP[1] 17 | 7: MAD TEMP[1], CONST[10], IN[2].wwww, TEMP[1] 18 | 8: RCP TEMP[2].x, TEMP[1].wwww 19 | 9: MUL TEMP[1].xyz, TEMP[1].xyzz, TEMP[2].xxxx 20 | 10: ADD TEMP[1].xyz, IMM[0].xxyy, -TEMP[1].xyzz 21 | 11: MOV TEMP[2].w, IMM[0].zzzz 22 | 12: MUL TEMP[3].xyz, CONST[0].xyzz, IN[1].xxxx 23 | 13: MAD TEMP[3].xyz, CONST[1].xyzz, IN[1].yyyy, TEMP[3].xyzz 24 | 14: MAD TEMP[3].xyz, CONST[2].xyzz, IN[1].zzzz, TEMP[3].xyzz 25 | 15: DP3 TEMP[4].x, TEMP[1].xyzz, TEMP[1].xyzz 26 | 16: RSQ TEMP[4].x, TEMP[4].xxxx 27 | 17: MUL TEMP[1].xyz, TEMP[1].xyzz, TEMP[4].xxxx 28 | 18: DP3 TEMP[1].x, TEMP[3].xyzz, TEMP[1].xyzz 29 | 19: MAX TEMP[1].x, IMM[0].wwww, TEMP[1].xxxx 30 | 20: MUL TEMP[2].xyz, TEMP[1].xxxx, IN[0].xyzz 31 | 21: MOV OUT[1], TEMP[2] 32 | 22: MOV OUT[0], TEMP[0] 33 | 23: END 34 | 35 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/cubemap_sphere_frag.tgsi: -------------------------------------------------------------------------------- 1 | FRAG 2 | PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1 3 | DCL IN[0], GENERIC[0], PERSPECTIVE 4 | DCL OUT[0], COLOR 5 | DCL SAMP[0] 6 | DCL TEMP[0], LOCAL 7 | 0: TEX TEMP[0], IN[0].xyzz, SAMP[0], CUBE 8 | 1: MOV OUT[0], TEMP[0] 9 | 2: END 10 | 11 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/cubemap_sphere_vert.tgsi: -------------------------------------------------------------------------------- 1 | VERT 2 | DCL IN[0] 3 | DCL IN[1] 4 | DCL OUT[0], POSITION 5 | DCL OUT[1], GENERIC[0] 6 | DCL TEMP[0], LOCAL 7 | 0: MOV TEMP[0].xyz, IN[0].xyzx 8 | 1: MOV OUT[1], TEMP[0] 9 | 2: MOV OUT[0], IN[1] 10 | 3: END 11 | 12 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/displacement_frag.tgsi: -------------------------------------------------------------------------------- 1 | FRAG 2 | PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1 3 | DCL IN[0], GENERIC[0], PERSPECTIVE 4 | DCL OUT[0], COLOR 5 | 0: MOV OUT[0], IN[0] 6 | 1: END 7 | 8 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/displacement_vert.tgsi: -------------------------------------------------------------------------------- 1 | VERT 2 | DCL IN[0] 3 | DCL IN[1] 4 | DCL IN[2] 5 | DCL OUT[0], POSITION 6 | DCL OUT[1], GENERIC[0] 7 | DCL SAMP[0] 8 | DCL CONST[1..11] 9 | DCL TEMP[0..4], LOCAL 10 | IMM[0] FLT32 { 0.0000, 0.2000, 2.0000, 20.0000} 11 | IMM[1] FLT32 { 0.0000, 1.0000, 0.0000, 0.0000} 12 | 0: MOV TEMP[0].w, IMM[0].xxxx 13 | 1: TEX TEMP[1].x, IN[0].xyyy, SAMP[0], 2D 14 | 2: MUL TEMP[1].x, IMM[0].yyyy, TEMP[1].xxxx 15 | 3: MUL TEMP[0].xyz, TEMP[1].xxxx, IN[1].xyzz 16 | 4: ADD TEMP[0], IN[2], TEMP[0] 17 | 5: MUL TEMP[1], CONST[4], TEMP[0].xxxx 18 | 6: MAD TEMP[1], CONST[5], TEMP[0].yyyy, TEMP[1] 19 | 7: MAD TEMP[1], CONST[6], TEMP[0].zzzz, TEMP[1] 20 | 8: MAD TEMP[0], CONST[7], TEMP[0].wwww, TEMP[1] 21 | 9: MUL TEMP[1], CONST[8], IN[2].xxxx 22 | 10: MAD TEMP[1], CONST[9], IN[2].yyyy, TEMP[1] 23 | 11: MAD TEMP[1], CONST[10], IN[2].zzzz, TEMP[1] 24 | 12: MAD TEMP[1], CONST[11], IN[2].wwww, TEMP[1] 25 | 13: RCP TEMP[2].x, TEMP[1].wwww 26 | 14: MUL TEMP[1].xyz, TEMP[1].xyzz, TEMP[2].xxxx 27 | 15: ADD TEMP[1].xyz, IMM[0].zzww, -TEMP[1].xyzz 28 | 16: MOV TEMP[2].yzw, IMM[1].xxxy 29 | 17: MUL TEMP[3].xyz, CONST[1].xyzz, IN[1].xxxx 30 | 18: MAD TEMP[3].xyz, CONST[2].xyzz, IN[1].yyyy, TEMP[3].xyzz 31 | 19: MAD TEMP[3].xyz, CONST[3].xyzz, IN[1].zzzz, TEMP[3].xyzz 32 | 20: DP3 TEMP[4].x, TEMP[1].xyzz, TEMP[1].xyzz 33 | 21: RSQ TEMP[4].x, TEMP[4].xxxx 34 | 22: MUL TEMP[1].xyz, TEMP[1].xyzz, TEMP[4].xxxx 35 | 23: DP3 TEMP[1].x, TEMP[3].xyzz, TEMP[1].xyzz 36 | 24: MAX TEMP[2].x, IMM[0].xxxx, TEMP[1].xxxx 37 | 25: MOV OUT[1], TEMP[2] 38 | 26: MOV OUT[0], TEMP[0] 39 | 27: END 40 | 41 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/etna_gears_ps.tgsi: -------------------------------------------------------------------------------- 1 | PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1 2 | DCL IN[0], GENERIC[0], PERSPECTIVE 3 | DCL OUT[0], COLOR 4 | 0: MOV OUT[0], IN[0] 5 | 1: END 6 | 7 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/etna_gears_vs.tgsi: -------------------------------------------------------------------------------- 1 | VERT 2 | DCL IN[0] 3 | DCL IN[1] 4 | DCL OUT[0], POSITION 5 | DCL OUT[1], GENERIC[0] 6 | DCL CONST[0..9] 7 | DCL TEMP[0..1], LOCAL 8 | IMM[0] FLT32 { 0.0000, 0.0000, 0.0000, 0.0000} 9 | 0: MUL TEMP[0], CONST[2], IN[0].xxxx 10 | 1: MAD TEMP[0], CONST[3], IN[0].yyyy, TEMP[0] 11 | 2: MAD TEMP[0], CONST[4], IN[0].zzzz, TEMP[0] 12 | 3: ADD TEMP[0].xyz, TEMP[0], CONST[5] 13 | 4: DP3 TEMP[1].x, TEMP[0].xyzz, TEMP[0].xyzz 14 | 5: RSQ TEMP[1].x, TEMP[1].xxxx 15 | 6: MUL TEMP[0].xyz, TEMP[0].xyzz, TEMP[1].xxxx 16 | 7: DP3 TEMP[1].x, CONST[1].xyzz, CONST[1].xyzz 17 | 8: RSQ TEMP[1].x, TEMP[1].xxxx 18 | 9: MUL TEMP[1].xyz, CONST[1].xyzz, TEMP[1].xxxx 19 | 10: DP3 TEMP[0].x, TEMP[0].xyzz, TEMP[1].xyzz 20 | 11: MAX TEMP[0].x, TEMP[0].xxxx, IMM[0].xxxx 21 | 12: MUL TEMP[0], TEMP[0].xxxx, CONST[0] 22 | 13: MUL TEMP[1], CONST[6], IN[1].xxxx 23 | 14: MAD TEMP[1], CONST[7], IN[1].yyyy, TEMP[1] 24 | 15: MAD TEMP[1], CONST[8], IN[1].zzzz, TEMP[1] 25 | 16: ADD TEMP[1], TEMP[1], CONST[9] 26 | 17: MOV OUT[1], TEMP[0] 27 | 18: MOV OUT[0], TEMP[1] 28 | 19: END 29 | 30 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/particle_system_frag.tgsi: -------------------------------------------------------------------------------- 1 | FRAG 2 | PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1 3 | DCL IN[0], PCOORD, LINEAR 4 | DCL IN[1], GENERIC[0], PERSPECTIVE 5 | DCL OUT[0], COLOR 6 | DCL SAMP[0] 7 | DCL CONST[1] 8 | DCL TEMP[0..1], LOCAL 9 | 0: TEX TEMP[0], IN[0].xyyy, SAMP[0], 2D 10 | 1: MUL TEMP[0], CONST[1], TEMP[0] 11 | 2: MOV TEMP[1].xyz, TEMP[0].xyzx 12 | 3: MUL TEMP[0].x, TEMP[0].wwww, IN[1].xxxx 13 | 4: MOV TEMP[1].w, TEMP[0].xxxx 14 | 5: MOV OUT[0], TEMP[1] 15 | 6: END 16 | 17 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/particle_system_vert.tgsi: -------------------------------------------------------------------------------- 1 | VERT 2 | DCL IN[0] 3 | DCL IN[1] 4 | DCL IN[2] 5 | DCL OUT[0], POSITION 6 | DCL OUT[1], PSIZE 7 | DCL OUT[2], GENERIC[0] 8 | DCL CONST[0..1] 9 | DCL TEMP[0..2], LOCAL 10 | IMM[0] FLT32 { 1.0000, -1000.0000, 0.0000, 40.0000} 11 | 0: SGE TEMP[0].x, IN[2].xxxx, CONST[1].xxxx 12 | 1: IF TEMP[0].xxxx :0 13 | 2: MAD TEMP[0].xyz, CONST[1].xxxx, IN[0].xyzz, IN[1].xyzz 14 | 3: ADD TEMP[0].xyz, TEMP[0].xyzz, CONST[0].xyzz 15 | 4: MOV TEMP[0].w, IMM[0].xxxx 16 | 5: ELSE :0 17 | 6: MOV TEMP[0], IMM[0].yyzz 18 | 7: ENDIF 19 | 8: RCP TEMP[1].x, IN[2].xxxx 20 | 9: MUL TEMP[1].x, CONST[1].xxxx, TEMP[1].xxxx 21 | 10: ADD_SAT TEMP[1].x, IMM[0].xxxx, -TEMP[1].xxxx 22 | 11: MUL TEMP[2].x, TEMP[1].xxxx, TEMP[1].xxxx 23 | 12: MUL TEMP[2].x, TEMP[2].xxxx, IMM[0].wwww 24 | 13: MOV TEMP[1].x, TEMP[1].xxxx 25 | 14: MOV OUT[2], TEMP[1] 26 | 15: MOV OUT[1], TEMP[2].xxxx 27 | 16: MOV OUT[0], TEMP[0] 28 | 17: END 29 | 30 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/stencil_test_frag.tgsi: -------------------------------------------------------------------------------- 1 | FRAG 2 | PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1 3 | DCL OUT[0], COLOR 4 | DCL CONST[0] 5 | 0: MOV OUT[0], CONST[0] 6 | 1: END 7 | 8 | -------------------------------------------------------------------------------- /attic/minigallium/tgsi_testdata/stencil_test_vert.tgsi: -------------------------------------------------------------------------------- 1 | VERT 2 | DCL IN[0] 3 | DCL OUT[0], POSITION 4 | 0: MOV OUT[0], IN[0] 5 | 1: END 6 | 7 | -------------------------------------------------------------------------------- /attic/replay/.gitignore: -------------------------------------------------------------------------------- 1 | cube 2 | cube_companion 3 | cube_etna 4 | ps_sandbox_etna 5 | reset 6 | etna_test 7 | cube_etna2 8 | viv_info 9 | cube_etna2_gc2000 10 | cube_etna_gc2000 11 | cube_companion_gc2000 12 | cube_gc2000 13 | empty_screen_gc2000 -------------------------------------------------------------------------------- /attic/replay/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -I$(TOP)/resources -I$(TOP)/driver 6 | LDFLAGS_ETNA = $(LDFLAGS) -L$(TOP)/etnaviv -letnaviv 7 | 8 | TARGETS = 9 | TARGETS_GC800 = cube cube_companion cube_etna ps_sandbox_etna etna_test cube_etna2 10 | TARGETS_GC880 = cube_etna2_gc880 empty_screen_gc880 cube_gc880 cube_companion_gc880 cube_etna_gc880 11 | COMPANION_OBJS = ../resources/companion_array.o ../resources/companion_mesh.o ../resources/companion_texture.o 12 | ETNA_OBJS = ../lib/etna_bswap.o 13 | 14 | all: $(TARGETS) 15 | 16 | clean: 17 | rm -f *.o ../lib/*.o ../driver/*.o 18 | rm -f $(TARGETS) $(TARGETS_GC800) $(TARGETS_GC2000) 19 | 20 | # These specifically replay command streams for gc800, don't build them by default 21 | gc800: $(TARGETS_GC800) 22 | 23 | # These specifically replay command streams for gc880, don't build them by default 24 | gc880: $(TARGETS_GC880) 25 | 26 | empty_screen_gc880: empty_screen_gc880.o ../lib/write_bmp.o viv_raw.o 27 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 28 | 29 | cube_gc880: cube_gc880.o ../lib/write_bmp.o viv_raw.o 30 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 31 | 32 | cube: cube.o ../lib/write_bmp.o viv_raw.o 33 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 34 | 35 | cube_companion: cube_companion.o viv_raw.o ../lib/write_bmp.o $(COMPANION_OBJS) 36 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 37 | 38 | cube_companion_gc880: cube_companion_gc880.o ../lib/write_bmp.o viv_raw.o $(COMPANION_OBJS) 39 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 40 | 41 | cube_etna: cube_etna.o ../lib/write_bmp.o ../lib/esTransform.o viv_raw.o 42 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 43 | 44 | cube_etna_gc880: cube_etna_gc880.o ../lib/write_bmp.o ../lib/esTransform.o viv_raw.o 45 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 46 | 47 | cube_etna2: cube_etna2.o ../lib/write_bmp.o ../lib/esTransform.o $(ETNA_OBJS) 48 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS_ETNA) 49 | 50 | cube_etna2_gc880: cube_etna2_gc880.o ../lib/write_bmp.o ../lib/esTransform.o $(ETNA_OBJS) 51 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS_ETNA) 52 | 53 | ps_sandbox_etna: ps_sandbox_etna.o ../lib/write_bmp.o ../lib/esTransform.o viv_raw.o 54 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 55 | 56 | etna_test: etna_test.o ../lib/write_bmp.o ../lib/esTransform.o $(ETNA_OBJS) 57 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS_ETNA) 58 | 59 | reset: reset.o viv_raw.o 60 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 61 | 62 | viv_info: viv_info.o viv_raw.o 63 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 64 | 65 | -------------------------------------------------------------------------------- /attic/replay/cube_companion_replay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/replay/cube_companion_replay.png -------------------------------------------------------------------------------- /attic/replay/cube_replay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/replay/cube_replay.png -------------------------------------------------------------------------------- /attic/replay/debugscript.gdb: -------------------------------------------------------------------------------- 1 | # Example gdb script for debugging remotely on Android device 2 | target remote 192.168.1.16:5050 3 | symbol-file ./etna_test 4 | break main 5 | cont 6 | sharedlibrary 7 | 8 | -------------------------------------------------------------------------------- /attic/replay/exec_replay.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build, upload, execute egl2 on device and fetch data log 3 | DEMO=$1 4 | if [ -z "$DEMO" ]; then 5 | echo "Defaulting to cube" 6 | DEMO="cube" 7 | fi 8 | IMAGE_OUT="/mnt/sdcard/replay.bmp" 9 | if [[ "$DEMO" == "ps_sandbox_etna" || "$DEMO" == "etna_test" ]]; then 10 | ARG="/data/mine/shader.bin" 11 | ../../tools/asm.py --isa-file ../../rnndb/isa.xml sandbox.asm -o shader.bin 12 | [ $? -ne 0 ] && exit 13 | adb push shader.bin ${ARG} 14 | fi 15 | make ${DEMO} 16 | [ $? -ne 0 ] && exit 17 | 18 | adb push ${DEMO} /data/mine 19 | adb shell "/data/mine/${DEMO} ${ARG} ${IMAGE_OUT}" 20 | #adb pull /mnt/sdcard/egl2.fdr . 21 | adb pull ${IMAGE_OUT} . 22 | -------------------------------------------------------------------------------- /attic/replay/sandbox.asm: -------------------------------------------------------------------------------- 1 | ; Shader assembler test 2 | ; used by ./exec_replay ps_sandbox_etna 3 | ; input: 4 | ; u0.x = 0 5 | ; u0.y = 1 6 | ; u0.z = 0.5 7 | ; u0.w = 2.0 8 | ; u1.x = 1.0/256.0 9 | ; u1.y = 16.0 10 | ; u1.z = 10.0 11 | ; u2.x = frame nr 12 | MOV t2, void, void, t1 13 | ;MOV t1, void, void, u0.yyyy ; set to ones 14 | MOV t1, void, void, u0.xxxx ; set to zeros 15 | 16 | ADD t3, t2, void, -u0.z ; t3=t2-0.5 t3.xy is -0.5 .. 0.5 17 | 18 | ;SELECT.GE t1.x, t2.x, t2.y, t2.x ; t1.x = MIN(t1.x,t1.y) 19 | ;SELECT.LE t1.x, t1.x, t1.y, t1.x ; t1.x = MAX(t1.x,t1.y) 20 | 21 | ;LITP t1, t3.zxxz, t2.zyyz, void; u0.y 22 | ; src0.y, src0.z 23 | ; src1.y, src1.z 24 | 25 | ;DST t1, t2.x, t2.y, void 26 | ;MOV t1.w, void, void, u0.z 27 | ;FRC t1, void, void, t3 28 | ;SIGN t1, void, void, -t0 29 | ;ADDLO t1, t1, void, u0.yyyy 30 | ;MOV t1, void, void, t0 31 | ;MUL t1, t1, u1.x, void 32 | 33 | ;MOV t1, void, void, u0 34 | ;MOV t1, void, void, t2 35 | 36 | ;MUL t2.xy, t2.xy, u1.y, void ; mul by 16 37 | MUL t2.xy, t2.xy, u2.x, void ; mul by frame number 38 | SIN t1.x, void, void, t2.x 39 | SIN t1.y, void, void, t2.y 40 | ; -1..1 to 0..1 41 | MUL t1.xy, t1.xy, u0.z, void 42 | ADD t1.xy, t1.xy, void, u0.z 43 | 44 | ; set alpha to 1.0 45 | MOV t1.w, void, void, u0.y 46 | 47 | NOP void, void, void, void 48 | -------------------------------------------------------------------------------- /attic/replay/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "context_cmd.h" 4 | int main() 5 | { 6 | printf("%08x\n", contextbuf[contextbuf_addr[0].index]); 7 | printf("%08x\n", sizeof(contextbuf)); 8 | } 9 | -------------------------------------------------------------------------------- /attic/resources/README.md: -------------------------------------------------------------------------------- 1 | Attributions 2 | ------------- 3 | 4 | Lava texture by Patrick Hoesly, CC-BY-SA from: https://secure.flickr.com/photos/zooboing/3663686646/ 5 | 6 | 7 | -------------------------------------------------------------------------------- /attic/resources/amethyst256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/amethyst256.png -------------------------------------------------------------------------------- /attic/resources/attribution.txt: -------------------------------------------------------------------------------- 1 | wall1_l8.dds / wall1_a8.dds 2 | CC-BY: brightretro 3 | http://opengameart.org/node/17576 4 | 5 | -------------------------------------------------------------------------------- /attic/resources/bigbuckbunny_yv12.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/bigbuckbunny_yv12.yuv -------------------------------------------------------------------------------- /attic/resources/companion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Luc Verhaegen 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the 6 | * Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #ifndef COMPANION_H 20 | #define COMPANION_H 1 21 | 22 | /* 23 | * mesh, indexed 24 | */ 25 | #define COMPANION_VERTEX_COUNT 4761 26 | extern float companion_vertices[COMPANION_VERTEX_COUNT][3]; 27 | extern float companion_texture_coordinates[COMPANION_VERTEX_COUNT][2]; 28 | extern float companion_normals[COMPANION_VERTEX_COUNT][3]; 29 | 30 | #define COMPANION_TRIANGLE_COUNT 4052 31 | extern short companion_triangles[COMPANION_TRIANGLE_COUNT][3]; 32 | 33 | /* 34 | * convert mesh from indexed to arrays - alloced arrays. 35 | */ 36 | #define COMPANION_ARRAY_COUNT (COMPANION_TRIANGLE_COUNT * 3) 37 | 38 | float *companion_vertices_array(void); 39 | float *companion_texture_coordinates_array(void); 40 | float *companion_normals_array(void); 41 | 42 | /* 43 | * textures 44 | */ 45 | #define COMPANION_TEXTURE_WIDTH 512 46 | #define COMPANION_TEXTURE_HEIGHT 512 47 | #define COMPANION_TEXTURE_FORMAT LIMA_TEXEL_FORMAT_RGB_888 48 | 49 | #define COMPANION_TEXTURE_SIZE \ 50 | (COMPANION_TEXTURE_WIDTH * COMPANION_TEXTURE_HEIGHT * 3 / 4) 51 | 52 | /* texture for the mesh */ 53 | extern unsigned int companion_texture[COMPANION_TEXTURE_SIZE]; 54 | 55 | /* flattened texture for more simple uses */ 56 | extern unsigned int companion_texture_flat[COMPANION_TEXTURE_SIZE]; 57 | 58 | #endif /* COMPANION_H */ 59 | -------------------------------------------------------------------------------- /attic/resources/companion_array.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2012 Luc Verhaegen 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the 6 | * Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include 20 | 21 | #include "companion.h" 22 | 23 | float * 24 | companion_vertices_array(void) 25 | { 26 | float *vertices = calloc(COMPANION_ARRAY_COUNT, 3 * sizeof(float)); 27 | short *triangles = (short *)companion_triangles; 28 | int i, index; 29 | 30 | for (i = 0; i < COMPANION_ARRAY_COUNT; i++) { 31 | index = triangles[i]; 32 | vertices[3 * i + 0] = companion_vertices[index][0]; 33 | vertices[3 * i + 1] = companion_vertices[index][1]; 34 | vertices[3 * i + 2] = companion_vertices[index][2]; 35 | } 36 | 37 | return vertices; 38 | } 39 | 40 | float * 41 | companion_texture_coordinates_array(void) 42 | { 43 | float *texture_coordinates = calloc(COMPANION_ARRAY_COUNT, 44 | 2 * sizeof(float)); 45 | short *triangles = (short *)companion_triangles; 46 | int i, index; 47 | 48 | for (i = 0; i < COMPANION_ARRAY_COUNT; i++) { 49 | index = triangles[i]; 50 | texture_coordinates[2 * i + 0] = 51 | companion_texture_coordinates[index][0]; 52 | texture_coordinates[2 * i + 1] = 53 | companion_texture_coordinates[index][1]; 54 | } 55 | 56 | return texture_coordinates; 57 | } 58 | 59 | float * 60 | companion_normals_array(void) 61 | { 62 | float *normals = calloc(COMPANION_ARRAY_COUNT, 3 * sizeof(float)); 63 | short *triangles = (short *)companion_triangles; 64 | int i, index; 65 | 66 | for (i = 0; i < COMPANION_ARRAY_COUNT; i++) { 67 | index = triangles[i]; 68 | normals[3 * i + 0] = companion_normals[index][0]; 69 | normals[3 * i + 1] = companion_normals[index][1]; 70 | normals[3 * i + 2] = companion_normals[index][2]; 71 | } 72 | 73 | return normals; 74 | } 75 | -------------------------------------------------------------------------------- /attic/resources/lavaetc1.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/lavaetc1.dds -------------------------------------------------------------------------------- /attic/resources/mipdxt1.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/mipdxt1.dds -------------------------------------------------------------------------------- /attic/resources/mipdxt5.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/mipdxt5.dds -------------------------------------------------------------------------------- /attic/resources/miprgba.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/miprgba.dds -------------------------------------------------------------------------------- /attic/resources/smoke.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/smoke.tga -------------------------------------------------------------------------------- /attic/resources/test_image-dxt1a.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/test_image-dxt1a.dds -------------------------------------------------------------------------------- /attic/resources/test_image-dxt1c.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/test_image-dxt1c.dds -------------------------------------------------------------------------------- /attic/resources/test_image-dxt3.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/test_image-dxt3.dds -------------------------------------------------------------------------------- /attic/resources/wall1_a8.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/wall1_a8.dds -------------------------------------------------------------------------------- /attic/resources/wall1_l8.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/attic/resources/wall1_l8.dds -------------------------------------------------------------------------------- /attic/test2d/.gitignore: -------------------------------------------------------------------------------- 1 | bitblt2d 2 | bitblt2d_from_stream 3 | clear2d 4 | bitblt2d_palette 5 | filterblt2d 6 | filterblt2d_fromplanar 7 | bitblt2d_rotate 8 | line2d 9 | line2d_patterned 10 | stretchblt2d 11 | bitblt2d_alpha 12 | 13 | -------------------------------------------------------------------------------- /attic/test2d/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -I$(TOP)/resources -I$(TOP)/driver 6 | CFLAGS += -DDUMP 7 | CXXFLAGS += 8 | LDFLAGS += -lpng 9 | 10 | TARGETS = clear2d line2d bitblt2d_from_stream line2d_patterned bitblt2d \ 11 | bitblt2d_palette filterblt2d stretchblt2d filterblt2d_fromplanar \ 12 | bitblt2d_alpha bitblt2d_rotate 13 | 14 | ETNA_OBJS = ../lib/write_bmp.o ../lib/etna_bswap.o ../etnaviv/libetnaviv.a ../lib/read_png.o 15 | 16 | all: $(TARGETS) 17 | 18 | clean: 19 | rm -f *.o ../lib/*.o ../resources/*.o 20 | rm -f $(TARGETS) 21 | 22 | clear2d: clear2d.o $(ETNA_OBJS) 23 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 24 | 25 | line2d: line2d.o $(ETNA_OBJS) 26 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 27 | 28 | line2d_patterned: line2d_patterned.o $(ETNA_OBJS) 29 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 30 | 31 | bitblt2d_from_stream: bitblt2d_from_stream.o $(ETNA_OBJS) 32 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 33 | 34 | bitblt2d_palette: bitblt2d_palette.o $(ETNA_OBJS) 35 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 36 | 37 | filterblt2d: filterblt2d.o $(ETNA_OBJS) 38 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 39 | 40 | filterblt2d_fromplanar: filterblt2d_fromplanar.o $(ETNA_OBJS) 41 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 42 | 43 | bitblt2d_rotate: bitblt2d_rotate.o $(ETNA_OBJS) 44 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 45 | 46 | bitblt2d: bitblt2d.o $(ETNA_OBJS) 47 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 48 | 49 | bitblt2d_alpha: bitblt2d_alpha.o $(ETNA_OBJS) 50 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 51 | 52 | stretchblt2d: stretchblt2d.o $(ETNA_OBJS) 53 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 54 | 55 | -------------------------------------------------------------------------------- /attic/utils/.gitignore: -------------------------------------------------------------------------------- 1 | viv_gpu_top 2 | viv_info 3 | viv_registers 4 | viv_reset 5 | viv_watch 6 | viv_throughput 7 | -------------------------------------------------------------------------------- /attic/utils/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | include $(TOP)/Makefile.inc 4 | 5 | COMMON_FLAGS += -I$(TOP)/driver 6 | CFLAGS += 7 | CXXFLAGS += 8 | LDFLAGS += 9 | 10 | ifeq ($(ETNAVIV_PROFILER), 1) 11 | # Define ETNAVIV_PROFILER=1 if the kernel was built with VIVANTE_PROFILER 12 | # enabled 13 | COMMON_FLAGS += -DVIVANTE_PROFILER=1 14 | endif 15 | 16 | TARGETS = viv_gpu_top viv_info viv_registers viv_reset viv_watch viv_throughput viv_interpose.so 17 | 18 | ETNA_OBJS = ../etnaviv/libetnaviv.a 19 | DRIVER_OBJS = ../lib/fbdemos.o ../lib/etna_bswap.o ../driver/libetnadriver.a ../minigallium/libminigallium.a ../etnaviv/libetnaviv.a 20 | 21 | LDFLAGS_SLIB = -shared -Xlinker -Bsymbolic -ldl 22 | 23 | all: $(TARGETS) 24 | 25 | clean: 26 | rm -f *.o ../lib/*.o ../resources/*.o 27 | rm -f $(TARGETS) 28 | 29 | viv_gpu_top: viv_gpu_top.o $(ETNA_OBJS) 30 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 31 | 32 | viv_info: viv_info.o 33 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 34 | 35 | viv_interpose.so: viv_interpose.o ../lib/viv_hook.o ../lib/elf_hook.o ../lib/flightrecorder.o 36 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_SLIB) 37 | 38 | viv_registers: viv_registers.o $(ETNA_OBJS) 39 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 40 | 41 | viv_reset: viv_reset.o $(ETNA_OBJS) 42 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 43 | 44 | viv_watch: viv_watch.o $(ETNA_OBJS) 45 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 46 | 47 | # viv_throughput is the only utility that needs the gallium pipe driver 48 | viv_throughput: viv_throughput.o $(DRIVER_OBJS) 49 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) 50 | 51 | -------------------------------------------------------------------------------- /attic/utils/viv_reset.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013 Etnaviv Project 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the 12 | * next paragraph) shall be included in all copies or substantial portions 13 | * of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | * DEALINGS IN THE SOFTWARE. 22 | */ 23 | /* Reset GPU, useful in case it hangs. 24 | */ 25 | /* 26 | * Note: this is known to be unreliable with many kernel drivers and can bring 27 | * the GPU in a state that can only be recovered with a device reboot. 28 | */ 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | 41 | int main(int argc, char **argv) 42 | { 43 | int rv; 44 | struct viv_conn *conn = 0; 45 | rv = viv_open(VIV_HW_3D, &conn); 46 | if(rv!=0) 47 | { 48 | fprintf(stderr, "Error opening device\n"); 49 | exit(1); 50 | } 51 | printf("Succesfully opened device, resetting\n"); 52 | viv_reset(conn); 53 | viv_close(conn); 54 | return 0; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /doc/blob_extensions.md: -------------------------------------------------------------------------------- 1 | EGL/GLES2 extension list from blob drivers 2 | =========================================== 3 | 4 | gk802 5 | ---------- 6 | 7 | VERSION 4.6.9:1478, PLATFORM Android 8 | 9 | EGL Extensions: 10 | 11 | EGL_KHR_reusable_sync 12 | EGL_KHR_fence_sync 13 | EGL_KHR_image_base 14 | EGL_KHR_image_pixmap 15 | EGL_KHR_image 16 | EGL_KHR_gl_texture_2D_image 17 | EGL_KHR_gl_texture_cubmap_image 18 | EGL_KHR_gl_renderbuffer_image 19 | EGL_KHR_lock_surface 20 | EGL_ANDROID_image_native_buffer 21 | EGL_ANDROID_swap_rectangle 22 | EGL_ANDROID_blob_cache 23 | EGL_ANDROID_recordable 24 | 25 | GLES2 Extensions: 26 | 27 | GL_OES_compressed_ETC1_RGB8_texture 28 | GL_OES_compressed_paletted_texture 29 | GL_OES_EGL_image 30 | GL_OES_depth24 31 | GL_OES_element_index_uint 32 | GL_OES_fbo_render_mipmap 33 | GL_OES_fragment_precision_high 34 | GL_OES_rgb8_rgba8 35 | GL_OES_stencil1 36 | GL_OES_stencil4 37 | GL_OES_texture_npot 38 | GL_OES_vertex_half_float 39 | GL_OES_depth_texture 40 | GL_OES_packed_depth_stencil 41 | GL_OES_standard_derivatives 42 | GL_OES_get_program_binary 43 | GL_EXT_texture_format_BGRA8888 44 | GL_IMG_read_format 45 | GL_EXT_blend_minmax 46 | GL_EXT_read_format_bgra 47 | GL_EXT_multi_draw_arrays 48 | GL_APPLE_texture_format_BGRA8888 49 | GL_APPLE_texture_max_level 50 | GL_ARM_rgba8 51 | GL_EXT_frag_depth 52 | GL_VIV_shader_binary 53 | GL_VIV_timestamp 54 | GL_OES_mapbuffer 55 | GL_OES_EGL_image_external 56 | GL_EXT_texture_compression_dxt1 57 | GL_EXT_texture_compression_s3tc 58 | GL_IMG_texture_compression_pvrtc 59 | GL_EXT_discard_framebuffer 60 | GL_OES_vertex_type_10_10_10_2 61 | GL_EXT_texture_type_2_10_10_10_REV 62 | GL_EXT_texture_filter_anisotropic 63 | 64 | -------------------------------------------------------------------------------- /doc/images/displacement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/doc/images/displacement.png -------------------------------------------------------------------------------- /doc/images/fsaa1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/doc/images/fsaa1.png -------------------------------------------------------------------------------- /doc/images/fsaa2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/doc/images/fsaa2.png -------------------------------------------------------------------------------- /doc/images/fsaa4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/doc/images/fsaa4.png -------------------------------------------------------------------------------- /doc/images/fsaa_result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/doc/images/fsaa_result.png -------------------------------------------------------------------------------- /doc/images/mipmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/doc/images/mipmap.png -------------------------------------------------------------------------------- /doc/images/supertile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/doc/images/supertile.png -------------------------------------------------------------------------------- /envytools/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | 3 | -------------------------------------------------------------------------------- /envytools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(ENVYTOOLS C) 2 | cmake_minimum_required(VERSION 2.6) 3 | enable_testing() 4 | 5 | SET(CMAKE_C_FLAGS "-g -O2 -Wall") 6 | 7 | include_directories(include) 8 | 9 | add_subdirectory(util) 10 | add_subdirectory(rnn) 11 | 12 | install(DIRECTORY include/ DESTINATION include/envytools) 13 | install(DIRECTORY rnndb DESTINATION share) 14 | install(DIRECTORY hwdocs DESTINATION share/doc/envytools) 15 | install(FILES README DESTINATION share/doc/envytools) 16 | -------------------------------------------------------------------------------- /envytools/include/colors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #ifndef COLORS_H 26 | #define COLORS_H 27 | 28 | struct envy_colors { 29 | const char *reset; 30 | const char *iname; /* instruction name */ 31 | const char *rname; /* register or bitfield name */ 32 | const char *mod; /* instruction modifier */ 33 | const char *sym; /* auxiliary char like { , + */ 34 | const char *reg; /* ISA register */ 35 | const char *regsp; /* special ISA register */ 36 | const char *num; /* immediate number */ 37 | const char *mem; /* memory reference */ 38 | const char *btarg; /* branch target */ 39 | const char *ctarg; /* call target */ 40 | const char *bctarg; /* branch and call target */ 41 | const char *eval; /* enum value */ 42 | const char *comm; /* comment */ 43 | const char *err; /* error */ 44 | }; 45 | 46 | extern const struct envy_colors envy_null_colors; 47 | extern const struct envy_colors envy_def_colors; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /envytools/include/mask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #ifndef MASK_H 26 | #define MASK_H 27 | 28 | #include "util.h" 29 | #include 30 | #include 31 | #include 32 | 33 | #define MASK_CHUNK_SIZE 32 34 | #define MASK_SIZE(num) CEILDIV((num), MASK_CHUNK_SIZE) 35 | 36 | static inline int mask_get(uint32_t *mask, int num) { 37 | return (mask[num/32] >> (num % 32)) & 1; 38 | } 39 | 40 | static inline void mask_set(uint32_t *mask, int num) { 41 | mask[num/32] |= 1 << (num % 32); 42 | } 43 | 44 | static inline uint32_t *mask_new(int num) { 45 | uint32_t *res = calloc(sizeof *res, MASK_SIZE(num)); 46 | return res; 47 | } 48 | 49 | static inline uint32_t *mask_dup(uint32_t *mask, int num) { 50 | uint32_t *res = mask_new(num); 51 | memcpy(res, mask, MASK_SIZE(num) * sizeof *res); 52 | return res; 53 | } 54 | 55 | void mask_or(uint32_t *dmask, uint32_t *smask, int size); 56 | int mask_or_r(uint32_t *dmask, uint32_t *smask, int size); 57 | 58 | int mask_intersect(uint32_t *a, uint32_t *b, int size); 59 | int mask_contains(uint32_t *a, uint32_t *b, int size); 60 | void mask_print(FILE *out, uint32_t *mask, int size); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /envytools/include/rnndec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #ifndef RNNDEC_H 26 | #define RNNDEC_H 27 | 28 | #include "rnn.h" 29 | #include "colors.h" 30 | 31 | struct rnndecvariant { 32 | struct rnnenum *en; 33 | int variant; 34 | }; 35 | 36 | struct rnndeccontext { 37 | struct rnndb *db; 38 | struct rnndecvariant **vars; 39 | int varsnum; 40 | int varsmax; 41 | const struct envy_colors *colors; 42 | }; 43 | 44 | struct rnndecaddrinfo { 45 | struct rnntypeinfo *typeinfo; 46 | int width; 47 | char *name; 48 | }; 49 | 50 | struct rnndeccontext *rnndec_newcontext(struct rnndb *db); 51 | int rnndec_varadd(struct rnndeccontext *ctx, char *varset, char *variant); 52 | int rnndec_varmatch(struct rnndeccontext *ctx, struct rnnvarinfo *vi); 53 | char *rnndec_decodeval(struct rnndeccontext *ctx, struct rnntypeinfo *ti, uint64_t value, int width); 54 | struct rnndecaddrinfo *rnndec_decodeaddr(struct rnndeccontext *ctx, struct rnndomain *domain, uint64_t addr, int write); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /envytools/include/symtab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #ifndef SYMTAB_H 26 | #define SYMTAB_H 27 | 28 | #include 29 | 30 | struct symtab_sym { 31 | char *name; 32 | uint32_t hash; 33 | int hchain; 34 | int type; 35 | int data; 36 | }; 37 | 38 | struct symtab { 39 | struct symtab_sym *syms; 40 | int symsnum; 41 | int symsmax; 42 | int *buckets; 43 | int bucketsnum; 44 | }; 45 | 46 | struct symtab *symtab_new(); 47 | void symtab_del(struct symtab *tab); 48 | int symtab_get(struct symtab *tab, const char *name, int *ptype, int *pdata); 49 | int symtab_get_t(struct symtab *tab, const char *name, int type, int *pdata); 50 | int symtab_put(struct symtab *tab, const char *name, int type, int data); 51 | static inline int symtab_get_td(struct symtab *tab, const char *name, int type) { 52 | int res; 53 | if (symtab_get_t(tab, name, type, &res) == -1) 54 | return -1; 55 | return res; 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /envytools/rnn/.gitignore: -------------------------------------------------------------------------------- 1 | headergen 2 | lookup 3 | expand 4 | demmio 5 | dedma 6 | rnncheck 7 | librnn.a 8 | librnn.so 9 | rnn_path.h 10 | -------------------------------------------------------------------------------- /envytools/rnn/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(ENVYTOOLS C) 2 | cmake_minimum_required(VERSION 2.6) 3 | 4 | # <3 libxml2 5 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-sign") 6 | 7 | find_package(LibXml2 REQUIRED) 8 | 9 | find_path(LIBICONV_INCLUDE_DIR iconv.h) 10 | include_directories(${LIBXML2_INCLUDE_DIR} ${LIBICONV_INCLUDE_DIR}) 11 | 12 | configure_file(rnn_path.h.in rnn_path.h ESCAPE_QUOTES) 13 | include_directories(${PROJECT_BINARY_DIR}) 14 | 15 | add_library(rnn rnn.c rnndec.c) 16 | 17 | #add_executable(demmio demmio.c) 18 | add_executable(headergen headergen.c) 19 | #add_executable(dedma dedma.c dedma_cache.c dedma_back.c) 20 | add_executable(lookup lookup.c) 21 | add_executable(rnncheck rnncheck.c) 22 | 23 | target_link_libraries(rnn ${LIBXML2_LIBRARIES} envyutil) 24 | #target_link_libraries(demmio envy rnn) 25 | target_link_libraries(headergen rnn) 26 | #target_link_libraries(dedma rnn) 27 | target_link_libraries(lookup rnn) 28 | target_link_libraries(rnncheck rnn) 29 | 30 | #install(TARGETS demmio headergen rnn dedma lookup 31 | # RUNTIME DESTINATION bin 32 | # LIBRARY DESTINATION lib${LIB_SUFFIX} 33 | # ARCHIVE DESTINATION lib${LIB_SUFFIX}) 34 | 35 | #add_test(check_nv_mmio rnncheck nv_mmio.xml) 36 | #add_test(check_nv_evo rnncheck nv_evo.xml) 37 | #add_test(check_nv_structs rnncheck nv_struct.xml) 38 | #add_test(check_nv_objects rnncheck nv_objects.xml) 39 | #add_test(check_nv50_texture rnncheck nv50_texture.xml) 40 | #add_test(check_adt7473 rnncheck extdev/adt7473.xml) 41 | #add_test(check_nv17_mpeg rnncheck nv17_mpeg.xml) 42 | #add_test(check_nvc0_shaders rnncheck nvc0_shaders.xml) 43 | 44 | -------------------------------------------------------------------------------- /envytools/rnn/rnn_path.h.in: -------------------------------------------------------------------------------- 1 | #define RNN_DEF_PATH "${CMAKE_SOURCE_DIR}/rnndb:${CMAKE_INSTALL_PREFIX}/share/rnndb" 2 | -------------------------------------------------------------------------------- /envytools/rnn/rnncheck.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #include "rnn.h" 26 | #include "rnndec.h" 27 | #include 28 | 29 | void usage() 30 | { 31 | printf ("Usage:\n" 32 | "\trnncheck file.xml\n" 33 | ); 34 | exit(2); 35 | } 36 | 37 | int main(int argc, char **argv) { 38 | rnn_init(); 39 | if (argc < 2) { 40 | usage(); 41 | } 42 | struct rnndb *db = rnn_newdb(); 43 | rnn_parsefile (db, argv[1]); 44 | rnn_prepdb (db); 45 | return db->estatus; 46 | } 47 | -------------------------------------------------------------------------------- /envytools/rnn/update.sed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if test renouveau.xml -nt renouveau; then 3 | ./renouveau2rnn 4 | fi 5 | 6 | for i in renouveau/*; do 7 | if test "${i:${#i} - 4:4}" == ".xml"; then 8 | continue 9 | fi 10 | 11 | if test "$i" -nt "$i.xml"; then 12 | ./text2xml "$i" > "$i.xml" 13 | fi 14 | done 15 | 16 | function addrs 17 | { 18 | sed -nre "s/d NV01_SUBCHAN ([^ ]*) ([^ ]*).*/\1 \2/p" 19 | } 20 | 21 | function gen 22 | { 23 | join <(./expand "$3" -v obj-class "$1"|addrs|sort) <(./expand "$4" -v obj-class "$2"|addrs|sort)|sed -re 's@\([^()]*\)@@g; s@([^ ]*) ([^ ]*) ([^ ]*)@s/\2/\3/g;@g; s@s/NV..TCL_@s/'"$1"'_@'|sort|uniq 24 | } 25 | 26 | gen NV10TCL NV10TCL renouveau/nv10-20tcl.xml nv10_3d.xml 27 | gen NV20TCL NV20TCL renouveau/nv10-20tcl.xml nv20_3d.xml 28 | gen NV34TCL NV30_3D renouveau/nv30-40tcl.xml nv30-40_3d.xml 29 | gen NV40TCL NV40_3D renouveau/nv30-40tcl.xml nv30-40_3d.xml 30 | gen NV50TCL NV50_3D renouveau/nv50tcl.xml nv50_3d.xml 31 | 32 | -------------------------------------------------------------------------------- /envytools/util/.gitignore: -------------------------------------------------------------------------------- 1 | libenvyutil.a 2 | libenvyutil.so 3 | -------------------------------------------------------------------------------- /envytools/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(ENVYTOOLS C) 2 | cmake_minimum_required(VERSION 2.6) 3 | 4 | add_library(envyutil 5 | path.c mask.c hash.c symtab.c colors.c yy.c astr.c aprintf.c 6 | vardata.c varinfo.c varselect.c 7 | ) 8 | 9 | install(TARGETS envyutil 10 | RUNTIME DESTINATION bin 11 | LIBRARY DESTINATION lib${LIB_SUFFIX} 12 | ARCHIVE DESTINATION lib${LIB_SUFFIX}) 13 | -------------------------------------------------------------------------------- /envytools/util/aprintf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009-2011 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #include "util.h" 26 | #include 27 | 28 | char *aprintf(const char *format, ...) { 29 | va_list va; 30 | va_start(va, format); 31 | size_t sz = vsnprintf(0, 0, format, va); 32 | va_end(va); 33 | char *res = malloc(sz + 1); 34 | va_start(va, format); 35 | vsnprintf(res, sz + 1, format, va); 36 | va_end(va); 37 | return res; 38 | } 39 | -------------------------------------------------------------------------------- /envytools/util/astr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #include "util.h" 26 | 27 | void print_escaped_astr(FILE *out, struct astr *astr) { 28 | int i; 29 | fprintf(out, "\""); 30 | for (i = 0; i < astr->len; i++) { 31 | unsigned char c = astr->str[i]; 32 | switch (c) { 33 | case '\\': 34 | fprintf(out, "\\\\"); 35 | break; 36 | case '\"': 37 | fprintf(out, "\\\""); 38 | break; 39 | case '\n': 40 | fprintf(out, "\\n"); 41 | break; 42 | case '\f': 43 | fprintf(out, "\\f"); 44 | break; 45 | case '\t': 46 | fprintf(out, "\\t"); 47 | break; 48 | case '\a': 49 | fprintf(out, "\\a"); 50 | break; 51 | case '\v': 52 | fprintf(out, "\\v"); 53 | break; 54 | case '\r': 55 | fprintf(out, "\\r"); 56 | break; 57 | default: 58 | if (c >= 0x20 && c <= 0x7e) { 59 | fprintf(out, "%c", c); 60 | } else { 61 | fprintf(out, "\\x%02x", c); 62 | } 63 | break; 64 | } 65 | } 66 | fprintf(out, "\""); 67 | } 68 | -------------------------------------------------------------------------------- /envytools/util/colors.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #include "colors.h" 26 | 27 | const struct envy_colors envy_null_colors = { 28 | .reset = "", 29 | .iname = "", 30 | .rname = "", 31 | .mod = "", 32 | .sym = "", 33 | .reg = "", 34 | .regsp = "", 35 | .num = "", 36 | .mem = "", 37 | .btarg = "", 38 | .ctarg = "", 39 | .bctarg = "", 40 | .eval = "", 41 | .comm = "", 42 | .err = "", 43 | }; 44 | 45 | const struct envy_colors envy_def_colors = { 46 | .reset = "\x1b[0m", 47 | .iname = "\x1b[0;32m", 48 | .rname = "\x1b[0;32m", 49 | .mod = "\x1b[0;36m", 50 | .sym = "\x1b[0;36m", 51 | .reg = "\x1b[0;31m", 52 | .regsp = "\x1b[0;35m", 53 | .num = "\x1b[0;33m", 54 | .mem = "\x1b[0;35m", 55 | .btarg = "\x1b[0;35m", 56 | .ctarg = "\x1b[0;1;37m", 57 | .bctarg = "\x1b[0;1;35m", 58 | .eval = "\x1b[0;35m", 59 | .comm = "\x1b[0;34m", 60 | .err = "\x1b[0;1;31m", 61 | }; 62 | -------------------------------------------------------------------------------- /envytools/util/hash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #include "util.h" 26 | 27 | uint32_t elf_hash(const char *str) { 28 | const unsigned char *ustr = (const unsigned char *)str; 29 | uint32_t h = 0; 30 | while (*ustr) { 31 | h <<= 4; 32 | h += *ustr++; 33 | h ^= (h >> 24) & 0xf0; 34 | h &= 0xfffffff; 35 | } 36 | return h; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /envytools/util/path.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Marcin Kościelnicki 3 | * All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a 6 | * copy of this software and associated documentation files (the "Software"), 7 | * to deal in the Software without restriction, including without limitation 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the next 13 | * paragraph) shall be included in all copies or substantial portions of the 14 | * Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | #include "util.h" 26 | #include 27 | 28 | FILE *find_in_path(const char *name, const char *path, char **pfullname) { 29 | if (!path) 30 | return 0; 31 | while (path) { 32 | const char *npath = strchr(path, ':'); 33 | size_t plen; 34 | if (npath) { 35 | plen = npath - path; 36 | npath++; 37 | } else { 38 | plen = strlen(path); 39 | } 40 | if (plen) { 41 | char *fullname = malloc(strlen(name) + plen + 2); 42 | strncpy(fullname, path, plen); 43 | fullname[plen] = '/'; 44 | fullname[plen+1] = 0; 45 | strcat(fullname, name); 46 | FILE *file = fopen(fullname, "r"); 47 | if (file) { 48 | if (pfullname) 49 | *pfullname = fullname; 50 | else 51 | free(fullname); 52 | return file; 53 | } 54 | free(fullname); 55 | } 56 | path = npath; 57 | } 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /rnndb/copyright.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a 15 | copy of this software and associated documentation files (the "Software"), 16 | to deal in the Software without restriction, including without limitation 17 | the rights to use, copy, modify, merge, publish, distribute, sub license, 18 | and/or sell copies of the Software, and to permit persons to whom the 19 | Software is furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice (including the 22 | next paragraph) shall be included in all copies or substantial portions 23 | of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 28 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 30 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 31 | DEALINGS IN THE SOFTWARE. 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /rnndb/gen_headers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Generate headers using `headergen` 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | export RNN_PATH=${DIR} 5 | HEADERGEN=${DIR}/../envytools/build/rnn/headergen 6 | ${HEADERGEN} isa.xml 7 | ${HEADERGEN} cmdstream.xml 8 | ${HEADERGEN} state.xml 9 | ${HEADERGEN} texdesc_3d.xml 10 | rm -f ${DIR}/copyright.xml.h 11 | mv ${DIR}/*.xml.h ${DIR}/../src/etnaviv 12 | 13 | -------------------------------------------------------------------------------- /tools/bits_set.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | ''' 3 | Print which bits are set in a value. 4 | ''' 5 | from __future__ import print_function, division, unicode_literals 6 | import argparse 7 | 8 | def intdh(s): 9 | if s.startswith("0x"): 10 | return int(s[2:], 16) 11 | else: 12 | return int(s) 13 | 14 | parser = argparse.ArgumentParser(description='Print which bits are set.') 15 | parser.add_argument('value', metavar='VALUE') 16 | parser.add_argument('-i', dest='invert', default=False, action='store_const', const=True) 17 | parser.add_argument('-b', dest='bits', default=32, type=int) 18 | args = parser.parse_args() 19 | 20 | value = intdh(args.value) 21 | if args.invert: 22 | value ^= (1< 0: 27 | if value & (1< 3 | # 4 | # build structure definition for GCS hal interface from dwarf debug information in native executable. 5 | # Needs dwarf_to_c (https://www.github.com/laanwj/dwarf_to_c) 6 | extract_structures_json.py $1 _gcsHAL_INTERFACE _gcoCMDBUF _gcsQUEUE > data/gcs_hal_interface_$2.json 7 | -------------------------------------------------------------------------------- /tools/data/gcs_hal_interface_arnova.json: -------------------------------------------------------------------------------- 1 | gcs_hal_interface_v2.json -------------------------------------------------------------------------------- /tools/deobfuscate-simple-vivante.pl: -------------------------------------------------------------------------------- 1 | $bitfield = '\d+:\d+|[A-Z_a-z]+'; 2 | $id = '[^()]+|[^()]*(?:(\((?:[^()]++|(?-1))*+\))[^()]*)*'; 3 | $hex = '0x[0-9a-fA-F]+'; 4 | 5 | $sub = ""; 6 | $name = ""; 7 | undef $prev; 8 | 9 | while (<>) { 10 | s/\(0 ?\? ?($bitfield)\)/__gcmSTART(\1)/g; 11 | s/\(1 ?\? ?($bitfield)\)/__gcmEND(\1)/g; 12 | s/\(__gcmEND\(($bitfield)\) ?- ?__gcmSTART\(\1\) ?\+ ?1\)/__gcmGETSIZE(\1)/g; 13 | s/\(\(gctUINT32\) ?\(\(__gcmGETSIZE\(($bitfield)\) ?== ?32\) ?\? ?~0 ?: ?\(~\(~0 ?<< ?__gcmGETSIZE\((?-1)\)\)\)\)\)/__gcmMASK(\1)/g; 14 | s/\(\(\(gctUINT32\) ?\(($id)\)\) ?\<\< ?__gcmSTART\((?$bitfield)\)\)/__gcmALIGN(\1, $+{field})/g; 15 | 16 | print; 17 | } 18 | -------------------------------------------------------------------------------- /tools/deobfuscate-simple2-vivante.pl: -------------------------------------------------------------------------------- 1 | # deobfuscation for alternative gcmXXX macros 2 | # - Make u32 type configurable (for uapi) 3 | # - Modify macros to take a bit field instead of register name and field 4 | # - Add gcmGETFIELD 5 | $bitfield = '\d+:\d+|[A-Z_a-z]+'; 6 | $id = '[^()]+|[^()]*(?:(\((?:[^()]++|(?-1))*+\))[^()]*)*'; 7 | $hex = '0x[0-9a-fA-F]+'; 8 | # 32-bit type 9 | $u32 = 'u32'; 10 | #$u32 = 'gctUINT32'; 11 | 12 | $sub = ""; 13 | $name = ""; 14 | undef $prev; 15 | 16 | while (<>) { 17 | s/\(0 ?\? ?($bitfield)\)/__gcmSTART(\1)/g; 18 | s/\(1 ?\? ?($bitfield)\)/__gcmEND(\1)/g; 19 | s/\(__gcmEND\(($bitfield)\) ?- ?__gcmSTART\(\1\) ?\+ ?1\)/__gcmGETSIZE(\1)/g; 20 | s/\(\($u32\) ?\(\(__gcmGETSIZE\(($bitfield)\) ?== ?32\) ?\? ?~0 ?: ?\(~\(~0 ?\<\< ?__gcmGETSIZE\((?-1)\)\)\)\)\)/__gcmMASK(\1)/g; 21 | s/\(\(\($u32\) ?\(($id)\)\) ?\<\< ?__gcmSTART\((?$bitfield)\)\)/__gcmALIGN(\1, $+{field})/g; 22 | s/\( ?__gcmALIGN\(__gcmMASK\((?$bitfield)\), ?(?-1)\) ?\)/gcmFIELDMASK($+{field})/g; 23 | s/\( ?\(\(\($u32\) ?\((?$id)\)\) ?& ?~__gcmALIGN\(__gcmMASK\((?$bitfield)\), ?\g{field}\)\) ?\| ?__gcmALIGN\(\($u32\) ?\((?$id)\) ?& ?__gcmMASK\(\g{field}\), ?\g{field}\) ?\)/gcmSETFIELD($+{data}, $+{field}, $+{value})/g; 24 | # SETFIELD without u32 cast?! 25 | s/\( ?\(\(\($u32\) ?\((?$id)\)\) ?& ?~__gcmALIGN\(__gcmMASK\((?$bitfield)\), ?\g{field}\)\) ?\| ?__gcmALIGN\((?$id) ?& ?__gcmMASK\(\g{field}\), ?\g{field}\) ?\)/gcmSETFIELD($+{data}, $+{field}, $+{value})/g; 26 | s/\( ?\(\(\($u32\) ?\((?$id)\)\) ?\>\> ?__gcmSTART\((?$bitfield)\) ?& ?__gcmMASK\(\g{field}\)\) ?== ?\((?$id) ?& ?__gcmMASK\(\g{field}\) ?\) ?\)/gcmVERIFYFIELDVALUE($+{data}, $+{field}, $+{value})/g; 27 | 28 | s/\( ?\(\(\(\(u32\) ?\((?$id)\)\) ?>> ?__gcmSTART\((?$bitfield)\)\) ?& ?__gcmMASK\(\g{field}\)\) ?\)/gcmGETFIELD($+{data}, $+{field})/g; 29 | 30 | print; 31 | } 32 | -------------------------------------------------------------------------------- /tools/etnaviv/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etnaviv/etna_viv/51dbdbd9b83a60ed62834f836f2759ec2a4fc23a/tools/etnaviv/__init__.py -------------------------------------------------------------------------------- /tools/etnaviv/asm_defs.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Wladimir J. van der Laan 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a 4 | # copy of this software and associated documentation files (the "Software"), 5 | # to deal in the Software without restriction, including without limitation 6 | # the rights to use, copy, modify, merge, publish, distribute, sub license, 7 | # and/or sell copies of the Software, and to permit persons to whom the 8 | # Software is furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice (including the 11 | # next paragraph) shall be included in all copies or substantial portions 12 | # of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | class Model: 22 | '''GPU model definition''' 23 | GC2000 = 0 # or older 24 | GC3000 = 1 25 | 26 | by_name = { 27 | 'GC2000':GC2000, 28 | 'GC3000':GC3000, 29 | } 30 | by_idx = { 31 | GC2000:'GC2000', 32 | GC3000:'GC3000', 33 | } 34 | 35 | class Flags: 36 | '''GPU dialect flags''' 37 | NONE = 0 38 | DUAL16 = 1 39 | 40 | by_name = { 41 | 'DUAL16':DUAL16, 42 | } 43 | by_idx = { 44 | DUAL16:'DUAL16', 45 | } 46 | 47 | @classmethod 48 | def from_str(cls, s): 49 | if not s: 50 | return 0 51 | rv = 0 52 | for atom in s.split(','): 53 | rv |= cls.by_name[atom.upper()] 54 | return rv 55 | 56 | @classmethod 57 | def available(cls): 58 | return ','.join(cls.by_name.keys()) 59 | 60 | class Dialect: 61 | '''ISA dialect''' 62 | def __init__(self, model, flags): 63 | self.model = model 64 | self.flags = flags 65 | -------------------------------------------------------------------------------- /tools/etnaviv/auto_gcabi.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Choose GCABI json file automatically, based on Vivante driver version 3 | in FDR file 4 | ''' 5 | # Copyright (c) 2012-2013 Wladimir J. van der Laan 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a 8 | # copy of this software and associated documentation files (the "Software"), 9 | # to deal in the Software without restriction, including without limitation 10 | # the rights to use, copy, modify, merge, publish, distribute, sub license, 11 | # and/or sell copies of the Software, and to permit persons to whom the 12 | # Software is furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice (including the 15 | # next paragraph) shall be included in all copies or substantial portions 16 | # of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | # DEALINGS IN THE SOFTWARE. 25 | import os, struct 26 | 27 | from etnaviv.util import BASEPATH 28 | from etnaviv.parse_fdr import FDRLoader, Event, Comment 29 | from etnaviv.target_arch import ENDIAN, WORD_SPEC, WORD_CHAR 30 | 31 | DATAPATH=os.path.join(BASEPATH, "tools", "data") 32 | 33 | BY_VERSION={ 34 | (5,0,11,25762): 'gcs_hal_interface_imx6_v5_0_11_p4_25762.json', 35 | (5,0,11,41671): 'gcs_hal_interface_imx6_v5_0_11_p8_41671.json', 36 | (6,2,3,129602): 'gcs_hal_interface_imx8_v6.2.3.129602.json', 37 | (6,2,2,93313): 'gcs_hal_interface_imx6_v6.2.2.93313.json', 38 | (6,2,4,190076): 'gcs_hal_interface_imx8_v6.2.4.190076.json', 39 | 40 | } 41 | 42 | def guess_from_version(version): 43 | try: 44 | return os.path.join(DATAPATH, BY_VERSION[version]) 45 | except KeyError: 46 | return None 47 | 48 | def guess_from_fdr(filename): 49 | fdr = FDRLoader(filename) 50 | rec = next(iter(fdr)) 51 | if isinstance(rec, Comment): 52 | t = WORD_SPEC.unpack(rec.data[0:4])[0] 53 | if t == 0x424f4c42: # Version marker 54 | v = struct.unpack(ENDIAN + WORD_CHAR * 4, rec.data[4:]) 55 | return guess_from_version(v) 56 | return None 57 | -------------------------------------------------------------------------------- /tools/etnaviv/counter.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Simple class to count unique values and assign ids to them. 3 | ''' 4 | # Copyright (c) 2012-2017 Wladimir J. van der Laan 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a 7 | # copy of this software and associated documentation files (the "Software"), 8 | # to deal in the Software without restriction, including without limitation 9 | # the rights to use, copy, modify, merge, publish, distribute, sub license, 10 | # and/or sell copies of the Software, and to permit persons to whom the 11 | # Software is furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice (including the 14 | # next paragraph) shall be included in all copies or substantial portions 15 | # of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | class Counter(object): 26 | '''Count unique values''' 27 | def __init__(self): 28 | self.d = {} 29 | self.c = 0 30 | 31 | def __getitem__(self, key): 32 | try: 33 | return self.d[key] 34 | except KeyError: 35 | rv = self.c 36 | self.d[key] = rv 37 | self.c += 1 38 | return rv 39 | 40 | 41 | -------------------------------------------------------------------------------- /tools/etnaviv/disasm.py: -------------------------------------------------------------------------------- 1 | import struct 2 | from etnaviv.asm_common import format_instruction, disassemble 3 | 4 | def disasm_format(out, isa, dialect, data, opt_addr=False, opt_raw=False, opt_cfmt=False): 5 | for idx in xrange(len(data)//16): 6 | inst = struct.unpack(b' 0x80000000: 35 | return (i - 0x100000000) / 65536.0 36 | else: 37 | return i / 65536.0 38 | 39 | COMPS = 'xyzw' 40 | def offset_to_uniform(num): 41 | ''' 42 | Register offset to u0.x. 43 | ''' 44 | return 'u%i.%s' % (num//16, COMPS[(num//4)%4]) 45 | 46 | -------------------------------------------------------------------------------- /tools/etnaviv/parse_proc_map.py: -------------------------------------------------------------------------------- 1 | import os, bisect 2 | 3 | class Memblock: 4 | pass 5 | def parse_proc_map(m): 6 | for line in m.rstrip().split(b'\n'): 7 | # 7f44adffd000-7f44ae7fd000 rw-p 00000000 00:00 0 [stack:14834] 8 | attrs = line.split() 9 | addrfrom,addrto = attrs[0].split(b'-') 10 | blk = Memblock() 11 | blk.addrfrom = int(addrfrom, 16) 12 | blk.addrto = int(addrto, 16) 13 | blk.size = blk.addrto - blk.addrfrom 14 | blk.perms = attrs[1] 15 | blk.offset = int(attrs[2], 16) 16 | blk.stime = attrs[3] 17 | blk.inode = int(attrs[4]) 18 | if len(attrs)>=6: 19 | blk.desc = attrs[5] 20 | else: 21 | blk.desc = '' 22 | yield blk 23 | 24 | class MemRangeDesc: 25 | def __init__(self, name, addrfrom, addrto): 26 | self.addrfrom = addrfrom 27 | self.addrto = addrto 28 | self.name = name 29 | self.basename = os.path.basename(name) 30 | def __repr__(self): 31 | return 'MemRangeDesc(0x%08x:0x%08x,name=%s)' % (self.addrfrom, self.addrto, self.name.decode('utf-8')) 32 | 33 | class MemRanges: 34 | def __init__(self, ranges): 35 | self.ranges = ranges 36 | self.starts = [r.addrfrom for r in ranges] 37 | 38 | def lookup(self, addr): 39 | i = bisect.bisect(self.starts, addr) - 1 40 | if i>=0 and self.ranges[i].addrfrom <= addr < self.ranges[i].addrto: 41 | return self.ranges[i] 42 | else: 43 | return None 44 | 45 | def extract_mem_ranges(msg): 46 | ranges = {} 47 | for rec in parse_proc_map(msg): # Memblock iter 48 | if not rec.desc: 49 | continue 50 | if rec.desc in ranges: # if known mapping, extend end address 51 | ranges[rec.desc].addrto = rec.addrto 52 | else: # new mapping 53 | r = MemRangeDesc(rec.desc, rec.addrfrom, rec.addrto) 54 | ranges[rec.addrfrom] = r 55 | ranges = list(ranges.values()) 56 | ranges.sort(key=lambda e:e.addrfrom) 57 | return MemRanges(ranges) 58 | 59 | -------------------------------------------------------------------------------- /tools/etnaviv/rangeutil.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Basic range utilities which have no Python built-in or library function. 3 | ''' 4 | # Copyright (c) 2017 Wladimir J. van der Laan 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a 7 | # copy of this software and associated documentation files (the "Software"), 8 | # to deal in the Software without restriction, including without limitation 9 | # the rights to use, copy, modify, merge, publish, distribute, sub license, 10 | # and/or sell copies of the Software, and to permit persons to whom the 11 | # Software is furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice (including the 14 | # next paragraph) shall be included in all copies or substantial portions 15 | # of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | def ranges_overlap_exclusive(a, b): 26 | '''Return whether two exclusive ranges overlap''' 27 | return not (a[0] >= b[1] or b[0] >= a[1]) 28 | 29 | 30 | -------------------------------------------------------------------------------- /tools/etnaviv/rnn_domain_visitor.py: -------------------------------------------------------------------------------- 1 | from etnaviv.parse_rng import parse_rng_file, format_path, BitSet, Domain, Stripe, Register, Array, BaseType 2 | 3 | class DomainVisitor(object): 4 | ''' 5 | Walk a rnndb domain, visit all registers recursively. 6 | ''' 7 | def __init__(self): 8 | pass 9 | 10 | def visit(self, node): 11 | if isinstance(node, Domain): 12 | self.visit_domain(node) 13 | elif isinstance(node, Stripe): 14 | self.visit_stripe(node) 15 | elif isinstance(node, Array): 16 | self.visit_array(node) 17 | elif isinstance(node, Register): 18 | self.visit_register(node) 19 | else: 20 | raise ValueError('DomainVisitor: unknown node type %s' % node.__class__.__name__) 21 | 22 | def visit_domain(self, node): 23 | for child in node.contents: 24 | self.visit(child) 25 | 26 | def visit_stripe(self, node): 27 | for child in node.contents: 28 | self.visit(child) 29 | 30 | def visit_register(self, node): 31 | for child in node.contents: 32 | self.visit(child) 33 | 34 | def visit_array(self, node): 35 | for child in node.contents: 36 | self.visit(child) 37 | 38 | -------------------------------------------------------------------------------- /tools/etnaviv/stringutil.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Basic string utilities which have no Python built-in or library function. 3 | ''' 4 | # Copyright (c) 2017 Wladimir J. van der Laan 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a 7 | # copy of this software and associated documentation files (the "Software"), 8 | # to deal in the Software without restriction, including without limitation 9 | # the rights to use, copy, modify, merge, publish, distribute, sub license, 10 | # and/or sell copies of the Software, and to permit persons to whom the 11 | # Software is furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice (including the 14 | # next paragraph) shall be included in all copies or substantial portions 15 | # of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | def strip_prefix(s, prefix): 26 | ''' 27 | Strip a known prefix from a string. 28 | ''' 29 | pl = len(prefix) 30 | assert(s[0:pl] == prefix) 31 | return s[pl:] 32 | 33 | 34 | -------------------------------------------------------------------------------- /tools/etnaviv/textutil.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | COLOR_RE = re.compile('(\x1b\[(?:[0-9]+\;)*[0-9]+m)') 4 | def pad_right(s, length, ch=' '): 5 | '''Pad text with possibly color escape sequences, 6 | will cut off the text if it is longer than the allowed length.''' 7 | y = COLOR_RE.split(s) 8 | ptr,idx,rv = (0,0,[]) 9 | while ptr < length and idx < len(y): 10 | if idx > 0: 11 | rv.append(y[idx-1]) 12 | rv.append(y[idx][0:length - ptr]) 13 | ptr += len(rv[-1]) 14 | idx += 2 15 | rv.append(ch * (length - ptr)) 16 | return ''.join(rv) 17 | 18 | 19 | -------------------------------------------------------------------------------- /tools/etnaviv/util.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Basic utilities. 3 | ''' 4 | # Copyright (c) 2012-2013 Wladimir J. van der Laan 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a 7 | # copy of this software and associated documentation files (the "Software"), 8 | # to deal in the Software without restriction, including without limitation 9 | # the rights to use, copy, modify, merge, publish, distribute, sub license, 10 | # and/or sell copies of the Software, and to permit persons to whom the 11 | # Software is furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice (including the 14 | # next paragraph) shall be included in all copies or substantial portions 15 | # of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | from __future__ import print_function, division, unicode_literals 25 | from os import path 26 | import os,sys 27 | 28 | FILE = path.dirname(sys.modules[__name__].__file__) 29 | BASEPATH = os.path.join(FILE, '../..') 30 | 31 | def rnndb_path(filename): 32 | return path.join(BASEPATH, 'rnndb', filename) 33 | 34 | --------------------------------------------------------------------------------