From ccfd23a05dbc934fefeef94a8627f01d5f23aeaf Mon Sep 17 00:00:00 2001 From: Johannes Obermayr Date: Mon, 28 Jan 2013 20:18:40 +0100 Subject: [PATCH] radeon: Build and use libradeon the right way. Better build system integration for: http://cgit.freedesktop.org/mesa/mesa/commit/?id=91a160b http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b2855b The EGL runtime issue should be fixed now. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64810 --- configure.ac | 2 - src/gallium/drivers/r600/Makefile.am | 26 +--- src/gallium/drivers/r600/r600_blit.c | 70 +-------- src/gallium/drivers/r600/r600_pipe.c | 2 +- src/gallium/drivers/r600/r600_texture.c | 73 +-------- src/gallium/drivers/r600/r600_uvd.c | 2 +- src/gallium/drivers/radeon/Makefile.am | 31 +--- src/gallium/drivers/radeon/Makefile.sources | 2 + src/gallium/drivers/radeon/r600_blit_common.c | 43 ++++++ src/gallium/drivers/radeon/r600_blit_common.h | 31 ++++ src/gallium/drivers/radeon/r600_texture_common.c | 77 ++++++++++ src/gallium/drivers/radeon/r600_texture_common.h | 15 ++ src/gallium/drivers/radeonsi/Makefile.am | 10 +- src/gallium/drivers/radeonsi/r600.h | 16 +- src/gallium/drivers/radeonsi/r600_blit.c | 185 ++++++++--------------- src/gallium/drivers/radeonsi/r600_buffer.c | 24 +-- src/gallium/drivers/radeonsi/r600_hw_context.c | 62 ++++---- src/gallium/drivers/radeonsi/r600_query.c | 44 +++--- src/gallium/drivers/radeonsi/r600_resource.c | 12 +- src/gallium/drivers/radeonsi/r600_resource.h | 6 +- src/gallium/drivers/radeonsi/r600_texture.c | 181 +++++++--------------- src/gallium/drivers/radeonsi/r600_translate.c | 2 +- src/gallium/drivers/radeonsi/radeonsi_compute.c | 2 +- src/gallium/drivers/radeonsi/radeonsi_pipe.c | 100 ++++++------ src/gallium/drivers/radeonsi/radeonsi_pipe.h | 22 +-- src/gallium/drivers/radeonsi/radeonsi_pm4.c | 2 +- src/gallium/drivers/radeonsi/radeonsi_resource.h | 2 +- src/gallium/drivers/radeonsi/radeonsi_shader.c | 6 +- src/gallium/drivers/radeonsi/radeonsi_uvd.c | 2 +- src/gallium/drivers/radeonsi/si_descriptors.c | 4 +- src/gallium/drivers/radeonsi/si_state.c | 6 +- src/gallium/drivers/radeonsi/si_state_draw.c | 14 +- src/gallium/targets/dri-r600/Makefile.am | 5 + src/gallium/targets/dri-radeonsi/Makefile.am | 4 +- src/gallium/targets/egl-static/Makefile.am | 24 +-- src/gallium/targets/pipe-loader/Makefile.am | 8 +- src/gallium/targets/vdpau-r600/Makefile.am | 5 + src/gallium/targets/vdpau-radeonsi/Makefile.am | 4 +- src/gallium/targets/xorg-r600/Makefile.am | 5 + src/gallium/targets/xorg-radeonsi/Makefile.am | 4 +- src/gallium/targets/xvmc-r600/Makefile.am | 5 + 41 files changed, 521 insertions(+), 619 deletions(-) create mode 100644 src/gallium/drivers/radeon/r600_blit_common.c create mode 100644 src/gallium/drivers/radeon/r600_blit_common.h create mode 100644 src/gallium/drivers/radeon/r600_texture_common.c create mode 100644 src/gallium/drivers/radeon/r600_texture_common.h diff --git a/configure.ac b/configure.ac index e3d323d..6224386 100644 --- a/configure.ac +++ b/configure.ac @@ -1779,7 +1779,6 @@ if test "x$with_gallium_drivers" != x; then GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600" if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then radeon_llvm_check - R600_NEED_RADEON_GALLIUM=yes; LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser" fi if test "x$enable_r600_llvm" = xyes; then @@ -1936,7 +1935,6 @@ AM_CONDITIONAL(NEED_WINSYS_WRAPPER, test "x$HAVE_GALLIUM_I915" = xyes -o \ "x$HAVE_GALLIUM_SVGA" = xyes) AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes) AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes) -AM_CONDITIONAL(R600_NEED_RADEON_GALLIUM, test x$R600_NEED_RADEON_GALLIUM = xyes) AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes) AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes) AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes) diff --git a/src/gallium/drivers/r600/Makefile.am b/src/gallium/drivers/r600/Makefile.am index 9203d03..3cf7291 100644 --- a/src/gallium/drivers/r600/Makefile.am +++ b/src/gallium/drivers/r600/Makefile.am @@ -3,38 +3,24 @@ include $(top_srcdir)/src/gallium/Automake.inc noinst_LTLIBRARIES = libr600.la -AM_CFLAGS = \ - -I$(top_srcdir)/src/gallium/drivers \ - -I$(top_srcdir)/include \ +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/gallium/drivers/radeon/ \ $(GALLIUM_CFLAGS) \ $(RADEON_CFLAGS) \ $(VISIBILITY_CFLAGS) -AM_CXXFLAGS = \ - -I$(top_srcdir)/src/gallium/drivers \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/gallium/include \ - -I$(top_srcdir)/src/gallium/auxiliary \ - $(RADEON_CFLAGS) \ - $(DEFINES) - libr600_la_SOURCES = \ $(C_SOURCES) \ $(CXX_SOURCES) -libr600_la_LIBADD = ../radeon/libradeon.la +AM_CFLAGS = -if R600_NEED_RADEON_GALLIUM +if NEED_RADEON_LLVM +AM_CFLAGS += \ + $(LLVM_CFLAGS) libr600_la_SOURCES += \ $(LLVM_C_SOURCES) - -libr600_la_LIBADD += ../radeon/libllvmradeon.la - -AM_CFLAGS += \ - $(LLVM_CFLAGS) \ - -I$(top_srcdir)/src/gallium/drivers/radeon/ - endif if USE_R600_LLVM_COMPILER diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 60dda28..cae18d1 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -20,35 +20,12 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "r600_blit_common.h" #include "r600_pipe.h" #include "util/u_surface.h" #include "util/u_blitter.h" #include "util/u_format.h" -enum r600_blitter_op /* bitmask */ -{ - R600_SAVE_FRAGMENT_STATE = 1, - R600_SAVE_TEXTURES = 2, - R600_SAVE_FRAMEBUFFER = 4, - R600_DISABLE_RENDER_COND = 8, - - R600_CLEAR = R600_SAVE_FRAGMENT_STATE, - - R600_CLEAR_SURFACE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER, - - R600_COPY_BUFFER = R600_DISABLE_RENDER_COND, - - R600_COPY_TEXTURE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES | - R600_DISABLE_RENDER_COND, - - R600_BLIT = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES | - R600_DISABLE_RENDER_COND, - - R600_DECOMPRESS = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND, - - R600_COLOR_RESOLVE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND -}; - static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op) { struct r600_context *rctx = (struct r600_context *)ctx; @@ -99,11 +76,6 @@ static void r600_blitter_end(struct pipe_context *ctx) r600_resume_nontimer_queries(rctx); } -static unsigned u_max_sample(struct pipe_resource *r) -{ - return r->nr_samples ? r->nr_samples - 1 : 0; -} - void r600_blit_decompress_depth(struct pipe_context *ctx, struct r600_texture *texture, struct r600_texture *staging, @@ -383,7 +355,7 @@ static bool r600_decompress_subresource(struct pipe_context *ctx, return true; } -static boolean is_simple_msaa_resolve(const struct pipe_blit_info *info) +static boolean r600_is_simple_msaa_resolve(const struct pipe_blit_info *info) { unsigned dst_width = u_minify(info->dst.resource->width0, info->dst.level); unsigned dst_height = u_minify(info->dst.resource->height0, info->dst.level); @@ -773,42 +745,6 @@ static void r600_resource_copy_region(struct pipe_context *ctx, pipe_sampler_view_reference(&src_view, NULL); } -/* For MSAA integer resolving to work, we change the format to NORM using this function. */ -static enum pipe_format int_to_norm_format(enum pipe_format format) -{ - switch (format) { -#define REPLACE_FORMAT_SIGN(format,sign) \ - case PIPE_FORMAT_##format##_##sign##INT: \ - return PIPE_FORMAT_##format##_##sign##NORM -#define REPLACE_FORMAT(format) \ - REPLACE_FORMAT_SIGN(format, U); \ - REPLACE_FORMAT_SIGN(format, S) - - REPLACE_FORMAT_SIGN(B10G10R10A2, U); - REPLACE_FORMAT(R8); - REPLACE_FORMAT(R8G8); - REPLACE_FORMAT(R8G8B8X8); - REPLACE_FORMAT(R8G8B8A8); - REPLACE_FORMAT(A8); - REPLACE_FORMAT(I8); - REPLACE_FORMAT(L8); - REPLACE_FORMAT(L8A8); - REPLACE_FORMAT(R16); - REPLACE_FORMAT(R16G16); - REPLACE_FORMAT(R16G16B16X16); - REPLACE_FORMAT(R16G16B16A16); - REPLACE_FORMAT(A16); - REPLACE_FORMAT(I16); - REPLACE_FORMAT(L16); - REPLACE_FORMAT(L16A16); - -#undef REPLACE_FORMAT -#undef REPLACE_FORMAT_SIGN - default: - return format; - } -} - static void r600_msaa_color_resolve(struct pipe_context *ctx, const struct pipe_blit_info *info) { @@ -824,7 +760,7 @@ static void r600_msaa_color_resolve(struct pipe_context *ctx, assert(info->src.box.depth == 1); assert(info->dst.box.depth == 1); - if (is_simple_msaa_resolve(info)) { + if (r600_is_simple_msaa_resolve(info)) { r600_blitter_begin(ctx, R600_COLOR_RESOLVE); util_blitter_custom_resolve_color(rctx->blitter, info->dst.resource, info->dst.level, diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index f60252a..0f5d1f0 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -39,7 +39,7 @@ #include "util/u_math.h" #include "vl/vl_decoder.h" #include "vl/vl_video_buffer.h" -#include "radeon/radeon_uvd.h" +#include "radeon_uvd.h" #include "os/os_time.h" static const struct debug_named_value debug_options[] = { diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 07e7c6c..c05d61e 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -26,6 +26,7 @@ */ #include "r600_formats.h" #include "evergreen_compute.h" +#include "r600_texture_common.h" #include "r600d.h" #include @@ -33,40 +34,6 @@ #include "util/u_memory.h" -/* Same as resource_copy_region, except that both upsampling and downsampling are allowed. */ -static void r600_copy_region_with_blit(struct pipe_context *pipe, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box) -{ - struct pipe_blit_info blit; - - memset(&blit, 0, sizeof(blit)); - blit.src.resource = src; - blit.src.format = src->format; - blit.src.level = src_level; - blit.src.box = *src_box; - blit.dst.resource = dst; - blit.dst.format = dst->format; - blit.dst.level = dst_level; - blit.dst.box.x = dstx; - blit.dst.box.y = dsty; - blit.dst.box.z = dstz; - blit.dst.box.width = src_box->width; - blit.dst.box.height = src_box->height; - blit.dst.box.depth = src_box->depth; - blit.mask = util_format_get_mask(src->format) & - util_format_get_mask(dst->format); - blit.filter = PIPE_TEX_FILTER_NEAREST; - - if (blit.mask) { - pipe->blit(pipe, &blit); - } -} - /* Copy from a full GPU texture to a transfer's staging one. */ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) { @@ -760,44 +727,6 @@ bool r600_init_flushed_depth_texture(struct pipe_context *ctx, return true; } -/** - * Initialize the pipe_resource descriptor to be of the same size as the box, - * which is supposed to hold a subregion of the texture "orig" at the given - * mipmap level. - */ -static void r600_init_temp_resource_from_box(struct pipe_resource *res, - struct pipe_resource *orig, - const struct pipe_box *box, - unsigned level, unsigned flags) -{ - memset(res, 0, sizeof(*res)); - res->format = orig->format; - res->width0 = box->width; - res->height0 = box->height; - res->depth0 = 1; - res->array_size = 1; - res->usage = flags & R600_RESOURCE_FLAG_TRANSFER ? PIPE_USAGE_STAGING : PIPE_USAGE_STATIC; - res->flags = flags; - - /* We must set the correct texture target and dimensions for a 3D box. */ - if (box->depth > 1 && util_max_layer(orig, level) > 0) - res->target = orig->target; - else - res->target = PIPE_TEXTURE_2D; - - switch (res->target) { - case PIPE_TEXTURE_1D_ARRAY: - case PIPE_TEXTURE_2D_ARRAY: - case PIPE_TEXTURE_CUBE_ARRAY: - res->array_size = box->depth; - break; - case PIPE_TEXTURE_3D: - res->depth0 = box->depth; - break; - default:; - } -} - static void *r600_texture_transfer_map(struct pipe_context *ctx, struct pipe_resource *texture, unsigned level, diff --git a/src/gallium/drivers/r600/r600_uvd.c b/src/gallium/drivers/r600/r600_uvd.c index 00669fd..d84cb57 100644 --- a/src/gallium/drivers/r600/r600_uvd.c +++ b/src/gallium/drivers/r600/r600_uvd.c @@ -45,7 +45,7 @@ #include "vl/vl_mpeg12_decoder.h" #include "r600_pipe.h" -#include "radeon/radeon_uvd.h" +#include "radeon_uvd.h" #include "r600d.h" /** diff --git a/src/gallium/drivers/radeon/Makefile.am b/src/gallium/drivers/radeon/Makefile.am index ac8cbd3..d691114 100644 --- a/src/gallium/drivers/radeon/Makefile.am +++ b/src/gallium/drivers/radeon/Makefile.am @@ -1,38 +1,21 @@ include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc -LIBGALLIUM_LIBS= +AM_CPPFLAGS = \ + $(GALLIUM_CFLAGS) \ + $(RADEON_CFLAGS) \ + $(VISIBILTY_CFLAGS) \ + $(DEFINES) noinst_LTLIBRARIES = libradeon.la -AM_CFLAGS = $(GALLIUM_CFLAGS) $(RADEON_CFLAGS) - libradeon_la_SOURCES = \ $(C_SOURCES) if NEED_RADEON_LLVM - -libllvmradeon_la_LDFLAGS = \ - $(LLVM_LDFLAGS) - -noinst_LTLIBRARIES += libllvmradeon.la - -libllvmradeon_la_CXXFLAGS = \ - $(GALLIUM_CFLAGS) \ - $(DEFINES) - -libllvmradeon_la_CFLAGS = \ - $(GALLIUM_CFLAGS) \ +AM_CPPFLAGS += \ $(LLVM_CFLAGS) -libllvmradeon_la_SOURCES = \ - $(LLVM_CPP_FILES) \ +libradeon_la_SOURCES += \ $(LLVM_C_FILES) - -libllvmradeon_la_LIBADD = \ - $(LIBGALLIUM_LIBS) \ - $(CLOCK_LIB) \ - $(LLVM_LIBS) \ - $(ELF_LIB) - endif diff --git a/src/gallium/drivers/radeon/Makefile.sources b/src/gallium/drivers/radeon/Makefile.sources index 740dbc7..0e0ae32 100644 --- a/src/gallium/drivers/radeon/Makefile.sources +++ b/src/gallium/drivers/radeon/Makefile.sources @@ -1,6 +1,8 @@ C_SOURCES := \ + r600_blit_common.c \ r600_pipe_common.c \ r600_streamout.c \ + r600_texture_common.c \ radeon_uvd.c LLVM_C_FILES := \ diff --git a/src/gallium/drivers/radeon/r600_blit_common.c b/src/gallium/drivers/radeon/r600_blit_common.c new file mode 100644 index 0000000..2307b5c --- /dev/null +++ b/src/gallium/drivers/radeon/r600_blit_common.c @@ -0,0 +1,43 @@ + +#include "r600_blit_common.h" + +unsigned u_max_sample(struct pipe_resource *r) +{ + return r->nr_samples ? r->nr_samples - 1 : 0; +} + +/* For MSAA integer resolving to work, we change the format to NORM using this function. */ +enum pipe_format int_to_norm_format(enum pipe_format format) +{ + switch (format) { +#define REPLACE_FORMAT_SIGN(format,sign) \ + case PIPE_FORMAT_##format##_##sign##INT: \ + return PIPE_FORMAT_##format##_##sign##NORM +#define REPLACE_FORMAT(format) \ + REPLACE_FORMAT_SIGN(format, U); \ + REPLACE_FORMAT_SIGN(format, S) + + REPLACE_FORMAT_SIGN(B10G10R10A2, U); + REPLACE_FORMAT(R8); + REPLACE_FORMAT(R8G8); + REPLACE_FORMAT(R8G8B8X8); + REPLACE_FORMAT(R8G8B8A8); + REPLACE_FORMAT(A8); + REPLACE_FORMAT(I8); + REPLACE_FORMAT(L8); + REPLACE_FORMAT(L8A8); + REPLACE_FORMAT(R16); + REPLACE_FORMAT(R16G16); + REPLACE_FORMAT(R16G16B16X16); + REPLACE_FORMAT(R16G16B16A16); + REPLACE_FORMAT(A16); + REPLACE_FORMAT(I16); + REPLACE_FORMAT(L16); + REPLACE_FORMAT(L16A16); + +#undef REPLACE_FORMAT +#undef REPLACE_FORMAT_SIGN + default: + return format; + } +} diff --git a/src/gallium/drivers/radeon/r600_blit_common.h b/src/gallium/drivers/radeon/r600_blit_common.h new file mode 100644 index 0000000..d967df8 --- /dev/null +++ b/src/gallium/drivers/radeon/r600_blit_common.h @@ -0,0 +1,31 @@ + +#include "pipe/p_format.h" +#include "pipe/p_state.h" + +unsigned u_max_sample(struct pipe_resource *r); + +enum pipe_format int_to_norm_format(enum pipe_format format); + +enum r600_blitter_op /* bitmask */ +{ + R600_SAVE_FRAGMENT_STATE = 1, + R600_SAVE_TEXTURES = 2, + R600_SAVE_FRAMEBUFFER = 4, + R600_DISABLE_RENDER_COND = 8, + + R600_CLEAR = R600_SAVE_FRAGMENT_STATE, + + R600_CLEAR_SURFACE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER, + + R600_COPY_BUFFER = R600_DISABLE_RENDER_COND, + + R600_COPY_TEXTURE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES | + R600_DISABLE_RENDER_COND, + + R600_BLIT = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES | + R600_DISABLE_RENDER_COND, + + R600_DECOMPRESS = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND, + + R600_COLOR_RESOLVE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND +}; diff --git a/src/gallium/drivers/radeon/r600_texture_common.c b/src/gallium/drivers/radeon/r600_texture_common.c new file mode 100644 index 0000000..551c9ca --- /dev/null +++ b/src/gallium/drivers/radeon/r600_texture_common.c @@ -0,0 +1,77 @@ + +#include "r600_texture_common.h" + +#include "util/u_inlines.h" +#include "util/u_format.h" + +/* Same as resource_copy_region, except that both upsampling and downsampling are allowed. */ +void r600_copy_region_with_blit(struct pipe_context *pipe, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box) +{ + struct pipe_blit_info blit; + + memset(&blit, 0, sizeof(blit)); + blit.src.resource = src; + blit.src.format = src->format; + blit.src.level = src_level; + blit.src.box = *src_box; + blit.dst.resource = dst; + blit.dst.format = dst->format; + blit.dst.level = dst_level; + blit.dst.box.x = dstx; + blit.dst.box.y = dsty; + blit.dst.box.z = dstz; + blit.dst.box.width = src_box->width; + blit.dst.box.height = src_box->height; + blit.dst.box.depth = src_box->depth; + blit.mask = util_format_get_mask(src->format) & + util_format_get_mask(dst->format); + blit.filter = PIPE_TEX_FILTER_NEAREST; + + if (blit.mask) { + pipe->blit(pipe, &blit); + } +} + +/** + * Initialize the pipe_resource descriptor to be of the same size as the box, + * which is supposed to hold a subregion of the texture "orig" at the given + * mipmap level. + */ +void r600_init_temp_resource_from_box(struct pipe_resource *res, + struct pipe_resource *orig, + const struct pipe_box *box, + unsigned level, unsigned flags) +{ + memset(res, 0, sizeof(*res)); + res->format = orig->format; + res->width0 = box->width; + res->height0 = box->height; + res->depth0 = 1; + res->array_size = 1; + res->usage = flags & PIPE_RESOURCE_FLAG_DRV_PRIV ? PIPE_USAGE_STAGING : PIPE_USAGE_STATIC; + res->flags = flags; + + /* We must set the correct texture target and dimensions for a 3D box. */ + if (box->depth > 1 && util_max_layer(orig, level) > 0) + res->target = orig->target; + else + res->target = PIPE_TEXTURE_2D; + + switch (res->target) { + case PIPE_TEXTURE_1D_ARRAY: + case PIPE_TEXTURE_2D_ARRAY: + case PIPE_TEXTURE_CUBE_ARRAY: + res->array_size = box->depth; + break; + case PIPE_TEXTURE_3D: + res->depth0 = box->depth; + break; + default:; + } +} diff --git a/src/gallium/drivers/radeon/r600_texture_common.h b/src/gallium/drivers/radeon/r600_texture_common.h new file mode 100644 index 0000000..1fd135c --- /dev/null +++ b/src/gallium/drivers/radeon/r600_texture_common.h @@ -0,0 +1,15 @@ + +#include "pipe/p_context.h" + +void r600_copy_region_with_blit(struct pipe_context *pipe, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box); + +void r600_init_temp_resource_from_box(struct pipe_resource *res, + struct pipe_resource *orig, + const struct pipe_box *box, + unsigned level, unsigned flags); diff --git a/src/gallium/drivers/radeonsi/Makefile.am b/src/gallium/drivers/radeonsi/Makefile.am index 0c27973..81b87b5 100644 --- a/src/gallium/drivers/radeonsi/Makefile.am +++ b/src/gallium/drivers/radeonsi/Makefile.am @@ -27,13 +27,9 @@ noinst_LTLIBRARIES = libradeonsi.la AM_CPPFLAGS = \ -I$(top_srcdir)/src/gallium/drivers/radeon \ - -I$(top_srcdir)/src/gallium/drivers \ - -I$(top_srcdir)/include \ $(GALLIUM_CFLAGS) \ - $(RADEON_CFLAGS) -AM_CFLAGS = $(LLVM_CFLAGS) + $(RADEON_CFLAGS) \ + $(LLVM_CFLAGS) \ + $(VISIBILITY_CFLAGS) libradeonsi_la_SOURCES = $(C_SOURCES) -libradeonsi_la_LIBADD = \ - ../radeon/libradeon.la \ - ../radeon/libllvmradeon.la diff --git a/src/gallium/drivers/radeonsi/r600.h b/src/gallium/drivers/radeonsi/r600.h index 4b43169..aa30a9f 100644 --- a/src/gallium/drivers/radeonsi/r600.h +++ b/src/gallium/drivers/radeonsi/r600.h @@ -76,16 +76,16 @@ void si_get_backend_mask(struct r600_context *ctx); void si_context_flush(struct r600_context *ctx, unsigned flags); void si_begin_new_cs(struct r600_context *ctx); -struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type); -void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query); -boolean r600_context_query_result(struct r600_context *ctx, +struct r600_query *si_context_query_create(struct r600_context *ctx, unsigned query_type); +void si_context_query_destroy(struct r600_context *ctx, struct r600_query *query); +boolean si_context_query_result(struct r600_context *ctx, struct r600_query *query, boolean wait, void *vresult); -void r600_query_begin(struct r600_context *ctx, struct r600_query *query); -void r600_query_end(struct r600_context *ctx, struct r600_query *query); -void r600_context_queries_suspend(struct r600_context *ctx); -void r600_context_queries_resume(struct r600_context *ctx); -void r600_query_predication(struct r600_context *ctx, struct r600_query *query, int operation, +void si_query_begin(struct r600_context *ctx, struct r600_query *query); +void si_query_end(struct r600_context *ctx, struct r600_query *query); +void si_context_queries_suspend(struct r600_context *ctx); +void si_context_queries_resume(struct r600_context *ctx); +void si_query_predication(struct r600_context *ctx, struct r600_query *query, int operation, int flag_wait); void si_context_emit_fence(struct r600_context *ctx, struct r600_resource *fence, unsigned offset, unsigned value); diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c index 9d7c738..d9fff16 100644 --- a/src/gallium/drivers/radeonsi/r600_blit.c +++ b/src/gallium/drivers/radeonsi/r600_blit.c @@ -23,35 +23,15 @@ #include "util/u_surface.h" #include "util/u_blitter.h" #include "util/u_format.h" +#include "r600_blit_common.h" #include "radeonsi_pipe.h" #include "si_state.h" -enum r600_blitter_op /* bitmask */ -{ - R600_SAVE_TEXTURES = 1, - R600_SAVE_FRAMEBUFFER = 2, - R600_DISABLE_RENDER_COND = 4, - - R600_CLEAR = 0, - - R600_CLEAR_SURFACE = R600_SAVE_FRAMEBUFFER, - - R600_COPY = R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES | - R600_DISABLE_RENDER_COND, - - R600_BLIT = R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES | - R600_DISABLE_RENDER_COND, - - R600_DECOMPRESS = R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND, - - R600_COLOR_RESOLVE = R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND -}; - -static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op) +static void si_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op) { struct r600_context *rctx = (struct r600_context *)ctx; - r600_context_queries_suspend(rctx); + si_context_queries_suspend(rctx); util_blitter_save_blend(rctx->blitter, rctx->queued.named.blend); util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->queued.named.dsa); @@ -90,7 +70,7 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op } -static void r600_blitter_end(struct pipe_context *ctx) +static void si_blitter_end(struct pipe_context *ctx) { struct r600_context *rctx = (struct r600_context *)ctx; if (rctx->saved_render_cond) { @@ -100,15 +80,10 @@ static void r600_blitter_end(struct pipe_context *ctx) rctx->saved_render_cond_mode); rctx->saved_render_cond = NULL; } - r600_context_queries_resume(rctx); + si_context_queries_resume(rctx); } -static unsigned u_max_sample(struct pipe_resource *r) -{ - return r->nr_samples ? r->nr_samples - 1 : 0; -} - -void r600_blit_decompress_depth(struct pipe_context *ctx, +void si_blit_decompress_depth(struct pipe_context *ctx, struct r600_texture *texture, struct r600_texture *staging, unsigned first_level, unsigned last_level, @@ -168,10 +143,10 @@ void r600_blit_decompress_depth(struct pipe_context *ctx, cbsurf = ctx->create_surface(ctx, (struct pipe_resource*)flushed_depth_texture, &surf_tmpl); - r600_blitter_begin(ctx, R600_DECOMPRESS); + si_blitter_begin(ctx, R600_DECOMPRESS); util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, 1 << sample, custom_dsa[sample], depth); - r600_blitter_end(ctx); + si_blitter_end(ctx); pipe_surface_reference(&zsurf, NULL); pipe_surface_reference(&cbsurf, NULL); @@ -215,11 +190,11 @@ static void si_blit_decompress_depth_in_place(struct r600_context *rctx, zsurf = rctx->b.b.create_surface(&rctx->b.b, &texture->resource.b.b, &surf_tmpl); - r600_blitter_begin(&rctx->b.b, R600_DECOMPRESS); + si_blitter_begin(&rctx->b.b, R600_DECOMPRESS); util_blitter_custom_depth_stencil(rctx->blitter, zsurf, NULL, ~0, rctx->custom_dsa_flush_inplace, 1.0f); - r600_blitter_end(&rctx->b.b); + si_blitter_end(&rctx->b.b); pipe_surface_reference(&zsurf, NULL); } @@ -254,7 +229,7 @@ void si_flush_depth_textures(struct r600_context *rctx, } } -static void r600_blit_decompress_color(struct pipe_context *ctx, +static void si_blit_decompress_color(struct pipe_context *ctx, struct r600_texture *rtex, unsigned first_level, unsigned last_level, unsigned first_layer, unsigned last_layer) @@ -283,10 +258,10 @@ static void r600_blit_decompress_color(struct pipe_context *ctx, surf_tmpl.u.tex.last_layer = layer; cbsurf = ctx->create_surface(ctx, &rtex->resource.b.b, &surf_tmpl); - r600_blitter_begin(ctx, R600_DECOMPRESS); + si_blitter_begin(ctx, R600_DECOMPRESS); util_blitter_custom_color(rctx->blitter, cbsurf, rctx->custom_blend_decompress); - r600_blitter_end(ctx); + si_blitter_end(ctx); pipe_surface_reference(&cbsurf, NULL); } @@ -299,7 +274,7 @@ static void r600_blit_decompress_color(struct pipe_context *ctx, } } -void r600_decompress_color_textures(struct r600_context *rctx, +void si_decompress_color_textures(struct r600_context *rctx, struct r600_textures_info *textures) { unsigned i; @@ -317,26 +292,26 @@ void r600_decompress_color_textures(struct r600_context *rctx, tex = (struct r600_texture *)view->texture; assert(tex->cmask.size || tex->fmask.size); - r600_blit_decompress_color(&rctx->b.b, tex, + si_blit_decompress_color(&rctx->b.b, tex, view->u.tex.first_level, view->u.tex.last_level, 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level)); } } -static void r600_clear(struct pipe_context *ctx, unsigned buffers, +static void si_clear(struct pipe_context *ctx, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { struct r600_context *rctx = (struct r600_context *)ctx; struct pipe_framebuffer_state *fb = &rctx->framebuffer; - r600_blitter_begin(ctx, R600_CLEAR); + si_blitter_begin(ctx, R600_CLEAR); util_blitter_clear(rctx->blitter, fb->width, fb->height, buffers, color, depth, stencil); - r600_blitter_end(ctx); + si_blitter_end(ctx); } -static void r600_clear_render_target(struct pipe_context *ctx, +static void si_clear_render_target(struct pipe_context *ctx, struct pipe_surface *dst, const union pipe_color_union *color, unsigned dstx, unsigned dsty, @@ -344,13 +319,13 @@ static void r600_clear_render_target(struct pipe_context *ctx, { struct r600_context *rctx = (struct r600_context *)ctx; - r600_blitter_begin(ctx, R600_CLEAR_SURFACE); + si_blitter_begin(ctx, R600_CLEAR_SURFACE); util_blitter_clear_render_target(rctx->blitter, dst, color, dstx, dsty, width, height); - r600_blitter_end(ctx); + si_blitter_end(ctx); } -static void r600_clear_depth_stencil(struct pipe_context *ctx, +static void si_clear_depth_stencil(struct pipe_context *ctx, struct pipe_surface *dst, unsigned clear_flags, double depth, @@ -360,17 +335,17 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, { struct r600_context *rctx = (struct r600_context *)ctx; - r600_blitter_begin(ctx, R600_CLEAR_SURFACE); + si_blitter_begin(ctx, R600_CLEAR_SURFACE); util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height); - r600_blitter_end(ctx); + si_blitter_end(ctx); } /* Helper for decompressing a portion of a color or depth resource before * blitting if any decompression is needed. * The driver doesn't decompress resources automatically while u_blitter is * rendering. */ -static void r600_decompress_subresource(struct pipe_context *ctx, +static void si_decompress_subresource(struct pipe_context *ctx, struct pipe_resource *tex, unsigned level, unsigned first_layer, unsigned last_layer) @@ -383,7 +358,7 @@ static void r600_decompress_subresource(struct pipe_context *ctx, level, level, first_layer, last_layer); } else if (rtex->fmask.size || rtex->cmask.size) { - r600_blit_decompress_color(ctx, rtex, level, level, + si_blit_decompress_color(ctx, rtex, level, level, first_layer, last_layer); } } @@ -398,7 +373,7 @@ struct texture_orig_info { unsigned npix0_y; }; -static void r600_compressed_to_blittable(struct pipe_resource *tex, +static void si_compressed_to_blittable(struct pipe_resource *tex, unsigned level, struct texture_orig_info *orig) { @@ -432,7 +407,7 @@ static void r600_compressed_to_blittable(struct pipe_resource *tex, rtex->surface.level[level].npix_y = util_format_get_nblocksy(orig->format, orig->npix_y); } -static void r600_change_format(struct pipe_resource *tex, +static void si_change_format(struct pipe_resource *tex, unsigned level, struct texture_orig_info *orig, enum pipe_format format) @@ -450,7 +425,7 @@ static void r600_change_format(struct pipe_resource *tex, tex->format = format; } -static void r600_reset_blittable_to_orig(struct pipe_resource *tex, +static void si_reset_blittable_to_orig(struct pipe_resource *tex, unsigned level, struct texture_orig_info *orig) { @@ -465,7 +440,7 @@ static void r600_reset_blittable_to_orig(struct pipe_resource *tex, rtex->surface.level[level].npix_y = orig->npix_y; } -static void r600_resource_copy_region(struct pipe_context *ctx, +static void si_resource_copy_region(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, @@ -490,14 +465,14 @@ static void r600_resource_copy_region(struct pipe_context *ctx, /* The driver doesn't decompress resources automatically while * u_blitter is rendering. */ - r600_decompress_subresource(ctx, src, src_level, + si_decompress_subresource(ctx, src, src_level, src_box->z, src_box->z + src_box->depth - 1); restore_orig[0] = restore_orig[1] = FALSE; if (util_format_is_compressed(src->format) && util_format_is_compressed(dst->format)) { - r600_compressed_to_blittable(src, src_level, &orig_info[0]); + si_compressed_to_blittable(src, src_level, &orig_info[0]); restore_orig[0] = TRUE; sbox.x = util_format_get_nblocksx(orig_info[0].format, src_box->x); sbox.y = util_format_get_nblocksy(orig_info[0].format, src_box->y); @@ -507,7 +482,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, sbox.depth = src_box->depth; psbox=&sbox; - r600_compressed_to_blittable(dst, dst_level, &orig_info[1]); + si_compressed_to_blittable(dst, dst_level, &orig_info[1]); restore_orig[1] = TRUE; /* translate the dst box as well */ dstx = util_format_get_nblocksx(orig_info[1].format, dstx); @@ -518,33 +493,33 @@ static void r600_resource_copy_region(struct pipe_context *ctx, switch (blocksize) { case 1: - r600_change_format(src, src_level, &orig_info[0], + si_change_format(src, src_level, &orig_info[0], PIPE_FORMAT_R8_UNORM); - r600_change_format(dst, dst_level, &orig_info[1], + si_change_format(dst, dst_level, &orig_info[1], PIPE_FORMAT_R8_UNORM); break; case 2: - r600_change_format(src, src_level, &orig_info[0], + si_change_format(src, src_level, &orig_info[0], PIPE_FORMAT_R8G8_UNORM); - r600_change_format(dst, dst_level, &orig_info[1], + si_change_format(dst, dst_level, &orig_info[1], PIPE_FORMAT_R8G8_UNORM); break; case 4: - r600_change_format(src, src_level, &orig_info[0], + si_change_format(src, src_level, &orig_info[0], PIPE_FORMAT_R8G8B8A8_UNORM); - r600_change_format(dst, dst_level, &orig_info[1], + si_change_format(dst, dst_level, &orig_info[1], PIPE_FORMAT_R8G8B8A8_UNORM); break; case 8: - r600_change_format(src, src_level, &orig_info[0], + si_change_format(src, src_level, &orig_info[0], PIPE_FORMAT_R16G16B16A16_UINT); - r600_change_format(dst, dst_level, &orig_info[1], + si_change_format(dst, dst_level, &orig_info[1], PIPE_FORMAT_R16G16B16A16_UINT); break; case 16: - r600_change_format(src, src_level, &orig_info[0], + si_change_format(src, src_level, &orig_info[0], PIPE_FORMAT_R32G32B32A32_UINT); - r600_change_format(dst, dst_level, &orig_info[1], + si_change_format(dst, dst_level, &orig_info[1], PIPE_FORMAT_R32G32B32A32_UINT); break; default: @@ -556,19 +531,19 @@ static void r600_resource_copy_region(struct pipe_context *ctx, restore_orig[1] = TRUE; } - r600_blitter_begin(ctx, R600_COPY); + si_blitter_begin(ctx, R600_COPY_TEXTURE); util_blitter_copy_texture(rctx->blitter, dst, dst_level, dstx, dsty, dstz, src, src_level, psbox, PIPE_MASK_RGBAZS, TRUE); - r600_blitter_end(ctx); + si_blitter_end(ctx); if (restore_orig[0]) - r600_reset_blittable_to_orig(src, src_level, &orig_info[0]); + si_reset_blittable_to_orig(src, src_level, &orig_info[0]); if (restore_orig[1]) - r600_reset_blittable_to_orig(dst, dst_level, &orig_info[1]); + si_reset_blittable_to_orig(dst, dst_level, &orig_info[1]); } -static boolean is_simple_msaa_resolve(const struct pipe_blit_info *info) +static boolean si_is_simple_msaa_resolve(const struct pipe_blit_info *info) { unsigned dst_width = u_minify(info->dst.resource->width0, info->dst.level); unsigned dst_height = u_minify(info->dst.resource->height0, info->dst.level); @@ -597,42 +572,6 @@ static boolean is_simple_msaa_resolve(const struct pipe_blit_info *info) !dst_is_scanout; } -/* For MSAA integer resolving to work, we change the format to NORM using this function. */ -static enum pipe_format int_to_norm_format(enum pipe_format format) -{ - switch (format) { -#define REPLACE_FORMAT_SIGN(format,sign) \ - case PIPE_FORMAT_##format##_##sign##INT: \ - return PIPE_FORMAT_##format##_##sign##NORM -#define REPLACE_FORMAT(format) \ - REPLACE_FORMAT_SIGN(format, U); \ - REPLACE_FORMAT_SIGN(format, S) - - REPLACE_FORMAT_SIGN(B10G10R10A2, U); - REPLACE_FORMAT(R8); - REPLACE_FORMAT(R8G8); - REPLACE_FORMAT(R8G8B8X8); - REPLACE_FORMAT(R8G8B8A8); - REPLACE_FORMAT(A8); - REPLACE_FORMAT(I8); - REPLACE_FORMAT(L8); - REPLACE_FORMAT(L8A8); - REPLACE_FORMAT(R16); - REPLACE_FORMAT(R16G16); - REPLACE_FORMAT(R16G16B16X16); - REPLACE_FORMAT(R16G16B16A16); - REPLACE_FORMAT(A16); - REPLACE_FORMAT(I16); - REPLACE_FORMAT(L16); - REPLACE_FORMAT(L16A16); - -#undef REPLACE_FORMAT -#undef REPLACE_FORMAT_SIGN - default: - return format; - } -} - static void si_msaa_color_resolve(struct pipe_context *ctx, const struct pipe_blit_info *info) { @@ -646,15 +585,15 @@ static void si_msaa_color_resolve(struct pipe_context *ctx, assert(info->src.box.depth == 1); assert(info->dst.box.depth == 1); - if (is_simple_msaa_resolve(info)) { - r600_blitter_begin(ctx, R600_COLOR_RESOLVE); + if (si_is_simple_msaa_resolve(info)) { + si_blitter_begin(ctx, R600_COLOR_RESOLVE); util_blitter_custom_resolve_color(rctx->blitter, info->dst.resource, info->dst.level, info->dst.box.z, info->src.resource, info->src.box.z, sample_mask, rctx->custom_blend_resolve, int_to_norm_format(info->dst.format)); - r600_blitter_end(ctx); + si_blitter_end(ctx); return; } @@ -674,22 +613,22 @@ static void si_msaa_color_resolve(struct pipe_context *ctx, tmp = screen->resource_create(screen, &templ); /* resolve */ - r600_blitter_begin(ctx, R600_COLOR_RESOLVE); + si_blitter_begin(ctx, R600_COLOR_RESOLVE); util_blitter_custom_resolve_color(rctx->blitter, tmp, 0, 0, info->src.resource, info->src.box.z, sample_mask, rctx->custom_blend_resolve, int_to_norm_format(tmp->format)); - r600_blitter_end(ctx); + si_blitter_end(ctx); /* blit */ blit = *info; blit.src.resource = tmp; blit.src.box.z = 0; - r600_blitter_begin(ctx, R600_BLIT); + si_blitter_begin(ctx, R600_BLIT); util_blitter_blit(rctx->blitter, &blit); - r600_blitter_end(ctx); + si_blitter_end(ctx); pipe_resource_reference(&tmp, NULL); } @@ -711,20 +650,20 @@ static void si_blit(struct pipe_context *ctx, /* The driver doesn't decompress resources automatically while * u_blitter is rendering. */ - r600_decompress_subresource(ctx, info->src.resource, info->src.level, + si_decompress_subresource(ctx, info->src.resource, info->src.level, info->src.box.z, info->src.box.z + info->src.box.depth - 1); - r600_blitter_begin(ctx, R600_BLIT); + si_blitter_begin(ctx, R600_BLIT); util_blitter_blit(rctx->blitter, info); - r600_blitter_end(ctx); + si_blitter_end(ctx); } void si_init_blit_functions(struct r600_context *rctx) { - rctx->b.b.clear = r600_clear; - rctx->b.b.clear_render_target = r600_clear_render_target; - rctx->b.b.clear_depth_stencil = r600_clear_depth_stencil; - rctx->b.b.resource_copy_region = r600_resource_copy_region; + rctx->b.b.clear = si_clear; + rctx->b.b.clear_render_target = si_clear_render_target; + rctx->b.b.clear_depth_stencil = si_clear_depth_stencil; + rctx->b.b.resource_copy_region = si_resource_copy_region; rctx->b.b.blit = si_blit; } diff --git a/src/gallium/drivers/radeonsi/r600_buffer.c b/src/gallium/drivers/radeonsi/r600_buffer.c index 12e5c4d..fc63283 100644 --- a/src/gallium/drivers/radeonsi/r600_buffer.c +++ b/src/gallium/drivers/radeonsi/r600_buffer.c @@ -35,7 +35,7 @@ #include "r600.h" #include "radeonsi_pipe.h" -static void r600_buffer_destroy(struct pipe_screen *screen, +static void si_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *buf) { struct r600_resource *rbuffer = r600_resource(buf); @@ -44,7 +44,7 @@ static void r600_buffer_destroy(struct pipe_screen *screen, FREE(rbuffer); } -static void *r600_buffer_transfer_map(struct pipe_context *ctx, +static void *si_buffer_transfer_map(struct pipe_context *ctx, struct pipe_resource *resource, unsigned level, unsigned usage, @@ -73,26 +73,26 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx, return (uint8_t*)data + transfer->box.x; } -static void r600_buffer_transfer_unmap(struct pipe_context *ctx, +static void si_buffer_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer *transfer) { struct r600_context *rctx = (struct r600_context*)ctx; util_slab_free(&rctx->pool_transfers, transfer); } -static void r600_buffer_transfer_flush_region(struct pipe_context *pipe, +static void si_buffer_transfer_flush_region(struct pipe_context *pipe, struct pipe_transfer *transfer, const struct pipe_box *box) { } -static const struct u_resource_vtbl r600_buffer_vtbl = +static const struct u_resource_vtbl si_buffer_vtbl = { u_default_resource_get_handle, /* get_handle */ - r600_buffer_destroy, /* resource_destroy */ - r600_buffer_transfer_map, /* transfer_map */ - r600_buffer_transfer_flush_region, /* transfer_flush_region */ - r600_buffer_transfer_unmap, /* transfer_unmap */ + si_buffer_destroy, /* resource_destroy */ + si_buffer_transfer_map, /* transfer_map */ + si_buffer_transfer_flush_region, /* transfer_flush_region */ + si_buffer_transfer_unmap, /* transfer_unmap */ NULL /* transfer_inline_write */ }; @@ -153,7 +153,7 @@ struct pipe_resource *si_buffer_create(struct pipe_screen *screen, rbuffer->b.b = *templ; pipe_reference_init(&rbuffer->b.b.reference, 1); rbuffer->b.b.screen = screen; - rbuffer->b.vtbl = &r600_buffer_vtbl; + rbuffer->b.vtbl = &si_buffer_vtbl; util_range_init(&rbuffer->valid_buffer_range); if (!si_init_resource(rscreen, rbuffer, templ->width0, alignment, TRUE, templ->usage)) { @@ -163,14 +163,14 @@ struct pipe_resource *si_buffer_create(struct pipe_screen *screen, return &rbuffer->b.b; } -void r600_upload_index_buffer(struct r600_context *rctx, +void si_upload_index_buffer(struct r600_context *rctx, struct pipe_index_buffer *ib, unsigned count) { u_upload_data(rctx->uploader, 0, count * ib->index_size, ib->user_buffer, &ib->offset, &ib->buffer); } -void r600_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer, +void si_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer, const uint8_t *ptr, unsigned size, uint32_t *const_offset) { diff --git a/src/gallium/drivers/radeonsi/r600_hw_context.c b/src/gallium/drivers/radeonsi/r600_hw_context.c index b6e7a0f..30ecd25 100644 --- a/src/gallium/drivers/radeonsi/r600_hw_context.c +++ b/src/gallium/drivers/radeonsi/r600_hw_context.c @@ -61,7 +61,7 @@ void si_get_backend_mask(struct r600_context *ctx) /* otherwise backup path for older kernels */ /* create buffer for event data */ - buffer = r600_resource_create_custom(&ctx->screen->b.b, + buffer = si_resource_create_custom(&ctx->screen->b.b, PIPE_USAGE_STAGING, ctx->max_db*16); if (!buffer) @@ -186,7 +186,7 @@ void si_context_flush(struct r600_context *ctx, unsigned flags) /* suspend queries */ ctx->nontimer_queries_suspended = false; if (ctx->num_cs_dw_nontimer_queries_suspend) { - r600_context_queries_suspend(ctx); + si_context_queries_suspend(ctx); ctx->nontimer_queries_suspended = true; } @@ -273,7 +273,7 @@ void si_begin_new_cs(struct r600_context *ctx) /* resume queries */ if (ctx->nontimer_queries_suspended) { - r600_context_queries_resume(ctx); + si_context_queries_resume(ctx); } si_all_descriptors_begin_new_cs(ctx); @@ -302,7 +302,7 @@ void si_context_emit_fence(struct r600_context *ctx, struct r600_resource *fence cs->buf[cs->cdw++] = r600_context_bo_reloc(&ctx->b, &ctx->b.rings.gfx, fence_bo, RADEON_USAGE_WRITE); } -static unsigned r600_query_read_result(char *map, unsigned start_index, unsigned end_index, +static unsigned si_query_read_result(char *map, unsigned start_index, unsigned end_index, bool test_status_bit) { uint32_t *current_result = (uint32_t*)map; @@ -320,7 +320,7 @@ static unsigned r600_query_read_result(char *map, unsigned start_index, unsigned return 0; } -static boolean r600_query_result(struct r600_context *ctx, struct r600_query *query, boolean wait) +static boolean si_query_result(struct r600_context *ctx, struct r600_query *query, boolean wait) { unsigned results_base = query->results_start; char *map; @@ -336,14 +336,14 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu case PIPE_QUERY_OCCLUSION_COUNTER: while (results_base != query->results_end) { query->result.u64 += - r600_query_read_result(map + results_base, 0, 2, true); + si_query_read_result(map + results_base, 0, 2, true); results_base = (results_base + 16) % query->buffer->b.b.width0; } break; case PIPE_QUERY_OCCLUSION_PREDICATE: while (results_base != query->results_end) { query->result.b = query->result.b || - r600_query_read_result(map + results_base, 0, 2, true) != 0; + si_query_read_result(map + results_base, 0, 2, true) != 0; results_base = (results_base + 16) % query->buffer->b.b.width0; } break; @@ -356,7 +356,7 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu case PIPE_QUERY_TIME_ELAPSED: while (results_base != query->results_end) { query->result.u64 += - r600_query_read_result(map + results_base, 0, 2, false); + si_query_read_result(map + results_base, 0, 2, false); results_base = (results_base + query->result_size) % query->buffer->b.b.width0; } break; @@ -369,7 +369,7 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu * We only need NumPrimitivesWritten here. */ while (results_base != query->results_end) { query->result.u64 += - r600_query_read_result(map + results_base, 2, 6, true); + si_query_read_result(map + results_base, 2, 6, true); results_base = (results_base + query->result_size) % query->buffer->b.b.width0; } break; @@ -377,24 +377,24 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu /* Here we read PrimitiveStorageNeeded. */ while (results_base != query->results_end) { query->result.u64 += - r600_query_read_result(map + results_base, 0, 4, true); + si_query_read_result(map + results_base, 0, 4, true); results_base = (results_base + query->result_size) % query->buffer->b.b.width0; } break; case PIPE_QUERY_SO_STATISTICS: while (results_base != query->results_end) { query->result.so.num_primitives_written += - r600_query_read_result(map + results_base, 2, 6, true); + si_query_read_result(map + results_base, 2, 6, true); query->result.so.primitives_storage_needed += - r600_query_read_result(map + results_base, 0, 4, true); + si_query_read_result(map + results_base, 0, 4, true); results_base = (results_base + query->result_size) % query->buffer->b.b.width0; } break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: while (results_base != query->results_end) { query->result.b = query->result.b || - r600_query_read_result(map + results_base, 2, 6, true) != - r600_query_read_result(map + results_base, 0, 4, true); + si_query_read_result(map + results_base, 2, 6, true) != + si_query_read_result(map + results_base, 0, 4, true); results_base = (results_base + query->result_size) % query->buffer->b.b.width0; } break; @@ -407,7 +407,7 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu return TRUE; } -void r600_query_begin(struct r600_context *ctx, struct r600_query *query) +void si_query_begin(struct r600_context *ctx, struct r600_query *query) { struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs; unsigned new_results_end, i; @@ -420,7 +420,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) /* collect current results if query buffer is full */ if (new_results_end == query->results_start) { - r600_query_result(ctx, query, TRUE); + si_query_result(ctx, query, TRUE); } switch (query->type) { @@ -496,7 +496,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) } } -void r600_query_end(struct r600_context *ctx, struct r600_query *query) +void si_query_end(struct r600_context *ctx, struct r600_query *query) { struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs; uint64_t va; @@ -510,7 +510,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) /* collect current results if query buffer is full */ if (new_results_end == query->results_start) { - r600_query_result(ctx, query, TRUE); + si_query_result(ctx, query, TRUE); } } @@ -559,7 +559,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) } } -void r600_query_predication(struct r600_context *ctx, struct r600_query *query, int operation, +void si_query_predication(struct r600_context *ctx, struct r600_query *query, int operation, int flag_wait) { struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs; @@ -602,7 +602,7 @@ void r600_query_predication(struct r600_context *ctx, struct r600_query *query, } } -struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type) +struct r600_query *si_context_query_create(struct r600_context *ctx, unsigned query_type) { struct r600_query *query; unsigned buffer_size = 4096; @@ -648,7 +648,7 @@ struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned * being written by the gpu, hence staging is probably a good * usage pattern. */ - query->buffer = r600_resource_create_custom(&ctx->screen->b.b, + query->buffer = si_resource_create_custom(&ctx->screen->b.b, PIPE_USAGE_STAGING, buffer_size); if (!query->buffer) { @@ -658,13 +658,13 @@ struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned return query; } -void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query) +void si_context_query_destroy(struct r600_context *ctx, struct r600_query *query) { r600_resource_reference(&query->buffer, NULL); free(query); } -boolean r600_context_query_result(struct r600_context *ctx, +boolean si_context_query_result(struct r600_context *ctx, struct r600_query *query, boolean wait, void *vresult) { @@ -673,7 +673,7 @@ boolean r600_context_query_result(struct r600_context *ctx, struct pipe_query_data_so_statistics *result_so = (struct pipe_query_data_so_statistics*)vresult; - if (!r600_query_result(ctx, query, wait)) + if (!si_query_result(ctx, query, wait)) return FALSE; switch (query->type) { @@ -699,36 +699,36 @@ boolean r600_context_query_result(struct r600_context *ctx, return TRUE; } -void r600_context_queries_suspend(struct r600_context *ctx) +void si_context_queries_suspend(struct r600_context *ctx) { struct r600_query *query; LIST_FOR_EACH_ENTRY(query, &ctx->active_nontimer_query_list, list) { - r600_query_end(ctx, query); + si_query_end(ctx, query); } assert(ctx->num_cs_dw_nontimer_queries_suspend == 0); } -void r600_context_queries_resume(struct r600_context *ctx) +void si_context_queries_resume(struct r600_context *ctx) { struct r600_query *query; assert(ctx->num_cs_dw_nontimer_queries_suspend == 0); LIST_FOR_EACH_ENTRY(query, &ctx->active_nontimer_query_list, list) { - r600_query_begin(ctx, query); + si_query_begin(ctx, query); } } #if R600_TRACE_CS -void r600_trace_emit(struct r600_context *rctx) +void si_trace_emit(struct r600_context *rctx) { struct r600_screen *rscreen = rctx->screen; struct radeon_winsys_cs *cs = rctx->cs; uint64_t va; - va = r600_resource_va(&rscreen->screen, (void*)rscreen->trace_bo); - r600_context_bo_reloc(rctx, rscreen->trace_bo, RADEON_USAGE_READWRITE); + va = si_resource_va(&rscreen->screen, (void*)rscreen->trace_bo); + si_context_bo_reloc(rctx, rscreen->trace_bo, RADEON_USAGE_READWRITE); cs->buf[cs->cdw++] = PKT3(PKT3_WRITE_DATA, 4, 0); cs->buf[cs->cdw++] = PKT3_WRITE_DATA_DST_SEL(PKT3_WRITE_DATA_DST_SEL_MEM_SYNC) | PKT3_WRITE_DATA_WR_CONFIRM | diff --git a/src/gallium/drivers/radeonsi/r600_query.c b/src/gallium/drivers/radeonsi/r600_query.c index e9fce94..74e4a0b 100644 --- a/src/gallium/drivers/radeonsi/r600_query.c +++ b/src/gallium/drivers/radeonsi/r600_query.c @@ -23,21 +23,21 @@ #include "radeonsi_pipe.h" #include "sid.h" -static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type) +static struct pipe_query *si_create_query(struct pipe_context *ctx, unsigned query_type) { struct r600_context *rctx = (struct r600_context *)ctx; - return (struct pipe_query*)r600_context_query_create(rctx, query_type); + return (struct pipe_query*)si_context_query_create(rctx, query_type); } -static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query) +static void si_destroy_query(struct pipe_context *ctx, struct pipe_query *query) { struct r600_context *rctx = (struct r600_context *)ctx; - r600_context_query_destroy(rctx, (struct r600_query *)query); + si_context_query_destroy(rctx, (struct r600_query *)query); } -static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) +static void si_begin_query(struct pipe_context *ctx, struct pipe_query *query) { struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; @@ -49,14 +49,14 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) memset(&rquery->result, 0, sizeof(rquery->result)); rquery->results_start = rquery->results_end; - r600_query_begin(rctx, (struct r600_query *)query); + si_query_begin(rctx, (struct r600_query *)query); if (!si_is_timer_query(rquery->type)) { LIST_ADDTAIL(&rquery->list, &rctx->active_nontimer_query_list); } } -static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) +static void si_end_query(struct pipe_context *ctx, struct pipe_query *query) { struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; @@ -65,24 +65,24 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) memset(&rquery->result, 0, sizeof(rquery->result)); } - r600_query_end(rctx, rquery); + si_query_end(rctx, rquery); if (si_query_needs_begin(rquery->type) && !si_is_timer_query(rquery->type)) { LIST_DELINIT(&rquery->list); } } -static boolean r600_get_query_result(struct pipe_context *ctx, +static boolean si_get_query_result(struct pipe_context *ctx, struct pipe_query *query, boolean wait, union pipe_query_result *vresult) { struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; - return r600_context_query_result(rctx, rquery, wait, vresult); + return si_context_query_result(rctx, rquery, wait, vresult); } -static void r600_render_condition(struct pipe_context *ctx, +static void si_render_condition(struct pipe_context *ctx, struct pipe_query *query, boolean condition, uint mode) @@ -94,7 +94,7 @@ static void r600_render_condition(struct pipe_context *ctx, /* If we already have nonzero result, render unconditionally */ if (query != NULL && rquery->result.u64 != 0) { if (rctx->current_render_cond) { - r600_render_condition(ctx, NULL, FALSE, 0); + si_render_condition(ctx, NULL, FALSE, 0); } return; } @@ -106,7 +106,7 @@ static void r600_render_condition(struct pipe_context *ctx, if (query == NULL) { if (rctx->predicate_drawing) { rctx->predicate_drawing = false; - r600_query_predication(rctx, NULL, PREDICATION_OP_CLEAR, 1); + si_query_predication(rctx, NULL, PREDICATION_OP_CLEAR, 1); } return; } @@ -121,27 +121,27 @@ static void r600_render_condition(struct pipe_context *ctx, switch (rquery->type) { case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: - r600_query_predication(rctx, rquery, PREDICATION_OP_ZPASS, wait_flag); + si_query_predication(rctx, rquery, PREDICATION_OP_ZPASS, wait_flag); break; case PIPE_QUERY_PRIMITIVES_EMITTED: case PIPE_QUERY_PRIMITIVES_GENERATED: case PIPE_QUERY_SO_STATISTICS: case PIPE_QUERY_SO_OVERFLOW_PREDICATE: - r600_query_predication(rctx, rquery, PREDICATION_OP_PRIMCOUNT, wait_flag); + si_query_predication(rctx, rquery, PREDICATION_OP_PRIMCOUNT, wait_flag); break; default: assert(0); } } -void r600_init_query_functions(struct r600_context *rctx) +void si_init_query_functions(struct r600_context *rctx) { - rctx->b.b.create_query = r600_create_query; - rctx->b.b.destroy_query = r600_destroy_query; - rctx->b.b.begin_query = r600_begin_query; - rctx->b.b.end_query = r600_end_query; - rctx->b.b.get_query_result = r600_get_query_result; + rctx->b.b.create_query = si_create_query; + rctx->b.b.destroy_query = si_destroy_query; + rctx->b.b.begin_query = si_begin_query; + rctx->b.b.end_query = si_end_query; + rctx->b.b.get_query_result = si_get_query_result; if (rctx->screen->b.info.r600_num_backends > 0) - rctx->b.b.render_condition = r600_render_condition; + rctx->b.b.render_condition = si_render_condition; } diff --git a/src/gallium/drivers/radeonsi/r600_resource.c b/src/gallium/drivers/radeonsi/r600_resource.c index 660e279..626e2f3 100644 --- a/src/gallium/drivers/radeonsi/r600_resource.c +++ b/src/gallium/drivers/radeonsi/r600_resource.c @@ -23,7 +23,7 @@ #include "radeonsi_pipe.h" -static struct pipe_resource *r600_resource_create(struct pipe_screen *screen, +static struct pipe_resource *si_resource_create(struct pipe_screen *screen, const struct pipe_resource *templ) { if (templ->target == PIPE_BUFFER) { @@ -33,7 +33,7 @@ static struct pipe_resource *r600_resource_create(struct pipe_screen *screen, } } -static struct pipe_resource *r600_resource_from_handle(struct pipe_screen * screen, +static struct pipe_resource *si_resource_from_handle(struct pipe_screen * screen, const struct pipe_resource *templ, struct winsys_handle *whandle) { @@ -44,15 +44,15 @@ static struct pipe_resource *r600_resource_from_handle(struct pipe_screen * scre } } -void r600_init_screen_resource_functions(struct pipe_screen *screen) +void si_init_screen_resource_functions(struct pipe_screen *screen) { - screen->resource_create = r600_resource_create; - screen->resource_from_handle = r600_resource_from_handle; + screen->resource_create = si_resource_create; + screen->resource_from_handle = si_resource_from_handle; screen->resource_get_handle = u_resource_get_handle_vtbl; screen->resource_destroy = u_resource_destroy_vtbl; } -void r600_init_context_resource_functions(struct r600_context *r600) +void si_init_context_resource_functions(struct r600_context *r600) { r600->b.b.transfer_map = u_transfer_map_vtbl; r600->b.b.transfer_flush_region = u_transfer_flush_region_vtbl; diff --git a/src/gallium/drivers/radeonsi/r600_resource.h b/src/gallium/drivers/radeonsi/r600_resource.h index 3f9c769..eaa1be8 100644 --- a/src/gallium/drivers/radeonsi/r600_resource.h +++ b/src/gallium/drivers/radeonsi/r600_resource.h @@ -77,7 +77,7 @@ struct r600_surface { struct pipe_surface base; }; -void r600_init_screen_resource_functions(struct pipe_screen *screen); +void si_init_screen_resource_functions(struct pipe_screen *screen); /* r600_texture */ struct pipe_resource *si_texture_create(struct pipe_screen *screen, @@ -86,14 +86,14 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, const struct pipe_resource *base, struct winsys_handle *whandle); -bool r600_init_flushed_depth_texture(struct pipe_context *ctx, +bool si_init_flushed_depth_texture(struct pipe_context *ctx, struct pipe_resource *texture, struct r600_texture **staging); struct r600_context; -void r600_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer, +void si_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer, const uint8_t *ptr, unsigned size, uint32_t *const_offset); diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c index e6e8e20..73fa431 100644 --- a/src/gallium/drivers/radeonsi/r600_texture.c +++ b/src/gallium/drivers/radeonsi/r600_texture.c @@ -34,44 +34,11 @@ #include "pipebuffer/pb_buffer.h" #include "radeonsi_pipe.h" #include "r600_resource.h" +#include "r600_texture_common.h" #include "sid.h" -/* Same as resource_copy_region, except that both upsampling and downsampling are allowed. */ -static void r600_copy_region_with_blit(struct pipe_context *pipe, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dstx, unsigned dsty, unsigned dstz, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box) -{ - struct pipe_blit_info blit; - - memset(&blit, 0, sizeof(blit)); - blit.src.resource = src; - blit.src.format = src->format; - blit.src.level = src_level; - blit.src.box = *src_box; - blit.dst.resource = dst; - blit.dst.format = dst->format; - blit.dst.level = dst_level; - blit.dst.box.x = dstx; - blit.dst.box.y = dsty; - blit.dst.box.z = dstz; - blit.dst.box.width = src_box->width; - blit.dst.box.height = src_box->height; - blit.dst.box.depth = src_box->depth; - blit.mask = util_format_get_mask(src->format) & - util_format_get_mask(dst->format); - blit.filter = PIPE_TEX_FILTER_NEAREST; - - if (blit.mask) { - pipe->blit(pipe, &blit); - } -} - /* Copy from a full GPU texture to a transfer's staging one. */ -static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) +static void si_copy_to_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) { struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer; struct pipe_resource *dst = &rtransfer->staging->b.b; @@ -88,7 +55,7 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t } /* Copy from a transfer's staging texture to a full GPU one. */ -static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) +static void si_copy_from_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer) { struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer; struct pipe_resource *dst = transfer->resource; @@ -109,8 +76,8 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600 src, 0, &sbox); } -static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned level, - const struct pipe_box *box) +static unsigned si_texture_get_offset(struct r600_texture *rtex, unsigned level, + const struct pipe_box *box) { enum pipe_format format = rtex->resource.b.b.format; @@ -120,11 +87,11 @@ static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned leve box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); } -static int r600_init_surface(struct r600_screen *rscreen, - struct radeon_surface *surface, - const struct pipe_resource *ptex, - unsigned array_mode, - bool is_flushed_depth) +static int si_init_surface(struct r600_screen *rscreen, + struct radeon_surface *surface, + const struct pipe_resource *ptex, + unsigned array_mode, + bool is_flushed_depth) { const struct util_format_description *desc = util_format_description(ptex->format); @@ -212,9 +179,9 @@ static int r600_init_surface(struct r600_screen *rscreen, return 0; } -static int r600_setup_surface(struct pipe_screen *screen, - struct r600_texture *rtex, - unsigned pitch_in_bytes_override) +static int si_setup_surface(struct pipe_screen *screen, + struct r600_texture *rtex, + unsigned pitch_in_bytes_override) { struct r600_screen *rscreen = (struct r600_screen*)screen; int r; @@ -241,7 +208,7 @@ static int r600_setup_surface(struct pipe_screen *screen, return 0; } -static boolean r600_texture_get_handle(struct pipe_screen* screen, +static boolean si_texture_get_handle(struct pipe_screen* screen, struct pipe_resource *ptex, struct winsys_handle *whandle) { @@ -266,8 +233,8 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, surface->level[0].pitch_bytes, whandle); } -static void r600_texture_destroy(struct pipe_screen *screen, - struct pipe_resource *ptex) +static void si_texture_destroy(struct pipe_screen *screen, + struct pipe_resource *ptex) { struct r600_texture *rtex = (struct r600_texture*)ptex; struct r600_resource *resource = &rtex->resource; @@ -279,15 +246,15 @@ static void r600_texture_destroy(struct pipe_screen *screen, FREE(rtex); } -static const struct u_resource_vtbl r600_texture_vtbl; +static const struct u_resource_vtbl si_texture_vtbl; DEBUG_GET_ONCE_BOOL_OPTION(print_texdepth, "RADEON_PRINT_TEXDEPTH", FALSE); /* The number of samples can be specified independently of the texture. */ -static void r600_texture_get_fmask_info(struct r600_screen *rscreen, - struct r600_texture *rtex, - unsigned nr_samples, - struct r600_fmask_info *out) +static void si_texture_get_fmask_info(struct r600_screen *rscreen, + struct r600_texture *rtex, + unsigned nr_samples, + struct r600_fmask_info *out) { /* FMASK is allocated like an ordinary texture. */ struct radeon_surface fmask = rtex->surface; @@ -330,10 +297,10 @@ static void r600_texture_get_fmask_info(struct r600_screen *rscreen, out->size = fmask.bo_size; } -static void r600_texture_allocate_fmask(struct r600_screen *rscreen, - struct r600_texture *rtex) +static void si_texture_allocate_fmask(struct r600_screen *rscreen, + struct r600_texture *rtex) { - r600_texture_get_fmask_info(rscreen, rtex, + si_texture_get_fmask_info(rscreen, rtex, rtex->resource.b.b.nr_samples, &rtex->fmask); rtex->fmask.offset = align(rtex->size, rtex->fmask.alignment); @@ -383,8 +350,8 @@ static void si_texture_get_cmask_info(struct r600_screen *rscreen, out->size = rtex->surface.array_size * align(slice_bytes, base_align); } -static void r600_texture_allocate_cmask(struct r600_screen *rscreen, - struct r600_texture *rtex) +static void si_texture_allocate_cmask(struct r600_screen *rscreen, + struct r600_texture *rtex) { si_texture_get_cmask_info(rscreen, rtex, &rtex->cmask); @@ -395,11 +362,11 @@ static void r600_texture_allocate_cmask(struct r600_screen *rscreen, } static struct r600_texture * -r600_texture_create_object(struct pipe_screen *screen, - const struct pipe_resource *base, - unsigned pitch_in_bytes_override, - struct pb_buffer *buf, - struct radeon_surface *surface) +si_texture_create_object(struct pipe_screen *screen, + const struct pipe_resource *base, + unsigned pitch_in_bytes_override, + struct pb_buffer *buf, + struct radeon_surface *surface) { struct r600_texture *rtex; struct r600_resource *resource; @@ -412,7 +379,7 @@ r600_texture_create_object(struct pipe_screen *screen, resource = &rtex->resource; resource->b.b = *base; - resource->b.vtbl = &r600_texture_vtbl; + resource->b.vtbl = &si_texture_vtbl; pipe_reference_init(&resource->b.b.reference, 1); resource->b.b.screen = screen; rtex->pitch_override = pitch_in_bytes_override; @@ -421,15 +388,15 @@ r600_texture_create_object(struct pipe_screen *screen, rtex->is_depth = util_format_has_depth(util_format_description(rtex->resource.b.b.format)); rtex->surface = *surface; - r = r600_setup_surface(screen, rtex, pitch_in_bytes_override); + r = si_setup_surface(screen, rtex, pitch_in_bytes_override); if (r) { FREE(rtex); return NULL; } if (base->nr_samples > 1 && !rtex->is_depth && !buf) { - r600_texture_allocate_fmask(rscreen, rtex); - r600_texture_allocate_cmask(rscreen, rtex); + si_texture_allocate_fmask(rscreen, rtex); + si_texture_allocate_cmask(rscreen, rtex); } if (!rtex->is_depth && base->nr_samples > 1 && @@ -533,7 +500,7 @@ struct pipe_resource *si_texture_create(struct pipe_screen *screen, } } - r = r600_init_surface(rscreen, &surface, templ, array_mode, + r = si_init_surface(rscreen, &surface, templ, array_mode, templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH); if (r) { return NULL; @@ -542,11 +509,11 @@ struct pipe_resource *si_texture_create(struct pipe_screen *screen, if (r) { return NULL; } - return (struct pipe_resource *)r600_texture_create_object(screen, templ, + return (struct pipe_resource *)si_texture_create_object(screen, templ, 0, NULL, &surface); } -static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, +static struct pipe_surface *si_create_surface(struct pipe_context *pipe, struct pipe_resource *texture, const struct pipe_surface *surf_tmpl) { @@ -560,7 +527,7 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, if (surface == NULL) return NULL; /* XXX no offset */ -/* offset = r600_texture_get_offset(rtex, level, surf_tmpl->u.tex.first_layer);*/ +/* offset = si_texture_get_offset(rtex, level, surf_tmpl->u.tex.first_layer);*/ pipe_reference_init(&surface->base.reference, 1); pipe_resource_reference(&surface->base.texture, texture); surface->base.context = pipe; @@ -575,7 +542,7 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, return &surface->base; } -static void r600_surface_destroy(struct pipe_context *pipe, +static void si_surface_destroy(struct pipe_context *pipe, struct pipe_surface *surface) { pipe_resource_reference(&surface->texture, NULL); @@ -616,7 +583,7 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, else array_mode = V_009910_ARRAY_LINEAR_ALIGNED; - r = r600_init_surface(rscreen, &surface, templ, array_mode, false); + r = si_init_surface(rscreen, &surface, templ, array_mode, false); if (r) { return NULL; } @@ -624,11 +591,11 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, /* always set the scanout flags */ surface.flags |= RADEON_SURF_SCANOUT; - return (struct pipe_resource *)r600_texture_create_object(screen, templ, + return (struct pipe_resource *)si_texture_create_object(screen, templ, stride, buf, &surface); } -bool r600_init_flushed_depth_texture(struct pipe_context *ctx, +bool si_init_flushed_depth_texture(struct pipe_context *ctx, struct pipe_resource *texture, struct r600_texture **staging) { @@ -665,44 +632,6 @@ bool r600_init_flushed_depth_texture(struct pipe_context *ctx, return true; } -/** - * Initialize the pipe_resource descriptor to be of the same size as the box, - * which is supposed to hold a subregion of the texture "orig" at the given - * mipmap level. - */ -static void r600_init_temp_resource_from_box(struct pipe_resource *res, - struct pipe_resource *orig, - const struct pipe_box *box, - unsigned level, unsigned flags) -{ - memset(res, 0, sizeof(*res)); - res->format = orig->format; - res->width0 = box->width; - res->height0 = box->height; - res->depth0 = 1; - res->array_size = 1; - res->usage = flags & R600_RESOURCE_FLAG_TRANSFER ? PIPE_USAGE_STAGING : PIPE_USAGE_STATIC; - res->flags = flags; - - /* We must set the correct texture target and dimensions for a 3D box. */ - if (box->depth > 1 && util_max_layer(orig, level) > 0) - res->target = orig->target; - else - res->target = PIPE_TEXTURE_2D; - - switch (res->target) { - case PIPE_TEXTURE_1D_ARRAY: - case PIPE_TEXTURE_2D_ARRAY: - case PIPE_TEXTURE_CUBE_ARRAY: - res->array_size = box->depth; - break; - case PIPE_TEXTURE_3D: - res->depth0 = box->depth; - break; - default:; - } -} - static void *si_texture_transfer_map(struct pipe_context *ctx, struct pipe_resource *texture, unsigned level, @@ -770,7 +699,7 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, r600_init_temp_resource_from_box(&resource, texture, box, level, 0); - if (!r600_init_flushed_depth_texture(ctx, &resource, &staging_depth)) { + if (!si_init_flushed_depth_texture(ctx, &resource, &staging_depth)) { R600_ERR("failed to create temporary texture to hold untiled copy\n"); FREE(trans); return NULL; @@ -780,7 +709,7 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, struct pipe_resource *temp = ctx->screen->resource_create(ctx->screen, &resource); r600_copy_region_with_blit(ctx, temp, 0, 0, 0, 0, texture, level, box); - r600_blit_decompress_depth(ctx, (struct r600_texture*)temp, staging_depth, + si_blit_decompress_depth(ctx, (struct r600_texture*)temp, staging_depth, 0, 0, 0, box->depth, 0, 0); pipe_resource_reference((struct pipe_resource**)&temp, NULL); } @@ -788,18 +717,18 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, else { /* XXX: only readback the rectangle which is being mapped? */ /* XXX: when discard is true, no need to read back from depth texture */ - if (!r600_init_flushed_depth_texture(ctx, texture, &staging_depth)) { + if (!si_init_flushed_depth_texture(ctx, texture, &staging_depth)) { R600_ERR("failed to create temporary texture to hold untiled copy\n"); FREE(trans); return NULL; } - r600_blit_decompress_depth(ctx, rtex, staging_depth, + si_blit_decompress_depth(ctx, rtex, staging_depth, level, level, box->z, box->z + box->depth - 1, 0, 0); - offset = r600_texture_get_offset(staging_depth, level, box); + offset = si_texture_get_offset(staging_depth, level, box); } trans->transfer.stride = staging_depth->surface.level[level].pitch_bytes; @@ -823,13 +752,13 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, trans->transfer.stride = staging->surface.level[0].pitch_bytes; trans->transfer.layer_stride = staging->surface.level[0].slice_size; if (usage & PIPE_TRANSFER_READ) { - r600_copy_to_staging_texture(ctx, trans); + si_copy_to_staging_texture(ctx, trans); } } else { /* the resource is mapped directly */ trans->transfer.stride = rtex->surface.level[level].pitch_bytes; trans->transfer.layer_stride = rtex->surface.level[level].slice_size; - offset = r600_texture_get_offset(rtex, level, box); + offset = si_texture_get_offset(rtex, level, box); } if (trans->staging) { @@ -871,7 +800,7 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx, &rtransfer->staging->b.b, transfer->level, &transfer->box); } else { - r600_copy_from_staging_texture(ctx, rtransfer); + si_copy_from_staging_texture(ctx, rtransfer); } } @@ -883,14 +812,14 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx, void si_init_surface_functions(struct r600_context *r600) { - r600->b.b.create_surface = r600_create_surface; - r600->b.b.surface_destroy = r600_surface_destroy; + r600->b.b.create_surface = si_create_surface; + r600->b.b.surface_destroy = si_surface_destroy; } static const struct u_resource_vtbl r600_texture_vtbl = { - r600_texture_get_handle, /* get_handle */ - r600_texture_destroy, /* resource_destroy */ + si_texture_get_handle, /* get_handle */ + si_texture_destroy, /* resource_destroy */ si_texture_transfer_map, /* transfer_map */ u_default_transfer_flush_region,/* transfer_flush_region */ si_texture_transfer_unmap, /* transfer_unmap */ diff --git a/src/gallium/drivers/radeonsi/r600_translate.c b/src/gallium/drivers/radeonsi/r600_translate.c index ccb72d5..b6e7b40 100644 --- a/src/gallium/drivers/radeonsi/r600_translate.c +++ b/src/gallium/drivers/radeonsi/r600_translate.c @@ -28,7 +28,7 @@ #include "radeonsi_pipe.h" -void r600_translate_index_buffer(struct r600_context *r600, +void si_translate_index_buffer(struct r600_context *r600, struct pipe_index_buffer *ib, unsigned count) { diff --git a/src/gallium/drivers/radeonsi/radeonsi_compute.c b/src/gallium/drivers/radeonsi/radeonsi_compute.c index 4135480..3003140 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_compute.c +++ b/src/gallium/drivers/radeonsi/radeonsi_compute.c @@ -129,7 +129,7 @@ static void radeonsi_launch_grid( memcpy(kernel_args + (num_work_size_bytes / 4), input, program->input_size); - r600_upload_const_buffer(rctx, &kernel_args_buffer, (uint8_t*)kernel_args, + si_upload_const_buffer(rctx, &kernel_args_buffer, (uint8_t*)kernel_args, kernel_args_size, &kernel_args_offset); kernel_args_va = r600_resource_va(ctx->screen, (struct pipe_resource*)kernel_args_buffer); diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index 138268c..476ecc44 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -44,18 +44,18 @@ #include "os/os_time.h" #include "pipebuffer/pb_buffer.h" #include "radeonsi_pipe.h" -#include "radeon/radeon_uvd.h" +#include "radeon_uvd.h" #include "r600.h" #include "sid.h" #include "r600_resource.h" #include "radeonsi_pipe.h" #include "si_state.h" -#include "../radeon/r600_cs.h" +#include "r600_cs.h" /* * pipe_context */ -static struct r600_fence *r600_create_fence(struct r600_context *rctx) +static struct r600_fence *si_create_fence(struct r600_context *rctx) { struct r600_screen *rscreen = rctx->screen; struct r600_fence *fence = NULL; @@ -64,7 +64,7 @@ static struct r600_fence *r600_create_fence(struct r600_context *rctx) if (!rscreen->fences.bo) { /* Create the shared buffer object */ - rscreen->fences.bo = r600_resource_create_custom(&rscreen->b.b, + rscreen->fences.bo = si_resource_create_custom(&rscreen->b.b, PIPE_USAGE_STAGING, 4096); if (!rscreen->fences.bo) { @@ -122,7 +122,7 @@ static struct r600_fence *r600_create_fence(struct r600_context *rctx) si_context_emit_fence(rctx, rscreen->fences.bo, fence->index, 1); /* Create a dummy BO so that fence_finish without a timeout can sleep waiting for completion */ - fence->sleep_bo = r600_resource_create_custom(&rctx->screen->b.b, PIPE_USAGE_STAGING, 1); + fence->sleep_bo = si_resource_create_custom(&rctx->screen->b.b, PIPE_USAGE_STAGING, 1); /* Add the fence as a dummy relocation. */ r600_context_bo_reloc(&rctx->b, &rctx->b.rings.gfx, fence->sleep_bo, RADEON_USAGE_READWRITE); @@ -143,7 +143,7 @@ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, unsigned render_cond_mode = 0; if (rfence) - *rfence = r600_create_fence(rctx); + *rfence = si_create_fence(rctx); /* Disable render condition. */ if (rctx->current_render_cond) { @@ -161,7 +161,7 @@ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, } } -static void r600_flush_from_st(struct pipe_context *ctx, +static void si_flush_from_st(struct pipe_context *ctx, struct pipe_fence_handle **fence, unsigned flags) { @@ -169,12 +169,12 @@ static void r600_flush_from_st(struct pipe_context *ctx, flags & PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME : 0); } -static void r600_flush_from_winsys(void *ctx, unsigned flags) +static void si_flush_from_winsys(void *ctx, unsigned flags) { radeonsi_flush((struct pipe_context*)ctx, NULL, flags); } -static void r600_destroy_context(struct pipe_context *context) +static void si_destroy_context(struct pipe_context *context) { struct r600_context *rctx = (struct r600_context *)context; @@ -206,7 +206,7 @@ static void r600_destroy_context(struct pipe_context *context) FREE(rctx); } -static struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) +static struct pipe_context *si_create_context(struct pipe_screen *screen, void *priv) { struct r600_context *rctx = CALLOC_STRUCT(r600_context); struct r600_screen* rscreen = (struct r600_screen *)screen; @@ -219,15 +219,15 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void rctx->b.b.screen = screen; rctx->b.b.priv = priv; - rctx->b.b.destroy = r600_destroy_context; - rctx->b.b.flush = r600_flush_from_st; + rctx->b.b.destroy = si_destroy_context; + rctx->b.b.flush = si_flush_from_st; /* Easy accessing of screen/winsys. */ rctx->screen = rscreen; si_init_blit_functions(rctx); - r600_init_query_functions(rctx); - r600_init_context_resource_functions(rctx); + si_init_query_functions(rctx); + si_init_context_resource_functions(rctx); si_init_surface_functions(rctx); si_init_compute_functions(rctx); @@ -240,7 +240,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void } rctx->b.rings.gfx.cs = rctx->b.ws->cs_create(rctx->b.ws, RING_GFX, NULL); - rctx->b.rings.gfx.flush = r600_flush_from_winsys; + rctx->b.rings.gfx.flush = si_flush_from_winsys; si_init_all_descriptors(rctx); @@ -263,7 +263,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void goto fail; } - rctx->b.ws->cs_set_flush_callback(rctx->b.rings.gfx.cs, r600_flush_from_winsys, rctx); + rctx->b.ws->cs_set_flush_callback(rctx->b.rings.gfx.cs, si_flush_from_winsys, rctx); util_slab_create(&rctx->pool_transfers, sizeof(struct pipe_transfer), 64, @@ -290,19 +290,19 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void si_get_backend_mask(rctx); return &rctx->b.b; fail: - r600_destroy_context(&rctx->b.b); + si_destroy_context(&rctx->b.b); return NULL; } /* * pipe_screen */ -static const char* r600_get_vendor(struct pipe_screen* pscreen) +static const char* si_get_vendor(struct pipe_screen* pscreen) { return "X.Org"; } -const char *r600_get_llvm_processor_name(enum radeon_family family) +const char *si_get_llvm_processor_name(enum radeon_family family) { switch (family) { case CHIP_TAHITI: return "tahiti"; @@ -317,7 +317,7 @@ const char *r600_get_llvm_processor_name(enum radeon_family family) } } -static const char *r600_get_family_name(enum radeon_family family) +static const char *si_get_family_name(enum radeon_family family) { switch(family) { case CHIP_TAHITI: return "AMD TAHITI"; @@ -332,14 +332,14 @@ static const char *r600_get_family_name(enum radeon_family family) } } -static const char* r600_get_name(struct pipe_screen* pscreen) +static const char* si_get_name(struct pipe_screen* pscreen) { struct r600_screen *rscreen = (struct r600_screen *)pscreen; - return r600_get_family_name(rscreen->b.family); + return si_get_family_name(rscreen->b.family); } -static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) +static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param) { struct r600_screen *rscreen = (struct r600_screen *)pscreen; bool has_streamout = HAVE_LLVM >= 0x0304; @@ -454,7 +454,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) return 0; } -static float r600_get_paramf(struct pipe_screen* pscreen, +static float si_get_paramf(struct pipe_screen* pscreen, enum pipe_capf param) { switch (param) { @@ -476,7 +476,7 @@ static float r600_get_paramf(struct pipe_screen* pscreen, return 0.0f; } -static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) +static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) { switch(shader) { @@ -540,7 +540,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e return 0; } -static int r600_get_video_param(struct pipe_screen *screen, +static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profile profile, enum pipe_video_entrypoint entrypoint, enum pipe_video_cap param) @@ -562,7 +562,7 @@ static int r600_get_video_param(struct pipe_screen *screen, } } -static int r600_get_compute_param(struct pipe_screen *screen, +static int si_get_compute_param(struct pipe_screen *screen, enum pipe_compute_cap param, void *ret) { @@ -570,7 +570,7 @@ static int r600_get_compute_param(struct pipe_screen *screen, //TODO: select these params by asic switch (param) { case PIPE_COMPUTE_CAP_IR_TARGET: { - const char *gpu = r600_get_llvm_processor_name(rscreen->b.family); + const char *gpu = si_get_llvm_processor_name(rscreen->b.family); if (ret) { sprintf(ret, "%s-r600--", gpu); } @@ -631,7 +631,7 @@ static int r600_get_compute_param(struct pipe_screen *screen, if (ret) { uint64_t max_global_size; uint64_t *max_mem_alloc_size = ret; - r600_get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE, &max_global_size); + si_get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE, &max_global_size); *max_mem_alloc_size = max_global_size / 4; } return sizeof(uint64_t); @@ -641,7 +641,7 @@ static int r600_get_compute_param(struct pipe_screen *screen, } } -static void r600_destroy_screen(struct pipe_screen* pscreen) +static void si_destroy_screen(struct pipe_screen* pscreen) { struct r600_screen *rscreen = (struct r600_screen *)pscreen; @@ -673,7 +673,7 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) FREE(rscreen); } -static void r600_fence_reference(struct pipe_screen *pscreen, +static void si_fence_reference(struct pipe_screen *pscreen, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) { @@ -691,7 +691,7 @@ static void r600_fence_reference(struct pipe_screen *pscreen, *ptr = fence; } -static boolean r600_fence_signalled(struct pipe_screen *pscreen, +static boolean si_fence_signalled(struct pipe_screen *pscreen, struct pipe_fence_handle *fence) { struct r600_screen *rscreen = (struct r600_screen *)pscreen; @@ -700,7 +700,7 @@ static boolean r600_fence_signalled(struct pipe_screen *pscreen, return rscreen->fences.data[rfence->index] != 0; } -static boolean r600_fence_finish(struct pipe_screen *pscreen, +static boolean si_fence_finish(struct pipe_screen *pscreen, struct pipe_fence_handle *fence, uint64_t timeout) { @@ -790,7 +790,7 @@ static int evergreen_interpret_tiling(struct r600_screen *rscreen, uint32_t tili return 0; } -static int r600_init_tiling(struct r600_screen *rscreen) +static int si_init_tiling(struct r600_screen *rscreen) { uint32_t tiling_config = rscreen->b.info.r600_tiling_config; @@ -803,7 +803,7 @@ static int r600_init_tiling(struct r600_screen *rscreen) return evergreen_interpret_tiling(rscreen, tiling_config); } -static uint64_t r600_get_timestamp(struct pipe_screen *screen) +static uint64_t si_get_timestamp(struct pipe_screen *screen) { struct r600_screen *rscreen = (struct r600_screen*)screen; @@ -820,31 +820,31 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws) r600_common_screen_init(&rscreen->b, ws); - if (r600_init_tiling(rscreen)) { + if (si_init_tiling(rscreen)) { FREE(rscreen); return NULL; } - rscreen->b.b.destroy = r600_destroy_screen; - rscreen->b.b.get_name = r600_get_name; - rscreen->b.b.get_vendor = r600_get_vendor; - rscreen->b.b.get_param = r600_get_param; - rscreen->b.b.get_shader_param = r600_get_shader_param; - rscreen->b.b.get_paramf = r600_get_paramf; - rscreen->b.b.get_compute_param = r600_get_compute_param; - rscreen->b.b.get_timestamp = r600_get_timestamp; + rscreen->b.b.destroy = si_destroy_screen; + rscreen->b.b.get_name = si_get_name; + rscreen->b.b.get_vendor = si_get_vendor; + rscreen->b.b.get_param = si_get_param; + rscreen->b.b.get_shader_param = si_get_shader_param; + rscreen->b.b.get_paramf = si_get_paramf; + rscreen->b.b.get_compute_param = si_get_compute_param; + rscreen->b.b.get_timestamp = si_get_timestamp; rscreen->b.b.is_format_supported = si_is_format_supported; - rscreen->b.b.context_create = r600_create_context; - rscreen->b.b.fence_reference = r600_fence_reference; - rscreen->b.b.fence_signalled = r600_fence_signalled; - rscreen->b.b.fence_finish = r600_fence_finish; - r600_init_screen_resource_functions(&rscreen->b.b); + rscreen->b.b.context_create = si_create_context; + rscreen->b.b.fence_reference = si_fence_reference; + rscreen->b.b.fence_signalled = si_fence_signalled; + rscreen->b.b.fence_finish = si_fence_finish; + si_init_screen_resource_functions(&rscreen->b.b); if (rscreen->b.info.has_uvd) { rscreen->b.b.get_video_param = ruvd_get_video_param; rscreen->b.b.is_video_format_supported = ruvd_is_format_supported; } else { - rscreen->b.b.get_video_param = r600_get_video_param; + rscreen->b.b.get_video_param = si_get_video_param; rscreen->b.b.is_video_format_supported = vl_video_buffer_is_format_supported; } diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h index 9306790..f662820 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h @@ -207,7 +207,7 @@ struct r600_context { /* r600_blit.c */ void si_init_blit_functions(struct r600_context *rctx); -void r600_blit_decompress_depth(struct pipe_context *ctx, +void si_blit_decompress_depth(struct pipe_context *ctx, struct r600_texture *texture, struct r600_texture *staging, unsigned first_level, unsigned last_level, @@ -215,7 +215,7 @@ void r600_blit_decompress_depth(struct pipe_context *ctx, unsigned first_sample, unsigned last_sample); void si_flush_depth_textures(struct r600_context *rctx, struct r600_textures_info *textures); -void r600_decompress_color_textures(struct r600_context *rctx, +void si_decompress_color_textures(struct r600_context *rctx, struct r600_textures_info *textures); /* r600_buffer.c */ @@ -225,32 +225,32 @@ bool si_init_resource(struct r600_screen *rscreen, boolean use_reusable_pool, unsigned usage); struct pipe_resource *si_buffer_create(struct pipe_screen *screen, const struct pipe_resource *templ); -void r600_upload_index_buffer(struct r600_context *rctx, +void si_upload_index_buffer(struct r600_context *rctx, struct pipe_index_buffer *ib, unsigned count); /* r600_pipe.c */ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, unsigned flags); -const char *r600_get_llvm_processor_name(enum radeon_family family); +const char *si_get_llvm_processor_name(enum radeon_family family); /* r600_query.c */ -void r600_init_query_functions(struct r600_context *rctx); +void si_init_query_functions(struct r600_context *rctx); /* r600_resource.c */ -void r600_init_context_resource_functions(struct r600_context *r600); +void si_init_context_resource_functions(struct r600_context *r600); /* r600_texture.c */ -void r600_init_screen_texture_functions(struct pipe_screen *screen); +void si_init_screen_texture_functions(struct pipe_screen *screen); void si_init_surface_functions(struct r600_context *r600); /* r600_translate.c */ -void r600_translate_index_buffer(struct r600_context *r600, +void si_translate_index_buffer(struct r600_context *r600, struct pipe_index_buffer *ib, unsigned count); #if R600_TRACE_CS -void r600_trace_emit(struct r600_context *rctx); +void si_trace_emit(struct r600_context *rctx); #endif /* radeonsi_compute.c */ @@ -290,7 +290,7 @@ static INLINE unsigned si_map_swizzle(unsigned swizzle) } } -static inline unsigned r600_tex_aniso_filter(unsigned filter) +static inline unsigned si_tex_aniso_filter(unsigned filter) { if (filter <= 1) return 0; if (filter <= 2) return 1; @@ -300,7 +300,7 @@ static inline unsigned r600_tex_aniso_filter(unsigned filter) } /* 12.4 fixed-point */ -static INLINE unsigned r600_pack_float_12p4(float x) +static INLINE unsigned si_pack_float_12p4(float x) { return x <= 0 ? 0 : x >= 4096 ? 0xffff : x * 16; diff --git a/src/gallium/drivers/radeonsi/radeonsi_pm4.c b/src/gallium/drivers/radeonsi/radeonsi_pm4.c index eed0c47..f396775 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pm4.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pm4.c @@ -229,7 +229,7 @@ void si_pm4_emit(struct r600_context *rctx, struct si_pm4_state *state) #if R600_TRACE_CS if (rctx->screen->trace_bo) { - r600_trace_emit(rctx); + si_trace_emit(rctx); } #endif } diff --git a/src/gallium/drivers/radeonsi/radeonsi_resource.h b/src/gallium/drivers/radeonsi/radeonsi_resource.h index 7794beb..e4aaf94 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_resource.h +++ b/src/gallium/drivers/radeonsi/radeonsi_resource.h @@ -32,7 +32,7 @@ #include "util/u_inlines.h" static INLINE struct r600_resource * -r600_resource_create_custom(struct pipe_screen *screen, +si_resource_create_custom(struct pipe_screen *screen, unsigned usage, unsigned size) { assert(size); diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 867a385..2788c36 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -1151,7 +1151,7 @@ handle_semantic: last_args, 9); } /* XXX: Look up what this function does */ -/* ctx->shader->output[i].spi_sid = r600_spi_sid(&ctx->shader->output[i]);*/ +/* ctx->shader->output[i].spi_sid = si_spi_sid(&ctx->shader->output[i]);*/ } static const struct lp_build_tgsi_action txf_action; @@ -1762,7 +1762,7 @@ int si_compile_llvm(struct r600_context *rctx, struct si_pipe_shader *shader, memset(&binary, 0, sizeof(binary)); radeon_llvm_compile(mod, &binary, - r600_get_llvm_processor_name(rctx->screen->b.family), dump); + si_get_llvm_processor_name(rctx->screen->b.family), dump); if (dump) { fprintf(stderr, "SI CODE:\n"); for (i = 0; i < binary.code_size; i+=4 ) { @@ -1804,7 +1804,7 @@ int si_compile_llvm(struct r600_context *rctx, struct si_pipe_shader *shader, /* copy new shader */ r600_resource_reference(&shader->bo, NULL); - shader->bo = r600_resource_create_custom(rctx->b.b.screen, PIPE_USAGE_IMMUTABLE, + shader->bo = si_resource_create_custom(rctx->b.b.screen, PIPE_USAGE_IMMUTABLE, binary.code_size); if (shader->bo == NULL) { return -ENOMEM; diff --git a/src/gallium/drivers/radeonsi/radeonsi_uvd.c b/src/gallium/drivers/radeonsi/radeonsi_uvd.c index 1cb3be0..46736ca 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_uvd.c +++ b/src/gallium/drivers/radeonsi/radeonsi_uvd.c @@ -45,7 +45,7 @@ #include "vl/vl_mpeg12_decoder.h" #include "radeonsi_pipe.h" -#include "radeon/radeon_uvd.h" +#include "radeon_uvd.h" #include "sid.h" /** diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index a8f8781..1556427 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -420,7 +420,7 @@ static void si_set_constant_buffer(struct pipe_context *ctx, uint shader, uint s if (input->user_buffer) { unsigned buffer_offset; - r600_upload_const_buffer(rctx, + si_upload_const_buffer(rctx, (struct r600_resource**)&buffer, input->user_buffer, input->buffer_size, &buffer_offset); va = r600_resource_va(ctx->screen, buffer) + buffer_offset; @@ -474,7 +474,7 @@ static void si_set_streamout_targets(struct pipe_context *ctx, */ /* Set the VGT regs. */ - r600_set_streamout_targets(ctx, num_targets, targets, append_bitmask); + si_set_streamout_targets(ctx, num_targets, targets, append_bitmask); /* Set the shader resources.*/ for (i = 0; i < num_targets; i++) { diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index e1b4e32..91e52cb 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -589,8 +589,8 @@ static void *si_create_rs_state(struct pipe_context *ctx, } /* Divide by two, because 0.5 = 1 pixel. */ si_pm4_set_reg(pm4, R_028A04_PA_SU_POINT_MINMAX, - S_028A04_MIN_SIZE(r600_pack_float_12p4(psize_min/2)) | - S_028A04_MAX_SIZE(r600_pack_float_12p4(psize_max/2))); + S_028A04_MIN_SIZE(si_pack_float_12p4(psize_min/2)) | + S_028A04_MAX_SIZE(si_pack_float_12p4(psize_max/2))); tmp = (unsigned)state->line_width * 8; si_pm4_set_reg(pm4, R_028A08_PA_SU_LINE_CNTL, S_028A08_WIDTH(tmp)); @@ -2936,7 +2936,7 @@ static struct si_pm4_state *si_bind_sampler_states(struct r600_context *rctx, un rctx->border_color_offset = 0; rctx->border_color_table = - r600_resource_create_custom(&rctx->screen->b.b, + si_resource_create_custom(&rctx->screen->b.b, PIPE_USAGE_STAGING, 4096 * 4 * 4); } diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index cb5055a..a3a58c0 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -53,7 +53,7 @@ static void si_pipe_shader_vs(struct pipe_context *ctx, struct si_pipe_shader *s return; /* Certain attributes (position, psize, etc.) don't count as params. - * VS is required to export at least one param and r600_shader_from_tgsi() + * VS is required to export at least one param and si_shader_from_tgsi() * takes care of adding a dummy export. */ for (nparams = 0, i = 0 ; i < shader->shader.noutput; i++) { @@ -278,7 +278,7 @@ static unsigned si_conv_pipe_prim(unsigned pprim) return result; } -static unsigned r600_conv_prim_to_gs_out(unsigned mode) +static unsigned si_conv_prim_to_gs_out(unsigned mode) { static const int prim_conv[] = { [PIPE_PRIM_POINTS] = V_028A6C_OUTPRIM_TYPE_POINTLIST, @@ -307,7 +307,7 @@ static bool si_update_draw_info_state(struct r600_context *rctx, struct si_pm4_state *pm4 = si_pm4_alloc_state(rctx); struct si_shader *vs = &rctx->vs_shader->current->shader; unsigned prim = si_conv_pipe_prim(info->mode); - unsigned gs_out_prim = r600_conv_prim_to_gs_out(info->mode); + unsigned gs_out_prim = si_conv_prim_to_gs_out(info->mode); unsigned ls_mask = 0; if (pm4 == NULL) @@ -432,7 +432,7 @@ static void si_update_derived_state(struct r600_context *rctx) si_flush_depth_textures(rctx, &rctx->samplers[i]); } if (rctx->samplers[i].compressed_colortex_mask) { - r600_decompress_color_textures(rctx, &rctx->samplers[i]); + si_decompress_color_textures(rctx, &rctx->samplers[i]); } } } @@ -711,10 +711,10 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) ib.offset = rctx->index_buffer.offset + info->start * ib.index_size; /* Translate or upload, if needed. */ - r600_translate_index_buffer(rctx, &ib, info->count); + si_translate_index_buffer(rctx, &ib, info->count); if (ib.user_buffer && !ib.buffer) { - r600_upload_index_buffer(rctx, &ib, info->count); + si_upload_index_buffer(rctx, &ib, info->count); } } @@ -744,7 +744,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) #if R600_TRACE_CS if (rctx->screen->trace_bo) { - r600_trace_emit(rctx); + si_trace_emit(rctx); } #endif diff --git a/src/gallium/targets/dri-r600/Makefile.am b/src/gallium/targets/dri-r600/Makefile.am index 2b3524b..45a7467 100644 --- a/src/gallium/targets/dri-r600/Makefile.am +++ b/src/gallium/targets/dri-r600/Makefile.am @@ -51,6 +51,7 @@ r600_dri_la_LIBADD = \ $(top_builddir)/src/mesa/libmesagallium.la \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ @@ -60,6 +61,10 @@ r600_dri_la_LIBADD = \ $(LIBDRM_LIBS) \ $(RADEON_LIBS) +if NEED_RADEON_LLVM +r600_dri_la_LIBADD += $(ELF_LIB) +endif + nodist_EXTRA_r600_dri_la_SOURCES = dummy.cpp if HAVE_MESA_LLVM diff --git a/src/gallium/targets/dri-radeonsi/Makefile.am b/src/gallium/targets/dri-radeonsi/Makefile.am index f7d87a6..686f5bb 100644 --- a/src/gallium/targets/dri-radeonsi/Makefile.am +++ b/src/gallium/targets/dri-radeonsi/Makefile.am @@ -52,13 +52,15 @@ radeonsi_dri_la_LIBADD = \ $(top_builddir)/src/mesa/libmesagallium.la \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ $(top_builddir)/src/gallium/drivers/rbug/librbug.la \ $(top_builddir)/src/gallium/drivers/noop/libnoop.la \ $(GALLIUM_DRI_LIB_DEPS) \ - $(RADEON_LIBS) + $(RADEON_LIBS) \ + $(ELF_LIB) if HAVE_MESA_LLVM radeonsi_dri_la_LDFLAGS += $(LLVM_LDFLAGS) diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am index 0b30aeb..e4b177a 100644 --- a/src/gallium/targets/egl-static/Makefile.am +++ b/src/gallium/targets/egl-static/Makefile.am @@ -64,7 +64,7 @@ egl_gallium_la_LIBADD = \ $(PTHREAD_LIBS) \ -lm -egl_gallium_la_LDFLAGS = -Wl,--no-undefined -Wl,--allow-multiple-definition -avoid-version -module +egl_gallium_la_LDFLAGS = -Wl,--no-undefined -avoid-version -module if HAVE_EGL_PLATFORM_X11 AM_CPPFLAGS += $(LIBDRM_CFLAGS) @@ -174,28 +174,34 @@ egl_gallium_la_LIBADD += \ $(NOUVEAU_LIBS) endif +if NEED_RADEON_DRM_WINSYS if HAVE_GALLIUM_R300 AM_CPPFLAGS += -D_EGL_PIPE_R300=1 egl_gallium_la_LIBADD += \ - $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ - $(top_builddir)/src/gallium/drivers/r300/libr300.la \ - $(RADEON_LIBS) + $(top_builddir)/src/gallium/drivers/r300/libr300.la endif - if HAVE_GALLIUM_R600 AM_CPPFLAGS += -D_EGL_PIPE_R600=1 egl_gallium_la_LIBADD += \ - $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ - $(RADEON_LIBS) + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la endif - if HAVE_GALLIUM_RADEONSI AM_CPPFLAGS += -D_EGL_PIPE_RADEONSI=1 egl_gallium_la_LIBADD += \ + $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la +if !HAVE_GALLIUM_R600 +egl_gallium_la_LIBADD += \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la +endif +endif +egl_gallium_la_LIBADD += \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ - $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ $(RADEON_LIBS) +if NEED_RADEON_LLVM +egl_gallium_la_LIBADD += \ + $(ELF_LIB) +endif endif if HAVE_GALLIUM_SVGA diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am index e6772b8..f125aeb 100644 --- a/src/gallium/targets/pipe-loader/Makefile.am +++ b/src/gallium/targets/pipe-loader/Makefile.am @@ -103,9 +103,13 @@ pipe_r600_la_LIBADD = \ $(PIPE_LIBS) \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(LIBDRM_LIBS) \ $(RADEON_LIBS) pipe_r600_la_LDFLAGS = -no-undefined -avoid-version -module +if NEED_RADEON_LLVM +pipe_r600_la_LIBADD += $(ELF_LIB) +endif if HAVE_MESA_LLVM nodist_EXTRA_pipe_r600_la_SOURCES = dummy.cpp pipe_r600_la_LIBADD += $(LLVM_LIBS) @@ -121,8 +125,10 @@ pipe_radeonsi_la_LIBADD = \ $(PIPE_LIBS) \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(LIBDRM_LIBS) \ - $(RADEON_LIBS) + $(RADEON_LIBS) \ + $(ELF_LIB) pipe_radeonsi_la_LDFLAGS = -no-undefined -avoid-version -module if HAVE_MESA_LLVM pipe_radeonsi_la_LIBADD += $(LLVM_LIBS) diff --git a/src/gallium/targets/vdpau-r600/Makefile.am b/src/gallium/targets/vdpau-r600/Makefile.am index f6b82de..22db575 100644 --- a/src/gallium/targets/vdpau-r600/Makefile.am +++ b/src/gallium/targets/vdpau-r600/Makefile.am @@ -46,6 +46,7 @@ libvdpau_r600_la_LDFLAGS = \ libvdpau_r600_la_LIBADD = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ @@ -54,6 +55,10 @@ libvdpau_r600_la_LIBADD = \ $(LIBDRM_LIBS) \ $(RADEON_LIBS) +if NEED_RADEON_LLVM +libvdpau_r600_la_LIBADD += $(ELF_LIB) +endif + if HAVE_MESA_LLVM libvdpau_r600_la_LINK = $(CXXLINK) $(libvdpau_r600_la_LDFLAGS) # Mention a dummy pure C++ file to trigger generation of the $(LINK) variable diff --git a/src/gallium/targets/vdpau-radeonsi/Makefile.am b/src/gallium/targets/vdpau-radeonsi/Makefile.am index beae309..b8c5d69 100644 --- a/src/gallium/targets/vdpau-radeonsi/Makefile.am +++ b/src/gallium/targets/vdpau-radeonsi/Makefile.am @@ -47,6 +47,7 @@ libvdpau_radeonsi_la_LDFLAGS = \ libvdpau_radeonsi_la_LIBADD = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ @@ -55,7 +56,8 @@ libvdpau_radeonsi_la_LIBADD = \ $(GALLIUM_DRI_LIB_DEPS) \ $(VDPAU_LIBS) \ $(LIBDRM_LIBS) \ - $(RADEON_LIBS) + $(RADEON_LIBS) \ + $(ELF_LIB) if HAVE_MESA_LLVM libvdpau_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS) diff --git a/src/gallium/targets/xorg-r600/Makefile.am b/src/gallium/targets/xorg-r600/Makefile.am index 1a21655..8232b03 100644 --- a/src/gallium/targets/xorg-r600/Makefile.am +++ b/src/gallium/targets/xorg-r600/Makefile.am @@ -47,6 +47,7 @@ r600g_drv_la_LIBADD = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/xorg/libxorgtracker.la \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \ $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ @@ -56,6 +57,10 @@ r600g_drv_la_LIBADD = \ $(LIBKMS_XORG_LIBS) \ $(RADEON_LIBS) +if NEED_RADEON_LLVM +r600g_drv_la_LIBADD += $(ELF_LIB) +endif + if HAVE_MESA_LLVM r600g_drv_la_LINK = $(CXXLINK) $(r600g_drv_la_LDFLAGS) # Mention a dummy pure C++ file to trigger generation of the $(LINK) variable diff --git a/src/gallium/targets/xorg-radeonsi/Makefile.am b/src/gallium/targets/xorg-radeonsi/Makefile.am index 5ca1056..ac97b83 100644 --- a/src/gallium/targets/xorg-radeonsi/Makefile.am +++ b/src/gallium/targets/xorg-radeonsi/Makefile.am @@ -48,6 +48,7 @@ radeonsi_drv_la_LIBADD = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/xorg/libxorgtracker.la \ $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \ $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ @@ -55,7 +56,8 @@ radeonsi_drv_la_LIBADD = \ $(GALLIUM_DRI_LIB_DEPS) \ $(LIBDRM_XORG_LIBS) \ $(LIBKMS_XORG_LIBS) \ - $(RADEON_LIBS) + $(RADEON_LIBS) \ + $(ELF_LIB) if HAVE_MESA_LLVM AM_CFLAGS += $(LLVM_CFLAGS) diff --git a/src/gallium/targets/xvmc-r600/Makefile.am b/src/gallium/targets/xvmc-r600/Makefile.am index b337c7e..308c163 100644 --- a/src/gallium/targets/xvmc-r600/Makefile.am +++ b/src/gallium/targets/xvmc-r600/Makefile.am @@ -46,6 +46,7 @@ libXvMCr600_la_LDFLAGS = \ libXvMCr600_la_LIBADD = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ + $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \ $(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ @@ -54,6 +55,10 @@ libXvMCr600_la_LIBADD = \ $(LIBDRM_LIBS) \ $(RADEON_LIBS) +if NEED_RADEON_LLVM +libXvMCr600_la_LIBADD += $(ELF_LIB) +endif + if HAVE_MESA_LLVM libXvMCr600_la_LINK = $(CXXLINK) $(libXvMCr600_la_LDFLAGS) # Mention a dummy pure C++ file to trigger generation of the $(LINK) variable -- 1.8.1.4