Skip to content
Commits on Source (30)
# This is reverted shortly after landing
4432a2d14d80081d062f7939a950d65ea3a16eed
# This was manually backported
# These were manually backported
21be5c8edd3ad156f6cbfbceb96e7939716d9f2c
4b392ced2d744fccffe95490ff57e6b41033c266
b6905438514ae4de0b7f85c861e3d811ddaadda9
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -1362,6 +1362,20 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
#endif /* EGL_TIZEN_image_native_surface */
#ifndef EGL_EXT_image_flush_external
#define EGL_EXT_image_flush_external 1
#define EGL_IMAGE_EXTERNAL_FLUSH_EXT 0x32A2
typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEFLUSHEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEINVALIDATEEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglImageFlushExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglImageInvalidateExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
#endif
#endif /* EGL_EXT_image_flush_external */
#include <EGL/eglmesaext.h>
#include <EGL/eglextchromium.h>
#ifdef __cplusplus
}
#endif
......
......@@ -53,17 +53,6 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCVALUESCHROMIUMPROC)
#endif
#endif
#ifndef EGL_EXT_image_flush_external
#define EGL_EXT_image_flush_external 1
#define EGL_IMAGE_EXTERNAL_FLUSH_EXT 0x32A2
typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEFLUSHEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEINVALIDATEEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglImageFlushExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglImageInvalidateExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
#endif
#endif /* EGL_EXT_image_flush_external */
#ifdef __cplusplus
}
#endif
......
......@@ -3713,11 +3713,21 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
break;
}
case nir_intrinsic_load_constant: {
unsigned base = nir_intrinsic_base(instr);
unsigned range = nir_intrinsic_range(instr);
LLVMValueRef offset = get_src(ctx, instr->src[0]);
LLVMValueRef base = LLVMConstInt(ctx->ac.i32,
nir_intrinsic_base(instr),
false);
offset = LLVMBuildAdd(ctx->ac.builder, offset, base, "");
offset = LLVMBuildAdd(ctx->ac.builder, offset,
LLVMConstInt(ctx->ac.i32, base, false), "");
/* Clamp the offset to avoid out-of-bound access because global
* instructions can't handle them.
*/
LLVMValueRef size = LLVMConstInt(ctx->ac.i32, base + range, false);
LLVMValueRef cond = LLVMBuildICmp(ctx->ac.builder, LLVMIntULT,
offset, size, "");
offset = LLVMBuildSelect(ctx->ac.builder, cond, offset, size, "");
LLVMValueRef ptr = ac_build_gep0(&ctx->ac, ctx->constant_data,
offset);
LLVMTypeRef comp_type =
......
......@@ -392,8 +392,8 @@ vk_format_from_android(unsigned android_format, unsigned android_usage)
{
switch (android_format) {
case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
return VK_FORMAT_R8G8B8A8_UNORM;
case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM:
return VK_FORMAT_R8G8B8A8_UNORM;
case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
return VK_FORMAT_R8G8B8_UNORM;
case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
......
......@@ -58,6 +58,6 @@ libbroadcom_cle = static_library(
'v3d_decoder.c',
include_directories : [inc_common, inc_broadcom],
c_args : [c_vis_args, no_override_init_args],
dependencies : [dep_libdrm, dep_valgrind],
dependencies : [dep_libdrm, dep_valgrind, dep_expat, dep_zlib],
build_by_default : false,
)
......@@ -34,32 +34,11 @@
*/
static bool
add_interface_variables(const struct gl_context *cts,
struct gl_shader_program *prog,
struct set *resource_set,
unsigned stage, GLenum programInterface)
add_vars_from_list(const struct gl_context *ctx,
struct gl_shader_program *prog, struct set *resource_set,
const struct exec_list *var_list, unsigned stage,
GLenum programInterface)
{
const struct exec_list *var_list = NULL;
struct gl_linked_shader *sh = prog->_LinkedShaders[stage];
if (!sh)
return true;
nir_shader *nir = sh->Program->nir;
assert(nir);
switch (programInterface) {
case GL_PROGRAM_INPUT:
var_list = &nir->inputs;
break;
case GL_PROGRAM_OUTPUT:
var_list = &nir->outputs;
break;
default:
assert("!Should not get here");
break;
}
nir_foreach_variable(var, var_list) {
if (var->data.how_declared == nir_var_hidden)
continue;
......@@ -108,6 +87,38 @@ add_interface_variables(const struct gl_context *cts,
return true;
}
static bool
add_interface_variables(const struct gl_context *ctx,
struct gl_shader_program *prog,
struct set *resource_set,
unsigned stage, GLenum programInterface)
{
struct gl_linked_shader *sh = prog->_LinkedShaders[stage];
if (!sh)
return true;
nir_shader *nir = sh->Program->nir;
assert(nir);
switch (programInterface) {
case GL_PROGRAM_INPUT: {
bool result = add_vars_from_list(ctx, prog, resource_set,
&nir->inputs, stage, programInterface);
result &= add_vars_from_list(ctx, prog, resource_set, &nir->system_values,
stage, programInterface);
return result;
}
case GL_PROGRAM_OUTPUT:
return add_vars_from_list(ctx, prog, resource_set, &nir->outputs, stage,
programInterface);
default:
assert("!Should not get here");
break;
}
return false;
}
/* TODO: as we keep adding features, this method is becoming more and more
* similar to its GLSL counterpart at linker.cpp. Eventually it would be good
* to check if they could be refactored, and reduce code duplication somehow
......
......@@ -316,6 +316,17 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables, bool use_vars,
if (!ucp_enables)
return false;
/* find clipvertex/position outputs: */
nir_foreach_variable(var, &shader->outputs) {
int loc = var->data.driver_location;
/* keep track of last used driver-location.. we'll be
* appending CLIP_DIST0/CLIP_DIST1 after last existing
* output:
*/
maxloc = MAX2(maxloc, loc);
}
nir_builder_init(&b, impl);
/* NIR should ensure that, even in case of loops/if-else, there
......
......@@ -100,8 +100,6 @@ def generateHeader(functions):
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <EGL/eglmesaext.h>
#include <EGL/eglextchromium.h>
#include "glvnd/libeglabi.h"
""".lstrip("\n"))
......
......@@ -33,8 +33,6 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <EGL/eglmesaext.h>
#include <EGL/eglextchromium.h>
#ifdef __cplusplus
extern "C" {
......
......@@ -77,3 +77,14 @@ LOCAL_GENERATED_SOURCES += $(MESA_GEN_NIR_H)
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
# Build libmesa_galliumvl used by radeonsi
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(VL_SOURCES)
LOCAL_MODULE := libmesa_galliumvl
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
......@@ -338,7 +338,14 @@ u_stream_outputs_for_vertices(enum pipe_prim_type primitive, unsigned nr)
/* Extraneous vertices don't contribute to stream outputs */
u_trim_pipe_prim(primitive, &nr);
/* Consider how many primitives are actually generated */
/* Polygons are special, since they are a single primitive with many
* vertices. In this case, we just have an output for each vertex (after
* trimming) */
if (primitive == PIPE_PRIM_POLYGON)
return nr;
/* Normally, consider how many primitives are actually generated */
unsigned prims = u_decomposed_prims_for_vertices(primitive, nr);
/* One output per vertex after decomposition */
......
......@@ -60,9 +60,9 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
}
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
(fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0) &&
(target == PIPE_BUFFER ||
util_format_get_blocksize(format) != 12) &&
(fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
util_format_get_blocksize(format) != 12)) {
retval |= PIPE_BIND_SAMPLER_VIEW;
}
......
......@@ -76,9 +76,9 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen,
}
if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) &&
(fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0) &&
(target == PIPE_BUFFER ||
util_format_get_blocksize(format) != 12) &&
(fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0)) {
util_format_get_blocksize(format) != 12)) {
retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE);
}
......
......@@ -82,9 +82,9 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen,
}
if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) &&
(fd6_pipe2tex(format) != (enum a6xx_tex_fmt)~0) &&
(target == PIPE_BUFFER ||
util_format_get_blocksize(format) != 12) &&
(fd6_pipe2tex(format) != (enum a6xx_tex_fmt)~0)) {
util_format_get_blocksize(format) != 12)) {
retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE);
}
......
......@@ -1294,7 +1294,8 @@ iris_bo_get_tiling(struct iris_bo *bo, uint32_t *tiling_mode,
}
struct iris_bo *
iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd)
iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd,
uint32_t tiling, uint32_t stride)
{
uint32_t handle;
struct iris_bo *bo;
......@@ -1345,9 +1346,15 @@ iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd)
if (gen_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling))
goto err;
if (get_tiling.tiling_mode == tiling || tiling > I915_TILING_LAST) {
bo->tiling_mode = get_tiling.tiling_mode;
bo->swizzle_mode = get_tiling.swizzle_mode;
/* XXX stride is unknown */
} else {
if (bo_set_tiling_internal(bo, tiling, stride)) {
goto err;
}
}
out:
mtx_unlock(&bufmgr->lock);
......
......@@ -352,7 +352,8 @@ int iris_hw_context_set_priority(struct iris_bufmgr *bufmgr,
void iris_destroy_hw_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id);
int iris_bo_export_dmabuf(struct iris_bo *bo, int *prime_fd);
struct iris_bo *iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd);
struct iris_bo *iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd,
uint32_t tiling, uint32_t stride);
uint32_t iris_bo_export_gem_handle(struct iris_bo *bo);
......
......@@ -960,12 +960,21 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
struct gen_device_info *devinfo = &screen->devinfo;
struct iris_bufmgr *bufmgr = screen->bufmgr;
struct iris_resource *res = iris_alloc_resource(pscreen, templ);
const struct isl_drm_modifier_info *mod_inf =
isl_drm_modifier_get_info(whandle->modifier);
uint32_t tiling;
if (!res)
return NULL;
switch (whandle->type) {
case WINSYS_HANDLE_TYPE_FD:
res->bo = iris_bo_import_dmabuf(bufmgr, whandle->handle);
if (mod_inf)
tiling = isl_tiling_to_i915_tiling(mod_inf->tiling);
else
tiling = I915_TILING_LAST + 1;
res->bo = iris_bo_import_dmabuf(bufmgr, whandle->handle,
tiling, whandle->stride);
break;
case WINSYS_HANDLE_TYPE_SHARED:
res->bo = iris_bo_gem_create_from_name(bufmgr, "winsys image",
......@@ -979,12 +988,14 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
res->offset = whandle->offset;
uint64_t modifier = whandle->modifier;
if (modifier == DRM_FORMAT_MOD_INVALID) {
modifier = tiling_to_modifier(res->bo->tiling_mode);
if (mod_inf == NULL) {
mod_inf =
isl_drm_modifier_get_info(tiling_to_modifier(res->bo->tiling_mode));
}
res->mod_info = isl_drm_modifier_get_info(modifier);
assert(res->mod_info);
assert(mod_inf);
res->external_format = whandle->format;
res->mod_info = mod_inf;
isl_surf_usage_flags_t isl_usage = pipe_bind_to_isl_usage(templ->bind);
......@@ -995,7 +1006,8 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
if (templ->target == PIPE_BUFFER) {
res->surf.tiling = ISL_TILING_LINEAR;
} else {
if (whandle->modifier == DRM_FORMAT_MOD_INVALID || whandle->plane == 0) {
/* Create a surface for each plane specified by the external format. */
if (whandle->plane < util_format_get_num_planes(whandle->format)) {
UNUSED const bool isl_surf_created_successfully =
isl_surf_init(&screen->isl_dev, &res->surf,
.dim = target_to_isl_surf_dim(templ->target),
......@@ -1173,6 +1185,8 @@ iris_resource_get_handle(struct pipe_screen *pscreen,
whandle->stride = res->surf.row_pitch_B;
bo = res->bo;
}
whandle->format = res->external_format;
whandle->modifier =
res->mod_info ? res->mod_info->modifier
: tiling_to_modifier(res->bo->tiling_mode);
......