* [PATCH v2 00/11] Android build sytem
@ 2013-11-12 11:50 oscar.mateo
2013-11-12 11:50 ` [PATCH v2 01/11] build: list all test/tool/lib source files in their own Makefile.sources oscar.mateo
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
These patches aim to create an Android build system. This used to exist, but
the old Android.mk files were bit-rotten and therefore kicked out.
As suggested by Daniel Vetter and Damien Lespiau, as a fist step I extracted
the source files lists into a Makefile.sources which can be included by both
the autoconf files and the Android makefiles.
Changes since the last submission:
- Tabs when defining variables are fine, but fix missing "\" (thanks Damien).
- Drop some of the warning fixes and instead fix compilation flags.
- Reword comment and commit message in name conflict with Android's i915_drm.h
- Do not error on return-type (at least until Bionic correctly annotates
"noreturn" on pthread_exit).
Oscar Mateo (11):
build: list all test/tool/lib source files in their own
Makefile.sources
build: Fix missing "\" in tests/Makefile.sources
build: Move logic to tests/Makefile.am and away from Makefile.sources
lib: Move kms stuff from drmtest.c over to igt_kms.c
rendercopy: Remove rendercopy.c
tests/drm_get_client_auth: In Android, use gettid() instead of
syscall(SYS_gettid)
tests/gem_vmap_blits: Finish extracting gem_read
build: Fix assorted compilation warnings
lib/drmtest: Get the correct basename() under Android
lib/igt_display: workaround a name conflict in Android
build: New Android makefiles
Android.mk | 530 +-----------------------------
lib/Makefile.am | 38 +--
lib/Makefile.sources | 37 +++
lib/drmtest.c | 744 +----------------------------------------
lib/drmtest.h | 76 +----
lib/igt_display.h | 4 +
lib/igt_kms.c | 764 +++++++++++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 102 ++++++
lib/intel_batchbuffer.h | 2 +-
lib/intel_gpu_tools.h | 2 +-
lib/intel_reg_map.c | 4 +-
lib/rendercopy.c | 49 ---
lib/rendercopy.h | 2 -
tests/Android.mk | 77 +++++
tests/Makefile.am | 206 +-----------
tests/Makefile.sources | 203 ++++++++++++
tests/drm_get_client_auth.c | 10 +-
tests/gem_render_copy.c | 21 ++
tests/gem_vmap_blits.c | 14 -
tests/kms_cursor_crc.c | 1 +
tests/kms_flip.c | 1 +
tests/kms_pipe_crc_basic.c | 1 +
tests/kms_render.c | 1 +
tests/kms_setmode.c | 1 +
tests/pm_pc8.c | 1 +
tests/testdisplay.c | 1 +
tools/Android.mk | 70 ++++
tools/Makefile.am | 54 +--
tools/Makefile.sources | 53 +++
29 files changed, 1369 insertions(+), 1700 deletions(-)
create mode 100644 lib/Makefile.sources
create mode 100644 lib/igt_kms.c
create mode 100644 lib/igt_kms.h
delete mode 100644 lib/rendercopy.c
create mode 100644 tests/Android.mk
create mode 100644 tests/Makefile.sources
create mode 100644 tools/Android.mk
create mode 100644 tools/Makefile.sources
--
1.7.9.5
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 01/11] build: list all test/tool/lib source files in their own Makefile.sources
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 02/11] build: Fix missing "\" in tests/Makefile.sources oscar.mateo
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
In this way, all source files are listed in Makefile.sources and included
from Makefile.am, thus enabling the reuse from Android makefiles.
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
lib/Makefile.am | 38 +--------
lib/Makefile.sources | 36 +++++++++
tests/Makefile.am | 208 +-----------------------------------------------
tests/Makefile.sources | 206 +++++++++++++++++++++++++++++++++++++++++++++++
tools/Makefile.am | 54 +------------
tools/Makefile.sources | 53 ++++++++++++
6 files changed, 302 insertions(+), 293 deletions(-)
create mode 100644 lib/Makefile.sources
create mode 100644 tests/Makefile.sources
create mode 100644 tools/Makefile.sources
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 8a94e1e..4d4efe4 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,44 +1,10 @@
+include Makefile.sources
noinst_LTLIBRARIES = libintel_tools.la
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS)
-libintel_tools_la_SOURCES = \
- debug.h \
- drmtest.c \
- drmtest.h \
- i830_reg.h \
- i915_3d.h \
- i915_reg.h \
- igt_debugfs.c \
- igt_debugfs.h \
- igt_display.c \
- igt_display.h \
- instdone.c \
- instdone.h \
- intel_batchbuffer.c \
- intel_batchbuffer.h \
- intel_chipset.h \
- intel_drm.c \
- intel_gpu_tools.h \
- intel_mmio.c \
- intel_pci.c \
- intel_reg.h \
- rendercopy_i915.c \
- rendercopy_i830.c \
- gen6_render.h \
- gen7_render.h \
- gen8_render.h \
- rendercopy_gen6.c \
- rendercopy_gen7.c \
- rendercopy_gen8.c \
- rendercopy.h \
- rendercopy.c \
- intel_reg_map.c \
- intel_dpio.c \
- intel_iosf.c \
- $(NULL)
-
LDADD = $(CAIRO_LIBS)
AM_CFLAGS += $(CAIRO_CFLAGS)
+
diff --git a/lib/Makefile.sources b/lib/Makefile.sources
new file mode 100644
index 0000000..d71f837
--- /dev/null
+++ b/lib/Makefile.sources
@@ -0,0 +1,36 @@
+libintel_tools_la_SOURCES = \
+ debug.h \
+ drmtest.c \
+ drmtest.h \
+ i830_reg.h \
+ i915_3d.h \
+ i915_reg.h \
+ igt_debugfs.c \
+ igt_debugfs.h \
+ igt_display.c \
+ igt_display.h \
+ instdone.c \
+ instdone.h \
+ intel_batchbuffer.c \
+ intel_batchbuffer.h \
+ intel_chipset.h \
+ intel_drm.c \
+ intel_gpu_tools.h \
+ intel_mmio.c \
+ intel_pci.c \
+ intel_reg.h \
+ rendercopy_i915.c \
+ rendercopy_i830.c \
+ gen6_render.h \
+ gen7_render.h \
+ gen8_render.h \
+ rendercopy_gen6.c \
+ rendercopy_gen7.c \
+ rendercopy_gen8.c \
+ rendercopy.h \
+ rendercopy.c \
+ intel_reg_map.c \
+ intel_dpio.c \
+ intel_iosf.c \
+ $(NULL)
+
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0426ec0..9e1b13f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,185 +1,6 @@
-if BUILD_TESTS
-noinst_PROGRAMS = \
- gem_stress \
- ddi_compute_wrpll \
- $(TESTS_progs) \
- $(TESTS_progs_M) \
- $(HANG) \
- $(TESTS_testsuite)
- $(NULL)
-
-if HAVE_NOUVEAU
-NOUVEAU_TESTS_M = \
- prime_nv_api \
- prime_nv_pcopy \
- prime_nv_test \
- $(NULL)
-endif
-
-TESTS_progs_M = \
- drv_suspend \
- gem_basic \
- gem_caching \
- gem_concurrent_blit \
- gem_cs_tlb \
- gem_ctx_bad_exec \
- gem_dummy_reloc_loop \
- gem_evict_alignment \
- gem_evict_everything \
- gem_exec_bad_domains \
- gem_exec_nop \
- gem_fenced_exec_thrash \
- gem_fence_thrash \
- gem_flink \
- gem_flink_race \
- gem_linear_blits \
- gem_mmap \
- gem_mmap_gtt \
- gem_partial_pwrite_pread \
- gem_persistent_relocs \
- gem_pread \
- gem_pread_after_blit \
- gem_pwrite \
- gem_pwrite_pread \
- gem_readwrite \
- gem_reloc_overflow \
- gem_reloc_vs_gpu \
- gem_ringfill \
- gem_set_tiling_vs_blt \
- gem_storedw_batches_loop \
- gem_tiled_blits \
- gem_tiled_partial_pwrite_pread \
- gem_write_read_ring_switch \
- kms_addfb \
- kms_cursor_crc \
- kms_flip \
- kms_pipe_crc_basic \
- kms_render \
- kms_setmode \
- $(NOUVEAU_TESTS_M) \
- pm_pc8 \
- prime_self_import \
- template \
- $(NULL)
-
-TESTS_progs = \
- core_getclient \
- core_getstats \
- core_getversion \
- drm_get_client_auth \
- drm_vma_limiter \
- drm_vma_limiter_cached \
- drm_vma_limiter_cpu \
- drm_vma_limiter_gtt \
- gem_bad_length \
- gem_close_race \
- gem_cpu_reloc \
- gem_cs_prefetch \
- gem_ctx_bad_destroy \
- gem_ctx_basic \
- gem_ctx_create \
- gem_ctx_exec \
- gem_double_irq_loop \
- gem_exec_big \
- gem_exec_blt \
- gem_exec_faulting_reloc \
- gem_exec_lut_handle \
- gem_gtt_cpu_tlb \
- gem_gtt_speed \
- gem_hangcheck_forcewake \
- gem_largeobject \
- gem_lut_handle \
- gem_mmap_offset_exhaustion \
- gem_pin \
- gem_pipe_control_store_loop \
- gem_reg_read \
- gem_render_copy \
- gem_render_linear_blits \
- gem_render_tiled_blits \
- gem_ring_sync_loop \
- gem_seqno_wrap \
- gem_set_tiling_vs_gtt \
- gem_set_tiling_vs_pwrite \
- gem_storedw_loop_blt \
- gem_storedw_loop_bsd \
- gem_storedw_loop_render \
- gem_storedw_loop_vebox \
- gem_threaded_access_tiled \
- gem_tiled_fence_blits \
- gem_tiled_pread \
- gem_tiled_pread_pwrite \
- gem_tiled_swapping \
- gem_tiling_max_stride \
- gem_unfence_active_buffers \
- gem_unref_active_buffers \
- gem_vmap_blits \
- gem_wait_render_timeout \
- gen3_mixed_blits \
- gen3_render_linear_blits \
- gen3_render_mixed_blits \
- gen3_render_tiledx_blits \
- gen3_render_tiledy_blits \
- prime_udl \
- pm_psr \
- pm_rc6_residency \
- pm_rps \
- $(NULL)
-
-# IMPORTANT: The ZZ_ tests need to be run last!
-# ... and make can't deal with inlined comments ...
-TESTS_scripts_M = \
- $(NULL)
-
-TESTS_scripts = \
- debugfs_emon_crash \
- drv_debugfs_reader \
- drv_hangman \
- drv_missed_irq_hang \
- drv_module_reload \
- kms_sysfs_edid_timing \
- sysfs_l3_parity \
- test_rte_check \
- tools_test \
- $(NULL)
-
-# This target contains testcases which support automagic subtest enumeration
-# from the piglit testrunner with --list-subtests and running individual
-# subtests with --run-subtest <testname>
-multi_kernel_tests = \
- $(TESTS_progs_M) \
- $(TESTS_scripts_M) \
- $(NULL)
-
-single_kernel_tests = \
- $(TESTS_progs) \
- $(TESTS_scripts) \
- $(NULL)
-
-kernel_tests = \
- $(single_kernel_tests) \
- $(multi_kernel_tests) \
- $(NULL)
-
-TESTS_testsuite = \
- igt_no_exit \
- igt_no_exit_list_only \
- igt_fork_helper \
- igt_list_only \
- igt_no_subtest \
- $(NULL)
-
-TESTS = \
- $(TESTS_testsuite) \
- $(NULL)
-
-# Test that exercise specific asserts in the test framework library and are
-# hence expected to fail.
-XFAIL_TESTS = \
- igt_no_exit \
- igt_no_exit_list_only \
- igt_no_subtest \
- $(NULL)
+include Makefile.sources
+if BUILD_TESTS
list-single-tests:
@echo TESTLIST
@echo ${single_kernel_tests}
@@ -190,23 +11,6 @@ list-multi-tests:
@echo ${multi_kernel_tests}
@echo END TESTLIST
-HANG = \
- gem_bad_batch \
- gem_hang \
- gem_bad_blit \
- gem_bad_address \
- gem_non_secure_batch \
- $(NULL)
-
-scripts = \
- check_drm_clients \
- ddx_intel_after_fbdev \
- debugfs_wedged \
- drm_lib.sh \
- $(NULL)
-
-IMAGES = pass.png 1080p-left.png 1080p-right.png
-
EXTRA_PROGRAMS = $(TESTS_progs) $(TESTS_progs_M) $(HANG) $(TESTS_testsuite)
EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES)
@@ -220,13 +24,6 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
LDADD = ../lib/libintel_tools.la $(PCIACCESS_LIBS) $(DRM_LIBS)
-testdisplay_SOURCES = \
- testdisplay.c \
- testdisplay.h \
- testdisplay_hotplug.c \
- $(NULL)
-
-TESTS_progs += testdisplay
LDADD += $(CAIRO_LIBS) $(LIBUDEV_LIBS) $(GLIB_LIBS)
AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS)
@@ -249,3 +46,4 @@ prime_nv_api_LDADD = $(LDADD) $(DRM_NOUVEAU_LIBS)
prime_nv_pcopy_CFLAGS = $(AM_CFLAGS) $(DRM_NOUVEAU_CFLAGS)
prime_nv_pcopy_LDADD = $(LDADD) $(DRM_NOUVEAU_LIBS)
endif
+
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
new file mode 100644
index 0000000..70809c7
--- /dev/null
+++ b/tests/Makefile.sources
@@ -0,0 +1,206 @@
+noinst_PROGRAMS = \
+ gem_stress \
+ ddi_compute_wrpll \
+ $(TESTS_progs) \
+ $(TESTS_progs_M) \
+ $(HANG) \
+ $(TESTS_testsuite)
+ $(NULL)
+
+if HAVE_NOUVEAU
+NOUVEAU_TESTS_M = \
+ prime_nv_api \
+ prime_nv_pcopy \
+ prime_nv_test \
+ $(NULL)
+endif
+
+TESTS_progs_M = \
+ drv_suspend \
+ gem_basic \
+ gem_caching \
+ gem_concurrent_blit \
+ gem_cs_tlb \
+ gem_ctx_bad_exec \
+ gem_dummy_reloc_loop \
+ gem_evict_alignment \
+ gem_evict_everything \
+ gem_exec_bad_domains \
+ gem_exec_nop \
+ gem_fenced_exec_thrash \
+ gem_fence_thrash \
+ gem_flink \
+ gem_flink_race \
+ gem_linear_blits \
+ gem_mmap \
+ gem_mmap_gtt \
+ gem_partial_pwrite_pread \
+ gem_persistent_relocs \
+ gem_pread \
+ gem_pread_after_blit \
+ gem_pwrite \
+ gem_pwrite_pread \
+ gem_readwrite \
+ gem_reloc_overflow \
+ gem_reloc_vs_gpu \
+ gem_ringfill \
+ gem_set_tiling_vs_blt \
+ gem_storedw_batches_loop \
+ gem_tiled_blits \
+ gem_tiled_partial_pwrite_pread \
+ gem_write_read_ring_switch \
+ kms_addfb \
+ kms_cursor_crc \
+ kms_flip \
+ kms_pipe_crc_basic \
+ kms_render \
+ kms_setmode \
+ $(NOUVEAU_TESTS_M) \
+ pm_pc8 \
+ prime_self_import \
+ template \
+ $(NULL)
+
+TESTS_progs = \
+ core_getclient \
+ core_getstats \
+ core_getversion \
+ drm_get_client_auth \
+ drm_vma_limiter \
+ drm_vma_limiter_cached \
+ drm_vma_limiter_cpu \
+ drm_vma_limiter_gtt \
+ gem_bad_length \
+ gem_close_race \
+ gem_cpu_reloc \
+ gem_cs_prefetch \
+ gem_ctx_bad_destroy \
+ gem_ctx_basic \
+ gem_ctx_create \
+ gem_ctx_exec \
+ gem_double_irq_loop \
+ gem_exec_big \
+ gem_exec_blt \
+ gem_exec_faulting_reloc \
+ gem_exec_lut_handle \
+ gem_gtt_cpu_tlb \
+ gem_gtt_speed \
+ gem_hangcheck_forcewake \
+ gem_largeobject \
+ gem_lut_handle \
+ gem_mmap_offset_exhaustion \
+ gem_pin \
+ gem_pipe_control_store_loop \
+ gem_reg_read \
+ gem_render_copy \
+ gem_render_linear_blits \
+ gem_render_tiled_blits \
+ gem_ring_sync_loop \
+ gem_seqno_wrap \
+ gem_set_tiling_vs_gtt \
+ gem_set_tiling_vs_pwrite \
+ gem_storedw_loop_blt \
+ gem_storedw_loop_bsd \
+ gem_storedw_loop_render \
+ gem_storedw_loop_vebox \
+ gem_threaded_access_tiled \
+ gem_tiled_fence_blits \
+ gem_tiled_pread \
+ gem_tiled_pread_pwrite \
+ gem_tiled_swapping \
+ gem_tiling_max_stride \
+ gem_unfence_active_buffers \
+ gem_unref_active_buffers \
+ gem_vmap_blits \
+ gem_wait_render_timeout \
+ gen3_mixed_blits \
+ gen3_render_linear_blits \
+ gen3_render_mixed_blits \
+ gen3_render_tiledx_blits \
+ gen3_render_tiledy_blits \
+ prime_udl \
+ pm_psr \
+ pm_rc6_residency \
+ pm_rps \
+ $(NULL)
+
+# IMPORTANT: The ZZ_ tests need to be run last!
+# ... and make can't deal with inlined comments ...
+TESTS_scripts_M = \
+ $(NULL)
+
+TESTS_scripts = \
+ debugfs_emon_crash \
+ drv_debugfs_reader \
+ drv_hangman \
+ drv_missed_irq_hang \
+ drv_module_reload \
+ kms_sysfs_edid_timing \
+ sysfs_l3_parity \
+ test_rte_check \
+ tools_test \
+ $(NULL)
+
+# This target contains testcases which support automagic subtest enumeration
+# from the piglit testrunner with --list-subtests and running individual
+# subtests with --run-subtest <testname>
+multi_kernel_tests = \
+ $(TESTS_progs_M) \
+ $(TESTS_scripts_M) \
+ $(NULL)
+
+single_kernel_tests = \
+ $(TESTS_progs) \
+ $(TESTS_scripts) \
+ $(NULL)
+
+kernel_tests = \
+ $(single_kernel_tests) \
+ $(multi_kernel_tests) \
+ $(NULL)
+
+TESTS_testsuite = \
+ igt_no_exit \
+ igt_no_exit_list_only \
+ igt_fork_helper \
+ igt_list_only \
+ igt_no_subtest \
+ $(NULL)
+
+TESTS = \
+ $(TESTS_testsuite) \
+ $(NULL)
+
+# Test that exercise specific asserts in the test framework library and are
+# hence expected to fail.
+XFAIL_TESTS = \
+ igt_no_exit \
+ igt_no_exit_list_only \
+ igt_no_subtest \
+ $(NULL)
+
+HANG = \
+ gem_bad_batch \
+ gem_hang \
+ gem_bad_blit \
+ gem_bad_address \
+ gem_non_secure_batch \
+ $(NULL)
+
+scripts = \
+ check_drm_clients \
+ ddx_intel_after_fbdev \
+ debugfs_wedged \
+ drm_lib.sh \
+ $(NULL)
+
+IMAGES = pass.png 1080p-left.png 1080p-right.png
+
+testdisplay_SOURCES = \
+ testdisplay.c \
+ testdisplay.h \
+ testdisplay_hotplug.c \
+ $(NULL)
+
+TESTS_progs += testdisplay
+
diff --git a/tools/Makefile.am b/tools/Makefile.am
index d430377..151092b 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,60 +1,10 @@
+include Makefile.sources
+
if HAVE_DUMPER
SUBDIRS = quick_dump
endif
-bin_PROGRAMS = \
- intel_disable_clock_gating \
- intel_audio_dump \
- intel_backlight \
- intel_bios_dumper \
- intel_bios_reader \
- intel_error_decode \
- intel_framebuffer_dump \
- intel_gpu_top \
- intel_gpu_time \
- intel_gtt \
- intel_opregion_decode \
- intel_perf_counters \
- intel_stepping \
- intel_reg_checker \
- intel_reg_dumper \
- intel_reg_snapshot \
- intel_reg_write \
- intel_reg_read \
- intel_forcewaked \
- intel_dpio_read \
- intel_dpio_write \
- intel_l3_parity \
- intel_punit_read \
- intel_punit_write \
- intel_nc_write \
- intel_nc_read \
- intel_vga_read \
- intel_vga_write
-
-noinst_PROGRAMS = \
- intel_dump_decode \
- intel_infoframes \
- intel_lid \
- intel_panel_fitter
-
-dist_bin_SCRIPTS = intel_gpu_abrt
-
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
AM_CFLAGS = $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) $(CAIRO_CFLAGS)
LDADD = $(top_builddir)/lib/libintel_tools.la $(DRM_LIBS) $(PCIACCESS_LIBS) $(CAIRO_LIBS) $(LIBUDEV_LIBS)
-intel_dump_decode_SOURCES = \
- intel_dump_decode.c
-
-intel_error_decode_SOURCES = \
- intel_error_decode.c
-
-intel_bios_reader_SOURCES = \
- intel_bios_reader.c \
- intel_bios.h
-
-intel_l3_parity_SOURCES = \
- intel_l3_parity.c \
- intel_l3_parity.h \
- intel_l3_udev_listener.c
diff --git a/tools/Makefile.sources b/tools/Makefile.sources
new file mode 100644
index 0000000..a4664fe
--- /dev/null
+++ b/tools/Makefile.sources
@@ -0,0 +1,53 @@
+bin_PROGRAMS = \
+ intel_disable_clock_gating \
+ intel_audio_dump \
+ intel_backlight \
+ intel_bios_dumper \
+ intel_bios_reader \
+ intel_error_decode \
+ intel_framebuffer_dump \
+ intel_gpu_top \
+ intel_gpu_time \
+ intel_gtt \
+ intel_opregion_decode \
+ intel_perf_counters \
+ intel_stepping \
+ intel_reg_checker \
+ intel_reg_dumper \
+ intel_reg_snapshot \
+ intel_reg_write \
+ intel_reg_read \
+ intel_forcewaked \
+ intel_dpio_read \
+ intel_dpio_write \
+ intel_l3_parity \
+ intel_punit_read \
+ intel_punit_write \
+ intel_nc_write \
+ intel_nc_read \
+ intel_vga_read \
+ intel_vga_write
+
+noinst_PROGRAMS = \
+ intel_dump_decode \
+ intel_infoframes \
+ intel_lid \
+ intel_panel_fitter
+
+dist_bin_SCRIPTS = intel_gpu_abrt
+
+intel_dump_decode_SOURCES = \
+ intel_dump_decode.c
+
+intel_error_decode_SOURCES = \
+ intel_error_decode.c
+
+intel_bios_reader_SOURCES = \
+ intel_bios_reader.c \
+ intel_bios.h
+
+intel_l3_parity_SOURCES = \
+ intel_l3_parity.c \
+ intel_l3_parity.h \
+ intel_l3_udev_listener.c
+
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 02/11] build: Fix missing "\" in tests/Makefile.sources
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
2013-11-12 11:50 ` [PATCH v2 01/11] build: list all test/tool/lib source files in their own Makefile.sources oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 03/11] build: Move logic to tests/Makefile.am and away from Makefile.sources oscar.mateo
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
Noticed by Damien Lespiau.
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
tests/Makefile.sources | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 70809c7..311f4b6 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -4,7 +4,7 @@ noinst_PROGRAMS = \
$(TESTS_progs) \
$(TESTS_progs_M) \
$(HANG) \
- $(TESTS_testsuite)
+ $(TESTS_testsuite) \
$(NULL)
if HAVE_NOUVEAU
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 03/11] build: Move logic to tests/Makefile.am and away from Makefile.sources
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
2013-11-12 11:50 ` [PATCH v2 01/11] build: list all test/tool/lib source files in their own Makefile.sources oscar.mateo
2013-11-12 11:50 ` [PATCH v2 02/11] build: Fix missing "\" in tests/Makefile.sources oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 04/11] lib: Move kms stuff from drmtest.c over to igt_kms.c oscar.mateo
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
Makefile.sources is just a listing with all the sources, and the logic
to use these sources goes into either Makefile.am (automake) or
Android.mk (make).
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
tests/Makefile.am | 4 ++++
tests/Makefile.sources | 3 ---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9e1b13f..8e293f7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,9 @@
include Makefile.sources
+if HAVE_NOUVEAU
+ TESTS_progs_M += $(NOUVEAU_TESTS_M)
+endif
+
if BUILD_TESTS
list-single-tests:
@echo TESTLIST
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 311f4b6..5f4d282 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -7,13 +7,11 @@ noinst_PROGRAMS = \
$(TESTS_testsuite) \
$(NULL)
-if HAVE_NOUVEAU
NOUVEAU_TESTS_M = \
prime_nv_api \
prime_nv_pcopy \
prime_nv_test \
$(NULL)
-endif
TESTS_progs_M = \
drv_suspend \
@@ -55,7 +53,6 @@ TESTS_progs_M = \
kms_pipe_crc_basic \
kms_render \
kms_setmode \
- $(NOUVEAU_TESTS_M) \
pm_pc8 \
prime_self_import \
template \
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 04/11] lib: Move kms stuff from drmtest.c over to igt_kms.c
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (2 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 03/11] build: Move logic to tests/Makefile.am and away from Makefile.sources oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 05/11] rendercopy: Remove rendercopy.c oscar.mateo
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
This makes cairo dependencies easier to handle. Otherwise, we
would have to litter drmtest all over with "#ifndef ANDROID"
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
lib/Makefile.sources | 2 +
lib/drmtest.c | 732 ------------------------------------------
lib/drmtest.h | 72 -----
lib/igt_kms.c | 764 ++++++++++++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 102 ++++++
tests/kms_cursor_crc.c | 1 +
tests/kms_flip.c | 1 +
tests/kms_pipe_crc_basic.c | 1 +
tests/kms_render.c | 1 +
tests/kms_setmode.c | 1 +
tests/pm_pc8.c | 1 +
tests/testdisplay.c | 1 +
12 files changed, 875 insertions(+), 804 deletions(-)
create mode 100644 lib/igt_kms.c
create mode 100644 lib/igt_kms.h
diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index d71f837..78e2034 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -32,5 +32,7 @@ libintel_tools_la_SOURCES = \
intel_reg_map.c \
intel_dpio.c \
intel_iosf.c \
+ igt_kms.c \
+ igt_kms.h \
$(NULL)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index d8fc60f..38463f8 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -35,13 +35,10 @@
#include <sys/mman.h>
#include <signal.h>
#include <pciaccess.h>
-#include <math.h>
#include <getopt.h>
#include <stdlib.h>
-#include <linux/kd.h>
#include <unistd.h>
#include <sys/wait.h>
-#include "drm_fourcc.h"
#include "drmtest.h"
#include "i915_drm.h"
@@ -1375,553 +1372,6 @@ void igt_cleanup_aperture_trashers(void)
free(trash_bos);
}
-/* helpers to create nice-looking framebuffers */
-static int create_bo_for_fb(int fd, int width, int height, int bpp,
- bool tiled, uint32_t *gem_handle_ret,
- unsigned *size_ret, unsigned *stride_ret)
-{
- uint32_t gem_handle;
- int size;
- unsigned stride;
-
- if (tiled) {
- int v;
-
- /* Round the tiling up to the next power-of-two and the
- * region up to the next pot fence size so that this works
- * on all generations.
- *
- * This can still fail if the framebuffer is too large to
- * be tiled. But then that failure is expected.
- */
-
- v = width * bpp / 8;
- for (stride = 512; stride < v; stride *= 2)
- ;
-
- v = stride * height;
- for (size = 1024*1024; size < v; size *= 2)
- ;
- } else {
- /* Scan-out has a 64 byte alignment restriction */
- stride = (width * (bpp / 8) + 63) & ~63;
- size = stride * height;
- }
-
- gem_handle = gem_create(fd, size);
-
- if (tiled)
- gem_set_tiling(fd, gem_handle, I915_TILING_X, stride);
-
- *stride_ret = stride;
- *size_ret = size;
- *gem_handle_ret = gem_handle;
-
- return 0;
-}
-
-void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
- double r, double g, double b)
-{
- cairo_rectangle(cr, x, y, w, h);
- cairo_set_source_rgb(cr, r, g, b);
- cairo_fill(cr);
-}
-
-void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
- double r, double g, double b, double a)
-{
- cairo_rectangle(cr, x, y, w, h);
- cairo_set_source_rgba(cr, r, g, b, a);
- cairo_fill(cr);
-}
-
-void
-kmstest_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
- int r, int g, int b)
-{
- cairo_pattern_t *pat;
-
- pat = cairo_pattern_create_linear(x, y, x + w, y + h);
- cairo_pattern_add_color_stop_rgba(pat, 1, 0, 0, 0, 1);
- cairo_pattern_add_color_stop_rgba(pat, 0, r, g, b, 1);
-
- cairo_rectangle(cr, x, y, w, h);
- cairo_set_source(cr, pat);
- cairo_fill(cr);
- cairo_pattern_destroy(pat);
-}
-
-static void
-paint_test_patterns(cairo_t *cr, int width, int height)
-{
- double gr_height, gr_width;
- int x, y;
-
- y = height * 0.10;
- gr_width = width * 0.75;
- gr_height = height * 0.08;
- x = (width / 2) - (gr_width / 2);
-
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 0, 0);
-
- y += gr_height;
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 1, 0);
-
- y += gr_height;
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 0, 1);
-
- y += gr_height;
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 1, 1);
-}
-
-int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
- double yspacing, const char *fmt, ...)
-{
- double x, y, xofs, yofs;
- cairo_text_extents_t extents;
- char *text;
- va_list ap;
- int ret;
-
- va_start(ap, fmt);
- ret = vasprintf(&text, fmt, ap);
- assert(ret >= 0);
- va_end(ap);
-
- cairo_text_extents(cr, text, &extents);
-
- xofs = yofs = 0;
- if (align & align_right)
- xofs = -extents.width;
- else if (align & align_hcenter)
- xofs = -extents.width / 2;
-
- if (align & align_top)
- yofs = extents.height;
- else if (align & align_vcenter)
- yofs = extents.height / 2;
-
- cairo_get_current_point(cr, &x, &y);
- if (xofs || yofs)
- cairo_rel_move_to(cr, xofs, yofs);
-
- cairo_text_path(cr, text);
- cairo_set_source_rgb(cr, 0, 0, 0);
- cairo_stroke_preserve(cr);
- cairo_set_source_rgb(cr, 1, 1, 1);
- cairo_fill(cr);
-
- cairo_move_to(cr, x, y + extents.height + yspacing);
-
- free(text);
-
- return extents.width;
-}
-
-static void
-paint_marker(cairo_t *cr, int x, int y)
-{
- enum kmstest_text_align align;
- int xoff, yoff;
-
- cairo_move_to(cr, x, y - 20);
- cairo_line_to(cr, x, y + 20);
- cairo_move_to(cr, x - 20, y);
- cairo_line_to(cr, x + 20, y);
- cairo_new_sub_path(cr);
- cairo_arc(cr, x, y, 10, 0, M_PI * 2);
- cairo_set_line_width(cr, 4);
- cairo_set_source_rgb(cr, 0, 0, 0);
- cairo_stroke_preserve(cr);
- cairo_set_source_rgb(cr, 1, 1, 1);
- cairo_set_line_width(cr, 2);
- cairo_stroke(cr);
-
- xoff = x ? -20 : 20;
- align = x ? align_right : align_left;
-
- yoff = y ? -20 : 20;
- align |= y ? align_bottom : align_top;
-
- cairo_move_to(cr, x + xoff, y + yoff);
- cairo_set_font_size(cr, 18);
- kmstest_cairo_printf_line(cr, align, 0, "(%d, %d)", x, y);
-}
-
-void kmstest_paint_test_pattern(cairo_t *cr, int width, int height)
-{
- paint_test_patterns(cr, width, height);
-
- cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
-
- /* Paint corner markers */
- paint_marker(cr, 0, 0);
- paint_marker(cr, width, 0);
- paint_marker(cr, 0, height);
- paint_marker(cr, width, height);
-
- assert(!cairo_status(cr));
-}
-
-void kmstest_paint_image(cairo_t *cr, const char *filename,
- int dst_x, int dst_y, int dst_width, int dst_height)
-{
- cairo_surface_t *image;
- int img_width, img_height;
- double scale_x, scale_y;
-
- image = cairo_image_surface_create_from_png(filename);
- assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
-
- img_width = cairo_image_surface_get_width(image);
- img_height = cairo_image_surface_get_height(image);
-
- scale_x = (double)dst_width / img_width;
- scale_y = (double)dst_height / img_height;
-
- cairo_save(cr);
-
- cairo_translate(cr, dst_x, dst_y);
- cairo_scale(cr, scale_x, scale_y);
- cairo_set_source_surface(cr, image, 0, 0);
- cairo_paint(cr);
-
- cairo_surface_destroy(image);
-
- cairo_restore(cr);
-}
-
-#define DF(did, cid, _bpp, _depth) \
- { DRM_FORMAT_##did, CAIRO_FORMAT_##cid, # did, _bpp, _depth }
-static struct format_desc_struct {
- uint32_t drm_id;
- cairo_format_t cairo_id;
- const char *name;
- int bpp;
- int depth;
-} format_desc[] = {
- DF(RGB565, RGB16_565, 16, 16),
- DF(RGB888, INVALID, 24, 24),
- DF(XRGB8888, RGB24, 32, 24),
- DF(XRGB2101010, RGB30, 32, 30),
- DF(ARGB8888, ARGB32, 32, 32),
-};
-#undef DF
-
-#define for_each_format(f) \
- for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++)
-
-static uint32_t bpp_depth_to_drm_format(int bpp, int depth)
-{
- struct format_desc_struct *f;
-
- for_each_format(f)
- if (f->bpp == bpp && f->depth == depth)
- return f->drm_id;
-
- abort();
-}
-
-/* Return fb_id on success, 0 on error */
-unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
- int depth, bool tiled, struct kmstest_fb *fb)
-{
- memset(fb, 0, sizeof(*fb));
-
- if (create_bo_for_fb(fd, width, height, bpp, tiled, &fb->gem_handle,
- &fb->size, &fb->stride) < 0)
- return 0;
-
- if (drmModeAddFB(fd, width, height, depth, bpp, fb->stride,
- fb->gem_handle, &fb->fb_id) < 0) {
- gem_close(fd, fb->gem_handle);
-
- return 0;
- }
-
- fb->width = width;
- fb->height = height;
- fb->tiling = tiled;
- fb->drm_format = bpp_depth_to_drm_format(bpp, depth);
-
- return fb->fb_id;
-}
-
-uint32_t drm_format_to_bpp(uint32_t drm_format)
-{
- struct format_desc_struct *f;
-
- for_each_format(f)
- if (f->drm_id == drm_format)
- return f->bpp;
-
- abort();
-}
-
-unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format,
- bool tiled, struct kmstest_fb *fb)
-{
- uint32_t handles[4];
- uint32_t pitches[4];
- uint32_t offsets[4];
- uint32_t fb_id;
- int bpp;
- int ret;
-
- memset(fb, 0, sizeof(*fb));
-
- bpp = drm_format_to_bpp(format);
- ret = create_bo_for_fb(fd, width, height, bpp, tiled, &fb->gem_handle,
- &fb->size, &fb->stride);
- if (ret < 0)
- return ret;
-
- memset(handles, 0, sizeof(handles));
- handles[0] = fb->gem_handle;
- memset(pitches, 0, sizeof(pitches));
- pitches[0] = fb->stride;
- memset(offsets, 0, sizeof(offsets));
- if (drmModeAddFB2(fd, width, height, format, handles, pitches,
- offsets, &fb_id, 0) < 0) {
- gem_close(fd, fb->gem_handle);
-
- return 0;
- }
-
- fb->width = width;
- fb->height = height;
- fb->tiling = tiled;
- fb->drm_format = format;
- fb->fb_id = fb_id;
-
- return fb_id;
-}
-
-static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
-{
- struct format_desc_struct *f;
-
- for_each_format(f)
- if (f->drm_id == drm_format)
- return f->cairo_id;
-
- abort();
-}
-
-static cairo_surface_t *create_image_surface(int fd, struct kmstest_fb *fb)
-{
- cairo_surface_t *surface;
- cairo_format_t cformat;
- void *fb_ptr;
-
- cformat = drm_format_to_cairo(fb->drm_format);
- fb_ptr = gem_mmap(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE);
- surface = cairo_image_surface_create_for_data((unsigned char *)fb_ptr,
- cformat, fb->width,
- fb->height, fb->stride);
- assert(surface);
-
- return surface;
-}
-
-static cairo_t *create_cairo_ctx(int fd, struct kmstest_fb *fb)
-{
- cairo_t *cr;
- cairo_surface_t *surface;
-
- surface = create_image_surface(fd, fb);
- cr = cairo_create(surface);
- cairo_surface_destroy(surface);
-
- return cr;
-}
-
-void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename)
-{
- cairo_surface_t *surface;
- cairo_status_t status;
-
- surface = create_image_surface(fd, fb);
- status = cairo_surface_write_to_png(surface, filename);
- assert(status == CAIRO_STATUS_SUCCESS);
- cairo_surface_destroy(surface);
-}
-
-cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb)
-{
-
- if (!fb->cairo_ctx)
- fb->cairo_ctx = create_cairo_ctx(fd, fb);
-
- gem_set_domain(fd, fb->gem_handle, I915_GEM_DOMAIN_CPU,
- I915_GEM_DOMAIN_CPU);
-
- return fb->cairo_ctx;
-}
-
-void kmstest_remove_fb(int fd, struct kmstest_fb *fb)
-{
- if (fb->cairo_ctx)
- cairo_destroy(fb->cairo_ctx);
- do_or_die(drmModeRmFB(fd, fb->fb_id));
- gem_close(fd, fb->gem_handle);
-}
-
-const char *kmstest_format_str(uint32_t drm_format)
-{
- struct format_desc_struct *f;
-
- for_each_format(f)
- if (f->drm_id == drm_format)
- return f->name;
-
- return "invalid";
-}
-
-const char *kmstest_pipe_str(int pipe)
-{
- const char *str[] = { "A", "B", "C" };
-
- if (pipe > 2)
- return "invalid";
-
- return str[pipe];
-}
-
-void kmstest_get_all_formats(const uint32_t **formats, int *format_count)
-{
- static uint32_t *drm_formats;
-
- if (!drm_formats) {
- struct format_desc_struct *f;
- uint32_t *format;
-
- drm_formats = calloc(ARRAY_SIZE(format_desc),
- sizeof(*drm_formats));
- format = &drm_formats[0];
- for_each_format(f)
- *format++ = f->drm_id;
- }
-
- *formats = drm_formats;
- *format_count = ARRAY_SIZE(format_desc);
-}
-
-struct type_name {
- int type;
- const char *name;
-};
-
-#define type_name_fn(res) \
-const char * kmstest_##res##_str(int type) { \
- unsigned int i; \
- for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \
- if (res##_names[i].type == type) \
- return res##_names[i].name; \
- } \
- return "(invalid)"; \
-}
-
-struct type_name encoder_type_names[] = {
- { DRM_MODE_ENCODER_NONE, "none" },
- { DRM_MODE_ENCODER_DAC, "DAC" },
- { DRM_MODE_ENCODER_TMDS, "TMDS" },
- { DRM_MODE_ENCODER_LVDS, "LVDS" },
- { DRM_MODE_ENCODER_TVDAC, "TVDAC" },
-};
-
-type_name_fn(encoder_type)
-
-struct type_name connector_status_names[] = {
- { DRM_MODE_CONNECTED, "connected" },
- { DRM_MODE_DISCONNECTED, "disconnected" },
- { DRM_MODE_UNKNOWNCONNECTION, "unknown" },
-};
-
-type_name_fn(connector_status)
-
-struct type_name connector_type_names[] = {
- { DRM_MODE_CONNECTOR_Unknown, "unknown" },
- { DRM_MODE_CONNECTOR_VGA, "VGA" },
- { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
- { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
- { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
- { DRM_MODE_CONNECTOR_Composite, "composite" },
- { DRM_MODE_CONNECTOR_SVIDEO, "s-video" },
- { DRM_MODE_CONNECTOR_LVDS, "LVDS" },
- { DRM_MODE_CONNECTOR_Component, "component" },
- { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
- { DRM_MODE_CONNECTOR_DisplayPort, "DP" },
- { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
- { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
- { DRM_MODE_CONNECTOR_TV, "TV" },
- { DRM_MODE_CONNECTOR_eDP, "eDP" },
-};
-
-type_name_fn(connector_type)
-
-static const char *mode_stereo_name(const drmModeModeInfo *mode)
-{
- switch (mode->flags & DRM_MODE_FLAG_3D_MASK) {
- case DRM_MODE_FLAG_3D_FRAME_PACKING:
- return "FP";
- case DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE:
- return "FA";
- case DRM_MODE_FLAG_3D_LINE_ALTERNATIVE:
- return "LA";
- case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL:
- return "SBSF";
- case DRM_MODE_FLAG_3D_L_DEPTH:
- return "LD";
- case DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH:
- return "LDGFX";
- case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
- return "TB";
- case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
- return "SBSH";
- default:
- return NULL;
- }
-}
-
-void kmstest_dump_mode(drmModeModeInfo *mode)
-{
- const char *stereo = mode_stereo_name(mode);
-
- printf(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s\n",
- mode->name,
- mode->vrefresh,
- mode->hdisplay,
- mode->hsync_start,
- mode->hsync_end,
- mode->htotal,
- mode->vdisplay,
- mode->vsync_start,
- mode->vsync_end,
- mode->vtotal,
- mode->flags,
- mode->type,
- mode->clock,
- stereo ? " (3D:" : "",
- stereo ? stereo : "",
- stereo ? ")" : "");
- fflush(stdout);
-}
-
-int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id)
-{
- struct drm_i915_get_pipe_from_crtc_id pfci;
- int ret;
-
- memset(&pfci, 0, sizeof(pfci));
- pfci.crtc_id = crtc_id;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &pfci);
- igt_assert(ret == 0);
-
- return pfci.pipe;
-}
-
#define MAX_SIGNALS 32
#define MAX_EXIT_HANDLERS 5
@@ -2075,188 +1525,6 @@ void igt_enable_exit_handler(void)
exit_handler_disabled = false;
}
-static signed long set_vt_mode(unsigned long mode)
-{
- int fd;
- unsigned long prev_mode;
-
- fd = open("/dev/tty0", O_RDONLY);
- if (fd < 0)
- return -errno;
-
- prev_mode = 0;
- if (drmIoctl(fd, KDGETMODE, &prev_mode))
- goto err;
- if (drmIoctl(fd, KDSETMODE, (void *)mode))
- goto err;
-
- close(fd);
-
- return prev_mode;
-err:
- close(fd);
-
- return -errno;
-}
-
-static unsigned long orig_vt_mode = -1UL;
-
-static void restore_vt_mode_at_exit(int sig)
-{
- if (orig_vt_mode != -1UL)
- set_vt_mode(orig_vt_mode);
-}
-
-/*
- * Set the VT to graphics mode and install an exit handler to restore the
- * original mode.
- */
-
-void igt_set_vt_graphics_mode(void)
-{
- igt_install_exit_handler(restore_vt_mode_at_exit);
-
- igt_disable_exit_handler();
- orig_vt_mode = set_vt_mode(KD_GRAPHICS);
- if (orig_vt_mode < 0)
- orig_vt_mode = -1UL;
- igt_enable_exit_handler();
-
- igt_assert(orig_vt_mode >= 0);
-}
-
-int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
- drmModeModeInfo *mode)
-{
- drmModeRes *resources;
- int i;
-
- resources = drmModeGetResources(drm_fd);
- if (!resources) {
- perror("drmModeGetResources failed");
-
- return -1;
- }
-
- if (!connector->count_modes) {
- fprintf(stderr, "no modes for connector %d\n",
- connector->connector_id);
- drmModeFreeResources(resources);
-
- return -1;
- }
-
- for (i = 0; i < connector->count_modes; i++) {
- if (i == 0 ||
- connector->modes[i].type & DRM_MODE_TYPE_PREFERRED) {
- *mode = connector->modes[i];
- if (mode->type & DRM_MODE_TYPE_PREFERRED)
- break;
- }
- }
-
- drmModeFreeResources(resources);
-
- return 0;
-}
-
-int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
- unsigned long crtc_idx_mask,
- struct kmstest_connector_config *config)
-{
- drmModeRes *resources;
- drmModeConnector *connector;
- drmModeEncoder *encoder;
- int i, j;
-
- resources = drmModeGetResources(drm_fd);
- if (!resources) {
- perror("drmModeGetResources failed");
- goto err1;
- }
-
- /* First, find the connector & mode */
- connector = drmModeGetConnector(drm_fd, connector_id);
- if (!connector)
- goto err2;
-
- if (connector->connection != DRM_MODE_CONNECTED)
- goto err3;
-
- if (!connector->count_modes) {
- fprintf(stderr, "connector %d has no modes\n", connector_id);
- goto err3;
- }
-
- if (connector->connector_id != connector_id) {
- fprintf(stderr, "connector id doesn't match (%d != %d)\n",
- connector->connector_id, connector_id);
- goto err3;
- }
-
- /*
- * Find given CRTC if crtc_id != 0 or else the first CRTC not in use.
- * In both cases find the first compatible encoder and skip the CRTC
- * if there is non such.
- */
- encoder = NULL; /* suppress GCC warning */
- for (i = 0; i < resources->count_crtcs; i++) {
- if (!resources->crtcs[i] || !(crtc_idx_mask & (1 << i)))
- continue;
-
- /* Now get a compatible encoder */
- for (j = 0; j < connector->count_encoders; j++) {
- encoder = drmModeGetEncoder(drm_fd,
- connector->encoders[j]);
-
- if (!encoder) {
- fprintf(stderr, "could not get encoder %d: %s\n",
- resources->encoders[j], strerror(errno));
-
- continue;
- }
-
- if (encoder->possible_crtcs & (1 << i))
- goto found;
-
- drmModeFreeEncoder(encoder);
- }
- }
-
- goto err3;
-
-found:
- if (kmstest_get_connector_default_mode(drm_fd, connector,
- &config->default_mode) < 0)
- goto err4;
-
- config->connector = connector;
- config->encoder = encoder;
- config->crtc = drmModeGetCrtc(drm_fd, resources->crtcs[i]);
- config->crtc_idx = i;
- config->pipe = kmstest_get_pipe_from_crtc_id(drm_fd,
- config->crtc->crtc_id);
-
- drmModeFreeResources(resources);
-
- return 0;
-err4:
- drmModeFreeEncoder(encoder);
-err3:
- drmModeFreeConnector(connector);
-err2:
- drmModeFreeResources(resources);
-err1:
- return -1;
-}
-
-void kmstest_free_connector_config(struct kmstest_connector_config *config)
-{
- drmModeFreeCrtc(config->crtc);
- drmModeFreeEncoder(config->encoder);
- drmModeFreeConnector(config->connector);
-}
-
#define PREFAULT_DEBUGFS "/sys/module/i915/parameters/prefault_disable"
static void igt_prefault_control(bool enable)
{
diff --git a/lib/drmtest.h b/lib/drmtest.h
index a9fd0bc..ce9d18d 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -34,7 +34,6 @@
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
-#include <cairo.h>
#include <setjmp.h>
#include <sys/mman.h>
@@ -322,77 +321,6 @@ void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
void igt_trash_aperture(void);
void igt_cleanup_aperture_trashers(void);
-struct kmstest_connector_config {
- drmModeCrtc *crtc;
- drmModeConnector *connector;
- drmModeEncoder *encoder;
- drmModeModeInfo default_mode;
- int crtc_idx;
- int pipe;
-};
-
-int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
- drmModeModeInfo *mode);
-int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
- unsigned long crtc_idx_mask,
- struct kmstest_connector_config *config);
-void kmstest_free_connector_config(struct kmstest_connector_config *config);
-
-/* helpers to create nice-looking framebuffers */
-struct kmstest_fb {
- uint32_t fb_id;
- uint32_t gem_handle;
- uint32_t drm_format;
- int width;
- int height;
- int depth;
- unsigned stride;
- unsigned tiling;
- unsigned size;
- cairo_t *cairo_ctx;
-};
-
-enum kmstest_text_align {
- align_left,
- align_bottom = align_left,
- align_right = 0x01,
- align_top = 0x02,
- align_vcenter = 0x04,
- align_hcenter = 0x08,
-};
-
-int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
- double yspacing, const char *fmt, ...)
- __attribute__((format (printf, 4, 5)));
-
-unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
- int depth, bool tiled,
- struct kmstest_fb *fb_info);
-unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format,
- bool tiled, struct kmstest_fb *fb);
-void kmstest_remove_fb(int fd, struct kmstest_fb *fb_info);
-cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb);
-void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
- double r, double g, double b);
-void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
- double r, double g, double b, double a);
-void kmstest_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
- int r, int g, int b);
-void kmstest_paint_test_pattern(cairo_t *cr, int width, int height);
-void kmstest_paint_image(cairo_t *cr, const char *filename,
- int dst_x, int dst_y, int dst_width, int dst_height);
-void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename);
-void kmstest_dump_mode(drmModeModeInfo *mode);
-int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
-const char *kmstest_format_str(uint32_t drm_format);
-const char *kmstest_pipe_str(int pipe);
-void kmstest_get_all_formats(const uint32_t **formats, int *format_count);
-const char *kmstest_encoder_type_str(int type);
-const char *kmstest_connector_status_str(int type);
-const char *kmstest_connector_type_str(int type);
-
-uint32_t drm_format_to_bpp(uint32_t drm_format);
-
#define do_or_die(x) igt_assert((x) == 0)
#define do_ioctl(fd, ptr, sz) igt_assert(drmIoctl((fd), (ptr), (sz)) == 0)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
new file mode 100644
index 0000000..14efea0
--- /dev/null
+++ b/lib/igt_kms.c
@@ -0,0 +1,764 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <math.h>
+#include <linux/kd.h>
+#include "drm_fourcc.h"
+
+#include "drmtest.h"
+#include "igt_kms.h"
+
+/* helpers to create nice-looking framebuffers */
+static int create_bo_for_fb(int fd, int width, int height, int bpp,
+ bool tiled, uint32_t *gem_handle_ret,
+ unsigned *size_ret, unsigned *stride_ret)
+{
+ uint32_t gem_handle;
+ int size;
+ unsigned stride;
+
+ if (tiled) {
+ int v;
+
+ /* Round the tiling up to the next power-of-two and the
+ * region up to the next pot fence size so that this works
+ * on all generations.
+ *
+ * This can still fail if the framebuffer is too large to
+ * be tiled. But then that failure is expected.
+ */
+
+ v = width * bpp / 8;
+ for (stride = 512; stride < v; stride *= 2)
+ ;
+
+ v = stride * height;
+ for (size = 1024*1024; size < v; size *= 2)
+ ;
+ } else {
+ /* Scan-out has a 64 byte alignment restriction */
+ stride = (width * (bpp / 8) + 63) & ~63;
+ size = stride * height;
+ }
+
+ gem_handle = gem_create(fd, size);
+
+ if (tiled)
+ gem_set_tiling(fd, gem_handle, I915_TILING_X, stride);
+
+ *stride_ret = stride;
+ *size_ret = size;
+ *gem_handle_ret = gem_handle;
+
+ return 0;
+}
+
+void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
+ double r, double g, double b)
+{
+ cairo_rectangle(cr, x, y, w, h);
+ cairo_set_source_rgb(cr, r, g, b);
+ cairo_fill(cr);
+}
+
+void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
+ double r, double g, double b, double a)
+{
+ cairo_rectangle(cr, x, y, w, h);
+ cairo_set_source_rgba(cr, r, g, b, a);
+ cairo_fill(cr);
+}
+
+void
+kmstest_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
+ int r, int g, int b)
+{
+ cairo_pattern_t *pat;
+
+ pat = cairo_pattern_create_linear(x, y, x + w, y + h);
+ cairo_pattern_add_color_stop_rgba(pat, 1, 0, 0, 0, 1);
+ cairo_pattern_add_color_stop_rgba(pat, 0, r, g, b, 1);
+
+ cairo_rectangle(cr, x, y, w, h);
+ cairo_set_source(cr, pat);
+ cairo_fill(cr);
+ cairo_pattern_destroy(pat);
+}
+
+static void
+paint_test_patterns(cairo_t *cr, int width, int height)
+{
+ double gr_height, gr_width;
+ int x, y;
+
+ y = height * 0.10;
+ gr_width = width * 0.75;
+ gr_height = height * 0.08;
+ x = (width / 2) - (gr_width / 2);
+
+ kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 0, 0);
+
+ y += gr_height;
+ kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 1, 0);
+
+ y += gr_height;
+ kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 0, 1);
+
+ y += gr_height;
+ kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 1, 1);
+}
+
+int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
+ double yspacing, const char *fmt, ...)
+{
+ double x, y, xofs, yofs;
+ cairo_text_extents_t extents;
+ char *text;
+ va_list ap;
+ int ret;
+
+ va_start(ap, fmt);
+ ret = vasprintf(&text, fmt, ap);
+ assert(ret >= 0);
+ va_end(ap);
+
+ cairo_text_extents(cr, text, &extents);
+
+ xofs = yofs = 0;
+ if (align & align_right)
+ xofs = -extents.width;
+ else if (align & align_hcenter)
+ xofs = -extents.width / 2;
+
+ if (align & align_top)
+ yofs = extents.height;
+ else if (align & align_vcenter)
+ yofs = extents.height / 2;
+
+ cairo_get_current_point(cr, &x, &y);
+ if (xofs || yofs)
+ cairo_rel_move_to(cr, xofs, yofs);
+
+ cairo_text_path(cr, text);
+ cairo_set_source_rgb(cr, 0, 0, 0);
+ cairo_stroke_preserve(cr);
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ cairo_fill(cr);
+
+ cairo_move_to(cr, x, y + extents.height + yspacing);
+
+ free(text);
+
+ return extents.width;
+}
+
+static void
+paint_marker(cairo_t *cr, int x, int y)
+{
+ enum kmstest_text_align align;
+ int xoff, yoff;
+
+ cairo_move_to(cr, x, y - 20);
+ cairo_line_to(cr, x, y + 20);
+ cairo_move_to(cr, x - 20, y);
+ cairo_line_to(cr, x + 20, y);
+ cairo_new_sub_path(cr);
+ cairo_arc(cr, x, y, 10, 0, M_PI * 2);
+ cairo_set_line_width(cr, 4);
+ cairo_set_source_rgb(cr, 0, 0, 0);
+ cairo_stroke_preserve(cr);
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ cairo_set_line_width(cr, 2);
+ cairo_stroke(cr);
+
+ xoff = x ? -20 : 20;
+ align = x ? align_right : align_left;
+
+ yoff = y ? -20 : 20;
+ align |= y ? align_bottom : align_top;
+
+ cairo_move_to(cr, x + xoff, y + yoff);
+ cairo_set_font_size(cr, 18);
+ kmstest_cairo_printf_line(cr, align, 0, "(%d, %d)", x, y);
+}
+
+void kmstest_paint_test_pattern(cairo_t *cr, int width, int height)
+{
+ paint_test_patterns(cr, width, height);
+
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
+
+ /* Paint corner markers */
+ paint_marker(cr, 0, 0);
+ paint_marker(cr, width, 0);
+ paint_marker(cr, 0, height);
+ paint_marker(cr, width, height);
+
+ assert(!cairo_status(cr));
+}
+
+void kmstest_paint_image(cairo_t *cr, const char *filename,
+ int dst_x, int dst_y, int dst_width, int dst_height)
+{
+ cairo_surface_t *image;
+ int img_width, img_height;
+ double scale_x, scale_y;
+
+ image = cairo_image_surface_create_from_png(filename);
+ assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
+
+ img_width = cairo_image_surface_get_width(image);
+ img_height = cairo_image_surface_get_height(image);
+
+ scale_x = (double)dst_width / img_width;
+ scale_y = (double)dst_height / img_height;
+
+ cairo_save(cr);
+
+ cairo_translate(cr, dst_x, dst_y);
+ cairo_scale(cr, scale_x, scale_y);
+ cairo_set_source_surface(cr, image, 0, 0);
+ cairo_paint(cr);
+
+ cairo_surface_destroy(image);
+
+ cairo_restore(cr);
+}
+
+#define DF(did, cid, _bpp, _depth) \
+ { DRM_FORMAT_##did, CAIRO_FORMAT_##cid, # did, _bpp, _depth }
+static struct format_desc_struct {
+ uint32_t drm_id;
+ cairo_format_t cairo_id;
+ const char *name;
+ int bpp;
+ int depth;
+} format_desc[] = {
+ DF(RGB565, RGB16_565, 16, 16),
+ DF(RGB888, INVALID, 24, 24),
+ DF(XRGB8888, RGB24, 32, 24),
+ DF(XRGB2101010, RGB30, 32, 30),
+ DF(ARGB8888, ARGB32, 32, 32),
+};
+#undef DF
+
+#define for_each_format(f) \
+ for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++)
+
+static uint32_t bpp_depth_to_drm_format(int bpp, int depth)
+{
+ struct format_desc_struct *f;
+
+ for_each_format(f)
+ if (f->bpp == bpp && f->depth == depth)
+ return f->drm_id;
+
+ abort();
+}
+
+/* Return fb_id on success, 0 on error */
+unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
+ int depth, bool tiled, struct kmstest_fb *fb)
+{
+ memset(fb, 0, sizeof(*fb));
+
+ if (create_bo_for_fb(fd, width, height, bpp, tiled, &fb->gem_handle,
+ &fb->size, &fb->stride) < 0)
+ return 0;
+
+ if (drmModeAddFB(fd, width, height, depth, bpp, fb->stride,
+ fb->gem_handle, &fb->fb_id) < 0) {
+ gem_close(fd, fb->gem_handle);
+
+ return 0;
+ }
+
+ fb->width = width;
+ fb->height = height;
+ fb->tiling = tiled;
+ fb->drm_format = bpp_depth_to_drm_format(bpp, depth);
+
+ return fb->fb_id;
+}
+
+uint32_t drm_format_to_bpp(uint32_t drm_format)
+{
+ struct format_desc_struct *f;
+
+ for_each_format(f)
+ if (f->drm_id == drm_format)
+ return f->bpp;
+
+ abort();
+}
+
+unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format,
+ bool tiled, struct kmstest_fb *fb)
+{
+ uint32_t handles[4];
+ uint32_t pitches[4];
+ uint32_t offsets[4];
+ uint32_t fb_id;
+ int bpp;
+ int ret;
+
+ memset(fb, 0, sizeof(*fb));
+
+ bpp = drm_format_to_bpp(format);
+ ret = create_bo_for_fb(fd, width, height, bpp, tiled, &fb->gem_handle,
+ &fb->size, &fb->stride);
+ if (ret < 0)
+ return ret;
+
+ memset(handles, 0, sizeof(handles));
+ handles[0] = fb->gem_handle;
+ memset(pitches, 0, sizeof(pitches));
+ pitches[0] = fb->stride;
+ memset(offsets, 0, sizeof(offsets));
+ if (drmModeAddFB2(fd, width, height, format, handles, pitches,
+ offsets, &fb_id, 0) < 0) {
+ gem_close(fd, fb->gem_handle);
+
+ return 0;
+ }
+
+ fb->width = width;
+ fb->height = height;
+ fb->tiling = tiled;
+ fb->drm_format = format;
+ fb->fb_id = fb_id;
+
+ return fb_id;
+}
+
+static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
+{
+ struct format_desc_struct *f;
+
+ for_each_format(f)
+ if (f->drm_id == drm_format)
+ return f->cairo_id;
+
+ abort();
+}
+
+static cairo_surface_t *create_image_surface(int fd, struct kmstest_fb *fb)
+{
+ cairo_surface_t *surface;
+ cairo_format_t cformat;
+ void *fb_ptr;
+
+ cformat = drm_format_to_cairo(fb->drm_format);
+ fb_ptr = gem_mmap(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE);
+ surface = cairo_image_surface_create_for_data((unsigned char *)fb_ptr,
+ cformat, fb->width,
+ fb->height, fb->stride);
+ assert(surface);
+
+ return surface;
+}
+
+static cairo_t *create_cairo_ctx(int fd, struct kmstest_fb *fb)
+{
+ cairo_t *cr;
+ cairo_surface_t *surface;
+
+ surface = create_image_surface(fd, fb);
+ cr = cairo_create(surface);
+ cairo_surface_destroy(surface);
+
+ return cr;
+}
+
+void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename)
+{
+ cairo_surface_t *surface;
+ cairo_status_t status;
+
+ surface = create_image_surface(fd, fb);
+ status = cairo_surface_write_to_png(surface, filename);
+ assert(status == CAIRO_STATUS_SUCCESS);
+ cairo_surface_destroy(surface);
+}
+
+cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb)
+{
+
+ if (!fb->cairo_ctx)
+ fb->cairo_ctx = create_cairo_ctx(fd, fb);
+
+ gem_set_domain(fd, fb->gem_handle, I915_GEM_DOMAIN_CPU,
+ I915_GEM_DOMAIN_CPU);
+
+ return fb->cairo_ctx;
+}
+
+void kmstest_remove_fb(int fd, struct kmstest_fb *fb)
+{
+ if (fb->cairo_ctx)
+ cairo_destroy(fb->cairo_ctx);
+ do_or_die(drmModeRmFB(fd, fb->fb_id));
+ gem_close(fd, fb->gem_handle);
+}
+
+const char *kmstest_format_str(uint32_t drm_format)
+{
+ struct format_desc_struct *f;
+
+ for_each_format(f)
+ if (f->drm_id == drm_format)
+ return f->name;
+
+ return "invalid";
+}
+
+const char *kmstest_pipe_str(int pipe)
+{
+ const char *str[] = { "A", "B", "C" };
+
+ if (pipe > 2)
+ return "invalid";
+
+ return str[pipe];
+}
+
+void kmstest_get_all_formats(const uint32_t **formats, int *format_count)
+{
+ static uint32_t *drm_formats;
+
+ if (!drm_formats) {
+ struct format_desc_struct *f;
+ uint32_t *format;
+
+ drm_formats = calloc(ARRAY_SIZE(format_desc),
+ sizeof(*drm_formats));
+ format = &drm_formats[0];
+ for_each_format(f)
+ *format++ = f->drm_id;
+ }
+
+ *formats = drm_formats;
+ *format_count = ARRAY_SIZE(format_desc);
+}
+
+struct type_name {
+ int type;
+ const char *name;
+};
+
+#define type_name_fn(res) \
+const char * kmstest_##res##_str(int type) { \
+ unsigned int i; \
+ for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \
+ if (res##_names[i].type == type) \
+ return res##_names[i].name; \
+ } \
+ return "(invalid)"; \
+}
+
+struct type_name encoder_type_names[] = {
+ { DRM_MODE_ENCODER_NONE, "none" },
+ { DRM_MODE_ENCODER_DAC, "DAC" },
+ { DRM_MODE_ENCODER_TMDS, "TMDS" },
+ { DRM_MODE_ENCODER_LVDS, "LVDS" },
+ { DRM_MODE_ENCODER_TVDAC, "TVDAC" },
+};
+
+type_name_fn(encoder_type)
+
+struct type_name connector_status_names[] = {
+ { DRM_MODE_CONNECTED, "connected" },
+ { DRM_MODE_DISCONNECTED, "disconnected" },
+ { DRM_MODE_UNKNOWNCONNECTION, "unknown" },
+};
+
+type_name_fn(connector_status)
+
+struct type_name connector_type_names[] = {
+ { DRM_MODE_CONNECTOR_Unknown, "unknown" },
+ { DRM_MODE_CONNECTOR_VGA, "VGA" },
+ { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
+ { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
+ { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
+ { DRM_MODE_CONNECTOR_Composite, "composite" },
+ { DRM_MODE_CONNECTOR_SVIDEO, "s-video" },
+ { DRM_MODE_CONNECTOR_LVDS, "LVDS" },
+ { DRM_MODE_CONNECTOR_Component, "component" },
+ { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
+ { DRM_MODE_CONNECTOR_DisplayPort, "DP" },
+ { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
+ { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
+ { DRM_MODE_CONNECTOR_TV, "TV" },
+ { DRM_MODE_CONNECTOR_eDP, "eDP" },
+};
+
+type_name_fn(connector_type)
+
+static const char *mode_stereo_name(const drmModeModeInfo *mode)
+{
+ switch (mode->flags & DRM_MODE_FLAG_3D_MASK) {
+ case DRM_MODE_FLAG_3D_FRAME_PACKING:
+ return "FP";
+ case DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE:
+ return "FA";
+ case DRM_MODE_FLAG_3D_LINE_ALTERNATIVE:
+ return "LA";
+ case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL:
+ return "SBSF";
+ case DRM_MODE_FLAG_3D_L_DEPTH:
+ return "LD";
+ case DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH:
+ return "LDGFX";
+ case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
+ return "TB";
+ case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
+ return "SBSH";
+ default:
+ return NULL;
+ }
+}
+
+void kmstest_dump_mode(drmModeModeInfo *mode)
+{
+ const char *stereo = mode_stereo_name(mode);
+
+ printf(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s\n",
+ mode->name,
+ mode->vrefresh,
+ mode->hdisplay,
+ mode->hsync_start,
+ mode->hsync_end,
+ mode->htotal,
+ mode->vdisplay,
+ mode->vsync_start,
+ mode->vsync_end,
+ mode->vtotal,
+ mode->flags,
+ mode->type,
+ mode->clock,
+ stereo ? " (3D:" : "",
+ stereo ? stereo : "",
+ stereo ? ")" : "");
+ fflush(stdout);
+}
+
+int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id)
+{
+ struct drm_i915_get_pipe_from_crtc_id pfci;
+ int ret;
+
+ memset(&pfci, 0, sizeof(pfci));
+ pfci.crtc_id = crtc_id;
+ ret = drmIoctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &pfci);
+ igt_assert(ret == 0);
+
+ return pfci.pipe;
+}
+
+static signed long set_vt_mode(unsigned long mode)
+{
+ int fd;
+ unsigned long prev_mode;
+
+ fd = open("/dev/tty0", O_RDONLY);
+ if (fd < 0)
+ return -errno;
+
+ prev_mode = 0;
+ if (drmIoctl(fd, KDGETMODE, &prev_mode))
+ goto err;
+ if (drmIoctl(fd, KDSETMODE, (void *)mode))
+ goto err;
+
+ close(fd);
+
+ return prev_mode;
+err:
+ close(fd);
+
+ return -errno;
+}
+
+static unsigned long orig_vt_mode = -1UL;
+
+static void restore_vt_mode_at_exit(int sig)
+{
+ if (orig_vt_mode != -1UL)
+ set_vt_mode(orig_vt_mode);
+}
+
+/*
+ * Set the VT to graphics mode and install an exit handler to restore the
+ * original mode.
+ */
+
+void igt_set_vt_graphics_mode(void)
+{
+ igt_install_exit_handler(restore_vt_mode_at_exit);
+
+ igt_disable_exit_handler();
+ orig_vt_mode = set_vt_mode(KD_GRAPHICS);
+ if (orig_vt_mode < 0)
+ orig_vt_mode = -1UL;
+ igt_enable_exit_handler();
+
+ igt_assert(orig_vt_mode >= 0);
+}
+
+int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
+ drmModeModeInfo *mode)
+{
+ drmModeRes *resources;
+ int i;
+
+ resources = drmModeGetResources(drm_fd);
+ if (!resources) {
+ perror("drmModeGetResources failed");
+
+ return -1;
+ }
+
+ if (!connector->count_modes) {
+ fprintf(stderr, "no modes for connector %d\n",
+ connector->connector_id);
+ drmModeFreeResources(resources);
+
+ return -1;
+ }
+
+ for (i = 0; i < connector->count_modes; i++) {
+ if (i == 0 ||
+ connector->modes[i].type & DRM_MODE_TYPE_PREFERRED) {
+ *mode = connector->modes[i];
+ if (mode->type & DRM_MODE_TYPE_PREFERRED)
+ break;
+ }
+ }
+
+ drmModeFreeResources(resources);
+
+ return 0;
+}
+
+int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
+ unsigned long crtc_idx_mask,
+ struct kmstest_connector_config *config)
+{
+ drmModeRes *resources;
+ drmModeConnector *connector;
+ drmModeEncoder *encoder;
+ int i, j;
+
+ resources = drmModeGetResources(drm_fd);
+ if (!resources) {
+ perror("drmModeGetResources failed");
+ goto err1;
+ }
+
+ /* First, find the connector & mode */
+ connector = drmModeGetConnector(drm_fd, connector_id);
+ if (!connector)
+ goto err2;
+
+ if (connector->connection != DRM_MODE_CONNECTED)
+ goto err3;
+
+ if (!connector->count_modes) {
+ fprintf(stderr, "connector %d has no modes\n", connector_id);
+ goto err3;
+ }
+
+ if (connector->connector_id != connector_id) {
+ fprintf(stderr, "connector id doesn't match (%d != %d)\n",
+ connector->connector_id, connector_id);
+ goto err3;
+ }
+
+ /*
+ * Find given CRTC if crtc_id != 0 or else the first CRTC not in use.
+ * In both cases find the first compatible encoder and skip the CRTC
+ * if there is non such.
+ */
+ encoder = NULL; /* suppress GCC warning */
+ for (i = 0; i < resources->count_crtcs; i++) {
+ if (!resources->crtcs[i] || !(crtc_idx_mask & (1 << i)))
+ continue;
+
+ /* Now get a compatible encoder */
+ for (j = 0; j < connector->count_encoders; j++) {
+ encoder = drmModeGetEncoder(drm_fd,
+ connector->encoders[j]);
+
+ if (!encoder) {
+ fprintf(stderr, "could not get encoder %d: %s\n",
+ resources->encoders[j], strerror(errno));
+
+ continue;
+ }
+
+ if (encoder->possible_crtcs & (1 << i))
+ goto found;
+
+ drmModeFreeEncoder(encoder);
+ }
+ }
+
+ goto err3;
+
+found:
+ if (kmstest_get_connector_default_mode(drm_fd, connector,
+ &config->default_mode) < 0)
+ goto err4;
+
+ config->connector = connector;
+ config->encoder = encoder;
+ config->crtc = drmModeGetCrtc(drm_fd, resources->crtcs[i]);
+ config->crtc_idx = i;
+ config->pipe = kmstest_get_pipe_from_crtc_id(drm_fd,
+ config->crtc->crtc_id);
+
+ drmModeFreeResources(resources);
+
+ return 0;
+err4:
+ drmModeFreeEncoder(encoder);
+err3:
+ drmModeFreeConnector(connector);
+err2:
+ drmModeFreeResources(resources);
+err1:
+ return -1;
+}
+
+void kmstest_free_connector_config(struct kmstest_connector_config *config)
+{
+ drmModeFreeCrtc(config->crtc);
+ drmModeFreeEncoder(config->encoder);
+ drmModeFreeConnector(config->connector);
+}
+
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
new file mode 100644
index 0000000..f61f8e5
--- /dev/null
+++ b/lib/igt_kms.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __IGT_KMS_H__
+#define __IGT_KMS_H__
+
+#include <cairo.h>
+
+struct kmstest_connector_config {
+ drmModeCrtc *crtc;
+ drmModeConnector *connector;
+ drmModeEncoder *encoder;
+ drmModeModeInfo default_mode;
+ int crtc_idx;
+ int pipe;
+};
+
+int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
+ drmModeModeInfo *mode);
+int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
+ unsigned long crtc_idx_mask,
+ struct kmstest_connector_config *config);
+void kmstest_free_connector_config(struct kmstest_connector_config *config);
+
+/* helpers to create nice-looking framebuffers */
+struct kmstest_fb {
+ uint32_t fb_id;
+ uint32_t gem_handle;
+ uint32_t drm_format;
+ int width;
+ int height;
+ int depth;
+ unsigned stride;
+ unsigned tiling;
+ unsigned size;
+ cairo_t *cairo_ctx;
+};
+
+enum kmstest_text_align {
+ align_left,
+ align_bottom = align_left,
+ align_right = 0x01,
+ align_top = 0x02,
+ align_vcenter = 0x04,
+ align_hcenter = 0x08,
+};
+
+int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
+ double yspacing, const char *fmt, ...)
+ __attribute__((format (printf, 4, 5)));
+
+unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
+ int depth, bool tiled,
+ struct kmstest_fb *fb_info);
+unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format,
+ bool tiled, struct kmstest_fb *fb);
+void kmstest_remove_fb(int fd, struct kmstest_fb *fb_info);
+cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb);
+void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
+ double r, double g, double b);
+void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
+ double r, double g, double b, double a);
+void kmstest_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
+ int r, int g, int b);
+void kmstest_paint_test_pattern(cairo_t *cr, int width, int height);
+void kmstest_paint_image(cairo_t *cr, const char *filename,
+ int dst_x, int dst_y, int dst_width, int dst_height);
+void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename);
+void kmstest_dump_mode(drmModeModeInfo *mode);
+int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
+const char *kmstest_format_str(uint32_t drm_format);
+const char *kmstest_pipe_str(int pipe);
+void kmstest_get_all_formats(const uint32_t **formats, int *format_count);
+const char *kmstest_encoder_type_str(int type);
+const char *kmstest_connector_status_str(int type);
+const char *kmstest_connector_type_str(int type);
+
+uint32_t drm_format_to_bpp(uint32_t drm_format);
+
+#endif /* __IGT_KMS_H__ */
+
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 2c9ca35..4ecc9c8 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -33,6 +33,7 @@
#include "drmtest.h"
#include "igt_debugfs.h"
+#include "igt_kms.h"
enum cursor_type {
WHITE_VISIBLE,
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 10d8ae0..daaed8e 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -40,6 +40,7 @@
#include "drmtest.h"
#include "testdisplay.h"
#include "rendercopy.h"
+#include "igt_kms.h"
#define TEST_DPMS (1 << 0)
#define TEST_WITH_DUMMY_BCS (1 << 1)
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 2545233..3bc9eb0 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -31,6 +31,7 @@
#include "drmtest.h"
#include "igt_debugfs.h"
+#include "igt_kms.h"
typedef struct {
struct kmstest_connector_config config;
diff --git a/tests/kms_render.c b/tests/kms_render.c
index dc00932..055ebbb 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -36,6 +36,7 @@
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"
+#include "igt_kms.h"
drmModeRes *resources;
int drm_fd;
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 6bc7db1..3d18fc7 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -38,6 +38,7 @@
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"
+#include "igt_kms.h"
#define MAX_CONNECTORS 10
#define MAX_CRTCS 3
diff --git a/tests/pm_pc8.c b/tests/pm_pc8.c
index cddb11b..e17be1b 100644
--- a/tests/pm_pc8.c
+++ b/tests/pm_pc8.c
@@ -45,6 +45,7 @@
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"
#include "i915_drm.h"
+#include "igt_kms.h"
#define MSR_PC8_RES 0x630
#define MSR_PC9_RES 0x631
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index fd172f3..dd9e56d 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -65,6 +65,7 @@
#include "i915_drm.h"
#include "drmtest.h"
#include "testdisplay.h"
+#include "igt_kms.h"
#include <stdlib.h>
#include <signal.h>
--
1.7.9.5
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 05/11] rendercopy: Remove rendercopy.c
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (3 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 04/11] lib: Move kms stuff from drmtest.c over to igt_kms.c oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 06/11] tests/drm_get_client_auth: In Android, use gettid() instead of syscall(SYS_gettid) oscar.mateo
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
Move scratch_buf_write_to_png() to its only user, gem_render_copy.c.
This makes the cairo dependencies easier to handle from the Android
perspective, but if there is a good reason why this file exists I can
try to handle it differently.
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
lib/Makefile.sources | 1 -
lib/rendercopy.c | 49 -----------------------------------------------
lib/rendercopy.h | 2 --
tests/gem_render_copy.c | 21 ++++++++++++++++++++
4 files changed, 21 insertions(+), 52 deletions(-)
delete mode 100644 lib/rendercopy.c
diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index 78e2034..699621b 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -28,7 +28,6 @@ libintel_tools_la_SOURCES = \
rendercopy_gen7.c \
rendercopy_gen8.c \
rendercopy.h \
- rendercopy.c \
intel_reg_map.c \
intel_dpio.c \
intel_iosf.c \
diff --git a/lib/rendercopy.c b/lib/rendercopy.c
deleted file mode 100644
index 2c1684d..0000000
--- a/lib/rendercopy.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- * Damien Lespiau <damien.lespiau@intel.com>
- */
-
-#include <cairo.h>
-
-#include "rendercopy.h"
-
-void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filename)
-{
- cairo_surface_t *surface;
- cairo_status_t ret;
-
- drm_intel_bo_map(buf->bo, 0);
- surface = cairo_image_surface_create_for_data(buf->bo->virtual,
- CAIRO_FORMAT_RGB24,
- buf_width(buf),
- buf_height(buf),
- buf->stride);
- ret = cairo_surface_write_to_png(surface, filename);
- if (ret != CAIRO_STATUS_SUCCESS) {
- fprintf(stderr, "%s: %s\n", __func__,
- cairo_status_to_string(ret));
- }
- cairo_surface_destroy(surface);
- drm_intel_bo_unmap(buf->bo);
-}
diff --git a/lib/rendercopy.h b/lib/rendercopy.h
index 4605264..f726df6 100644
--- a/lib/rendercopy.h
+++ b/lib/rendercopy.h
@@ -89,6 +89,4 @@ void gen2_render_copyfunc(struct intel_batchbuffer *batch,
unsigned width, unsigned height,
struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
-void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filename);
-
#endif /* RENDERCOPY_H */
diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index e481733..ed49622 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <unistd.h>
+#include <cairo.h>
#include "rendercopy.h"
@@ -49,6 +50,26 @@ typedef struct {
uint32_t linear[WIDTH * HEIGHT];
} data_t;
+static void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filename)
+{
+ cairo_surface_t *surface;
+ cairo_status_t ret;
+
+ drm_intel_bo_map(buf->bo, 0);
+ surface = cairo_image_surface_create_for_data(buf->bo->virtual,
+ CAIRO_FORMAT_RGB24,
+ buf_width(buf),
+ buf_height(buf),
+ buf->stride);
+ ret = cairo_surface_write_to_png(surface, filename);
+ if (ret != CAIRO_STATUS_SUCCESS) {
+ fprintf(stderr, "%s: %s\n", __func__,
+ cairo_status_to_string(ret));
+ }
+ cairo_surface_destroy(surface);
+ drm_intel_bo_unmap(buf->bo);
+}
+
static void scratch_buf_init(data_t *data, struct scratch_buf *buf,
int width, int height, int stride, uint32_t color)
{
--
1.7.9.5
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 06/11] tests/drm_get_client_auth: In Android, use gettid() instead of syscall(SYS_gettid)
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (4 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 05/11] rendercopy: Remove rendercopy.c oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 07/11] tests/gem_vmap_blits: Finish extracting gem_read oscar.mateo
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
tests/drm_get_client_auth.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/drm_get_client_auth.c b/tests/drm_get_client_auth.c
index 28e1b3d..2f493f9 100644
--- a/tests/drm_get_client_auth.c
+++ b/tests/drm_get_client_auth.c
@@ -47,9 +47,13 @@
static bool
is_local_tid(pid_t tid)
{
- /* On Linux systems, drmGetClient() would return the thread ID
- instead of the actual process ID */
- return syscall(SYS_gettid) == tid;
+#ifndef ANDROID
+ /* On Linux systems, drmGetClient() would return the thread ID
+ instead of the actual process ID */
+ return syscall(SYS_gettid) == tid;
+#else
+ return gettid() == tid;
+#endif
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 07/11] tests/gem_vmap_blits: Finish extracting gem_read
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (5 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 06/11] tests/drm_get_client_auth: In Android, use gettid() instead of syscall(SYS_gettid) oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 08/11] build: Fix assorted compilation warnings oscar.mateo
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
It seems something escaped this commit:
commit bd5cf9a07d17ce91dfaa3aa12d3f2c93815f0489
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Tue Jan 10 15:37:53 2012 +0100
lib/drmtest: extract gem_read
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
tests/gem_vmap_blits.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/tests/gem_vmap_blits.c b/tests/gem_vmap_blits.c
index 3e8e458..8dd8c61 100644
--- a/tests/gem_vmap_blits.c
+++ b/tests/gem_vmap_blits.c
@@ -87,20 +87,6 @@ static void gem_vmap_sync(int fd, uint32_t handle)
}
static void
-gem_read(int fd, uint32_t handle, int offset, int size, void *buf)
-{
- struct drm_i915_gem_pread pread;
- int ret;
-
- pread.handle = handle;
- pread.offset = offset;
- pread.size = size;
- pread.data_ptr = (uintptr_t)buf;
- ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &pread);
- igt_assert(ret == 0);
-}
-
-static void
copy(int fd, uint32_t dst, uint32_t src)
{
uint32_t batch[10];
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 08/11] build: Fix assorted compilation warnings
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (6 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 07/11] tests/gem_vmap_blits: Finish extracting gem_read oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 09/11] lib/drmtest: Get the correct basename() under Android oscar.mateo
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 4091 bytes --]
From: Oscar Mateo <oscar.mateo@intel.com>
As these files are compiled for every test, the warnings cluttered
the Android build completely.
v2: As suggested by Daniel Vetter, drop some of the fixes and fix
the compilation flags instead.
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
lib/drmtest.c | 6 +++---
lib/drmtest.h | 4 ++--
lib/intel_batchbuffer.h | 2 +-
lib/intel_gpu_tools.h | 2 +-
lib/intel_reg_map.c | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 38463f8..44fd30e 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -306,7 +306,7 @@ int drm_open_any_render(void)
return fd;
}
-int __gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
+int __gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride)
{
struct drm_i915_gem_set_tiling st;
int ret;
@@ -326,7 +326,7 @@ int __gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
return 0;
}
-void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride)
+void gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride)
{
igt_assert(__gem_set_tiling(fd, handle, tiling, stride) == 0);
}
@@ -654,7 +654,7 @@ off_t prime_get_size(int dma_buf_fd)
/* signal interrupt helpers */
static bool igt_only_list_subtests(void);
-static int exit_handler_count;
+static unsigned int exit_handler_count;
static struct igt_helper_process signal_helper;
long long int sig_stat;
diff --git a/lib/drmtest.h b/lib/drmtest.h
index ce9d18d..5295a7b 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -54,8 +54,8 @@ int drm_open_any_render(void);
void gem_quiescent_gpu(int fd);
/* ioctl wrappers and similar stuff for bare metal testing */
-void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride);
-int __gem_set_tiling(int fd, uint32_t handle, int tiling, int stride);
+void gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride);
+int __gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride);
bool gem_has_enable_ring(int fd,int param);
bool gem_has_bsd(int fd);
bool gem_has_blt(int fd);
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index a799969..11b7e6e 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -47,7 +47,7 @@ void intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
* work...
*/
#pragma GCC diagnostic ignored "-Winline"
-static inline int
+static inline unsigned int
intel_batchbuffer_space(struct intel_batchbuffer *batch)
{
return (BATCH_SZ - BATCH_RESERVED) - (batch->ptr - batch->buffer);
diff --git a/lib/intel_gpu_tools.h b/lib/intel_gpu_tools.h
index faa948c..412e465 100644
--- a/lib/intel_gpu_tools.h
+++ b/lib/intel_gpu_tools.h
@@ -74,7 +74,7 @@ struct intel_register_map {
uint32_t alignment_mask;
};
struct intel_register_map intel_get_register_map(uint32_t devid);
-struct intel_register_range *intel_get_register_range(struct intel_register_map map, uint32_t offset, int mode);
+struct intel_register_range *intel_get_register_range(struct intel_register_map map, uint32_t offset, uint32_t mode);
static inline uint32_t
diff --git a/lib/intel_reg_map.c b/lib/intel_reg_map.c
index 0c8d49c..26ddd06 100644
--- a/lib/intel_reg_map.c
+++ b/lib/intel_reg_map.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2011 Intel Corporation
+ * Copyright © 2011 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -151,7 +151,7 @@ intel_get_register_map(uint32_t devid)
}
struct intel_register_range *
-intel_get_register_range(struct intel_register_map map, uint32_t offset, int mode)
+intel_get_register_range(struct intel_register_map map, uint32_t offset, uint32_t mode)
{
struct intel_register_range *range = map.map;
uint32_t align = map.alignment_mask;
--
1.7.9.5
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 09/11] lib/drmtest: Get the correct basename() under Android
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (7 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 08/11] build: Fix assorted compilation warnings oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 10/11] lib/igt_display: workaround a name conflict in Android oscar.mateo
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
lib/drmtest.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 44fd30e..75f49cd 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -26,7 +26,11 @@
*
*/
+#ifndef ANDROID
#define _GNU_SOURCE
+#else
+#include <libgen.h>
+#endif
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -1007,7 +1011,7 @@ static bool run_under_gdb(void)
sprintf(buf, "/proc/%d/exe", getppid());
return (readlink (buf, buf, sizeof (buf)) != -1 &&
- strncmp (basename (buf), "gdb", 3) == 0);
+ strncmp(basename(buf), "gdb", 3) == 0);
}
void __igt_fail_assert(int exitcode, const char *file,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 10/11] lib/igt_display: workaround a name conflict in Android
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (8 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 09/11] lib/drmtest: Get the correct basename() under Android oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:50 ` [PATCH v2 11/11] build: New Android makefiles oscar.mateo
2013-11-12 11:55 ` [PATCH v2 00/11] Android build sytem Daniel Vetter
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
PLANE_A/PLANE_B are used by libdrm's i915_drm.h in Android.
v2: Changes suggested by Daniel Vetter and Damien Lespiau:
- Pimp up comment with a FIXME.
- Reword commit message.
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
lib/igt_display.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/igt_display.h b/lib/igt_display.h
index 1357ce9..84638b2 100644
--- a/lib/igt_display.h
+++ b/lib/igt_display.h
@@ -33,6 +33,10 @@ enum pipe {
};
#define pipe_name(p) ((p) + 'A')
+/* FIXME: i915_drm.h on Android pollutes the general namespace. */
+#undef PLANE_A
+#undef PLANE_B
+
enum plane {
PLANE_A = 0,
PLANE_B,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 11/11] build: New Android makefiles
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (9 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 10/11] lib/igt_display: workaround a name conflict in Android oscar.mateo
@ 2013-11-12 11:50 ` oscar.mateo
2013-11-12 11:55 ` [PATCH v2 00/11] Android build sytem Daniel Vetter
11 siblings, 0 replies; 13+ messages in thread
From: oscar.mateo @ 2013-11-12 11:50 UTC (permalink / raw)
To: intel-gfx
From: Oscar Mateo <oscar.mateo@intel.com>
These form the basis of the new Android build system.
v2: As suggested by Daniel Vetter, modify compilation flags to
not error on return-type and not warn on sign-compare.
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
Android.mk | 530 +-----------------------------------------------------
tests/Android.mk | 77 ++++++++
tools/Android.mk | 70 ++++++++
3 files changed, 149 insertions(+), 528 deletions(-)
create mode 100644 tests/Android.mk
create mode 100644 tools/Android.mk
diff --git a/Android.mk b/Android.mk
index 3be3462..7b42d10 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,531 +1,5 @@
LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
- tools/intel_reg_write.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_reg_map.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-LOCAL_MODULE := intel_reg_write
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_reg_read.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_reg_map.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_reg_read
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_disable_clock_gating.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_disable_clock_gating
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_audio_dump.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_audio_dump
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_backlight.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_backlight
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_bios_dumper.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_bios_dumper
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_bios_reader.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_bios_reader
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-# Disabling intel_error_decode tool, since Android still does not have libdrm2.4.30
-#================
-#include $(CLEAR_VARS)
-#
-#LOCAL_SRC_FILES := \
-# tools/intel_error_decode.c \
-# lib/intel_pci.c \
-# lib/intel_gpu_tools.h \
-# tools/intel_reg.h \
-# lib/intel_batchbuffer.h \
-# lib/intel_batchbuffer.c \
-# lib/intel_mmio.c \
-# tools/intel_chipset.h \
-# lib/instdone.h \
-# lib/instdone.c \
-# tools/intel_decode.h \
-# lib/intel_drm.c
-#
-#
-#LOCAL_C_INCLUDES += \
-# $(LOCAL_PATH)/lib \
-# $(TOPDIR)hardware/intel/libdrm/include/drm \
-# $(TOPDIR)hardware/intel/libdrm/intel \
-# $(LOCAL_PATH)/../libpciaccess/include/
-#
-#LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-#LOCAL_CFLAGS += -DANDROID
-#LOCAL_CFLAGS += -std=c99
-#
-#
-#LOCAL_MODULE := intel_error_decode
-#LOCAL_MODULE_TAGS := optional
-#
-#LOCAL_SHARED_LIBRARIES := libpciaccess \
-# libdrm \
-# libdrm_intel
-#
-#include $(BUILD_EXECUTABLE)
-#
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_gpu_top.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h \
- lib/instdone.h \
- lib/instdone.c \
- lib/intel_reg_map.c
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_gpu_top
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_gpu_time.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_gpu_time
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_gtt.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-
-LOCAL_MODULE := intel_gtt
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_stepping.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_stepping
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_reg_dumper.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_reg_dumper
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/intel_reg_snapshot.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-
-LOCAL_MODULE := intel_reg_snapshot
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- tools/forcewaked.c \
- lib/intel_pci.c \
- lib/intel_gpu_tools.h \
- tools/intel_reg.h \
- lib/intel_batchbuffer.h \
- lib/intel_batchbuffer.c \
- lib/intel_mmio.c \
- tools/intel_chipset.h \
- lib/intel_reg_map.c \
- lib/intel_drm.c
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := forcewaked
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess \
- libdrm \
- libdrm_intel
-
-include $(BUILD_EXECUTABLE)
-
-#================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- lib/intel_gpu_tools.h \
- tools/intel_reg_checker.c \
- lib/intel_pci.c \
- lib/intel_mmio.c
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/lib \
- $(TOPDIR)hardware/intel/libdrm/include/drm \
- $(TOPDIR)hardware/intel/libdrm/intel \
- $(LOCAL_PATH)/../libpciaccess/include/
-
-LOCAL_CFLAGS += -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-LOCAL_CFLAGS += -DANDROID
-
-
-LOCAL_MODULE := intel_reg_checker
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libpciaccess
-
-include $(BUILD_EXECUTABLE)
+include $(LOCAL_PATH)/tests/Android.mk
+include $(LOCAL_PATH)/tools/Android.mk
diff --git a/tests/Android.mk b/tests/Android.mk
new file mode 100644
index 0000000..1bd3d21
--- /dev/null
+++ b/tests/Android.mk
@@ -0,0 +1,77 @@
+include $(LOCAL_PATH)/tests/Makefile.sources
+include $(LOCAL_PATH)/lib/Makefile.sources
+
+LIBPCIACCESS_PATH := $(firstword $(wildcard \
+ $(TOP)/external/PRIVATE/libpciaccess \
+ $(TOP)/hardware/intel/libpciaccess \
+ $(TOP)/external/libpciaccess))
+ifeq ($(LIBPCIACCESS_PATH),)
+ $(error "Unable to find libpciaccess!")
+endif
+
+LIBDRM_PATH := $(firstword $(wildcard \
+ $(TOP)/external/PRIVATE/drm \
+ $(TOP)/external/drm))
+ifeq ($(LIBDRM_PATH),)
+ $(error "Unable to find libdrm!")
+endif
+
+skip_lib_list := \
+ igt_kms.c \
+ igt_kms.h
+
+lib_list := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES))
+LIB_SOURCES := $(addprefix lib/,$(lib_list))
+
+#================#
+
+define add_test
+ include $(CLEAR_VARS)
+
+ LOCAL_SRC_FILES := \
+ tests/$1.c \
+ $(LIB_SOURCES)
+
+
+ LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/lib \
+ $(LIBDRM_PATH)/include/drm \
+ $(LIBDRM_PATH)/intel \
+ $(LIBPCIACCESS_PATH)/include
+
+ LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM
+ LOCAL_CFLAGS += -DANDROID
+ LOCAL_CFLAGS += -std=c99
+ # FIXME: drop once Bionic correctly annotates "noreturn" on pthread_exit
+ LOCAL_CFLAGS += -Wno-error=return-type
+ # Excessive complaining for established cases. Rely on the Linux version warnings.
+ LOCAL_CFLAGS += -Wno-sign-compare
+
+ LOCAL_MODULE := $1
+ LOCAL_MODULE_TAGS := optional
+
+ LOCAL_SHARED_LIBRARIES := libpciaccess \
+ libdrm \
+ libdrm_intel
+
+ include $(BUILD_EXECUTABLE)
+endef
+
+#================#
+
+skip_tests_list := \
+ testdisplay \
+ kms_addfb \
+ kms_cursor_crc \
+ kms_flip \
+ kms_pipe_crc_basic \
+ kms_render \
+ kms_setmode \
+ pm_pc8 \
+ gem_seqno_wrap \
+ gem_render_copy
+
+tests_list := $(filter-out $(skip_tests_list),$(TESTS_progs) $(TESTS_progs_M) $(HANG) $(TESTS_testsuite))
+
+$(foreach item,$(tests_list),$(eval $(call add_test,$(item))))
+
diff --git a/tools/Android.mk b/tools/Android.mk
new file mode 100644
index 0000000..4a19b6c
--- /dev/null
+++ b/tools/Android.mk
@@ -0,0 +1,70 @@
+include $(LOCAL_PATH)/tools/Makefile.sources
+include $(LOCAL_PATH)/lib/Makefile.sources
+
+LIBPCIACCESS_PATH := $(firstword $(wildcard \
+ $(TOP)/external/PRIVATE/libpciaccess \
+ $(TOP)/hardware/intel/libpciaccess \
+ $(TOP)/external/libpciaccess))
+ifeq ($(LIBPCIACCESS_PATH),)
+ $(error "Unable to find libpciaccess!")
+endif
+
+LIBDRM_PATH := $(firstword $(wildcard \
+ $(TOP)/external/PRIVATE/drm \
+ $(TOP)/external/drm))
+ifeq ($(LIBDRM_PATH),)
+ $(error "Unable to find libdrm!")
+endif
+
+skip_lib_list := \
+ igt_kms.c \
+ igt_kms.h
+
+lib_list := $(filter-out $(skip_lib_list),$(libintel_tools_la_SOURCES))
+LIB_SOURCES := $(addprefix lib/,$(lib_list))
+
+#================#
+
+define add_tool
+ include $(CLEAR_VARS)
+
+ LOCAL_SRC_FILES := \
+ tools/$1.c \
+ $(LIB_SOURCES)
+
+ LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/lib \
+ $(LIBDRM_PATH)/include/drm \
+ $(LIBDRM_PATH)/intel \
+ $(LIBPCIACCESS_PATH)/include
+
+ LOCAL_CFLAGS += -DHAVE_TERMIOS_H
+ LOCAL_CFLAGS += -DHAVE_STRUCT_SYSINFO_TOTALRAM
+ LOCAL_CFLAGS += -DANDROID
+ LOCAL_CFLAGS += -std=c99
+ # FIXME: drop once Bionic correctly annotates "noreturn" on pthread_exit
+ LOCAL_CFLAGS += -Wno-error=return-type
+ # Excessive complaining for established cases. Rely on the Linux version warnings.
+ LOCAL_CFLAGS += -Wno-sign-compare
+
+ LOCAL_MODULE := $1
+ LOCAL_MODULE_TAGS := optional
+
+ LOCAL_SHARED_LIBRARIES := libpciaccess \
+ libdrm \
+ libdrm_intel
+
+ include $(BUILD_EXECUTABLE)
+endef
+
+#================#
+
+skip_tools_list := \
+ intel_framebuffer_dump \
+ intel_reg_dumper \
+ intel_vga_read \
+ intel_vga_write
+
+tools_list := $(filter-out $(skip_tools_list),$(bin_PROGRAMS) $(noinst_PROGRAMS))
+
+$(foreach item,$(tools_list),$(eval $(call add_tool,$(item))))
--
1.7.9.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 00/11] Android build sytem
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
` (10 preceding siblings ...)
2013-11-12 11:50 ` [PATCH v2 11/11] build: New Android makefiles oscar.mateo
@ 2013-11-12 11:55 ` Daniel Vetter
11 siblings, 0 replies; 13+ messages in thread
From: Daniel Vetter @ 2013-11-12 11:55 UTC (permalink / raw)
To: oscar.mateo; +Cc: intel-gfx
On Tue, Nov 12, 2013 at 11:50:34AM +0000, oscar.mateo@intel.com wrote:
> From: Oscar Mateo <oscar.mateo@intel.com>
>
> These patches aim to create an Android build system. This used to exist, but
> the old Android.mk files were bit-rotten and therefore kicked out.
>
> As suggested by Daniel Vetter and Damien Lespiau, as a fist step I extracted
> the source files lists into a Makefile.sources which can be included by both
> the autoconf files and the Android makefiles.
>
> Changes since the last submission:
>
> - Tabs when defining variables are fine, but fix missing "\" (thanks Damien).
> - Drop some of the warning fixes and instead fix compilation flags.
> - Reword comment and commit message in name conflict with Android's i915_drm.h
> - Do not error on return-type (at least until Bionic correctly annotates
> "noreturn" on pthread_exit).
>
> Oscar Mateo (11):
> build: list all test/tool/lib source files in their own
> Makefile.sources
> build: Fix missing "\" in tests/Makefile.sources
> build: Move logic to tests/Makefile.am and away from Makefile.sources
> lib: Move kms stuff from drmtest.c over to igt_kms.c
> rendercopy: Remove rendercopy.c
> tests/drm_get_client_auth: In Android, use gettid() instead of
> syscall(SYS_gettid)
> tests/gem_vmap_blits: Finish extracting gem_read
> build: Fix assorted compilation warnings
> lib/drmtest: Get the correct basename() under Android
> lib/igt_display: workaround a name conflict in Android
> build: New Android makefiles
All slurped in, thanks for the patches. The igt_kms extraction needed two
small fixes to make it work, but I've frobbed that while applying.
-Daniel
>
> Android.mk | 530 +-----------------------------
> lib/Makefile.am | 38 +--
> lib/Makefile.sources | 37 +++
> lib/drmtest.c | 744 +----------------------------------------
> lib/drmtest.h | 76 +----
> lib/igt_display.h | 4 +
> lib/igt_kms.c | 764 +++++++++++++++++++++++++++++++++++++++++++
> lib/igt_kms.h | 102 ++++++
> lib/intel_batchbuffer.h | 2 +-
> lib/intel_gpu_tools.h | 2 +-
> lib/intel_reg_map.c | 4 +-
> lib/rendercopy.c | 49 ---
> lib/rendercopy.h | 2 -
> tests/Android.mk | 77 +++++
> tests/Makefile.am | 206 +-----------
> tests/Makefile.sources | 203 ++++++++++++
> tests/drm_get_client_auth.c | 10 +-
> tests/gem_render_copy.c | 21 ++
> tests/gem_vmap_blits.c | 14 -
> tests/kms_cursor_crc.c | 1 +
> tests/kms_flip.c | 1 +
> tests/kms_pipe_crc_basic.c | 1 +
> tests/kms_render.c | 1 +
> tests/kms_setmode.c | 1 +
> tests/pm_pc8.c | 1 +
> tests/testdisplay.c | 1 +
> tools/Android.mk | 70 ++++
> tools/Makefile.am | 54 +--
> tools/Makefile.sources | 53 +++
> 29 files changed, 1369 insertions(+), 1700 deletions(-)
> create mode 100644 lib/Makefile.sources
> create mode 100644 lib/igt_kms.c
> create mode 100644 lib/igt_kms.h
> delete mode 100644 lib/rendercopy.c
> create mode 100644 tests/Android.mk
> create mode 100644 tests/Makefile.sources
> create mode 100644 tools/Android.mk
> create mode 100644 tools/Makefile.sources
>
> --
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-11-12 11:54 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 11:50 [PATCH v2 00/11] Android build sytem oscar.mateo
2013-11-12 11:50 ` [PATCH v2 01/11] build: list all test/tool/lib source files in their own Makefile.sources oscar.mateo
2013-11-12 11:50 ` [PATCH v2 02/11] build: Fix missing "\" in tests/Makefile.sources oscar.mateo
2013-11-12 11:50 ` [PATCH v2 03/11] build: Move logic to tests/Makefile.am and away from Makefile.sources oscar.mateo
2013-11-12 11:50 ` [PATCH v2 04/11] lib: Move kms stuff from drmtest.c over to igt_kms.c oscar.mateo
2013-11-12 11:50 ` [PATCH v2 05/11] rendercopy: Remove rendercopy.c oscar.mateo
2013-11-12 11:50 ` [PATCH v2 06/11] tests/drm_get_client_auth: In Android, use gettid() instead of syscall(SYS_gettid) oscar.mateo
2013-11-12 11:50 ` [PATCH v2 07/11] tests/gem_vmap_blits: Finish extracting gem_read oscar.mateo
2013-11-12 11:50 ` [PATCH v2 08/11] build: Fix assorted compilation warnings oscar.mateo
2013-11-12 11:50 ` [PATCH v2 09/11] lib/drmtest: Get the correct basename() under Android oscar.mateo
2013-11-12 11:50 ` [PATCH v2 10/11] lib/igt_display: workaround a name conflict in Android oscar.mateo
2013-11-12 11:50 ` [PATCH v2 11/11] build: New Android makefiles oscar.mateo
2013-11-12 11:55 ` [PATCH v2 00/11] Android build sytem Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox