Commit aa0fed10 authored by Rob Clark's avatar Rob Clark

freedreno: move ir3 to common location

Move (most of) the ir3 compiler to src/freedreno/ir3 so that it can be
re-used by some future vulkan driver.  The parts that are gallium
specific have been refactored out and remain in the gallium driver.

Getting the move done now so that it can happen before further
refactoring to support a6xx specific instructions.

NOTE also removes ir3_cmdline compiler tool from autotools build since
that was easier than fixing it and I normally use meson build.  Waiting
patiently for the day that we can remove *everything* from the autotools
build.
Signed-off-by: Rob Clark's avatarRob Clark <robdclark@gmail.com>
parent 556eec24
......@@ -45,7 +45,8 @@ TESTS =
BUILT_SOURCES =
CLEANFILES =
EXTRA_DIST = \
drm/meson.build
drm/meson.build \
ir3/meson.build
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
......@@ -57,3 +58,19 @@ noinst_LTLIBRARIES += libfreedreno_drm.la
libfreedreno_drm_la_SOURCES = $(drm_SOURCES)
libfreedreno_drm_la_CFLAGS = $(VALGRIND_CFLAGS) $(LIBDRM_CFLAGS)
noinst_LTLIBRARIES += libfreedreno_ir3.la
libfreedreno_ir3_la_SOURCES = $(ir3_SOURCES) $(ir3_GENERATED_FILES)
libfreedreno_ir3_la_CFLAGS = \
-I$(top_srcdir)/src/freedreno/ir3 \
-I$(top_builddir)/src/compiler/nir \
-I$(top_srcdir)/src/compiler/nir
libfreedreno_ir3_LIBADD = \
$(top_builddir)/src/compiler/nir/libnir.la \
$(top_builddir)/src/util/libmesautil.la
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
ir3/ir3_nir_trig.c: ir3/ir3_nir_trig.py $(top_srcdir)/src/compiler/nir/nir_algebraic.py
$(MKDIR_GEN)
$(AM_V_GEN) $(PYTHON) $(PYTHON_FLAGS) $(srcdir)/ir3/ir3_nir_trig.py -p $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false)
......@@ -15,3 +15,27 @@ drm_SOURCES := \
drm/msm_drm.h \
drm/msm_ringbuffer.c
ir3_SOURCES := \
ir3/disasm-a3xx.c \
ir3/instr-a3xx.h \
ir3/ir3.c \
ir3/ir3_compiler.c \
ir3/ir3_compiler.h \
ir3/ir3_compiler_nir.c \
ir3/ir3_cp.c \
ir3/ir3_depth.c \
ir3/ir3_group.c \
ir3/ir3.h \
ir3/ir3_legalize.c \
ir3/ir3_nir.c \
ir3/ir3_nir.h \
ir3/ir3_nir_lower_tg4_to_tex.c \
ir3/ir3_print.c \
ir3/ir3_ra.c \
ir3/ir3_sched.c \
ir3/ir3_shader.c \
ir3/ir3_shader.h
ir3_GENERATED_FILES := \
ir3/ir3_nir_trig.c
......@@ -28,7 +28,7 @@
#include "util/u_memory.h"
#include "util/u_format.h"
#include "freedreno_util.h"
#include "drm/freedreno_drmif.h"
#include "ir3_shader.h"
#include "ir3_compiler.h"
......
# Copyright © 2018 Rob Clark
# 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 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.
ir3_nir_trig_c = custom_target(
'ir3_nir_trig.c',
input : 'ir3_nir_trig.py',
output : 'ir3_nir_trig.c',
command : [
prog_python, '@INPUT@',
'-p', join_paths(meson.source_root(), 'src/compiler/nir/'),
],
capture : true,
depend_files : nir_algebraic_py,
)
libfreedreno_ir3_files = files(
'disasm-a3xx.c',
'instr-a3xx.h',
'ir3.c',
'ir3_compiler_nir.c',
'ir3_compiler.c',
'ir3_compiler.h',
'ir3_cp.c',
'ir3_depth.c',
'ir3_group.c',
'ir3.h',
'ir3_legalize.c',
'ir3_nir.c',
'ir3_nir.h',
'ir3_nir_lower_tg4_to_tex.c',
'ir3_print.c',
'ir3_ra.c',
'ir3_sched.c',
'ir3_shader.c',
'ir3_shader.h',
)
libfreedreno_ir3 = static_library(
'freedreno_ir3',
[libfreedreno_ir3_files, ir3_nir_trig_c],
include_directories : [inc_freedreno, inc_common],
c_args : [c_vis_args, no_override_init_args],
cpp_args : [cpp_vis_args],
dependencies : idep_nir_headers,
build_by_default : false,
)
......@@ -21,3 +21,4 @@
inc_freedreno = include_directories('.')
subdir('drm')
subdir('ir3')
......@@ -6,6 +6,7 @@ TARGET_LIB_DEPS += \
$(top_builddir)/src/gallium/winsys/freedreno/drm/libfreedrenodrm.la \
$(top_builddir)/src/gallium/drivers/freedreno/libfreedreno.la \
$(top_builddir)/src/freedreno/libfreedreno_drm.la \
$(top_builddir)/src/freedreno/libfreedreno_ir3.la \
$(FREEDRENO_LIBS) \
$(LIBDRM_LIBS)
......
......@@ -9,11 +9,6 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/compiler/nir \
$(GALLIUM_DRIVER_CFLAGS)
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
ir3/ir3_nir_trig.c: ir3/ir3_nir_trig.py $(top_srcdir)/src/compiler/nir/nir_algebraic.py
$(MKDIR_GEN)
$(AM_V_GEN) $(PYTHON) $(PYTHON_FLAGS) $(srcdir)/ir3/ir3_nir_trig.py -p $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false)
noinst_LTLIBRARIES = libfreedreno.la
libfreedreno_la_SOURCES = \
......@@ -23,28 +18,6 @@ libfreedreno_la_SOURCES = \
$(a4xx_SOURCES) \
$(a5xx_SOURCES) \
$(a6xx_SOURCES) \
$(ir3_SOURCES) \
$(ir3_GENERATED_FILES)
BUILT_SOURCES := $(ir3_GENERATED_FILES)
CLEANFILES := $(BUILT_SOURCES)
EXTRA_DIST = ir3/ir3_nir_trig.py
noinst_PROGRAMS = ir3_compiler
# XXX: Required due to the C++ sources in libnir
nodist_EXTRA_ir3_compiler_SOURCES = dummy.cpp
ir3_compiler_SOURCES = \
ir3/ir3_cmdline.c
ir3_compiler_LDADD = \
libfreedreno.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/compiler/nir/libnir.la \
$(top_builddir)/src/compiler/glsl/libstandalone.la \
$(top_builddir)/src/util/libmesautil.la \
$(top_builddir)/src/mesa/libmesagallium.la \
$(top_builddir)/src/freedreno/libfreedreno_drm.la \
$(GALLIUM_COMMON_LIB_DEPS)
$(ir3_SOURCES)
EXTRA_DIST += meson.build
EXTRA_DIST = meson.build
......@@ -195,29 +195,8 @@ a6xx_SOURCES := \
a6xx/fd6_zsa.h
ir3_SOURCES := \
ir3/disasm-a3xx.c \
ir3/instr-a3xx.h \
ir3/ir3.c \
ir3/ir3_cache.c \
ir3/ir3_cache.h \
ir3/ir3_compiler_nir.c \
ir3/ir3_compiler.c \
ir3/ir3_compiler.h \
ir3/ir3_cp.c \
ir3/ir3_depth.c \
ir3/ir3_gallium.c \
ir3/ir3_gallium.h \
ir3/ir3_group.c \
ir3/ir3.h \
ir3/ir3_legalize.c \
ir3/ir3_nir.c \
ir3/ir3_nir.h \
ir3/ir3_nir_lower_tg4_to_tex.c \
ir3/ir3_print.c \
ir3/ir3_ra.c \
ir3/ir3_sched.c \
ir3/ir3_shader.c \
ir3/ir3_shader.h
ir3/ir3_gallium.h
ir3_GENERATED_FILES := \
ir3/ir3_nir_trig.c
......@@ -31,7 +31,7 @@
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
struct fd3_context {
......
......@@ -29,7 +29,8 @@
#include "pipe/p_context.h"
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
struct fd3_emit;
......
......@@ -30,7 +30,8 @@
#include "fd3_screen.h"
#include "fd3_context.h"
#include "fd3_format.h"
#include "ir3_compiler.h"
#include "ir3/ir3_compiler.h"
static boolean
fd3_screen_is_format_supported(struct pipe_screen *pscreen,
......
......@@ -31,7 +31,7 @@
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
struct fd4_context {
struct fd_context base;
......
......@@ -29,7 +29,8 @@
#include "pipe/p_context.h"
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
struct fd4_emit;
......
......@@ -30,7 +30,8 @@
#include "fd4_screen.h"
#include "fd4_context.h"
#include "fd4_format.h"
#include "ir3_compiler.h"
#include "ir3/ir3_compiler.h"
static boolean
fd4_screen_is_format_supported(struct pipe_screen *pscreen,
......
......@@ -31,7 +31,7 @@
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
struct fd5_context {
struct fd_context base;
......
......@@ -29,7 +29,8 @@
#include "pipe/p_context.h"
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
struct fd5_emit;
......
......@@ -33,7 +33,7 @@
#include "fd5_format.h"
#include "fd5_resource.h"
#include "ir3_compiler.h"
#include "ir3/ir3_compiler.h"
static bool
valid_sample_count(unsigned sample_count)
......
......@@ -32,7 +32,7 @@
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
#include "a6xx.xml.h"
......
......@@ -30,7 +30,8 @@
#include "pipe/p_context.h"
#include "freedreno_context.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
#include "ir3_cache.h"
struct fd6_streamout_state {
......
......@@ -33,7 +33,7 @@
#include "fd6_format.h"
#include "fd6_resource.h"
#include "ir3_compiler.h"
#include "ir3/ir3_compiler.h"
static boolean
fd6_screen_is_format_supported(struct pipe_screen *pscreen,
......
......@@ -27,7 +27,7 @@
#ifndef IR3_CACHE_H_
#define IR3_CACHE_H_
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
/*
* An in-memory cache for mapping shader state objects plus shader key to
......
......@@ -37,11 +37,11 @@
#include "tgsi/tgsi_text.h"
#include "tgsi/tgsi_dump.h"
#include "ir3_compiler.h"
#include "ir3_gallium.h"
#include "ir3_nir.h"
#include "instr-a3xx.h"
#include "ir3.h"
#include "ir3/ir3_compiler.h"
#include "ir3/ir3_gallium.h"
#include "ir3/ir3_nir.h"
#include "ir3/instr-a3xx.h"
#include "ir3/ir3.h"
#include "compiler/glsl/standalone.h"
#include "compiler/glsl/glsl_to_nir.h"
......
......@@ -37,10 +37,10 @@
#include "freedreno_context.h"
#include "freedreno_util.h"
#include "ir3_shader.h"
#include "ir3_gallium.h"
#include "ir3_compiler.h"
#include "ir3_nir.h"
#include "ir3/ir3_shader.h"
#include "ir3/ir3_gallium.h"
#include "ir3/ir3_compiler.h"
#include "ir3/ir3_nir.h"
static void
dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug)
......
......@@ -28,7 +28,7 @@
#define IR3_GALLIUM_H_
#include "pipe/p_state.h"
#include "ir3_shader.h"
#include "ir3/ir3_shader.h"
struct ir3_shader * ir3_shader_create(struct ir3_compiler *compiler,
const struct pipe_shader_state *cso, gl_shader_stage type,
......
......@@ -18,18 +18,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
ir3_nir_trig_c = custom_target(
'ir3_nir_trig.c',
input : 'ir3/ir3_nir_trig.py',
output : 'ir3_nir_trig.c',
command : [
prog_python, '@INPUT@',
'-p', join_paths(meson.source_root(), 'src/compiler/nir/'),
],
capture : true,
depend_files : nir_algebraic_py,
)
files_libfreedreno = files(
'adreno_common.xml.h',
'adreno_pm4.xml.h',
......@@ -215,35 +203,15 @@ files_libfreedreno = files(
'a6xx/fd6_texture.h',
'a6xx/fd6_zsa.c',
'a6xx/fd6_zsa.h',
'ir3/disasm-a3xx.c',
'ir3/instr-a3xx.h',
'ir3/ir3.c',
'ir3/ir3_cache.c',
'ir3/ir3_cache.h',
'ir3/ir3_compiler_nir.c',
'ir3/ir3_compiler.c',
'ir3/ir3_compiler.h',
'ir3/ir3_cp.c',
'ir3/ir3_depth.c',
'ir3/ir3_gallium.c',
'ir3/ir3_gallium.h',
'ir3/ir3_group.c',
'ir3/ir3.h',
'ir3/ir3_legalize.c',
'ir3/ir3_nir.c',
'ir3/ir3_nir.h',
'ir3/ir3_nir_lower_tg4_to_tex.c',
'ir3/ir3_print.c',
'ir3/ir3_ra.c',
'ir3/ir3_sched.c',
'ir3/ir3_shader.c',
'ir3/ir3_shader.h',
)
freedreno_includes = [
inc_src, inc_include, inc_gallium, inc_gallium_aux,
inc_freedreno,
include_directories('ir3')
inc_freedreno, include_directories('ir3'),
]
freedreno_c_args = []
......@@ -258,7 +226,7 @@ endif
libfreedreno = static_library(
'freedreno',
[files_libfreedreno, ir3_nir_trig_c],
[files_libfreedreno],
include_directories : freedreno_includes,
c_args : [freedreno_c_args, c_vis_args],
cpp_args : [freedreno_cpp_args, cpp_vis_args],
......@@ -273,6 +241,7 @@ driver_freedreno = declare_dependency(
libfreedrenowinsys,
libfreedreno,
libfreedreno_drm,
libfreedreno_ir3,
],
dependencies : idep_nir,
)
......@@ -288,6 +257,7 @@ ir3_compiler = executable(
link_with : [
libfreedreno,
libfreedreno_drm,
libfreedreno_ir3,
libgallium,
libglsl_standalone,
libmesa_util,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment