├── .editorconfig ├── .gitignore ├── .gitlab-ci.yml ├── Android.common.mk ├── Android.mk ├── CONTRIBUTING.rst ├── CleanSpec.mk ├── Makefile.am ├── Makefile.sources ├── README.rst ├── RELEASING ├── amdgpu ├── .editorconfig ├── Android.mk ├── Makefile.am ├── Makefile.sources ├── amdgpu-symbol-check ├── amdgpu.h ├── amdgpu_asic_id.c ├── amdgpu_bo.c ├── amdgpu_cs.c ├── amdgpu_device.c ├── amdgpu_gpu_info.c ├── amdgpu_internal.h ├── amdgpu_vamgr.c ├── amdgpu_vm.c ├── handle_table.c ├── handle_table.h ├── libdrm_amdgpu.pc.in └── meson.build ├── android └── gralloc_handle.h ├── autogen.sh ├── configure.ac ├── data ├── Android.mk ├── Makefile.am ├── amdgpu.ids └── meson.build ├── etnaviv ├── Android.mk ├── Makefile.am ├── Makefile.sources ├── etnaviv-symbol-check ├── etnaviv_bo.c ├── etnaviv_bo_cache.c ├── etnaviv_cmd_stream.c ├── etnaviv_device.c ├── etnaviv_drm.h ├── etnaviv_drmif.h ├── etnaviv_gpu.c ├── etnaviv_perfmon.c ├── etnaviv_pipe.c ├── etnaviv_priv.h ├── libdrm_etnaviv.pc.in └── meson.build ├── exynos ├── Makefile.am ├── exynos-symbol-check ├── exynos_drm.c ├── exynos_drm.h ├── exynos_drmif.h ├── exynos_fimg2d.c ├── exynos_fimg2d.h ├── fimg2d_reg.h ├── libdrm_exynos.pc.in └── meson.build ├── freedreno ├── Android.mk ├── Makefile.am ├── Makefile.sources ├── freedreno-symbol-check ├── freedreno_bo.c ├── freedreno_bo_cache.c ├── freedreno_device.c ├── freedreno_drmif.h ├── freedreno_pipe.c ├── freedreno_priv.h ├── freedreno_ringbuffer.c ├── freedreno_ringbuffer.h ├── kgsl │ ├── README │ ├── kgsl_bo.c │ ├── kgsl_device.c │ ├── kgsl_drm.h │ ├── kgsl_pipe.c │ ├── kgsl_priv.h │ ├── kgsl_ringbuffer.c │ └── msm_kgsl.h ├── libdrm_freedreno.pc.in ├── meson.build └── msm │ ├── msm_bo.c │ ├── msm_device.c │ ├── msm_pipe.c │ ├── msm_priv.h │ └── msm_ringbuffer.c ├── include └── drm │ ├── README │ ├── amdgpu_drm.h │ ├── drm.h │ ├── drm_fourcc.h │ ├── drm_mode.h │ ├── drm_sarea.h │ ├── i915_drm.h │ ├── mach64_drm.h │ ├── mga_drm.h │ ├── msm_drm.h │ ├── nouveau_drm.h │ ├── qxl_drm.h │ ├── r128_drm.h │ ├── radeon_drm.h │ ├── savage_drm.h │ ├── sis_drm.h │ ├── tegra_drm.h │ ├── vc4_drm.h │ ├── via_drm.h │ ├── virtgpu_drm.h │ └── vmwgfx_drm.h ├── intel ├── .gitignore ├── Android.mk ├── Makefile.am ├── Makefile.sources ├── i915_pciids.h ├── intel-symbol-check ├── intel_aub.h ├── intel_bufmgr.c ├── intel_bufmgr.h ├── intel_bufmgr_fake.c ├── intel_bufmgr_gem.c ├── intel_bufmgr_priv.h ├── intel_chipset.c ├── intel_chipset.h ├── intel_debug.h ├── intel_decode.c ├── libdrm_intel.pc.in ├── meson.build ├── mm.c ├── mm.h ├── test_decode.c ├── tests │ ├── .gitignore │ ├── gen4-3d.batch │ ├── gen4-3d.batch-ref.txt │ ├── gen4-3d.batch.sh │ ├── gen5-3d.batch │ ├── gen5-3d.batch-ref.txt │ ├── gen5-3d.batch.sh │ ├── gen6-3d.batch │ ├── gen6-3d.batch-ref.txt │ ├── gen6-3d.batch.sh │ ├── gen7-2d-copy.batch │ ├── gen7-2d-copy.batch-ref.txt │ ├── gen7-2d-copy.batch.sh │ ├── gen7-3d.batch │ ├── gen7-3d.batch-ref.txt │ ├── gen7-3d.batch.sh │ ├── gm45-3d.batch │ ├── gm45-3d.batch-ref.txt │ ├── gm45-3d.batch.sh │ └── test-batch.sh └── uthash.h ├── libdrm.pc.in ├── libdrm_lists.h ├── libdrm_macros.h ├── libkms ├── Android.mk ├── Makefile.am ├── Makefile.sources ├── api.c ├── dumb.c ├── exynos.c ├── intel.c ├── internal.h ├── kms-symbol-check ├── libkms.h ├── libkms.pc.in ├── linux.c ├── meson.build ├── nouveau.c ├── radeon.c └── vmwgfx.c ├── libsync.h ├── m4 └── .gitignore ├── man ├── Makefile.am ├── drm-kms.xml ├── drm-memory.xml ├── drm.xml ├── drmAvailable.xml ├── drmHandleEvent.xml ├── drmModeGetResources.xml └── meson.build ├── meson.build ├── meson_options.txt ├── nouveau ├── Android.mk ├── Makefile.am ├── Makefile.sources ├── abi16.c ├── bufctx.c ├── libdrm_nouveau.pc.in ├── meson.build ├── nouveau-symbol-check ├── nouveau.c ├── nouveau.h ├── nvif │ ├── cl0080.h │ ├── cl9097.h │ ├── class.h │ ├── if0002.h │ ├── if0003.h │ ├── ioctl.h │ └── unpack.h ├── private.h └── pushbuf.c ├── omap ├── Android.mk ├── Makefile.am ├── libdrm_omap.pc.in ├── meson.build ├── omap-symbol-check ├── omap_drm.c ├── omap_drm.h └── omap_drmif.h ├── radeon ├── Android.mk ├── Makefile.am ├── Makefile.sources ├── bof.c ├── bof.h ├── libdrm_radeon.pc.in ├── meson.build ├── r600_pci_ids.h ├── radeon-symbol-check ├── radeon_bo.c ├── radeon_bo.h ├── radeon_bo_gem.c ├── radeon_bo_gem.h ├── radeon_bo_int.h ├── radeon_cs.c ├── radeon_cs.h ├── radeon_cs_gem.c ├── radeon_cs_gem.h ├── radeon_cs_int.h ├── radeon_cs_space.c ├── radeon_surface.c └── radeon_surface.h ├── tegra ├── .gitignore ├── Makefile.am ├── channel.c ├── fence.c ├── job.c ├── libdrm_tegra.pc.in ├── meson.build ├── private.h ├── pushbuf.c ├── tegra-symbol-check ├── tegra.c ├── tegra.h └── tegra_bo_cache.c ├── tests ├── Android.mk ├── Makefile.am ├── amdgpu │ ├── .editorconfig │ ├── Makefile.am │ ├── amdgpu_test.c │ ├── amdgpu_test.h │ ├── basic_tests.c │ ├── bo_tests.c │ ├── cs_tests.c │ ├── deadlock_tests.c │ ├── decode_messages.h │ ├── frame.h │ ├── meson.build │ ├── uvd_enc_tests.c │ ├── uve_ib.h │ ├── vce_ib.h │ ├── vce_tests.c │ ├── vcn_tests.c │ └── vm_tests.c ├── drmdevice.c ├── drmsl.c ├── etnaviv │ ├── Makefile.am │ ├── cmdstream.xml.h │ ├── etnaviv_2d_test.c │ ├── etnaviv_bo_cache_test.c │ ├── etnaviv_cmd_stream_test.c │ ├── meson.build │ ├── state.xml.h │ ├── state_2d.xml.h │ ├── write_bmp.c │ └── write_bmp.h ├── exynos │ ├── Makefile.am │ ├── exynos_fimg2d_event.c │ ├── exynos_fimg2d_perf.c │ ├── exynos_fimg2d_test.c │ └── meson.build ├── hash.c ├── kms │ ├── Makefile.am │ ├── kms-steal-crtc.c │ ├── kms-universal-planes.c │ ├── libkms-test-crtc.c │ ├── libkms-test-device.c │ ├── libkms-test-framebuffer.c │ ├── libkms-test-plane.c │ ├── libkms-test-screen.c │ ├── libkms-test.h │ └── meson.build ├── kmstest │ ├── Makefile.am │ ├── main.c │ └── meson.build ├── meson.build ├── modeprint │ ├── Makefile.am │ ├── meson.build │ └── modeprint.c ├── modetest │ ├── Android.mk │ ├── Makefile.am │ ├── Makefile.sources │ ├── buffers.c │ ├── buffers.h │ ├── cursor.c │ ├── cursor.h │ ├── meson.build │ └── modetest.c ├── nouveau │ ├── .gitignore │ ├── Makefile.am │ ├── meson.build │ └── threaded.c ├── proptest │ ├── Android.mk │ ├── Makefile.am │ ├── Makefile.sources │ ├── meson.build │ └── proptest.c ├── radeon │ ├── Makefile.am │ ├── meson.build │ ├── radeon_ttm.c │ ├── rbo.c │ └── rbo.h ├── random.c ├── tegra │ ├── .gitignore │ ├── Makefile.am │ ├── meson.build │ └── openclose.c ├── ttmtest │ ├── AUTHORS │ ├── ChangeLog │ ├── Makefile.am │ ├── NEWS │ ├── README │ ├── configure.ac │ ├── reconf │ └── src │ │ ├── Makefile.am │ │ ├── ttmtest.c │ │ ├── xf86dri.c │ │ ├── xf86dri.h │ │ └── xf86dristr.h ├── util │ ├── Android.mk │ ├── Makefile.am │ ├── Makefile.sources │ ├── common.h │ ├── format.c │ ├── format.h │ ├── kms.c │ ├── kms.h │ ├── meson.build │ ├── pattern.c │ └── pattern.h └── vbltest │ ├── Makefile.am │ ├── meson.build │ └── vbltest.c ├── util_double_list.h ├── util_math.h ├── vc4 ├── Makefile.am ├── Makefile.sources ├── libdrm_vc4.pc.in ├── meson.build ├── vc4_packet.h └── vc4_qpu_defines.h ├── xf86atomic.h ├── xf86drm.c ├── xf86drm.h ├── xf86drmHash.c ├── xf86drmHash.h ├── xf86drmMode.c ├── xf86drmMode.h ├── xf86drmRandom.c ├── xf86drmRandom.h └── xf86drmSL.c /.editorconfig: -------------------------------------------------------------------------------- 1 | # To use this config with your editor, follow the instructions at: 2 | # http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | insert_final_newline = true 9 | 10 | [*.{c,h}] 11 | indent_style = space 12 | indent_size = 4 13 | 14 | [{Makefile.*,*.mk}] 15 | indent_style = tab 16 | 17 | [*.m4] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | [{meson.build,meson_options.txt}] 22 | indent_style = space 23 | indent_size = 2 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.1 2 | *.3 3 | *.5 4 | *.7 5 | *.flags 6 | *.ko 7 | *.ko.cmd 8 | *.la 9 | *.lo 10 | *.log 11 | *.mod.c 12 | *.mod.o 13 | *.o 14 | *.o.cmd 15 | *.sw? 16 | *.trs 17 | *~ 18 | .*check* 19 | .*install* 20 | .depend 21 | .deps 22 | .libs 23 | .tmp_versions 24 | /_build* 25 | /build* 26 | Makefile 27 | Makefile.in 28 | TAGS 29 | aclocal.m4 30 | autom4te.cache 31 | bsd-core/*/@ 32 | bsd-core/*/machine 33 | build-aux 34 | bus_if.h 35 | compile 36 | config.guess 37 | config.h 38 | config.h.in 39 | config.log 40 | config.status 41 | config.sub 42 | configure 43 | configure.lineno 44 | cscope.* 45 | depcomp 46 | device_if.h 47 | drm.kld 48 | drm_pciids.h 49 | export_syms 50 | i915.kld 51 | install-sh 52 | libdrm.pc 53 | libdrm/config.h.in 54 | libdrm_amdgpu.pc 55 | libdrm_etnaviv.pc 56 | libdrm_exynos.pc 57 | libdrm_freedreno.pc 58 | libdrm_intel.pc 59 | libdrm_nouveau.pc 60 | libdrm_omap.pc 61 | libdrm_radeon.pc 62 | libdrm_vc4.pc 63 | libkms.pc 64 | libtool 65 | ltmain.sh 66 | mach64.kld 67 | man/*.3 68 | man/.man_fixup 69 | mga.kld 70 | missing 71 | mkinstalldirs 72 | opt_drm.h 73 | pci_if.h 74 | r128.kld 75 | radeon.kld 76 | savage.kld 77 | sis.kld 78 | stamp-h1 79 | tdfx.kld 80 | tests/amdgpu/amdgpu_test 81 | tests/auth 82 | tests/dristat 83 | tests/drmdevice 84 | tests/drmsl 85 | tests/drmstat 86 | tests/etnaviv/etnaviv_2d_test 87 | tests/etnaviv/etnaviv_bo_cache_test 88 | tests/etnaviv/etnaviv_cmd_stream_test 89 | tests/exynos/exynos_fimg2d_event 90 | tests/exynos/exynos_fimg2d_perf 91 | tests/exynos/exynos_fimg2d_test 92 | tests/getclient 93 | tests/getstats 94 | tests/getversion 95 | tests/hash 96 | tests/kms/kms-steal-crtc 97 | tests/kms/kms-universal-planes 98 | tests/kmstest/kmstest 99 | tests/lock 100 | tests/modeprint/modeprint 101 | tests/modetest/modetest 102 | tests/name_from_fd 103 | tests/openclose 104 | tests/proptest/proptest 105 | tests/radeon/radeon_ttm 106 | tests/random 107 | tests/setversion 108 | tests/updatedraw 109 | tests/vbltest/vbltest 110 | via.kld 111 | -------------------------------------------------------------------------------- /Android.common.mk: -------------------------------------------------------------------------------- 1 | # XXX: Consider moving these to config.h analogous to autoconf. 2 | LOCAL_CFLAGS += \ 3 | -DMAJOR_IN_SYSMACROS=1 \ 4 | -DHAVE_VISIBILITY=1 \ 5 | -fvisibility=hidden \ 6 | -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 7 | 8 | LOCAL_CFLAGS += \ 9 | -Wno-error \ 10 | -Wno-unused-parameter \ 11 | -Wno-missing-field-initializers \ 12 | -Wno-pointer-arith \ 13 | -Wno-enum-conversion 14 | 15 | # Quiet down the build system and remove any .h files from the sources 16 | LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES)) 17 | LOCAL_EXPORT_C_INCLUDE_DIRS += $(LOCAL_PATH) 18 | 19 | LOCAL_PROPRIETARY_MODULE := true 20 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright © 2011-2012 Intel Corporation 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, sublicense, 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 next 12 | # paragraph) shall be included in all copies or substantial portions of the 13 | # 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 NONINFRINGEMENT. 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 DEALINGS 21 | # IN THE SOFTWARE. 22 | # 23 | 24 | LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk 25 | 26 | LOCAL_PATH := $(call my-dir) 27 | LIBDRM_TOP := $(LOCAL_PATH) 28 | 29 | include $(CLEAR_VARS) 30 | 31 | # Import variables LIBDRM_{,H,INCLUDE_H,INCLUDE_ANDROID_H,INCLUDE_VMWGFX_H}_FILES 32 | include $(LOCAL_PATH)/Makefile.sources 33 | 34 | #static library for the device (recovery) 35 | include $(CLEAR_VARS) 36 | LOCAL_MODULE := libdrm 37 | 38 | LOCAL_SRC_FILES := $(LIBDRM_FILES) 39 | LOCAL_EXPORT_C_INCLUDE_DIRS := \ 40 | $(LOCAL_PATH) \ 41 | $(LOCAL_PATH)/include/drm \ 42 | $(LOCAL_PATH)/android 43 | 44 | LOCAL_C_INCLUDES := \ 45 | $(LOCAL_PATH)/include/drm 46 | 47 | include $(LIBDRM_COMMON_MK) 48 | include $(BUILD_STATIC_LIBRARY) 49 | 50 | # Shared library for the device 51 | include $(CLEAR_VARS) 52 | LOCAL_MODULE := libdrm 53 | 54 | LOCAL_SRC_FILES := $(LIBDRM_FILES) 55 | LOCAL_EXPORT_C_INCLUDE_DIRS := \ 56 | $(LOCAL_PATH) \ 57 | $(LOCAL_PATH)/include/drm \ 58 | $(LOCAL_PATH)/android 59 | 60 | LOCAL_SHARED_LIBRARIES := \ 61 | libcutils 62 | 63 | LOCAL_C_INCLUDES := \ 64 | $(LOCAL_PATH)/include/drm 65 | 66 | include $(LIBDRM_COMMON_MK) 67 | include $(BUILD_SHARED_LIBRARY) 68 | 69 | include $(call all-makefiles-under,$(LOCAL_PATH)) 70 | -------------------------------------------------------------------------------- /CleanSpec.mk: -------------------------------------------------------------------------------- 1 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/include/libdrm) 2 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/include/freedreno) 3 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdrm_*intermediates) 4 | $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libdrm_*intermediates) 5 | -------------------------------------------------------------------------------- /Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBDRM_FILES := \ 2 | xf86drm.c \ 3 | xf86drmHash.c \ 4 | xf86drmHash.h \ 5 | xf86drmRandom.c \ 6 | xf86drmRandom.h \ 7 | xf86drmSL.c \ 8 | xf86drmMode.c \ 9 | xf86atomic.h \ 10 | libdrm_macros.h \ 11 | libdrm_lists.h \ 12 | util_double_list.h \ 13 | util_math.h 14 | 15 | LIBDRM_H_FILES := \ 16 | libsync.h \ 17 | xf86drm.h \ 18 | xf86drmMode.h 19 | 20 | LIBDRM_INCLUDE_H_FILES := \ 21 | include/drm/drm.h \ 22 | include/drm/drm_fourcc.h \ 23 | include/drm/drm_mode.h \ 24 | include/drm/drm_sarea.h \ 25 | include/drm/i915_drm.h \ 26 | include/drm/mach64_drm.h \ 27 | include/drm/mga_drm.h \ 28 | include/drm/msm_drm.h \ 29 | include/drm/nouveau_drm.h \ 30 | include/drm/qxl_drm.h \ 31 | include/drm/r128_drm.h \ 32 | include/drm/radeon_drm.h \ 33 | include/drm/amdgpu_drm.h \ 34 | include/drm/savage_drm.h \ 35 | include/drm/sis_drm.h \ 36 | include/drm/tegra_drm.h \ 37 | include/drm/vc4_drm.h \ 38 | include/drm/via_drm.h \ 39 | include/drm/virtgpu_drm.h 40 | 41 | LIBDRM_INCLUDE_ANDROID_H_FILES := \ 42 | android/gralloc_handle.h 43 | 44 | LIBDRM_INCLUDE_VMWGFX_H_FILES := \ 45 | include/drm/vmwgfx_drm.h 46 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | libdrm - userspace library for drm 2 | ---------------------------------- 3 | 4 | This is libdrm, a userspace library for accessing the DRM, direct rendering 5 | manager, on Linux, BSD and other operating systems that support the ioctl 6 | interface. 7 | The library provides wrapper functions for the ioctls to avoid exposing the 8 | kernel interface directly, and for chipsets with drm memory manager, support 9 | for tracking relocations and buffers. 10 | New functionality in the kernel DRM drivers typically requires a new libdrm, 11 | but a new libdrm will always work with an older kernel. 12 | 13 | libdrm is a low-level library, typically used by graphics drivers such as 14 | the Mesa drivers, the X drivers, libva and similar projects. 15 | 16 | 17 | Compiling 18 | --------- 19 | 20 | libdrm has two build systems, a legacy autotools build system, and a newer 21 | meson build system. The meson build system is much faster, and offers a 22 | slightly different interface, but otherwise provides an equivalent feature set. 23 | 24 | To use it: 25 | 26 | meson builddir/ 27 | 28 | By default this will install into /usr/local, you can change your prefix 29 | with --prefix=/usr (or `meson configure builddir/ -Dprefix=/usr` after 30 | the initial meson setup). 31 | 32 | Then use ninja to build and install: 33 | 34 | ninja -C builddir/ install 35 | 36 | If you are installing into a system location you will need to run install 37 | separately, and as root. 38 | 39 | 40 | Alternatively you can invoke autotools configure: 41 | 42 | ./configure 43 | 44 | By default, libdrm will install into the /usr/local/ prefix. If you 45 | want to install this DRM to replace your system copy, pass 46 | --prefix=/usr and --exec-prefix=/ to configure. If you are building 47 | libdrm from a git checkout, you first need to run the autogen.sh 48 | script. You can pass any options to autogen.sh that you would other 49 | wise pass to configure, or you can just re-run configure with the 50 | options you need once autogen.sh finishes. 51 | 52 | Next step is to build libdrm: 53 | 54 | make 55 | 56 | and once make finishes successfully, install the package using 57 | 58 | make install 59 | 60 | If you are installing into a system location, you will need to be root 61 | to perform the install step. 62 | -------------------------------------------------------------------------------- /RELEASING: -------------------------------------------------------------------------------- 1 | The release criteria for libdrm is essentially "if you need a release, 2 | make one". There is no designated release engineer or maintainer. 3 | Anybody is free to make a release if there's a certain feature or bug 4 | fix they need in a released version of libdrm. 5 | 6 | When new ioctl definitions are merged into drm-next, we will add 7 | support to libdrm, at which point we typically create a new release. 8 | However, this is up to whoever is driving the feature in question. 9 | 10 | Follow these steps to release a new version of libdrm: 11 | 12 | 1) Bump the version number in configure.ac and meson.build. We seem 13 | to have settled for 2.4.x as the versioning scheme for libdrm, so 14 | just bump the micro version. 15 | 16 | 2) Run autoconf and then re-run ./configure so the build system 17 | picks up the new version number. 18 | 19 | 3) Verify that the code passes "make distcheck". Running "make 20 | distcheck" should result in no warnings or errors and end with a 21 | message of the form: 22 | 23 | ============================================= 24 | libdrm-X.Y.Z archives ready for distribution: 25 | libdrm-X.Y.Z.tar.gz 26 | libdrm-X.Y.Z.tar.bz2 27 | ============================================= 28 | 29 | Make sure that the version number reported by distcheck and in 30 | the tarball names matches the number you bumped to in configure.ac. 31 | 32 | 4) Push the updated master branch with the bumped version number: 33 | 34 | git push origin master 35 | 36 | assuming the remote for the upstream libdrm repo is called origin. 37 | 38 | 5) Use the release.sh script from the xorg/util/modular repo to 39 | upload the tarballs to the freedesktop.org download area and 40 | create an announce email template. The script takes one argument: 41 | the path to the libdrm checkout. So, if a checkout of modular is 42 | at the same level than the libdrm repo: 43 | 44 | ./modular/release.sh libdrm 45 | 46 | This copies the two tarballs to freedesktop.org and creates 47 | libdrm-2.4.16.announce which has a detailed summary of the 48 | changes, links to the tarballs, MD5 and SHA1 sums and pre-filled 49 | out email headers. Fill out the blank between the email headers 50 | and the list of changes with a brief message of what changed or 51 | what prompted this release. Send out the email and you're done! 52 | -------------------------------------------------------------------------------- /amdgpu/.editorconfig: -------------------------------------------------------------------------------- 1 | # To use this config with your editor, follow the instructions at: 2 | # http://editorconfig.org 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = tab 7 | indent_size = 8 8 | tab_width = 8 9 | insert_final_newline = true 10 | 11 | [meson.build] 12 | indent_style = space 13 | indent_size = 2 14 | -------------------------------------------------------------------------------- /amdgpu/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # Import variables LIBDRM_AMDGPU_FILES, LIBDRM_AMDGPU_H_FILES 5 | include $(LOCAL_PATH)/Makefile.sources 6 | 7 | LOCAL_MODULE := libdrm_amdgpu 8 | 9 | LOCAL_SHARED_LIBRARIES := libdrm 10 | 11 | LOCAL_SRC_FILES := $(LIBDRM_AMDGPU_FILES) 12 | 13 | LOCAL_CFLAGS := \ 14 | -DAMDGPU_ASIC_ID_TABLE=\"/vendor/etc/hwdata/amdgpu.ids\" 15 | 16 | LOCAL_REQUIRED_MODULES := amdgpu.ids 17 | 18 | include $(LIBDRM_COMMON_MK) 19 | include $(BUILD_SHARED_LIBRARY) 20 | -------------------------------------------------------------------------------- /amdgpu/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright © 2008 Jérôme Glisse 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, sublicense, 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 next 11 | # paragraph) shall be included in all copies or substantial portions of the 12 | # 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 NONINFRINGEMENT. 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 DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | # Authors: 23 | # Jérôme Glisse 24 | 25 | include Makefile.sources 26 | 27 | AM_CFLAGS = \ 28 | $(WARN_CFLAGS) \ 29 | -fvisibility=hidden \ 30 | -I$(top_srcdir) \ 31 | $(PTHREADSTUBS_CFLAGS) \ 32 | -I$(top_srcdir)/include/drm 33 | 34 | libdrmdatadir = @libdrmdatadir@ 35 | AM_CPPFLAGS = -DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\" 36 | 37 | libdrm_amdgpu_la_LTLIBRARIES = libdrm_amdgpu.la 38 | libdrm_amdgpu_ladir = $(libdir) 39 | libdrm_amdgpu_la_LDFLAGS = -version-number 1:0:0 -no-undefined 40 | libdrm_amdgpu_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ 41 | 42 | libdrm_amdgpu_la_SOURCES = $(LIBDRM_AMDGPU_FILES) 43 | amdgpu_asic_id.lo: $(top_srcdir)/data/amdgpu.ids 44 | 45 | libdrm_amdgpuincludedir = ${includedir}/libdrm 46 | libdrm_amdgpuinclude_HEADERS = $(LIBDRM_AMDGPU_H_FILES) 47 | 48 | pkgconfigdir = @pkgconfigdir@ 49 | pkgconfig_DATA = libdrm_amdgpu.pc 50 | 51 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 52 | TESTS = amdgpu-symbol-check 53 | EXTRA_DIST = $(TESTS) 54 | -------------------------------------------------------------------------------- /amdgpu/Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBDRM_AMDGPU_FILES := \ 2 | amdgpu_asic_id.c \ 3 | amdgpu_bo.c \ 4 | amdgpu_cs.c \ 5 | amdgpu_device.c \ 6 | amdgpu_gpu_info.c \ 7 | amdgpu_internal.h \ 8 | amdgpu_vamgr.c \ 9 | amdgpu_vm.c \ 10 | handle_table.c \ 11 | handle_table.h 12 | 13 | LIBDRM_AMDGPU_H_FILES := \ 14 | amdgpu.h 15 | -------------------------------------------------------------------------------- /amdgpu/amdgpu-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first five) are taken from the public headers. 6 | # A list of the latter should be available Makefile.am/libdrm_amdgpuinclude_HEADERS 7 | 8 | FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_amdgpu.so} | awk '{print $3}' | while read func; do 9 | ( grep -q "^$func$" || echo $func ) <fd, DRM_AMDGPU_VM, 37 | &vm, sizeof(vm)); 38 | } 39 | 40 | drm_public int amdgpu_vm_unreserve_vmid(amdgpu_device_handle dev, 41 | uint32_t flags) 42 | { 43 | union drm_amdgpu_vm vm; 44 | 45 | vm.in.op = AMDGPU_VM_OP_UNRESERVE_VMID; 46 | vm.in.flags = flags; 47 | 48 | return drmCommandWriteRead(dev->fd, DRM_AMDGPU_VM, 49 | &vm, sizeof(vm)); 50 | } 51 | -------------------------------------------------------------------------------- /amdgpu/handle_table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Advanced Micro Devices, Inc. 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, sublicense, 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 shall be included in 12 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 | * OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "handle_table.h" 29 | #include "util_math.h" 30 | 31 | drm_private int handle_table_insert(struct handle_table *table, uint32_t key, 32 | void *value) 33 | { 34 | if (key >= table->max_key) { 35 | uint32_t alignment = sysconf(_SC_PAGESIZE) / sizeof(void*); 36 | uint32_t max_key = ALIGN(key + 1, alignment); 37 | void **values; 38 | 39 | values = realloc(table->values, max_key * sizeof(void *)); 40 | if (!values) 41 | return -ENOMEM; 42 | 43 | memset(values + table->max_key, 0, (max_key - table->max_key) * 44 | sizeof(void *)); 45 | 46 | table->max_key = max_key; 47 | table->values = values; 48 | } 49 | table->values[key] = value; 50 | return 0; 51 | } 52 | 53 | drm_private void handle_table_remove(struct handle_table *table, uint32_t key) 54 | { 55 | if (key < table->max_key) 56 | table->values[key] = NULL; 57 | } 58 | 59 | drm_private void *handle_table_lookup(struct handle_table *table, uint32_t key) 60 | { 61 | if (key < table->max_key) 62 | return table->values[key]; 63 | else 64 | return NULL; 65 | } 66 | 67 | drm_private void handle_table_fini(struct handle_table *table) 68 | { 69 | free(table->values); 70 | table->max_key = 0; 71 | table->values = NULL; 72 | } 73 | -------------------------------------------------------------------------------- /amdgpu/handle_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Advanced Micro Devices, Inc. 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, sublicense, 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 shall be included in 12 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 | * OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | #ifndef _HANDLE_TABLE_H_ 25 | #define _HANDLE_TABLE_H_ 26 | 27 | #include 28 | #include "libdrm_macros.h" 29 | 30 | struct handle_table { 31 | uint32_t max_key; 32 | void **values; 33 | }; 34 | 35 | drm_private int handle_table_insert(struct handle_table *table, uint32_t key, 36 | void *value); 37 | drm_private void handle_table_remove(struct handle_table *table, uint32_t key); 38 | drm_private void *handle_table_lookup(struct handle_table *table, uint32_t key); 39 | drm_private void handle_table_fini(struct handle_table *table); 40 | 41 | #endif /* _HANDLE_TABLE_H_ */ 42 | -------------------------------------------------------------------------------- /amdgpu/libdrm_amdgpu.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_amdgpu 7 | Description: Userspace interface to kernel DRM services for amdgpu 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ldrm_amdgpu 10 | Cflags: -I${includedir} -I${includedir}/libdrm 11 | Requires.private: libdrm 12 | -------------------------------------------------------------------------------- /amdgpu/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | 22 | datadir_amdgpu = join_paths(get_option('prefix'), get_option('datadir'), 'libdrm') 23 | 24 | libdrm_amdgpu = shared_library( 25 | 'drm_amdgpu', 26 | [ 27 | files( 28 | 'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c', 29 | 'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'handle_table.c', 30 | ), 31 | config_file, 32 | ], 33 | c_args : [ 34 | libdrm_c_args, 35 | '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(datadir_amdgpu, 'amdgpu.ids')), 36 | ], 37 | include_directories : [inc_root, inc_drm], 38 | link_with : libdrm, 39 | dependencies : [dep_pthread_stubs, dep_atomic_ops], 40 | version : '1.0.0', 41 | install : true, 42 | ) 43 | 44 | install_headers('amdgpu.h', subdir : 'libdrm') 45 | 46 | pkg.generate( 47 | name : 'libdrm_amdgpu', 48 | libraries : libdrm_amdgpu, 49 | subdirs : ['.', 'libdrm'], 50 | version : meson.project_version(), 51 | requires_private : 'libdrm', 52 | description : 'Userspace interface to kernel DRM services for amdgpu', 53 | ) 54 | 55 | ext_libdrm_amdgpu = declare_dependency( 56 | link_with : [libdrm, libdrm_amdgpu], 57 | include_directories : [inc_drm, include_directories('.')], 58 | ) 59 | 60 | test( 61 | 'amdgpu-symbol-check', 62 | prog_bash, 63 | env : env_test, 64 | args : [files('amdgpu-symbol-check'), libdrm_amdgpu] 65 | ) 66 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | srcdir=`dirname "$0"` 4 | test -z "$srcdir" && srcdir=. 5 | 6 | ORIGDIR=`pwd` 7 | cd "$srcdir" 8 | 9 | git config --local --get format.subjectPrefix >/dev/null || 10 | git config --local format.subjectPrefix "PATCH libdrm" 2>/dev/null 11 | 12 | git config --local --get sendemail.to >/dev/null || 13 | git config --local sendemail.to "dri-devel@lists.freedesktop.org" 2>/dev/null 14 | 15 | autoreconf --force --verbose --install || exit 1 16 | cd "$ORIGDIR" || exit $? 17 | 18 | if test -z "$NOCONFIGURE"; then 19 | "$srcdir"/configure "$@" 20 | fi 21 | -------------------------------------------------------------------------------- /data/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := amdgpu.ids 5 | LOCAL_MODULE_TAGS := optional 6 | LOCAL_MODULE_CLASS := ETC 7 | LOCAL_PROPRIETARY_MODULE := true 8 | LOCAL_MODULE_RELATIVE_PATH := hwdata 9 | LOCAL_SRC_FILES := $(LOCAL_MODULE) 10 | include $(BUILD_PREBUILT) 11 | -------------------------------------------------------------------------------- /data/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Advanced Micro Devices, Inc. 2 | # All Rights Reserved. 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 | # on the rights to use, copy, modify, merge, publish, distribute, sub 8 | # license, and/or sell copies of the Software, and to permit persons to whom 9 | # the Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice (including the next 12 | # paragraph) shall be included in all copies or substantial portions of the 13 | # 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 | # ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | libdrmdatadir = @libdrmdatadir@ 23 | if HAVE_AMDGPU 24 | dist_libdrmdata_DATA = amdgpu.ids 25 | endif 26 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | if with_amdgpu 22 | install_data( 23 | 'amdgpu.ids', 24 | install_mode : 'rw-r--r--', 25 | install_dir : datadir_amdgpu, 26 | ) 27 | endif 28 | -------------------------------------------------------------------------------- /etnaviv/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # Import variables LIBDRM_ETNAVIV_FILES, LIBDRM_ETNAVIV_H_FILES 5 | include $(LOCAL_PATH)/Makefile.sources 6 | 7 | LOCAL_MODULE := libdrm_etnaviv 8 | 9 | LOCAL_SHARED_LIBRARIES := libdrm 10 | 11 | LOCAL_SRC_FILES := $(LIBDRM_ETNAVIV_FILES) 12 | 13 | include $(LIBDRM_COMMON_MK) 14 | include $(BUILD_SHARED_LIBRARY) 15 | -------------------------------------------------------------------------------- /etnaviv/Makefile.am: -------------------------------------------------------------------------------- 1 | include Makefile.sources 2 | 3 | AM_CFLAGS = \ 4 | $(WARN_CFLAGS) \ 5 | -fvisibility=hidden \ 6 | -I$(top_srcdir) \ 7 | $(PTHREADSTUBS_CFLAGS) \ 8 | -I$(top_srcdir)/include/drm 9 | 10 | libdrm_etnaviv_ladir = $(libdir) 11 | libdrm_etnaviv_la_LTLIBRARIES = libdrm_etnaviv.la 12 | libdrm_etnaviv_la_LDFLAGS = -version-number 1:0:0 -no-undefined 13 | libdrm_etnaviv_la_LIBADD = \ 14 | ../libdrm.la \ 15 | @PTHREADSTUBS_LIBS@ \ 16 | @CLOCK_LIB@ 17 | 18 | libdrm_etnaviv_la_SOURCES = $(LIBDRM_ETNAVIV_FILES) 19 | 20 | libdrm_etnavivincludedir = ${includedir}/libdrm 21 | libdrm_etnavivinclude_HEADERS = $(LIBDRM_ETNAVIV_H_FILES) 22 | 23 | pkgconfigdir = @pkgconfigdir@ 24 | pkgconfig_DATA = libdrm_etnaviv.pc 25 | 26 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 27 | TESTS = etnaviv-symbol-check 28 | EXTRA_DIST = $(TESTS) 29 | -------------------------------------------------------------------------------- /etnaviv/Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBDRM_ETNAVIV_FILES := \ 2 | etnaviv_device.c \ 3 | etnaviv_gpu.c \ 4 | etnaviv_bo.c \ 5 | etnaviv_bo_cache.c \ 6 | etnaviv_perfmon.c \ 7 | etnaviv_pipe.c \ 8 | etnaviv_cmd_stream.c \ 9 | etnaviv_drm.h \ 10 | etnaviv_priv.h 11 | 12 | LIBDRM_ETNAVIV_H_FILES := \ 13 | etnaviv_drmif.h 14 | -------------------------------------------------------------------------------- /etnaviv/etnaviv-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first five) are taken from the public headers. 6 | # A list of the latter should be available Makefile.sources/LIBDRM_ETNAVIV_H_FILES 7 | 8 | FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_etnaviv.so} | awk '{print $3}'| while read func; do 9 | ( grep -q "^$func$" || echo $func ) < 25 | */ 26 | 27 | #include "etnaviv_priv.h" 28 | 29 | drm_public int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms) 30 | { 31 | return etna_pipe_wait_ns(pipe, timestamp, ms * 1000000); 32 | } 33 | 34 | drm_public int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns) 35 | { 36 | struct etna_device *dev = pipe->gpu->dev; 37 | int ret; 38 | 39 | struct drm_etnaviv_wait_fence req = { 40 | .pipe = pipe->gpu->core, 41 | .fence = timestamp, 42 | }; 43 | 44 | if (ns == 0) 45 | req.flags |= ETNA_WAIT_NONBLOCK; 46 | 47 | get_abs_timeout(&req.timeout, ns); 48 | 49 | ret = drmCommandWrite(dev->fd, DRM_ETNAVIV_WAIT_FENCE, &req, sizeof(req)); 50 | if (ret) { 51 | ERROR_MSG("wait-fence failed! %d (%s)", ret, strerror(errno)); 52 | return ret; 53 | } 54 | 55 | return 0; 56 | } 57 | 58 | drm_public void etna_pipe_del(struct etna_pipe *pipe) 59 | { 60 | free(pipe); 61 | } 62 | 63 | drm_public struct etna_pipe *etna_pipe_new(struct etna_gpu *gpu, enum etna_pipe_id id) 64 | { 65 | struct etna_pipe *pipe; 66 | 67 | pipe = calloc(1, sizeof(*pipe)); 68 | if (!pipe) { 69 | ERROR_MSG("allocation failed"); 70 | goto fail; 71 | } 72 | 73 | pipe->id = id; 74 | pipe->gpu = gpu; 75 | 76 | return pipe; 77 | fail: 78 | return NULL; 79 | } 80 | -------------------------------------------------------------------------------- /etnaviv/libdrm_etnaviv.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_etnaviv 7 | Description: Userspace interface to etnaviv kernel DRM services 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ldrm_etnaviv 10 | Cflags: -I${includedir} -I${includedir}/libdrm 11 | Requires.private: libdrm 12 | -------------------------------------------------------------------------------- /etnaviv/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | 22 | libdrm_etnaviv = shared_library( 23 | 'drm_etnaviv', 24 | [ 25 | files( 26 | 'etnaviv_device.c', 'etnaviv_gpu.c', 'etnaviv_bo.c', 'etnaviv_bo_cache.c', 27 | 'etnaviv_perfmon.c', 'etnaviv_pipe.c', 'etnaviv_cmd_stream.c', 28 | ), 29 | config_file 30 | ], 31 | include_directories : [inc_root, inc_drm], 32 | link_with : libdrm, 33 | c_args : libdrm_c_args, 34 | dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops], 35 | version : '1.0.0', 36 | install : true, 37 | ) 38 | 39 | install_headers('etnaviv_drmif.h', subdir : 'libdrm') 40 | 41 | pkg.generate( 42 | name : 'libdrm_etnaviv', 43 | libraries : libdrm_etnaviv, 44 | subdirs : ['.', 'libdrm'], 45 | version : meson.project_version(), 46 | requires_private : 'libdrm', 47 | description : 'Userspace interface to Tegra kernel DRM services', 48 | ) 49 | 50 | ext_libdrm_etnaviv = declare_dependency( 51 | link_with : [libdrm, libdrm_etnaviv], 52 | include_directories : [inc_drm, include_directories('.')], 53 | ) 54 | 55 | test( 56 | 'etnaviv-symbol-check', 57 | prog_bash, 58 | args : [files('etnaviv-symbol-check'), libdrm_etnaviv] 59 | ) 60 | -------------------------------------------------------------------------------- /exynos/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(WARN_CFLAGS) \ 3 | -fvisibility=hidden \ 4 | -I$(top_srcdir) \ 5 | $(PTHREADSTUBS_CFLAGS) \ 6 | -I$(top_srcdir)/include/drm 7 | 8 | libdrm_exynos_la_LTLIBRARIES = libdrm_exynos.la 9 | libdrm_exynos_ladir = $(libdir) 10 | libdrm_exynos_la_LDFLAGS = -version-number 1:0:0 -no-undefined 11 | libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ 12 | 13 | libdrm_exynos_la_SOURCES = \ 14 | exynos_drm.c \ 15 | exynos_fimg2d.c \ 16 | fimg2d_reg.h 17 | 18 | libdrm_exynoscommonincludedir = ${includedir}/exynos 19 | libdrm_exynoscommoninclude_HEADERS = exynos_drm.h exynos_fimg2d.h 20 | 21 | libdrm_exynosincludedir = ${includedir}/libdrm 22 | libdrm_exynosinclude_HEADERS = exynos_drmif.h 23 | 24 | pkgconfigdir = @pkgconfigdir@ 25 | pkgconfig_DATA = libdrm_exynos.pc 26 | 27 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 28 | TESTS = exynos-symbol-check 29 | EXTRA_DIST = $(TESTS) 30 | -------------------------------------------------------------------------------- /exynos/exynos-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first five) are taken from the public headers. 6 | # A list of the latter should be available Makefile.am/libdrm_exynos*_HEADERS 7 | 8 | FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_exynos.so} | awk '{print $3}'| while read func; do 9 | ( grep -q "^$func$" || echo $func ) <KMS changes). 23 | 24 | So don't look at freedreno as an example of how to write a libdrm 25 | module or a DRM driver.. it is just an attempt to paper over a non- 26 | standard kernel driver architecture. 27 | -------------------------------------------------------------------------------- /freedreno/kgsl/kgsl_device.c: -------------------------------------------------------------------------------- 1 | /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ 2 | 3 | /* 4 | * Copyright (C) 2013 Rob Clark 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, sublicense, 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 next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * 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 NONINFRINGEMENT. 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 FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | * Authors: 26 | * Rob Clark 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include "kgsl_priv.h" 34 | 35 | static void kgsl_device_destroy(struct fd_device *dev) 36 | { 37 | struct kgsl_device *kgsl_dev = to_kgsl_device(dev); 38 | free(kgsl_dev); 39 | } 40 | 41 | static const struct fd_device_funcs funcs = { 42 | .bo_new_handle = kgsl_bo_new_handle, 43 | .bo_from_handle = kgsl_bo_from_handle, 44 | .pipe_new = kgsl_pipe_new, 45 | .destroy = kgsl_device_destroy, 46 | }; 47 | 48 | drm_private struct fd_device * kgsl_device_new(int fd) 49 | { 50 | struct kgsl_device *kgsl_dev; 51 | struct fd_device *dev; 52 | 53 | kgsl_dev = calloc(1, sizeof(*kgsl_dev)); 54 | if (!kgsl_dev) 55 | return NULL; 56 | 57 | dev = &kgsl_dev->base; 58 | dev->funcs = &funcs; 59 | 60 | dev->bo_size = sizeof(struct kgsl_bo); 61 | 62 | return dev; 63 | } 64 | -------------------------------------------------------------------------------- /freedreno/libdrm_freedreno.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_freedreno 7 | Description: Userspace interface to freedreno kernel DRM services 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ldrm_freedreno 10 | Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/freedreno 11 | Requires.private: libdrm 12 | -------------------------------------------------------------------------------- /freedreno/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | files_freedreno = files( 22 | 'freedreno_device.c', 23 | 'freedreno_pipe.c', 24 | 'freedreno_ringbuffer.c', 25 | 'freedreno_bo.c', 26 | 'freedreno_bo_cache.c', 27 | 'msm/msm_bo.c', 28 | 'msm/msm_device.c', 29 | 'msm/msm_pipe.c', 30 | 'msm/msm_ringbuffer.c', 31 | ) 32 | 33 | if with_freedreno_kgsl 34 | files_freedreno += files( 35 | 'kgsl/kgsl_bo.c', 36 | 'kgsl/kgsl_device.c', 37 | 'kgsl/kgsl_pipe.c', 38 | 'kgsl/kgsl_ringbuffer.c', 39 | ) 40 | endif 41 | 42 | libdrm_freedreno = shared_library( 43 | 'drm_freedreno', 44 | [files_freedreno, config_file], 45 | c_args : libdrm_c_args, 46 | include_directories : [inc_root, inc_drm], 47 | dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops], 48 | link_with : libdrm, 49 | version : '1.0.0', 50 | install : true, 51 | ) 52 | 53 | ext_libdrm_freedreno = declare_dependency( 54 | link_with : [libdrm, libdrm_freedreno], 55 | include_directories : [inc_drm, include_directories('.')], 56 | ) 57 | 58 | install_headers( 59 | 'freedreno_drmif.h', 'freedreno_ringbuffer.h', 60 | subdir : 'freedreno' 61 | ) 62 | 63 | pkg.generate( 64 | name : 'libdrm_freedreno', 65 | libraries : libdrm_freedreno, 66 | subdirs : ['.', 'libdrm', 'freedreno'], 67 | version : meson.project_version(), 68 | requires_private : 'libdrm', 69 | description : 'Userspace interface to freedreno kernel DRM services', 70 | ) 71 | 72 | test( 73 | 'freedreno-symbol-check', 74 | prog_bash, 75 | env : env_test, 76 | args : [files('freedreno-symbol-check'), libdrm_freedreno] 77 | ) 78 | -------------------------------------------------------------------------------- /freedreno/msm/msm_device.c: -------------------------------------------------------------------------------- 1 | /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ 2 | 3 | /* 4 | * Copyright (C) 2013 Rob Clark 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, sublicense, 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 next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * 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 NONINFRINGEMENT. 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 FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | * Authors: 26 | * Rob Clark 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include "msm_priv.h" 34 | 35 | static void msm_device_destroy(struct fd_device *dev) 36 | { 37 | struct msm_device *msm_dev = to_msm_device(dev); 38 | free(msm_dev); 39 | } 40 | 41 | static const struct fd_device_funcs funcs = { 42 | .bo_new_handle = msm_bo_new_handle, 43 | .bo_from_handle = msm_bo_from_handle, 44 | .pipe_new = msm_pipe_new, 45 | .destroy = msm_device_destroy, 46 | }; 47 | 48 | drm_private struct fd_device * msm_device_new(int fd) 49 | { 50 | struct msm_device *msm_dev; 51 | struct fd_device *dev; 52 | 53 | msm_dev = calloc(1, sizeof(*msm_dev)); 54 | if (!msm_dev) 55 | return NULL; 56 | 57 | dev = &msm_dev->base; 58 | dev->funcs = &funcs; 59 | 60 | dev->bo_size = sizeof(struct msm_bo); 61 | 62 | return dev; 63 | } 64 | -------------------------------------------------------------------------------- /include/drm/sis_drm.h: -------------------------------------------------------------------------------- 1 | /* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ 2 | /* 3 | * Copyright 2005 Eric Anholt 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 "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 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 next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * 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 NONINFRINGEMENT. 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 FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | */ 26 | 27 | #ifndef __SIS_DRM_H__ 28 | #define __SIS_DRM_H__ 29 | 30 | #include "drm.h" 31 | 32 | #if defined(__cplusplus) 33 | extern "C" { 34 | #endif 35 | 36 | /* SiS specific ioctls */ 37 | #define NOT_USED_0_3 38 | #define DRM_SIS_FB_ALLOC 0x04 39 | #define DRM_SIS_FB_FREE 0x05 40 | #define NOT_USED_6_12 41 | #define DRM_SIS_AGP_INIT 0x13 42 | #define DRM_SIS_AGP_ALLOC 0x14 43 | #define DRM_SIS_AGP_FREE 0x15 44 | #define DRM_SIS_FB_INIT 0x16 45 | 46 | #define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t) 47 | #define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t) 48 | #define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t) 49 | #define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t) 50 | #define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t) 51 | #define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t) 52 | /* 53 | #define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t) 54 | #define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49) 55 | #define DRM_IOCTL_SIS_FLIP_FINAL DRM_IO( 0x50) 56 | */ 57 | 58 | typedef struct { 59 | int context; 60 | unsigned int offset; 61 | unsigned int size; 62 | unsigned long free; 63 | } drm_sis_mem_t; 64 | 65 | typedef struct { 66 | unsigned int offset, size; 67 | } drm_sis_agp_t; 68 | 69 | typedef struct { 70 | unsigned int offset, size; 71 | } drm_sis_fb_t; 72 | 73 | #if defined(__cplusplus) 74 | } 75 | #endif 76 | 77 | #endif /* __SIS_DRM_H__ */ 78 | -------------------------------------------------------------------------------- /intel/.gitignore: -------------------------------------------------------------------------------- 1 | test_decode 2 | -------------------------------------------------------------------------------- /intel/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright © 2011 Intel Corporation 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, sublicense, 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 next 12 | # paragraph) shall be included in all copies or substantial portions of the 13 | # 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 NONINFRINGEMENT. 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 DEALINGS 21 | # IN THE SOFTWARE. 22 | # 23 | 24 | LOCAL_PATH := $(call my-dir) 25 | include $(CLEAR_VARS) 26 | 27 | # Import variables LIBDRM_INTEL_FILES, LIBDRM_INTEL_H_FILES 28 | include $(LOCAL_PATH)/Makefile.sources 29 | 30 | LOCAL_MODULE := libdrm_intel 31 | 32 | LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) 33 | 34 | LOCAL_SHARED_LIBRARIES := \ 35 | libdrm 36 | 37 | include $(LIBDRM_COMMON_MK) 38 | include $(BUILD_SHARED_LIBRARY) 39 | -------------------------------------------------------------------------------- /intel/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright © 2008 Intel Corporation 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, sublicense, 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 next 11 | # paragraph) shall be included in all copies or substantial portions of the 12 | # 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 NONINFRINGEMENT. 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 DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | # Authors: 23 | # Eric Anholt 24 | 25 | include Makefile.sources 26 | 27 | AM_CFLAGS = \ 28 | $(WARN_CFLAGS) \ 29 | -fvisibility=hidden \ 30 | -I$(top_srcdir) \ 31 | $(PTHREADSTUBS_CFLAGS) \ 32 | $(PCIACCESS_CFLAGS) \ 33 | $(VALGRIND_CFLAGS) \ 34 | -I$(top_srcdir)/include/drm 35 | 36 | libdrm_intel_la_LTLIBRARIES = libdrm_intel.la 37 | libdrm_intel_ladir = $(libdir) 38 | libdrm_intel_la_LDFLAGS = -version-number 1:0:0 -no-undefined 39 | libdrm_intel_la_LIBADD = ../libdrm.la \ 40 | @PTHREADSTUBS_LIBS@ \ 41 | @PCIACCESS_LIBS@ \ 42 | @CLOCK_LIB@ 43 | 44 | libdrm_intel_la_SOURCES = $(LIBDRM_INTEL_FILES) 45 | 46 | libdrm_intelincludedir = ${includedir}/libdrm 47 | libdrm_intelinclude_HEADERS = $(LIBDRM_INTEL_H_FILES) 48 | 49 | # This may be interesting even outside of "make check", due to the -dump option. 50 | noinst_PROGRAMS = test_decode 51 | 52 | BATCHES = \ 53 | tests/gen4-3d.batch \ 54 | tests/gm45-3d.batch \ 55 | tests/gen5-3d.batch \ 56 | tests/gen6-3d.batch \ 57 | tests/gen7-2d-copy.batch \ 58 | tests/gen7-3d.batch 59 | 60 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 61 | TESTS = \ 62 | $(BATCHES:.batch=.batch.sh) \ 63 | intel-symbol-check 64 | 65 | EXTRA_DIST = \ 66 | $(BATCHES) \ 67 | $(BATCHES:.batch=.batch.sh) \ 68 | $(BATCHES:.batch=.batch-ref.txt) \ 69 | $(BATCHES:.batch=.batch-ref.txt) \ 70 | tests/test-batch.sh \ 71 | $(TESTS) 72 | 73 | test_decode_LDADD = libdrm_intel.la ../libdrm.la 74 | 75 | pkgconfig_DATA = libdrm_intel.pc 76 | -------------------------------------------------------------------------------- /intel/Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBDRM_INTEL_FILES := \ 2 | i915_pciids.h \ 3 | intel_bufmgr.c \ 4 | intel_bufmgr_priv.h \ 5 | intel_bufmgr_fake.c \ 6 | intel_bufmgr_gem.c \ 7 | intel_decode.c \ 8 | intel_chipset.h \ 9 | intel_chipset.c \ 10 | mm.c \ 11 | mm.h \ 12 | uthash.h 13 | 14 | LIBDRM_INTEL_H_FILES := \ 15 | intel_bufmgr.h \ 16 | intel_aub.h \ 17 | intel_debug.h 18 | -------------------------------------------------------------------------------- /intel/intel_bufmgr_gem.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/intel/intel_bufmgr_gem.c -------------------------------------------------------------------------------- /intel/intel_chipset.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Intel Corporation 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, sublicense, 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 next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 NONINFRINGEMENT. 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 DEALINGS 21 | * IN THE SOFTWARE. 22 | */ 23 | #include "intel_chipset.h" 24 | 25 | #include 26 | #include 27 | 28 | #include "i915_pciids.h" 29 | 30 | #undef INTEL_VGA_DEVICE 31 | #define INTEL_VGA_DEVICE(id, gen) { id, gen } 32 | 33 | static const struct pci_device { 34 | uint16_t device; 35 | uint16_t gen; 36 | } pciids[] = { 37 | /* Keep ids sorted by gen; latest gen first */ 38 | INTEL_ICL_11_IDS(11), 39 | INTEL_CNL_IDS(10), 40 | INTEL_CFL_IDS(9), 41 | INTEL_GLK_IDS(9), 42 | INTEL_KBL_IDS(9), 43 | INTEL_BXT_IDS(9), 44 | INTEL_SKL_IDS(9), 45 | }; 46 | 47 | drm_private bool intel_is_genx(unsigned int devid, int gen) 48 | { 49 | const struct pci_device *p, 50 | *pend = pciids + sizeof(pciids) / sizeof(pciids[0]); 51 | 52 | for (p = pciids; p < pend; p++) { 53 | /* PCI IDs are sorted */ 54 | if (p->gen < gen) 55 | break; 56 | 57 | if (p->device != devid) 58 | continue; 59 | 60 | if (gen == p->gen) 61 | return true; 62 | 63 | break; 64 | } 65 | 66 | return false; 67 | } 68 | 69 | drm_private bool intel_get_genx(unsigned int devid, int *gen) 70 | { 71 | const struct pci_device *p, 72 | *pend = pciids + sizeof(pciids) / sizeof(pciids[0]); 73 | 74 | for (p = pciids; p < pend; p++) { 75 | if (p->device != devid) 76 | continue; 77 | 78 | if (gen) 79 | *gen = p->gen; 80 | 81 | return true; 82 | } 83 | 84 | return false; 85 | } 86 | -------------------------------------------------------------------------------- /intel/intel_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011 Intel Corporation 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, sublicense, 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 next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 NONINFRINGEMENT. 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 DEALINGS 21 | * IN THE SOFTWARE. 22 | * 23 | * Authors: 24 | * Ben Widawsky 25 | * 26 | */ 27 | 28 | #ifndef INTEL_DEBUG_H 29 | #define INTEL_DEBUG_H 30 | 31 | #include 32 | 33 | #define SHADER_DEBUG_SOCKET "/var/run/gen_debug" 34 | #define DEBUG_HANDSHAKE_VERSION 0x3 35 | #define DEBUG_HANDSHAKE_ACK "okay" 36 | 37 | /* First byte must always be the 1 byte version */ 38 | struct intel_debug_handshake { 39 | uint32_t version; 40 | int flink_handle; 41 | uint32_t per_thread_scratch; 42 | } __attribute__((packed)); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /intel/libdrm_intel.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_intel 7 | Description: Userspace interface to intel kernel DRM services 8 | Version: @PACKAGE_VERSION@ 9 | Requires: libdrm 10 | Libs: -L${libdir} -ldrm_intel 11 | Cflags: -I${includedir} -I${includedir}/libdrm 12 | -------------------------------------------------------------------------------- /intel/mm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GLX Hardware Device Driver common code 3 | * Copyright (C) 1999 Wittawat Yamwong 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 shall be included 13 | * in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 19 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 21 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | /** 25 | * Memory manager code. Primarily used by device drivers to manage texture 26 | * heaps, etc. 27 | */ 28 | 29 | #ifndef MM_H 30 | #define MM_H 31 | 32 | #include "libdrm_macros.h" 33 | 34 | struct mem_block { 35 | struct mem_block *next, *prev; 36 | struct mem_block *next_free, *prev_free; 37 | struct mem_block *heap; 38 | int ofs, size; 39 | unsigned int free:1; 40 | unsigned int reserved:1; 41 | }; 42 | 43 | /** 44 | * input: total size in bytes 45 | * return: a heap pointer if OK, NULL if error 46 | */ 47 | drm_private extern struct mem_block *mmInit(int ofs, int size); 48 | 49 | /** 50 | * Allocate 'size' bytes with 2^align2 bytes alignment, 51 | * restrict the search to free memory after 'startSearch' 52 | * depth and back buffers should be in different 4mb banks 53 | * to get better page hits if possible 54 | * input: size = size of block 55 | * align2 = 2^align2 bytes alignment 56 | * startSearch = linear offset from start of heap to begin search 57 | * return: pointer to the allocated block, 0 if error 58 | */ 59 | drm_private extern struct mem_block *mmAllocMem(struct mem_block *heap, 60 | int size, int align2, 61 | int startSearch); 62 | 63 | /** 64 | * Free block starts at offset 65 | * input: pointer to a block 66 | * return: 0 if OK, -1 if error 67 | */ 68 | drm_private extern int mmFreeMem(struct mem_block *b); 69 | 70 | /** 71 | * destroy MM 72 | */ 73 | drm_private extern void mmDestroy(struct mem_block *mmInit); 74 | 75 | /** 76 | * For debuging purpose. 77 | */ 78 | drm_private extern void mmDumpMemInfo(const struct mem_block *mmInit); 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /intel/tests/.gitignore: -------------------------------------------------------------------------------- 1 | *-new.txt 2 | -------------------------------------------------------------------------------- /intel/tests/gen4-3d.batch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/intel/tests/gen4-3d.batch -------------------------------------------------------------------------------- /intel/tests/gen4-3d.batch.sh: -------------------------------------------------------------------------------- 1 | test-batch.sh -------------------------------------------------------------------------------- /intel/tests/gen5-3d.batch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/intel/tests/gen5-3d.batch -------------------------------------------------------------------------------- /intel/tests/gen5-3d.batch.sh: -------------------------------------------------------------------------------- 1 | test-batch.sh -------------------------------------------------------------------------------- /intel/tests/gen6-3d.batch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/intel/tests/gen6-3d.batch -------------------------------------------------------------------------------- /intel/tests/gen6-3d.batch.sh: -------------------------------------------------------------------------------- 1 | test-batch.sh -------------------------------------------------------------------------------- /intel/tests/gen7-2d-copy.batch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/intel/tests/gen7-2d-copy.batch -------------------------------------------------------------------------------- /intel/tests/gen7-2d-copy.batch-ref.txt: -------------------------------------------------------------------------------- 1 | 0x12300000: 0x54f08006: XY_SRC_COPY_BLT (rgb enabled, alpha enabled, src tile 1, dst tile 0) 2 | 0x12300004: 0x03cc0190: format 8888, pitch 400, rop 0xcc, clipping disabled, 3 | 0x12300008: 0x00000000: dst (0,0) 4 | 0x1230000c: 0x00640064: dst (100,100) 5 | 0x12300010: 0x122e9000: dst offset 0x122e9000 6 | 0x12300014: 0x00000000: src (0,0) 7 | 0x12300018: 0x00000080: src pitch 128 8 | 0x1230001c: 0x02ff1000: src offset 0x02ff1000 9 | 0x12300020: 0x13000002: MI_FLUSH_DW post_sync_op='no write' 10 | 0x12300024: 0x00000000: address 11 | 0x12300028: 0x00000000: dword 12 | 0x1230002c: 0x00000000: upper dword 13 | 0x12300030: 0x05000000: MI_BATCH_BUFFER_END 14 | 0x12300034: 0x00000000: 15 | -------------------------------------------------------------------------------- /intel/tests/gen7-2d-copy.batch.sh: -------------------------------------------------------------------------------- 1 | test-batch.sh -------------------------------------------------------------------------------- /intel/tests/gen7-3d.batch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/intel/tests/gen7-3d.batch -------------------------------------------------------------------------------- /intel/tests/gen7-3d.batch.sh: -------------------------------------------------------------------------------- 1 | test-batch.sh -------------------------------------------------------------------------------- /intel/tests/gm45-3d.batch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/intel/tests/gm45-3d.batch -------------------------------------------------------------------------------- /intel/tests/gm45-3d.batch.sh: -------------------------------------------------------------------------------- 1 | test-batch.sh -------------------------------------------------------------------------------- /intel/tests/test-batch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TEST_FILENAME=`echo "$0" | sed 's|.sh||'` 4 | ./test_decode $TEST_FILENAME 5 | 6 | ret=$? 7 | 8 | # pretty-print a diff showing what happened, and leave the dumped 9 | # around for possibly moving over the ref. 10 | if test $ret = 1; then 11 | REF_FILENAME="$TEST_FILENAME-ref.txt" 12 | NEW_FILENAME="$TEST_FILENAME-new.txt" 13 | ./test_decode $TEST_FILENAME -dump > $NEW_FILENAME 14 | if test $? = 0; then 15 | echo "Differences:" 16 | diff -u $REF_FILENAME $NEW_FILENAME 17 | fi 18 | fi 19 | 20 | exit $ret 21 | -------------------------------------------------------------------------------- /libdrm.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm 7 | Description: Userspace interface to kernel DRM services 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ldrm 10 | Cflags: -I${includedir} -I${includedir}/libdrm 11 | -------------------------------------------------------------------------------- /libkms/Android.mk: -------------------------------------------------------------------------------- 1 | DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS))) 2 | 3 | intel_drivers := i915 i965 i915g ilo 4 | radeon_drivers := r300g r600g radeonsi 5 | nouveau_drivers := nouveau 6 | virgl_drivers := virgl 7 | vmwgfx_drivers := vmwgfx 8 | 9 | valid_drivers := \ 10 | $(intel_drivers) \ 11 | $(radeon_drivers) \ 12 | $(nouveau_drivers) \ 13 | $(virgl_drivers) \ 14 | $(vmwgfx_drivers) 15 | 16 | # warn about invalid drivers 17 | invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS)) 18 | ifneq ($(invalid_drivers),) 19 | $(warning invalid GPU drivers: $(invalid_drivers)) 20 | # tidy up 21 | DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS)) 22 | endif 23 | 24 | LOCAL_PATH := $(call my-dir) 25 | 26 | include $(CLEAR_VARS) 27 | include $(LOCAL_PATH)/Makefile.sources 28 | 29 | LOCAL_SRC_FILES := $(LIBKMS_FILES) 30 | 31 | ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),) 32 | LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES) 33 | endif 34 | 35 | ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),) 36 | LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES) 37 | endif 38 | 39 | ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),) 40 | LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES) 41 | endif 42 | 43 | ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),) 44 | LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES) 45 | endif 46 | 47 | LOCAL_MODULE := libkms 48 | LOCAL_SHARED_LIBRARIES := libdrm 49 | 50 | include $(LIBDRM_COMMON_MK) 51 | include $(BUILD_SHARED_LIBRARY) 52 | -------------------------------------------------------------------------------- /libkms/Makefile.am: -------------------------------------------------------------------------------- 1 | include Makefile.sources 2 | 3 | AM_CFLAGS = \ 4 | $(WARN_CFLAGS) \ 5 | -fvisibility=hidden \ 6 | -I$(top_srcdir)/include/drm \ 7 | -I$(top_srcdir) 8 | 9 | libkms_la_LTLIBRARIES = libkms.la 10 | libkms_ladir = $(libdir) 11 | libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined 12 | libkms_la_LIBADD = ../libdrm.la 13 | 14 | libkms_la_SOURCES = $(LIBKMS_FILES) 15 | 16 | if HAVE_VMWGFX 17 | libkms_la_SOURCES += $(LIBKMS_VMWGFX_FILES) 18 | endif 19 | 20 | if HAVE_INTEL 21 | libkms_la_SOURCES += $(LIBKMS_INTEL_FILES) 22 | endif 23 | 24 | if HAVE_NOUVEAU 25 | libkms_la_SOURCES += $(LIBKMS_NOUVEAU_FILES) 26 | endif 27 | 28 | if HAVE_RADEON 29 | libkms_la_SOURCES += $(LIBKMS_RADEON_FILES) 30 | endif 31 | 32 | if HAVE_EXYNOS 33 | libkms_la_SOURCES += $(LIBKMS_EXYNOS_FILES) 34 | AM_CFLAGS += -I$(top_srcdir)/exynos 35 | endif 36 | 37 | libkmsincludedir = ${includedir}/libkms 38 | libkmsinclude_HEADERS = $(LIBKMS_H_FILES) 39 | 40 | pkgconfigdir = @pkgconfigdir@ 41 | pkgconfig_DATA = libkms.pc 42 | 43 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 44 | TESTS = kms-symbol-check 45 | EXTRA_DIST = $(TESTS) 46 | -------------------------------------------------------------------------------- /libkms/Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBKMS_FILES := \ 2 | internal.h \ 3 | linux.c \ 4 | dumb.c \ 5 | api.c 6 | 7 | LIBKMS_VMWGFX_FILES := \ 8 | vmwgfx.c 9 | 10 | LIBKMS_INTEL_FILES := \ 11 | intel.c 12 | 13 | LIBKMS_NOUVEAU_FILES := \ 14 | nouveau.c 15 | 16 | LIBKMS_RADEON_FILES := \ 17 | radeon.c 18 | 19 | LIBKMS_EXYNOS_FILES := \ 20 | exynos.c 21 | 22 | LIBKMS_H_FILES := \ 23 | libkms.h 24 | -------------------------------------------------------------------------------- /libkms/internal.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA 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 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 COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | **************************************************************************/ 27 | 28 | 29 | #ifndef INTERNAL_H_ 30 | #define INTERNAL_H_ 31 | 32 | #include "libdrm_macros.h" 33 | #include "libkms.h" 34 | 35 | struct kms_driver 36 | { 37 | int (*get_prop)(struct kms_driver *kms, const unsigned key, 38 | unsigned *out); 39 | int (*destroy)(struct kms_driver *kms); 40 | 41 | int (*bo_create)(struct kms_driver *kms, 42 | unsigned width, 43 | unsigned height, 44 | enum kms_bo_type type, 45 | const unsigned *attr, 46 | struct kms_bo **out); 47 | int (*bo_get_prop)(struct kms_bo *bo, const unsigned key, 48 | unsigned *out); 49 | int (*bo_map)(struct kms_bo *bo, void **out); 50 | int (*bo_unmap)(struct kms_bo *bo); 51 | int (*bo_destroy)(struct kms_bo *bo); 52 | 53 | int fd; 54 | }; 55 | 56 | struct kms_bo 57 | { 58 | struct kms_driver *kms; 59 | void *ptr; 60 | size_t size; 61 | size_t offset; 62 | size_t pitch; 63 | unsigned handle; 64 | }; 65 | 66 | drm_private int linux_create(int fd, struct kms_driver **out); 67 | 68 | drm_private int vmwgfx_create(int fd, struct kms_driver **out); 69 | 70 | drm_private int intel_create(int fd, struct kms_driver **out); 71 | 72 | drm_private int dumb_create(int fd, struct kms_driver **out); 73 | 74 | drm_private int nouveau_create(int fd, struct kms_driver **out); 75 | 76 | drm_private int radeon_create(int fd, struct kms_driver **out); 77 | 78 | drm_private int exynos_create(int fd, struct kms_driver **out); 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /libkms/kms-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first five) are taken from the public headers. 6 | # A list of the latter should be available Makefile.sources/LIBKMS_H_FILES 7 | 8 | FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libkms.so} | awk '{print $3}'| while read func; do 9 | ( grep -q "^$func$" || echo $func ) < 2 | 4 | 5 | 9 | 10 | 11 | 12 | Direct Rendering Manager 13 | libdrm 14 | September 2012 15 | 16 | 17 | Developer 18 | David 19 | Herrmann 20 | dh.herrmann@googlemail.com 21 | 22 | 23 | 24 | 25 | 26 | drmAvailable 27 | 3 28 | 29 | 30 | 31 | drmAvailable 32 | determine whether a DRM kernel driver has been 33 | loaded 34 | 35 | 36 | 37 | 38 | 39 | #include <xf86drm.h> 40 | 41 | 42 | int drmAvailable 43 | void 44 | 45 | 46 | 47 | 48 | 49 | 50 | Description 51 | drmAvailable allows the caller to determine 52 | whether a kernel DRM driver is loaded. 53 | 54 | 55 | 56 | Return Value 57 | drmAvailable returns 1 if a DRM driver is 58 | currently loaded. Otherwise 0 is returned. 59 | 60 | 61 | 62 | Reporting Bugs 63 | Bugs in this function should be reported to 64 | https://bugs.freedesktop.org/enter_bug.cgi?product=DRI&component=libdrm 65 | under the "DRI" product, component "libdrm" 66 | 67 | 68 | 69 | See Also 70 | 71 | drm7, 72 | drmOpen3 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /man/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | xsltproc_args = [ 22 | '--stringparam', 'man.authors.section.enabled', '0', 23 | '--stringparam', 'man.copyright.section.enabled', '0', 24 | '--stringparam', 'funcsynopsis.style', 'ansi', 25 | '--stringparam', 'man.output.quietly', '1', 26 | '--nonet', manpage_style, 27 | ] 28 | 29 | xmls = [ 30 | ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'], 31 | ['drmHandleEvent', '3'], ['drmModeGetResources', '3'] 32 | ] 33 | foreach x : xmls 34 | m = x[0] 35 | s = x[1] 36 | custom_target( 37 | m, 38 | input : files('@0@.xml'.format(m)), 39 | output : '@0@.@1@'.format(m, s), 40 | command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'], 41 | install : true, 42 | install_dir : join_paths(get_option('mandir'), 'man@0@'.format(s)), 43 | build_by_default : true, 44 | ) 45 | endforeach 46 | 47 | foreach x : ['drm-mm', 'drm-gem', 'drm-ttm'] 48 | gen = custom_target( 49 | 'gen-@0@'.format(x), 50 | input : 'drm-memory.xml', 51 | output : '@0@.xml'.format(x), 52 | command : [ 53 | prog_sed, '-e', 's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@', 54 | '@INPUT@', 55 | ], 56 | capture : true, 57 | ) 58 | custom_target( 59 | '@0@.7'.format(x), 60 | input : gen, 61 | output : '@0@.7'.format(x, '7'), 62 | command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'], 63 | install : true, 64 | install_dir : join_paths(get_option('mandir'), 'man7'), 65 | build_by_default : true, 66 | ) 67 | endforeach 68 | -------------------------------------------------------------------------------- /nouveau/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # Import variables LIBDRM_NOUVEAU_FILES, LIBDRM_NOUVEAU_H_FILES 5 | include $(LOCAL_PATH)/Makefile.sources 6 | 7 | LOCAL_MODULE := libdrm_nouveau 8 | 9 | LOCAL_SHARED_LIBRARIES := libdrm 10 | 11 | LOCAL_SRC_FILES := $(LIBDRM_NOUVEAU_FILES) 12 | 13 | include $(LIBDRM_COMMON_MK) 14 | include $(BUILD_SHARED_LIBRARY) 15 | -------------------------------------------------------------------------------- /nouveau/Makefile.am: -------------------------------------------------------------------------------- 1 | include Makefile.sources 2 | 3 | AM_CFLAGS = \ 4 | $(WARN_CFLAGS) \ 5 | -fvisibility=hidden \ 6 | -I$(top_srcdir) \ 7 | $(PTHREADSTUBS_CFLAGS) \ 8 | -I$(top_srcdir)/include/drm \ 9 | -DDEBUG 10 | 11 | libdrm_nouveau_la_LTLIBRARIES = libdrm_nouveau.la 12 | libdrm_nouveau_ladir = $(libdir) 13 | libdrm_nouveau_la_LDFLAGS = -version-number 2:0:0 -no-undefined 14 | libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ 15 | 16 | libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES) 17 | 18 | libdrm_nouveauincludedir = ${includedir}/libdrm/nouveau 19 | libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES) 20 | 21 | libdrm_nouveaunvifincludedir = ${includedir}/libdrm/nouveau/nvif 22 | libdrm_nouveaunvifinclude_HEADERS = nvif/class.h \ 23 | nvif/cl0080.h \ 24 | nvif/cl9097.h \ 25 | nvif/if0002.h \ 26 | nvif/if0003.h \ 27 | nvif/ioctl.h \ 28 | nvif/unpack.h 29 | 30 | pkgconfigdir = @pkgconfigdir@ 31 | pkgconfig_DATA = libdrm_nouveau.pc 32 | 33 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 34 | TESTS = nouveau-symbol-check 35 | EXTRA_DIST = $(TESTS) 36 | -------------------------------------------------------------------------------- /nouveau/Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBDRM_NOUVEAU_FILES := \ 2 | nouveau.c \ 3 | pushbuf.c \ 4 | bufctx.c \ 5 | abi16.c \ 6 | private.h 7 | 8 | LIBDRM_NOUVEAU_H_FILES := \ 9 | nouveau.h 10 | -------------------------------------------------------------------------------- /nouveau/libdrm_nouveau.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_nouveau 7 | Description: Userspace interface to nouveau kernel DRM services 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ldrm_nouveau 10 | Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/libdrm/nouveau 11 | Requires.private: libdrm 12 | -------------------------------------------------------------------------------- /nouveau/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | 22 | libdrm_nouveau = shared_library( 23 | 'drm_nouveau', 24 | [files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file], 25 | c_args : libdrm_c_args, 26 | include_directories : [inc_root, inc_drm], 27 | link_with : libdrm, 28 | dependencies : [dep_threads, dep_atomic_ops], 29 | version : '2.0.0', 30 | install : true, 31 | ) 32 | 33 | ext_libdrm_nouveau = declare_dependency( 34 | link_with : [libdrm, libdrm_nouveau], 35 | include_directories : [inc_drm, include_directories('.')], 36 | ) 37 | 38 | install_headers('nouveau.h', subdir : 'libdrm/nouveau') 39 | install_headers( 40 | 'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h', 41 | 'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h', 42 | subdir : 'libdrm/nouveau/nvif' 43 | ) 44 | 45 | pkg.generate( 46 | name : 'libdrm_nouveau', 47 | libraries : libdrm_nouveau, 48 | subdirs : ['.', 'libdrm', 'libdrm/nouveau'], 49 | version : meson.project_version(), 50 | requires_private : 'libdrm', 51 | description : 'Userspace interface to nouveau kernel DRM services', 52 | ) 53 | 54 | test( 55 | 'nouveau-symbol-check', 56 | prog_bash, 57 | env : env_test, 58 | args : [files('nouveau-symbol-check'), libdrm_nouveau] 59 | ) 60 | -------------------------------------------------------------------------------- /nouveau/nouveau-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first five) are taken from the public headers. 6 | # A list of the latter should be available Makefile.sources/LIBDRM_NOUVEAU_H_FILES 7 | 8 | FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_nouveau.so} | awk '{print $3}'| while read func; do 9 | ( grep -q "^$func$" || echo $func ) <= sizeof(m) && \ 17 | (m).version >= _vl && (m).version <= _vh) { \ 18 | *_data = (__u8 *)*_data + sizeof(m); \ 19 | *_size = *_size - sizeof(m); \ 20 | if (_ret = 0, !(x)) { \ 21 | _ret = *_size ? -E2BIG : 0; \ 22 | *_data = NULL; \ 23 | *_size = 0; \ 24 | } \ 25 | } \ 26 | _ret; \ 27 | }) 28 | #endif 29 | -------------------------------------------------------------------------------- /omap/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_MODULE := libdrm_omap 5 | LOCAL_VENDOR_MODULE := true 6 | 7 | LOCAL_SRC_FILES := omap_drm.c 8 | 9 | LOCAL_SHARED_LIBRARIES := libdrm 10 | 11 | include $(LIBDRM_COMMON_MK) 12 | 13 | include $(BUILD_SHARED_LIBRARY) 14 | -------------------------------------------------------------------------------- /omap/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(WARN_CFLAGS) \ 3 | -fvisibility=hidden \ 4 | -I$(top_srcdir) \ 5 | $(PTHREADSTUBS_CFLAGS) \ 6 | -I$(top_srcdir)/include/drm 7 | 8 | libdrm_omap_la_LTLIBRARIES = libdrm_omap.la 9 | libdrm_omap_ladir = $(libdir) 10 | libdrm_omap_la_LDFLAGS = -version-number 1:0:0 -no-undefined 11 | libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ 12 | 13 | libdrm_omap_la_SOURCES = omap_drm.c 14 | 15 | libdrm_omapcommonincludedir = ${includedir}/omap 16 | libdrm_omapcommoninclude_HEADERS = omap_drm.h 17 | 18 | libdrm_omapincludedir = ${includedir}/libdrm 19 | libdrm_omapinclude_HEADERS = omap_drmif.h 20 | 21 | pkgconfigdir = @pkgconfigdir@ 22 | pkgconfig_DATA = libdrm_omap.pc 23 | 24 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 25 | TESTS = omap-symbol-check 26 | EXTRA_DIST = $(TESTS) 27 | -------------------------------------------------------------------------------- /omap/libdrm_omap.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_omap 7 | Description: Userspace interface to omap kernel DRM services 8 | Version: 0.6 9 | Libs: -L${libdir} -ldrm_omap 10 | Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/omap 11 | Requires.private: libdrm 12 | -------------------------------------------------------------------------------- /omap/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | libdrm_omap = shared_library( 22 | 'drm_omap', 23 | [files('omap_drm.c'), config_file], 24 | include_directories : [inc_root, inc_drm], 25 | c_args : libdrm_c_args, 26 | link_with : libdrm, 27 | dependencies : [dep_pthread_stubs, dep_atomic_ops], 28 | version : '1.0.0', 29 | install : true, 30 | ) 31 | 32 | ext_libdrm_omap = declare_dependency( 33 | link_with : [libdrm, libdrm_omap], 34 | include_directories : [inc_drm, include_directories('.')], 35 | ) 36 | 37 | install_headers('omap_drmif.h', subdir : 'libdrm') 38 | install_headers('omap_drm.h', subdir : 'omap') 39 | 40 | pkg.generate( 41 | name : 'libdrm_omap', 42 | libraries : libdrm_omap, 43 | subdirs : ['.', 'libdrm', 'omap'], 44 | version : '0.6', 45 | requires_private : 'libdrm', 46 | description : 'Userspace interface to omap kernel DRM services', 47 | ) 48 | 49 | test( 50 | 'omap-symbol-check', 51 | prog_bash, 52 | env : env_test, 53 | args : [files('omap-symbol-check'), libdrm_omap] 54 | ) 55 | -------------------------------------------------------------------------------- /omap/omap-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first five) are taken from the public headers. 6 | # A list of the latter should be available Makefile.am/libdrm_omap*HEADERS 7 | 8 | FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_omap.so} | awk '{print $3}'| while read func; do 9 | ( grep -q "^$func$" || echo $func ) < 25 | */ 26 | 27 | #ifndef OMAP_DRMIF_H_ 28 | #define OMAP_DRMIF_H_ 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | struct omap_bo; 35 | struct omap_device; 36 | 37 | /* device related functions: 38 | */ 39 | 40 | struct omap_device * omap_device_new(int fd); 41 | struct omap_device * omap_device_ref(struct omap_device *dev); 42 | void omap_device_del(struct omap_device *dev); 43 | int omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value); 44 | int omap_set_param(struct omap_device *dev, uint64_t param, uint64_t value); 45 | 46 | /* buffer-object related functions: 47 | */ 48 | 49 | struct omap_bo * omap_bo_new(struct omap_device *dev, 50 | uint32_t size, uint32_t flags); 51 | struct omap_bo * omap_bo_new_tiled(struct omap_device *dev, 52 | uint32_t width, uint32_t height, uint32_t flags); 53 | struct omap_bo * omap_bo_ref(struct omap_bo *bo); 54 | struct omap_bo * omap_bo_from_name(struct omap_device *dev, uint32_t name); 55 | struct omap_bo * omap_bo_from_dmabuf(struct omap_device *dev, int fd); 56 | void omap_bo_del(struct omap_bo *bo); 57 | int omap_bo_get_name(struct omap_bo *bo, uint32_t *name); 58 | uint32_t omap_bo_handle(struct omap_bo *bo); 59 | int omap_bo_dmabuf(struct omap_bo *bo); 60 | uint32_t omap_bo_size(struct omap_bo *bo); 61 | void * omap_bo_map(struct omap_bo *bo); 62 | int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op); 63 | int omap_bo_cpu_fini(struct omap_bo *bo, enum omap_gem_op op); 64 | 65 | #endif /* OMAP_DRMIF_H_ */ 66 | -------------------------------------------------------------------------------- /radeon/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # Import variables LIBDRM_RADEON_FILES, LIBDRM_RADEON_H_FILES 5 | include $(LOCAL_PATH)/Makefile.sources 6 | 7 | LOCAL_MODULE := libdrm_radeon 8 | 9 | LOCAL_SHARED_LIBRARIES := libdrm 10 | 11 | LOCAL_SRC_FILES := $(LIBDRM_RADEON_FILES) 12 | 13 | include $(LIBDRM_COMMON_MK) 14 | include $(BUILD_SHARED_LIBRARY) 15 | -------------------------------------------------------------------------------- /radeon/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright © 2008 Jérôme Glisse 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, sublicense, 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 next 11 | # paragraph) shall be included in all copies or substantial portions of the 12 | # 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 NONINFRINGEMENT. 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 DEALINGS 20 | # IN THE SOFTWARE. 21 | # 22 | # Authors: 23 | # Jérôme Glisse 24 | 25 | include Makefile.sources 26 | 27 | AM_CFLAGS = \ 28 | $(WARN_CFLAGS) \ 29 | -fvisibility=hidden \ 30 | -I$(top_srcdir) \ 31 | $(PTHREADSTUBS_CFLAGS) \ 32 | -I$(top_srcdir)/include/drm 33 | 34 | libdrm_radeon_la_LTLIBRARIES = libdrm_radeon.la 35 | libdrm_radeon_ladir = $(libdir) 36 | libdrm_radeon_la_LDFLAGS = -version-number 1:0:1 -no-undefined 37 | libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ 38 | 39 | libdrm_radeon_la_SOURCES = $(LIBDRM_RADEON_FILES) 40 | 41 | libdrm_radeonincludedir = ${includedir}/libdrm 42 | libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES) 43 | 44 | pkgconfigdir = @pkgconfigdir@ 45 | pkgconfig_DATA = libdrm_radeon.pc 46 | 47 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 48 | TESTS = radeon-symbol-check 49 | EXTRA_DIST = $(LIBDRM_RADEON_BOF_FILES) $(TESTS) 50 | -------------------------------------------------------------------------------- /radeon/Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBDRM_RADEON_FILES := \ 2 | radeon_bo_gem.c \ 3 | radeon_cs_gem.c \ 4 | radeon_cs_space.c \ 5 | radeon_bo.c \ 6 | radeon_cs.c \ 7 | radeon_surface.c 8 | 9 | LIBDRM_RADEON_H_FILES := \ 10 | radeon_bo.h \ 11 | radeon_cs.h \ 12 | radeon_surface.h \ 13 | radeon_bo_gem.h \ 14 | radeon_cs_gem.h \ 15 | radeon_bo_int.h \ 16 | radeon_cs_int.h \ 17 | r600_pci_ids.h 18 | 19 | LIBDRM_RADEON_BOF_FILES := \ 20 | bof.c \ 21 | bof.h 22 | -------------------------------------------------------------------------------- /radeon/libdrm_radeon.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_radeon 7 | Description: Userspace interface to kernel DRM services for radeon 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ldrm_radeon 10 | Cflags: -I${includedir} -I${includedir}/libdrm 11 | Requires.private: libdrm 12 | -------------------------------------------------------------------------------- /radeon/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | 22 | libdrm_radeon = shared_library( 23 | 'drm_radeon', 24 | [ 25 | files( 26 | 'radeon_bo_gem.c', 'radeon_cs_gem.c', 'radeon_cs_space.c', 'radeon_bo.c', 27 | 'radeon_cs.c', 'radeon_surface.c', 28 | ), 29 | config_file, 30 | ], 31 | c_args : libdrm_c_args, 32 | include_directories : [inc_root, inc_drm], 33 | link_with : libdrm, 34 | dependencies : [dep_pthread_stubs, dep_atomic_ops], 35 | version : '1.0.1', 36 | install : true, 37 | ) 38 | 39 | ext_libdrm_radeon = declare_dependency( 40 | link_with : [libdrm, libdrm_radeon], 41 | include_directories : [inc_drm, include_directories('.')], 42 | ) 43 | 44 | install_headers( 45 | 'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h', 46 | 'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h', 47 | subdir : 'libdrm' 48 | ) 49 | 50 | pkg.generate( 51 | name : 'libdrm_radeon', 52 | libraries : libdrm_radeon, 53 | subdirs : ['.', 'libdrm'], 54 | version : meson.project_version(), 55 | requires_private : 'libdrm', 56 | description : 'Userspace interface to kernel DRM services for radeon', 57 | ) 58 | 59 | test( 60 | 'radeon-symbol-check', 61 | prog_bash, 62 | env : env_test, 63 | args : [files('radeon-symbol-check'), libdrm_radeon] 64 | ) 65 | -------------------------------------------------------------------------------- /radeon/radeon-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first five) are taken from the public headers. 6 | # A list of the latter should be available Makefile.sources/LIBDRM_RADEON_H_FILES 7 | 8 | FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_radeon.so} | awk '{print $3}'| while read func; do 9 | ( grep -q "^$func$" || echo $func ) < 29 | */ 30 | #ifndef RADEON_BO_H 31 | #define RADEON_BO_H 32 | 33 | #include 34 | #include 35 | 36 | /* bo object */ 37 | #define RADEON_BO_FLAGS_MACRO_TILE 1 38 | #define RADEON_BO_FLAGS_MICRO_TILE 2 39 | #define RADEON_BO_FLAGS_MICRO_TILE_SQUARE 0x20 40 | 41 | struct radeon_bo_manager; 42 | struct radeon_cs; 43 | 44 | struct radeon_bo { 45 | void *ptr; 46 | uint32_t flags; 47 | uint32_t handle; 48 | uint32_t size; 49 | }; 50 | 51 | struct radeon_bo_manager; 52 | 53 | void radeon_bo_debug(struct radeon_bo *bo, const char *op); 54 | 55 | struct radeon_bo *radeon_bo_open(struct radeon_bo_manager *bom, 56 | uint32_t handle, 57 | uint32_t size, 58 | uint32_t alignment, 59 | uint32_t domains, 60 | uint32_t flags); 61 | 62 | void radeon_bo_ref(struct radeon_bo *bo); 63 | struct radeon_bo *radeon_bo_unref(struct radeon_bo *bo); 64 | int radeon_bo_map(struct radeon_bo *bo, int write); 65 | int radeon_bo_unmap(struct radeon_bo *bo); 66 | int radeon_bo_wait(struct radeon_bo *bo); 67 | int radeon_bo_is_busy(struct radeon_bo *bo, uint32_t *domain); 68 | int radeon_bo_set_tiling(struct radeon_bo *bo, uint32_t tiling_flags, uint32_t pitch); 69 | int radeon_bo_get_tiling(struct radeon_bo *bo, uint32_t *tiling_flags, uint32_t *pitch); 70 | int radeon_bo_is_static(struct radeon_bo *bo); 71 | int radeon_bo_is_referenced_by_cs(struct radeon_bo *bo, struct radeon_cs *cs); 72 | uint32_t radeon_bo_get_handle(struct radeon_bo *bo); 73 | uint32_t radeon_bo_get_src_domain(struct radeon_bo *bo); 74 | #endif 75 | -------------------------------------------------------------------------------- /radeon/radeon_bo_gem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2008 Dave Airlie 3 | * Copyright © 2008 Jérôme Glisse 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a 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, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 16 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS 18 | * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * The above copyright notice and this permission notice (including the 24 | * next paragraph) shall be included in all copies or substantial portions 25 | * of the Software. 26 | */ 27 | /* 28 | * Authors: 29 | * Dave Airlie 30 | * Jérôme Glisse 31 | */ 32 | #ifndef RADEON_BO_GEM_H 33 | #define RADEON_BO_GEM_H 34 | 35 | #include "radeon_bo.h" 36 | 37 | struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd); 38 | void radeon_bo_manager_gem_dtor(struct radeon_bo_manager *bom); 39 | 40 | uint32_t radeon_gem_name_bo(struct radeon_bo *bo); 41 | void *radeon_gem_get_reloc_in_cs(struct radeon_bo *bo); 42 | int radeon_gem_set_domain(struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain); 43 | int radeon_gem_get_kernel_name(struct radeon_bo *bo, uint32_t *name); 44 | int radeon_gem_prime_share_bo(struct radeon_bo *bo, int *handle); 45 | struct radeon_bo *radeon_gem_bo_open_prime(struct radeon_bo_manager *bom, 46 | int fd_handle, 47 | uint32_t size); 48 | #endif 49 | -------------------------------------------------------------------------------- /radeon/radeon_bo_int.h: -------------------------------------------------------------------------------- 1 | #ifndef RADEON_BO_INT 2 | #define RADEON_BO_INT 3 | 4 | struct radeon_bo_manager { 5 | const struct radeon_bo_funcs *funcs; 6 | int fd; 7 | }; 8 | 9 | struct radeon_bo_int { 10 | void *ptr; 11 | uint32_t flags; 12 | uint32_t handle; 13 | uint32_t size; 14 | /* private members */ 15 | uint32_t alignment; 16 | uint32_t domains; 17 | unsigned cref; 18 | struct radeon_bo_manager *bom; 19 | uint32_t space_accounted; 20 | uint32_t referenced_in_cs; 21 | }; 22 | 23 | /* bo functions */ 24 | struct radeon_bo_funcs { 25 | struct radeon_bo *(*bo_open)(struct radeon_bo_manager *bom, 26 | uint32_t handle, 27 | uint32_t size, 28 | uint32_t alignment, 29 | uint32_t domains, 30 | uint32_t flags); 31 | void (*bo_ref)(struct radeon_bo_int *bo); 32 | struct radeon_bo *(*bo_unref)(struct radeon_bo_int *bo); 33 | int (*bo_map)(struct radeon_bo_int *bo, int write); 34 | int (*bo_unmap)(struct radeon_bo_int *bo); 35 | int (*bo_wait)(struct radeon_bo_int *bo); 36 | int (*bo_is_static)(struct radeon_bo_int *bo); 37 | int (*bo_set_tiling)(struct radeon_bo_int *bo, uint32_t tiling_flags, 38 | uint32_t pitch); 39 | int (*bo_get_tiling)(struct radeon_bo_int *bo, uint32_t *tiling_flags, 40 | uint32_t *pitch); 41 | int (*bo_is_busy)(struct radeon_bo_int *bo, uint32_t *domain); 42 | int (*bo_is_referenced_by_cs)(struct radeon_bo_int *bo, struct radeon_cs *cs); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /radeon/radeon_cs_gem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2008 Nicolai Haehnle 3 | * Copyright © 2008 Jérôme Glisse 4 | * All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a 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, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 16 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS 18 | * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21 | * USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * The above copyright notice and this permission notice (including the 24 | * next paragraph) shall be included in all copies or substantial portions 25 | * of the Software. 26 | */ 27 | /* 28 | * Authors: 29 | * Aapo Tahkola 30 | * Nicolai Haehnle 31 | * Jérôme Glisse 32 | */ 33 | #ifndef RADEON_CS_GEM_H 34 | #define RADEON_CS_GEM_H 35 | 36 | #include "radeon_cs.h" 37 | 38 | struct radeon_cs_manager *radeon_cs_manager_gem_ctor(int fd); 39 | void radeon_cs_manager_gem_dtor(struct radeon_cs_manager *csm); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /radeon/radeon_cs_int.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _RADEON_CS_INT_H_ 3 | #define _RADEON_CS_INT_H_ 4 | 5 | struct radeon_cs_space_check { 6 | struct radeon_bo_int *bo; 7 | uint32_t read_domains; 8 | uint32_t write_domain; 9 | uint32_t new_accounted; 10 | }; 11 | 12 | struct radeon_cs_int { 13 | /* keep first two in same place */ 14 | uint32_t *packets; 15 | unsigned cdw; 16 | unsigned ndw; 17 | unsigned section_ndw; 18 | unsigned section_cdw; 19 | /* private members */ 20 | struct radeon_cs_manager *csm; 21 | void *relocs; 22 | unsigned crelocs; 23 | unsigned relocs_total_size; 24 | const char *section_file; 25 | const char *section_func; 26 | int section_line; 27 | struct radeon_cs_space_check bos[MAX_SPACE_BOS]; 28 | int bo_count; 29 | void (*space_flush_fn)(void *); 30 | void *space_flush_data; 31 | uint32_t id; 32 | }; 33 | 34 | /* cs functions */ 35 | struct radeon_cs_funcs { 36 | struct radeon_cs_int *(*cs_create)(struct radeon_cs_manager *csm, 37 | uint32_t ndw); 38 | int (*cs_write_reloc)(struct radeon_cs_int *cs, 39 | struct radeon_bo *bo, 40 | uint32_t read_domain, 41 | uint32_t write_domain, 42 | uint32_t flags); 43 | int (*cs_begin)(struct radeon_cs_int *cs, 44 | uint32_t ndw, 45 | const char *file, 46 | const char *func, 47 | int line); 48 | int (*cs_end)(struct radeon_cs_int *cs, 49 | const char *file, const char *func, 50 | int line); 51 | 52 | 53 | int (*cs_emit)(struct radeon_cs_int *cs); 54 | int (*cs_destroy)(struct radeon_cs_int *cs); 55 | int (*cs_erase)(struct radeon_cs_int *cs); 56 | int (*cs_need_flush)(struct radeon_cs_int *cs); 57 | void (*cs_print)(struct radeon_cs_int *cs, FILE *file); 58 | }; 59 | 60 | struct radeon_cs_manager { 61 | const struct radeon_cs_funcs *funcs; 62 | int fd; 63 | int32_t vram_limit, gart_limit; 64 | int32_t vram_write_used, gart_write_used; 65 | int32_t read_used; 66 | }; 67 | #endif 68 | -------------------------------------------------------------------------------- /tegra/.gitignore: -------------------------------------------------------------------------------- 1 | libdrm_tegra.pc 2 | -------------------------------------------------------------------------------- /tegra/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I$(top_srcdir) \ 3 | -I$(top_srcdir)/include/drm 4 | 5 | AM_CFLAGS = \ 6 | @PTHREADSTUBS_CFLAGS@ \ 7 | $(WARN_CFLAGS) \ 8 | $(VALGRIND_CFLAGS) \ 9 | -fvisibility=hidden 10 | 11 | libdrm_tegra_ladir = $(libdir) 12 | libdrm_tegra_la_LTLIBRARIES = libdrm_tegra.la 13 | libdrm_tegra_la_LDFLAGS = -version-number 0:0:0 -no-undefined 14 | libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ 15 | 16 | libdrm_tegra_la_SOURCES = \ 17 | channel.c \ 18 | fence.c \ 19 | job.c \ 20 | private.h \ 21 | pushbuf.c \ 22 | tegra.c \ 23 | tegra_bo_cache.c 24 | 25 | libdrm_tegraincludedir = ${includedir}/libdrm 26 | libdrm_tegrainclude_HEADERS = tegra.h 27 | 28 | pkgconfigdir = @pkgconfigdir@ 29 | pkgconfig_DATA = libdrm_tegra.pc 30 | 31 | AM_TESTS_ENVIRONMENT = NM='$(NM)' 32 | TESTS = tegra-symbol-check 33 | EXTRA_DIST = $(TESTS) 34 | -------------------------------------------------------------------------------- /tegra/fence.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012, 2013 Thierry Reding 3 | * Copyright © 2013 Erik Faye-Lund 4 | * Copyright © 2014 NVIDIA Corporation 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, sublicense, 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 shall be included in 14 | * all copies or substantial portions of the 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 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 | #ifdef HAVE_CONFIG_H 26 | # include "config.h" 27 | #endif 28 | 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #include "private.h" 35 | 36 | drm_public 37 | int drm_tegra_fence_wait_timeout(struct drm_tegra_fence *fence, 38 | unsigned long timeout) 39 | { 40 | struct drm_tegra_syncpt_wait args; 41 | 42 | if (!fence) 43 | return -EINVAL; 44 | 45 | memset(&args, 0, sizeof(args)); 46 | args.id = fence->syncpt; 47 | args.thresh = fence->value; 48 | args.timeout = timeout; 49 | 50 | return drmCommandWriteRead(fence->drm->fd, DRM_TEGRA_SYNCPT_WAIT, 51 | &args, sizeof(args)); 52 | } 53 | 54 | drm_public 55 | void drm_tegra_fence_free(struct drm_tegra_fence *fence) 56 | { 57 | free(fence); 58 | } 59 | -------------------------------------------------------------------------------- /tegra/libdrm_tegra.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_tegra 7 | Description: Userspace interface to Tegra kernel DRM services 8 | Version: @PACKAGE_VERSION@ 9 | Libs: -L${libdir} -ldrm_tegra 10 | Cflags: -I${includedir} -I${includedir}/libdrm 11 | Requires.private: libdrm 12 | -------------------------------------------------------------------------------- /tegra/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | files_tegra = files( 22 | 'channel.c', 23 | 'fence.c', 24 | 'job.c', 25 | 'private.h', 26 | 'pushbuf.c', 27 | 'tegra_bo_cache.c', 28 | 'tegra.c', 29 | ) 30 | 31 | libdrm_tegra = shared_library( 32 | 'drm_tegra', 33 | [files_tegra, config_file], 34 | include_directories : [inc_root, inc_drm], 35 | link_with : libdrm, 36 | dependencies : [dep_pthread_stubs, dep_atomic_ops, dep_valgrind], 37 | c_args : libdrm_c_args, 38 | version : '0.0.0', 39 | install : true, 40 | ) 41 | 42 | ext_libdrm_tegra = declare_dependency( 43 | link_with : [libdrm, libdrm_tegra], 44 | include_directories : [inc_drm, include_directories('.')], 45 | ) 46 | 47 | install_headers('tegra.h', subdir : 'libdrm') 48 | 49 | pkg.generate( 50 | name : 'libdrm_tegra', 51 | libraries : libdrm_tegra, 52 | subdirs : ['.', 'libdrm'], 53 | version : meson.project_version(), 54 | requires_private : 'libdrm', 55 | description : 'Userspace interface to Tegra kernel DRM services', 56 | ) 57 | 58 | test( 59 | 'tegra-symbol-check', 60 | prog_bash, 61 | env : env_test, 62 | args : [files('tegra-symbol-check'), libdrm_tegra] 63 | ) 64 | -------------------------------------------------------------------------------- /tegra/tegra-symbol-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u 4 | 5 | # The following symbols (past the first nine) are taken from tegra.h. 6 | 7 | FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_tegra.so} | awk '{print $3}'| while read func; do 8 | ( grep -q "^$func$" || echo $func ) < 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 | -------------------------------------------------------------------------------- /tests/exynos/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | -pthread \ 3 | $(WARN_CFLAGS)\ 4 | -fvisibility=hidden \ 5 | -I $(top_srcdir)/include/drm \ 6 | -I $(top_srcdir)/libkms/ \ 7 | -I $(top_srcdir)/exynos \ 8 | -I $(top_srcdir) 9 | 10 | bin_PROGRAMS = 11 | noinst_PROGRAMS = 12 | 13 | if HAVE_LIBKMS 14 | if HAVE_INSTALL_TESTS 15 | bin_PROGRAMS += \ 16 | exynos_fimg2d_test 17 | else 18 | noinst_PROGRAMS += \ 19 | exynos_fimg2d_test 20 | endif 21 | endif 22 | 23 | if HAVE_INSTALL_TESTS 24 | bin_PROGRAMS += \ 25 | exynos_fimg2d_perf \ 26 | exynos_fimg2d_event 27 | else 28 | noinst_PROGRAMS += \ 29 | exynos_fimg2d_perf \ 30 | exynos_fimg2d_event 31 | endif 32 | 33 | exynos_fimg2d_perf_LDADD = \ 34 | $(top_builddir)/libdrm.la \ 35 | $(top_builddir)/exynos/libdrm_exynos.la 36 | 37 | exynos_fimg2d_event_LDADD = \ 38 | $(top_builddir)/libdrm.la \ 39 | $(top_builddir)/exynos/libdrm_exynos.la 40 | 41 | exynos_fimg2d_test_LDADD = \ 42 | $(top_builddir)/libdrm.la \ 43 | $(top_builddir)/libkms/libkms.la \ 44 | $(top_builddir)/exynos/libdrm_exynos.la 45 | 46 | exynos_fimg2d_test_SOURCES = \ 47 | exynos_fimg2d_test.c 48 | 49 | -------------------------------------------------------------------------------- /tests/exynos/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | inc_exynos = include_directories('../../exynos') 22 | 23 | if with_libkms 24 | exynos_fimg2d_test = executable( 25 | 'exynos_fimg2d_test', 26 | files('exynos_fimg2d_test.c'), 27 | c_args : libdrm_c_args, 28 | include_directories : [inc_root, inc_drm, inc_exynos, 29 | include_directories('../../libkms')], 30 | link_with : [libdrm, libkms, libdrm_exynos], 31 | dependencies : dep_threads, 32 | install : with_install_tests, 33 | ) 34 | endif 35 | 36 | exynos_fimg2d_perf = executable( 37 | 'exynos_fimg2d_perf', 38 | files('exynos_fimg2d_perf.c'), 39 | c_args : libdrm_c_args, 40 | include_directories : [inc_root, inc_drm, inc_exynos], 41 | link_with : [libdrm, libdrm_exynos], 42 | dependencies : dep_threads, 43 | install : with_install_tests, 44 | ) 45 | 46 | exynos_fimg2d_event = executable( 47 | 'exynos_fimg2d_event', 48 | files('exynos_fimg2d_event.c'), 49 | c_args : libdrm_c_args, 50 | include_directories : [inc_root, inc_drm, inc_exynos], 51 | link_with : [libdrm, libdrm_exynos], 52 | dependencies : dep_threads, 53 | install : with_install_tests, 54 | ) 55 | -------------------------------------------------------------------------------- /tests/kms/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I$(top_srcdir)/include/drm \ 3 | -I$(top_srcdir)/tests \ 4 | -I$(top_srcdir) 5 | 6 | AM_CFLAGS = \ 7 | $(WARN_CFLAGS) \ 8 | -fvisibility=hidden 9 | 10 | noinst_LTLIBRARIES = libkms-test.la 11 | 12 | libkms_test_la_SOURCES = \ 13 | libkms-test.h \ 14 | libkms-test-crtc.c \ 15 | libkms-test-device.c \ 16 | libkms-test-framebuffer.c \ 17 | libkms-test-plane.c \ 18 | libkms-test-screen.c 19 | 20 | libkms_test_la_LIBADD = \ 21 | $(top_builddir)/libdrm.la 22 | 23 | if HAVE_INSTALL_TESTS 24 | bin_PROGRAMS = \ 25 | kms-steal-crtc \ 26 | kms-universal-planes 27 | else 28 | noinst_PROGRAMS = \ 29 | kms-steal-crtc \ 30 | kms-universal-planes 31 | endif 32 | 33 | kms_steal_crtc_SOURCES = kms-steal-crtc.c 34 | kms_steal_crtc_LDADD = libkms-test.la ../util/libutil.la $(CAIRO_LIBS) 35 | 36 | kms_universal_planes_SOURCES = kms-universal-planes.c 37 | kms_universal_planes_LDADD = libkms-test.la $(CAIRO_LIBS) 38 | -------------------------------------------------------------------------------- /tests/kms/libkms-test-crtc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 NVIDIA Corporation 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, sublicense, 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 next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 NONINFRINGEMENT. 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 DEALINGS 21 | * IN THE SOFTWARE. 22 | */ 23 | 24 | #include "libkms-test.h" 25 | 26 | struct kms_crtc *kms_crtc_create(struct kms_device *device, uint32_t id) 27 | { 28 | struct kms_crtc *crtc; 29 | 30 | crtc = calloc(1, sizeof(*crtc)); 31 | if (!crtc) 32 | return NULL; 33 | 34 | crtc->device = device; 35 | crtc->id = id; 36 | 37 | return crtc; 38 | } 39 | 40 | void kms_crtc_free(struct kms_crtc *crtc) 41 | { 42 | free(crtc); 43 | } 44 | -------------------------------------------------------------------------------- /tests/kms/libkms-test-screen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 NVIDIA Corporation 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, sublicense, 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 next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 NONINFRINGEMENT. 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 DEALINGS 21 | * IN THE SOFTWARE. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | #include "libkms-test.h" 28 | 29 | static void kms_screen_probe(struct kms_screen *screen) 30 | { 31 | struct kms_device *device = screen->device; 32 | drmModeConnector *con; 33 | 34 | con = drmModeGetConnector(device->fd, screen->id); 35 | if (!con) 36 | return; 37 | 38 | screen->type = con->connector_type; 39 | 40 | if (con->connection == DRM_MODE_CONNECTED) 41 | screen->connected = true; 42 | else 43 | screen->connected = false; 44 | 45 | memcpy(&screen->mode, &con->modes[0], sizeof(drmModeModeInfo)); 46 | screen->width = screen->mode.hdisplay; 47 | screen->height = screen->mode.vdisplay; 48 | 49 | drmModeFreeConnector(con); 50 | } 51 | 52 | struct kms_screen *kms_screen_create(struct kms_device *device, uint32_t id) 53 | { 54 | struct kms_screen *screen; 55 | 56 | screen = calloc(1, sizeof(*screen)); 57 | if (!screen) 58 | return NULL; 59 | 60 | screen->device = device; 61 | screen->id = id; 62 | 63 | kms_screen_probe(screen); 64 | 65 | return screen; 66 | } 67 | 68 | void kms_screen_free(struct kms_screen *screen) 69 | { 70 | if (screen) 71 | free(screen->name); 72 | 73 | free(screen); 74 | } 75 | 76 | int kms_screen_set(struct kms_screen *screen, struct kms_crtc *crtc, 77 | struct kms_framebuffer *fb) 78 | { 79 | struct kms_device *device = screen->device; 80 | int err; 81 | 82 | err = drmModeSetCrtc(device->fd, crtc->id, fb->id, 0, 0, &screen->id, 83 | 1, &screen->mode); 84 | if (err < 0) 85 | return -errno; 86 | 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /tests/kms/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | 22 | libkms_test = static_library( 23 | 'kms-test', 24 | files( 25 | 'libkms-test-crtc.c', 'libkms-test-device.c', 'libkms-test-framebuffer.c', 26 | 'libkms-test-plane.c', 'libkms-test-screen.c', 27 | ), 28 | include_directories : [inc_root, inc_tests, inc_drm], 29 | link_with : libdrm, 30 | c_args : libdrm_c_args, 31 | ) 32 | 33 | kms_steal_crtc = executable( 34 | 'kms-steal-crtc', 35 | files('kms-steal-crtc.c'), 36 | dependencies : dep_cairo, 37 | include_directories : [inc_root, inc_tests, inc_drm], 38 | link_with : [libkms_test, libutil], 39 | install : with_install_tests, 40 | ) 41 | 42 | kms_universal_planes = executable( 43 | 'kms-universal-planes', 44 | files('kms-universal-planes.c'), 45 | dependencies : dep_cairo, 46 | include_directories : [inc_root, inc_tests, inc_drm], 47 | link_with : [libkms_test], 48 | install : with_install_tests, 49 | ) 50 | -------------------------------------------------------------------------------- /tests/kmstest/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(WARN_CFLAGS)\ 3 | -fvisibility=hidden \ 4 | -I$(top_srcdir)/include/drm \ 5 | -I$(top_srcdir)/libkms/ \ 6 | -I$(top_srcdir)/tests/ \ 7 | -I$(top_srcdir) 8 | 9 | if HAVE_INSTALL_TESTS 10 | bin_PROGRAMS = \ 11 | kmstest 12 | else 13 | noinst_PROGRAMS = \ 14 | kmstest 15 | endif 16 | 17 | kmstest_SOURCES = \ 18 | main.c 19 | 20 | kmstest_LDADD = \ 21 | $(top_builddir)/tests/util/libutil.la \ 22 | $(top_builddir)/libkms/libkms.la \ 23 | $(top_builddir)/libdrm.la 24 | 25 | run: kmstest 26 | ./kmstest 27 | -------------------------------------------------------------------------------- /tests/kmstest/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | kmstest = executable( 22 | 'kmstest', 23 | files('main.c'), 24 | c_args : libdrm_c_args, 25 | include_directories : [ 26 | inc_root, inc_tests, include_directories('../../libkms'), inc_drm, 27 | ], 28 | link_with : [libutil, libkms, libdrm], 29 | install : with_install_tests, 30 | ) 31 | -------------------------------------------------------------------------------- /tests/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | inc_tests = include_directories('.') 22 | 23 | subdir('util') 24 | subdir('kms') 25 | subdir('modeprint') 26 | subdir('proptest') 27 | subdir('modetest') 28 | subdir('vbltest') 29 | if with_libkms 30 | subdir('kmstest') 31 | endif 32 | if with_radeon 33 | subdir('radeon') 34 | endif 35 | if with_amdgpu 36 | subdir('amdgpu') 37 | endif 38 | if with_exynos 39 | subdir('exynos') 40 | endif 41 | if with_tegra 42 | subdir('tegra') 43 | endif 44 | if with_etnaviv 45 | subdir('etnaviv') 46 | endif 47 | if with_nouveau 48 | subdir('nouveau') 49 | endif 50 | 51 | drmsl = executable( 52 | 'drmsl', 53 | files('drmsl.c'), 54 | include_directories : [inc_root, inc_drm], 55 | link_with : libdrm, 56 | c_args : libdrm_c_args, 57 | ) 58 | 59 | hash = executable( 60 | 'hash', 61 | files('hash.c'), 62 | include_directories : [inc_root, inc_drm], 63 | link_with : libdrm, 64 | c_args : libdrm_c_args, 65 | ) 66 | 67 | random = executable( 68 | 'random', 69 | files('random.c'), 70 | include_directories : [inc_root, inc_drm], 71 | link_with : libdrm, 72 | c_args : libdrm_c_args, 73 | ) 74 | 75 | drmdevice = executable( 76 | 'drmdevice', 77 | files('drmdevice.c'), 78 | include_directories : [inc_root, inc_drm], 79 | link_with : libdrm, 80 | c_args : libdrm_c_args, 81 | ) 82 | 83 | test('random', random, timeout : 240) 84 | test('hash', hash) 85 | test('drmsl', drmsl) 86 | test('drmdevice', drmdevice) 87 | -------------------------------------------------------------------------------- /tests/modeprint/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(WARN_CFLAGS)\ 3 | -fvisibility=hidden \ 4 | -I$(top_srcdir)/include/drm \ 5 | -I$(top_srcdir)/tests \ 6 | -I$(top_srcdir) 7 | 8 | if HAVE_INSTALL_TESTS 9 | bin_PROGRAMS = \ 10 | modeprint 11 | else 12 | noinst_PROGRAMS = \ 13 | modeprint 14 | endif 15 | 16 | modeprint_SOURCES = \ 17 | modeprint.c 18 | modeprint_LDADD = \ 19 | $(top_builddir)/tests/util/libutil.la \ 20 | $(top_builddir)/libdrm.la 21 | -------------------------------------------------------------------------------- /tests/modeprint/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | modeprint = executable( 22 | 'modeprint', 23 | files('modeprint.c'), 24 | c_args : libdrm_c_args, 25 | include_directories : [inc_root, inc_tests, inc_drm], 26 | link_with : [libdrm, libutil], 27 | dependencies : dep_threads, 28 | install : with_install_tests, 29 | ) 30 | -------------------------------------------------------------------------------- /tests/modetest/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | include $(LOCAL_PATH)/Makefile.sources 5 | 6 | LOCAL_SRC_FILES := $(MODETEST_FILES) 7 | 8 | LOCAL_MODULE := modetest 9 | 10 | LOCAL_SHARED_LIBRARIES := libdrm 11 | LOCAL_STATIC_LIBRARIES := libdrm_util 12 | 13 | include $(LIBDRM_COMMON_MK) 14 | include $(BUILD_EXECUTABLE) 15 | -------------------------------------------------------------------------------- /tests/modetest/Makefile.am: -------------------------------------------------------------------------------- 1 | include Makefile.sources 2 | 3 | AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS)) 4 | 5 | AM_CFLAGS += \ 6 | -fvisibility=hidden \ 7 | -pthread \ 8 | -I$(top_srcdir)/include/drm \ 9 | -I$(top_srcdir)/tests \ 10 | -I$(top_srcdir) 11 | 12 | if HAVE_INSTALL_TESTS 13 | bin_PROGRAMS = \ 14 | modetest 15 | else 16 | noinst_PROGRAMS = \ 17 | modetest 18 | endif 19 | 20 | modetest_SOURCES = $(MODETEST_FILES) 21 | 22 | modetest_LDADD = \ 23 | $(top_builddir)/libdrm.la \ 24 | $(top_builddir)/tests/util/libutil.la \ 25 | $(CAIRO_LIBS) 26 | -------------------------------------------------------------------------------- /tests/modetest/Makefile.sources: -------------------------------------------------------------------------------- 1 | MODETEST_FILES := \ 2 | buffers.c \ 3 | buffers.h \ 4 | cursor.c \ 5 | cursor.h \ 6 | modetest.c 7 | -------------------------------------------------------------------------------- /tests/modetest/buffers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DRM based mode setting test program 3 | * Copyright 2008 Tungsten Graphics 4 | * Jakob Bornecrantz 5 | * Copyright 2008 Intel Corporation 6 | * Jesse Barnes 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a 9 | * copy of this software and associated documentation files (the "Software"), 10 | * to deal in the Software without restriction, including without limitation 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 | * and/or sell copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * 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 DEALINGS 24 | * IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef __BUFFERS_H__ 28 | #define __BUFFERS_H__ 29 | 30 | #include "util/pattern.h" 31 | 32 | struct bo; 33 | 34 | struct bo *bo_create(int fd, unsigned int format, 35 | unsigned int width, unsigned int height, 36 | unsigned int handles[4], unsigned int pitches[4], 37 | unsigned int offsets[4], enum util_fill_pattern pattern); 38 | void bo_destroy(struct bo *bo); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tests/modetest/cursor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DRM based mode setting test program 3 | * Copyright (C) 2014 Red Hat 4 | * Author: Rob Clark 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, sublicense, 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 shall be included in 14 | * all copies or substantial portions of the 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 THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 | * IN THE SOFTWARE. 23 | */ 24 | 25 | #ifndef __CURSOR_H__ 26 | #define __CURSOR_H__ 27 | 28 | int cursor_init(int fd, uint32_t bo_handle, uint32_t crtc_id, 29 | uint32_t crtc_w, uint32_t crtc_h, uint32_t w, uint32_t h); 30 | int cursor_start(void); 31 | int cursor_stop(void); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /tests/modetest/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | modetest = executable( 22 | 'modetest', 23 | files('buffers.c', 'cursor.c', 'modetest.c'), 24 | c_args : [libdrm_c_args, '-Wno-pointer-arith'], 25 | include_directories : [inc_root, inc_tests, inc_drm], 26 | dependencies : [dep_threads, dep_cairo], 27 | link_with : [libdrm, libutil], 28 | install : with_install_tests, 29 | ) 30 | -------------------------------------------------------------------------------- /tests/nouveau/.gitignore: -------------------------------------------------------------------------------- 1 | threaded 2 | -------------------------------------------------------------------------------- /tests/nouveau/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | -pthread \ 3 | $(WARN_CFLAGS) \ 4 | -fvisibility=hidden \ 5 | -I$(top_srcdir)/include/drm \ 6 | -I$(top_srcdir)/nouveau \ 7 | -I$(top_srcdir) 8 | 9 | LDADD = \ 10 | ../../nouveau/libdrm_nouveau.la \ 11 | ../../libdrm.la \ 12 | -ldl 13 | 14 | TESTS = threaded 15 | 16 | check_PROGRAMS = $(TESTS) 17 | 18 | -------------------------------------------------------------------------------- /tests/nouveau/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | threaded = executable( 22 | 'threaded', 23 | files('threaded.c'), 24 | dependencies : [dep_dl, dep_threads], 25 | include_directories : [inc_root, inc_drm, include_directories('../../nouveau')], 26 | link_with : [libdrm, libdrm_nouveau], 27 | c_args : libdrm_c_args, 28 | ) 29 | 30 | test('threaded', threaded) 31 | -------------------------------------------------------------------------------- /tests/proptest/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | include $(LOCAL_PATH)/Makefile.sources 5 | 6 | LOCAL_SRC_FILES := $(PROPTEST_FILES) 7 | 8 | LOCAL_MODULE := proptest 9 | 10 | LOCAL_SHARED_LIBRARIES := libdrm 11 | LOCAL_STATIC_LIBRARIES := libdrm_util 12 | 13 | include $(LIBDRM_COMMON_MK) 14 | include $(BUILD_EXECUTABLE) 15 | -------------------------------------------------------------------------------- /tests/proptest/Makefile.am: -------------------------------------------------------------------------------- 1 | include Makefile.sources 2 | 3 | AM_CFLAGS = \ 4 | $(WARN_CFLAGS)\ 5 | -fvisibility=hidden \ 6 | -I$(top_srcdir)/include/drm \ 7 | -I$(top_srcdir)/tests \ 8 | -I$(top_srcdir) 9 | 10 | if HAVE_INSTALL_TESTS 11 | bin_PROGRAMS = \ 12 | proptest 13 | else 14 | noinst_PROGRAMS = \ 15 | proptest 16 | endif 17 | 18 | proptest_SOURCES = $(PROPTEST_FILES) 19 | 20 | proptest_LDADD = \ 21 | $(top_builddir)/libdrm.la \ 22 | $(top_builddir)/tests/util/libutil.la 23 | -------------------------------------------------------------------------------- /tests/proptest/Makefile.sources: -------------------------------------------------------------------------------- 1 | PROPTEST_FILES := \ 2 | proptest.c 3 | -------------------------------------------------------------------------------- /tests/proptest/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | proptest = executable( 22 | 'proptest', 23 | files('proptest.c'), 24 | c_args : libdrm_c_args, 25 | include_directories : [inc_root, inc_tests, inc_drm], 26 | link_with : [libdrm, libutil], 27 | install : with_install_tests, 28 | ) 29 | -------------------------------------------------------------------------------- /tests/radeon/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(WARN_CFLAGS)\ 3 | -fvisibility=hidden \ 4 | -I $(top_srcdir)/include/drm \ 5 | -I $(top_srcdir) 6 | 7 | LDADD = $(top_builddir)/libdrm.la 8 | 9 | noinst_PROGRAMS = \ 10 | radeon_ttm 11 | 12 | radeon_ttm_SOURCES = \ 13 | rbo.c \ 14 | rbo.h \ 15 | radeon_ttm.c 16 | -------------------------------------------------------------------------------- /tests/radeon/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | radeon_ttm = executable( 22 | 'radeon_ttm', 23 | files('rbo.c', 'radeon_ttm.c'), 24 | include_directories : [inc_root, inc_drm], 25 | link_with : libdrm, 26 | c_args : libdrm_c_args, 27 | ) 28 | -------------------------------------------------------------------------------- /tests/radeon/radeon_ttm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011 Red Hat 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, sublicense, 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 next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 NONINFRINGEMENT. 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 DEALINGS 21 | * IN THE SOFTWARE. 22 | * 23 | * Authors: 24 | * Jerome Glisse 25 | */ 26 | #include 27 | #include 28 | #include 29 | #include "rbo.h" 30 | #include "xf86drm.h" 31 | 32 | /* allocate as many single page bo to try to starve the kernel 33 | * memory zone (below highmem) 34 | */ 35 | static void ttm_starve_kernel_private_memory(int fd) 36 | { 37 | struct list_head list; 38 | struct rbo *bo, *tmp; 39 | unsigned nbo = 0; 40 | 41 | printf("\n[%s]\n", __func__); 42 | list_inithead(&list); 43 | while (1) { 44 | bo = rbo(fd, 0, 4096, 0, NULL); 45 | if (bo == NULL) { 46 | printf("failing after %d bo\n", nbo); 47 | break; 48 | } 49 | nbo++; 50 | list_add(&bo->list, &list); 51 | } 52 | LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &list, list) { 53 | list_del(&bo->list); 54 | rbo_decref(bo); 55 | } 56 | } 57 | 58 | static int radeon_open_fd(void) 59 | { 60 | return drmOpen("radeon", NULL); 61 | } 62 | 63 | int main(void) 64 | { 65 | int radeonfd; 66 | 67 | radeonfd = radeon_open_fd(); 68 | if (radeonfd < 0) { 69 | fprintf(stderr, "failed to open radeon fd\n"); 70 | return -1; 71 | } 72 | 73 | ttm_starve_kernel_private_memory(radeonfd); 74 | 75 | close(radeonfd); 76 | return 0; 77 | } 78 | -------------------------------------------------------------------------------- /tests/radeon/rbo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2011 Red Hat 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, sublicense, 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 next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * 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 NONINFRINGEMENT. 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 DEALINGS 21 | * IN THE SOFTWARE. 22 | * 23 | * Authors: 24 | * Jerome Glisse 25 | */ 26 | #ifndef RBO_H 27 | #define RBO_H 28 | 29 | #include "util_double_list.h" 30 | 31 | struct rbo { 32 | struct list_head list; 33 | int fd; 34 | unsigned refcount; 35 | unsigned mapcount; 36 | unsigned handle; 37 | unsigned size; 38 | unsigned alignment; 39 | void *data; 40 | }; 41 | 42 | struct rbo *rbo(int fd, unsigned handle, unsigned size, 43 | unsigned alignment, void *ptr); 44 | int rbo_map(struct rbo *bo); 45 | void rbo_unmap(struct rbo *bo); 46 | struct rbo *rbo_incref(struct rbo *bo); 47 | struct rbo *rbo_decref(struct rbo *bo); 48 | int rbo_wait(struct rbo *bo); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /tests/tegra/.gitignore: -------------------------------------------------------------------------------- 1 | openclose 2 | -------------------------------------------------------------------------------- /tests/tegra/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I$(top_srcdir)/include/drm \ 3 | -I$(top_srcdir)/tegra \ 4 | -I$(top_srcdir) 5 | 6 | AM_CFLAGS = \ 7 | $(WARN_CFLAGS) \ 8 | -fvisibility=hidden 9 | 10 | LDADD = \ 11 | ../../tegra/libdrm_tegra.la \ 12 | ../../libdrm.la 13 | 14 | noinst_PROGRAMS = \ 15 | openclose 16 | -------------------------------------------------------------------------------- /tests/tegra/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | openclose = executable( 22 | 'openclose', 23 | files('openclose.c'), 24 | include_directories : [inc_root, inc_drm, include_directories('../../tegra')], 25 | c_args : libdrm_c_args, 26 | link_with : [libdrm, libdrm_tegra], 27 | ) 28 | -------------------------------------------------------------------------------- /tests/tegra/openclose.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 NVIDIA Corporation 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, sublicense, 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 shall be included in 12 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 | * OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include "xf86drm.h" 28 | #include "tegra.h" 29 | 30 | static const char default_device[] = "/dev/dri/card0"; 31 | 32 | int main(int argc, char *argv[]) 33 | { 34 | struct drm_tegra *tegra; 35 | drmVersionPtr version; 36 | const char *device; 37 | int err, fd; 38 | 39 | if (argc < 2) 40 | device = default_device; 41 | else 42 | device = argv[1]; 43 | 44 | fd = open(device, O_RDWR); 45 | if (fd < 0) 46 | return 1; 47 | 48 | version = drmGetVersion(fd); 49 | if (version) { 50 | printf("Version: %d.%d.%d\n", version->version_major, 51 | version->version_minor, version->version_patchlevel); 52 | printf(" Name: %s\n", version->name); 53 | printf(" Date: %s\n", version->date); 54 | printf(" Description: %s\n", version->desc); 55 | 56 | drmFreeVersion(version); 57 | } 58 | 59 | err = drm_tegra_new(&tegra, fd); 60 | if (err < 0) 61 | return 1; 62 | 63 | drm_tegra_close(tegra); 64 | close(fd); 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /tests/ttmtest/AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/tests/ttmtest/AUTHORS -------------------------------------------------------------------------------- /tests/ttmtest/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/tests/ttmtest/ChangeLog -------------------------------------------------------------------------------- /tests/ttmtest/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /tests/ttmtest/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/tests/ttmtest/NEWS -------------------------------------------------------------------------------- /tests/ttmtest/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/tests/ttmtest/README -------------------------------------------------------------------------------- /tests/ttmtest/configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT 2 | AC_PROG_CC 3 | AC_PATH_X 4 | if test "x$no_x" != "xyes"; then 5 | savecpp="$CPPFLAGS" 6 | CPPFLAGS="$CPPFLAGS -I$x_includes" 7 | AC_CHECK_HEADER($x_includes/X11/Xlib.h,,\ 8 | [AC_MSG_ERROR(Could not find X installation.)]) 9 | CPPFLAGS="$savecpp" 10 | MDRIINC="-I$x_includes" 11 | LIBS="-L$x_libraries $LIBS" 12 | else 13 | AC_MSG_ERROR(Could not find X installation. Aborting.) 14 | fi 15 | AC_ARG_WITH(libdrm, 16 | AC_HELP_STRING([--with-libdrm=DIR], 17 | [Installation prefix of libdrm [[default=/usr]]]), 18 | [libdrmpref="$withval"], 19 | [libdrmpref="/usr"]) 20 | savecpp="$CPPFLAGS" 21 | MDRIINC="-I$libdrmpref/include -I$libdrmpref/include/drm -I$x_includes" 22 | CPPFLAGS="$CPPFLAGS $MDRIINC" 23 | AC_CHECK_HEADER(xf86drm.h,,\ 24 | [AC_MSG_ERROR(Could not find libdrm installation. Use --with-libdrm=)]) 25 | AC_CHECK_HEADER(drm.h,,\ 26 | [AC_MSG_ERROR(Could not find libdrm installation. Use --with-libdrm=)]) 27 | CPPFLAGS="$savecpp" 28 | LIBS="-L$libdrmpref/lib64 -L$libdrmpref/lib $LIBS" 29 | AC_SUBST(MDRIINC) 30 | AC_SYS_LARGEFILE 31 | AM_INIT_AUTOMAKE(minidri,0.1.0) 32 | AM_CONFIG_HEADER(config.h) 33 | AC_OUTPUT([Makefile src/Makefile]) 34 | -------------------------------------------------------------------------------- /tests/ttmtest/reconf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | autoreconf -v --install || exit 1 -------------------------------------------------------------------------------- /tests/ttmtest/src/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = @MDRIINC@ 2 | bin_PROGRAMS = ttmtest 3 | ttmtest_SOURCES = \ 4 | ttmtest.c \ 5 | xf86dri.c \ 6 | xf86dri.h \ 7 | xf86dristr.h 8 | ttmtest_LDADD = -ldrm -lXext -lX11 9 | -------------------------------------------------------------------------------- /tests/ttmtest/src/ttmtest.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grate-driver/libdrm/3e3c53ed85c30331a6c0ba2af349223654caa5dd/tests/ttmtest/src/ttmtest.c -------------------------------------------------------------------------------- /tests/util/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright © 2015 NVIDIA Corporation 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, sublicense, 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 next 12 | # paragraph) shall be included in all copies or substantial portions of the 13 | # 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 NONINFRINGEMENT. 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 DEALINGS 21 | # IN THE SOFTWARE. 22 | # 23 | 24 | LOCAL_PATH := $(call my-dir) 25 | 26 | include $(CLEAR_VARS) 27 | include $(LOCAL_PATH)/Makefile.sources 28 | 29 | LOCAL_MODULE := libdrm_util 30 | 31 | LOCAL_SHARED_LIBRARIES := libdrm 32 | 33 | LOCAL_SRC_FILES := $(UTIL_FILES) 34 | 35 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LIBDRM_TOP)/tests 36 | 37 | include $(LIBDRM_COMMON_MK) 38 | include $(BUILD_STATIC_LIBRARY) 39 | -------------------------------------------------------------------------------- /tests/util/Makefile.am: -------------------------------------------------------------------------------- 1 | include Makefile.sources 2 | 3 | noinst_LTLIBRARIES = \ 4 | libutil.la 5 | 6 | libutil_la_CPPFLAGS = \ 7 | -I$(top_srcdir)/include/drm \ 8 | -I$(top_srcdir) 9 | 10 | libutil_la_CFLAGS = \ 11 | $(CAIRO_CFLAGS) 12 | 13 | libutil_la_SOURCES = $(UTIL_FILES) 14 | -------------------------------------------------------------------------------- /tests/util/Makefile.sources: -------------------------------------------------------------------------------- 1 | UTIL_FILES := \ 2 | common.h \ 3 | format.c \ 4 | format.h \ 5 | kms.c \ 6 | kms.h \ 7 | pattern.c \ 8 | pattern.h 9 | -------------------------------------------------------------------------------- /tests/util/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Tungsten Graphics 3 | * Jakob Bornecrantz 4 | * Copyright 2008 Intel Corporation 5 | * Jesse Barnes 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, sublicense, 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 shall be included in 15 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * 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 DEALINGS 23 | * IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef UTIL_COMMON_H 27 | #define UTIL_COMMON_H 28 | 29 | #ifndef ARRAY_SIZE 30 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 31 | #endif 32 | 33 | #endif /* UTIL_COMMON_H */ 34 | -------------------------------------------------------------------------------- /tests/util/format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Tungsten Graphics 3 | * Jakob Bornecrantz 4 | * Copyright 2008 Intel Corporation 5 | * Jesse Barnes 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, sublicense, 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 shall be included in 15 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * 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 DEALINGS 23 | * IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef UTIL_FORMAT_H 27 | #define UTIL_FORMAT_H 28 | 29 | struct util_color_component { 30 | unsigned int length; 31 | unsigned int offset; 32 | }; 33 | 34 | struct util_rgb_info { 35 | struct util_color_component red; 36 | struct util_color_component green; 37 | struct util_color_component blue; 38 | struct util_color_component alpha; 39 | }; 40 | 41 | enum util_yuv_order { 42 | YUV_YCbCr = 1, 43 | YUV_YCrCb = 2, 44 | YUV_YC = 4, 45 | YUV_CY = 8, 46 | }; 47 | 48 | struct util_yuv_info { 49 | enum util_yuv_order order; 50 | unsigned int xsub; 51 | unsigned int ysub; 52 | unsigned int chroma_stride; 53 | }; 54 | 55 | struct util_format_info { 56 | uint32_t format; 57 | const char *name; 58 | const struct util_rgb_info rgb; 59 | const struct util_yuv_info yuv; 60 | }; 61 | 62 | uint32_t util_format_fourcc(const char *name); 63 | const struct util_format_info *util_format_info_find(uint32_t format); 64 | 65 | #endif /* UTIL_FORMAT_H */ 66 | -------------------------------------------------------------------------------- /tests/util/kms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Tungsten Graphics 3 | * Jakob Bornecrantz 4 | * Copyright 2008 Intel Corporation 5 | * Jesse Barnes 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, sublicense, 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 shall be included in 15 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * 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 DEALINGS 23 | * IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef UTIL_KMS_H 27 | #define UTIL_KMS_H 28 | 29 | const char *util_lookup_encoder_type_name(unsigned int type); 30 | const char *util_lookup_connector_status_name(unsigned int type); 31 | const char *util_lookup_connector_type_name(unsigned int type); 32 | 33 | int util_open(const char *device, const char *module); 34 | 35 | #endif /* UTIL_KMS_H */ 36 | -------------------------------------------------------------------------------- /tests/util/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | 22 | libutil = static_library( 23 | 'util', 24 | [files('format.c', 'kms.c', 'pattern.c'), config_file], 25 | include_directories : [inc_root, inc_drm], 26 | link_with : libdrm, 27 | dependencies : dep_cairo 28 | ) 29 | -------------------------------------------------------------------------------- /tests/util/pattern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Tungsten Graphics 3 | * Jakob Bornecrantz 4 | * Copyright 2008 Intel Corporation 5 | * Jesse Barnes 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, sublicense, 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 shall be included in 15 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * 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 DEALINGS 23 | * IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef UTIL_PATTERN_H 27 | #define UTIL_PATTERN_H 28 | 29 | enum util_fill_pattern { 30 | UTIL_PATTERN_TILES, 31 | UTIL_PATTERN_PLAIN, 32 | UTIL_PATTERN_SMPTE, 33 | }; 34 | 35 | void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern, 36 | void *planes[3], unsigned int width, 37 | unsigned int height, unsigned int stride); 38 | 39 | #endif /* UTIL_PATTERN_H */ 40 | -------------------------------------------------------------------------------- /tests/vbltest/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = \ 2 | $(WARN_CFLAGS)\ 3 | -fvisibility=hidden \ 4 | -I$(top_srcdir)/include/drm \ 5 | -I$(top_srcdir)/tests \ 6 | -I$(top_srcdir) 7 | 8 | if HAVE_INSTALL_TESTS 9 | bin_PROGRAMS = \ 10 | vbltest 11 | else 12 | noinst_PROGRAMS = \ 13 | vbltest 14 | endif 15 | 16 | vbltest_SOURCES = \ 17 | vbltest.c 18 | vbltest_LDADD = \ 19 | $(top_builddir)/libdrm.la \ 20 | $(top_builddir)/tests/util/libutil.la 21 | -------------------------------------------------------------------------------- /tests/vbltest/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017-2018 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | vbltest = executable( 22 | 'vbltest', 23 | files('vbltest.c'), 24 | c_args : libdrm_c_args, 25 | include_directories : [inc_root, inc_tests, inc_drm], 26 | link_with : [libdrm, libutil], 27 | install : with_install_tests, 28 | ) 29 | -------------------------------------------------------------------------------- /util_math.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Advanced Micro Devices, Inc. 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, sublicense, 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 shall be included in 12 | * all copies or substantial portions 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 NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 | * OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | #ifndef _UTIL_MATH_H_ 25 | #define _UTIL_MATH_H_ 26 | 27 | #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) 28 | #define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) 29 | #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C)) 30 | 31 | #define __align_mask(value, mask) (((value) + (mask)) & ~(mask)) 32 | #define ALIGN(value, alignment) __align_mask(value, (__typeof__(value))((alignment) - 1)) 33 | 34 | #endif /*_UTIL_MATH_H_*/ 35 | -------------------------------------------------------------------------------- /vc4/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright © 2016 Broadcom 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, sublicense, 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 next 11 | # paragraph) shall be included in all copies or substantial portions of the 12 | # 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 NONINFRINGEMENT. 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 DEALINGS 20 | # IN THE SOFTWARE. 21 | 22 | include Makefile.sources 23 | 24 | AM_CFLAGS = \ 25 | $(WARN_CFLAGS) \ 26 | -fvisibility=hidden \ 27 | -I$(top_srcdir) \ 28 | $(PTHREADSTUBS_CFLAGS) \ 29 | $(VALGRIND_CFLAGS) \ 30 | -I$(top_srcdir)/include/drm 31 | 32 | libdrm_vc4includedir = ${includedir}/libdrm 33 | libdrm_vc4include_HEADERS = $(LIBDRM_VC4_H_FILES) 34 | 35 | pkgconfig_DATA = libdrm_vc4.pc 36 | -------------------------------------------------------------------------------- /vc4/Makefile.sources: -------------------------------------------------------------------------------- 1 | LIBDRM_VC4_H_FILES := \ 2 | vc4_packet.h \ 3 | vc4_qpu_defines.h 4 | -------------------------------------------------------------------------------- /vc4/libdrm_vc4.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libdrm_vc4 7 | Description: Userspace interface to vc4 kernel DRM services 8 | Version: @PACKAGE_VERSION@ 9 | Requires.private: libdrm 10 | -------------------------------------------------------------------------------- /vc4/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright © 2017 Intel Corporation 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | 21 | install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm') 22 | 23 | pkg.generate( 24 | name : 'libdrm_vc4', 25 | version : meson.project_version(), 26 | requires_private : 'libdrm', 27 | description : 'Userspace interface to vc4 kernel DRM services', 28 | ) 29 | -------------------------------------------------------------------------------- /xf86drmHash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 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 | * PRECISION INSIGHT 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 OTHER 22 | * DEALINGS IN THE SOFTWARE. 23 | * 24 | * Authors: Rickard E. (Rik) Faith 25 | */ 26 | 27 | #define HASH_SIZE 512 /* Good for about 100 entries */ 28 | /* If you change this value, you probably 29 | have to change the HashHash hashing 30 | function! */ 31 | 32 | typedef struct HashBucket { 33 | unsigned long key; 34 | void *value; 35 | struct HashBucket *next; 36 | } HashBucket, *HashBucketPtr; 37 | 38 | typedef struct HashTable { 39 | unsigned long magic; 40 | unsigned long entries; 41 | unsigned long hits; /* At top of linked list */ 42 | unsigned long partials; /* Not at top of linked list */ 43 | unsigned long misses; /* Not in table */ 44 | HashBucketPtr buckets[HASH_SIZE]; 45 | int p0; 46 | HashBucketPtr p1; 47 | } HashTable, *HashTablePtr; 48 | -------------------------------------------------------------------------------- /xf86drmRandom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 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 | * PRECISION INSIGHT 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 OTHER 22 | * DEALINGS IN THE SOFTWARE. 23 | * 24 | * Authors: Rickard E. (Rik) Faith 25 | */ 26 | 27 | typedef struct RandomState { 28 | unsigned long magic; 29 | unsigned long a; 30 | unsigned long m; 31 | unsigned long q; /* m div a */ 32 | unsigned long r; /* m mod a */ 33 | unsigned long check; 34 | unsigned long seed; 35 | } RandomState; 36 | --------------------------------------------------------------------------------