Updated to arc-runtime-42.4410.272.0
diff --git a/mods/android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c b/mods/android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c
index ff7d943..ea59bec 100644
--- a/mods/android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c
+++ b/mods/android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c
@@ -119,7 +119,6 @@
} else if (!strcmp(pathname, "audio_policy.default.so") ||
!strcmp(pathname, "audio.primary.arc.so") ||
!strcmp(pathname, "gralloc.arc.so") ||
- !strcmp(pathname, "gralloc.default.so") ||
!strcmp(pathname, "local_time.default.so")) {
strcat(strcat(realpath, "hw/"), pathname);
} else if (!strcmp(pathname, "libEGL_emulation.so") ||
diff --git a/src/build/build_options.py b/src/build/build_options.py
index 0f9a757..50b1a51 100755
--- a/src/build/build_options.py
+++ b/src/build/build_options.py
@@ -55,12 +55,6 @@
'prebuilt'] # for everyone else
_DEFAULT_INTERNAL_APKS_SOURCES = 'prebuilt'
-# --renderer= options
-_RENDERER_HW = 'hw'
-_RENDERER_SW = 'sw'
-_ALLOWED_RENDERERS = [_RENDERER_HW, _RENDERER_SW]
-_DEFAULT_RENDERER = _RENDERER_HW
-
# --logging=
_ANSI_FB_LOGGING = 'ansi-fb'
_ANSI_SF_LAYER_LOGGING = 'ansi-sf-layer'
@@ -215,9 +209,6 @@
def is_posix_translation_debug(self):
return _POSIX_TRANSLATION_DEBUG in self._loggers
- def is_hw_renderer(self):
- return self.renderer() == _RENDERER_HW
-
def internal_apks_source_is_internal(self):
return self.internal_apks_source().startswith('internal')
@@ -286,11 +277,6 @@
args.opt = True
args.disable_debug_code = True
args.regen_build_prop = True
-
- # SW renderer only works with hwui disabled.
- if args.renderer == _RENDERER_SW:
- args.disable_hwui = True
-
return args
def parse(self, args):
@@ -383,11 +369,6 @@
'Pass this option to make sure the file '
'is up to date. Note: requires rebuilding the rootfs.')
- parser.add_argument('--renderer',
- choices=_ALLOWED_RENDERERS,
- default=_DEFAULT_RENDERER,
- help='Renderer type to use.')
-
parser.add_argument('--restart-goma', action='store_true', help=
'Restart goma. This is mainly for buildbots.')
diff --git a/src/build/launch_chrome.py b/src/build/launch_chrome.py
index e9ff847..db2adf1 100755
--- a/src/build/launch_chrome.py
+++ b/src/build/launch_chrome.py
@@ -549,8 +549,7 @@
# driver even there is secondary Matrox GPU(http://crbug.com/145600). It
# happens with low memory but seems safe for buildbot. So passing
# ignore-gpu-blacklist to be able to use hardware acceleration.
- if OPTIONS.is_hw_renderer():
- params.append('--ignore-gpu-blacklist')
+ params.append('--ignore-gpu-blacklist')
return params
diff --git a/src/build/run_integration_tests.py b/src/build/run_integration_tests.py
index 9ed2c2b..bb60d23 100755
--- a/src/build/run_integration_tests.py
+++ b/src/build/run_integration_tests.py
@@ -126,7 +126,7 @@
include_fail=args.include_failing,
include_large=args.include_large,
include_timeout=args.include_timeouts,
- include_requires_opengl=(OPTIONS.is_hw_renderer() and not args.use_xvfb))
+ include_requires_opengl=(not args.use_xvfb))
test_driver_list = []
for runner in all_suite_runners:
diff --git a/src/common/matrix.cc b/src/common/matrix.cc
index a893d8a..ea15a58 100644
--- a/src/common/matrix.cc
+++ b/src/common/matrix.cc
@@ -11,34 +11,45 @@
namespace arc {
-Matrix::Matrix(float m00, float m01, float m02, float m03,
- float m10, float m11, float m12, float m13,
- float m20, float m21, float m22, float m23,
- float m30, float m31, float m32, float m33) {
- Set(0, 0, m00);
- Set(0, 1, m01);
- Set(0, 2, m02);
- Set(0, 3, m03);
- Set(1, 0, m10);
- Set(1, 1, m11);
- Set(1, 2, m12);
- Set(1, 3, m13);
- Set(2, 0, m20);
- Set(2, 1, m21);
- Set(2, 2, m22);
- Set(2, 3, m23);
- Set(3, 0, m30);
- Set(3, 1, m31);
- Set(3, 2, m32);
- Set(3, 3, m33);
+Matrix::Matrix(float row0col0, float row0col1, float row0col2, float row0col3,
+ float row1col0, float row1col1, float row1col2, float row1col3,
+ float row2col0, float row2col1, float row2col2, float row2col3,
+ float row3col0, float row3col1, float row3col2, float row3col3) {
+ entries_[0][0] = row0col0;
+ entries_[1][0] = row0col1;
+ entries_[2][0] = row0col2;
+ entries_[3][0] = row0col3;
+ entries_[0][1] = row1col0;
+ entries_[1][1] = row1col1;
+ entries_[2][1] = row1col2;
+ entries_[3][1] = row1col3;
+ entries_[0][2] = row2col0;
+ entries_[1][2] = row2col1;
+ entries_[2][2] = row2col2;
+ entries_[3][2] = row2col3;
+ entries_[0][3] = row3col0;
+ entries_[1][3] = row3col1;
+ entries_[2][3] = row3col2;
+ entries_[3][3] = row3col3;
}
void Matrix::AssignIdentity() {
- memset(&entries_, 0, sizeof(entries_));
- Set(0, 0, 1.f);
- Set(1, 1, 1.f);
- Set(2, 2, 1.f);
- Set(3, 3, 1.f);
+ entries_[0][0] = 1;
+ entries_[0][1] = 0;
+ entries_[0][2] = 0;
+ entries_[0][3] = 0;
+ entries_[1][0] = 0;
+ entries_[1][1] = 1;
+ entries_[1][2] = 0;
+ entries_[1][3] = 0;
+ entries_[2][0] = 0;
+ entries_[2][1] = 0;
+ entries_[2][2] = 1;
+ entries_[2][3] = 0;
+ entries_[3][0] = 0;
+ entries_[3][1] = 0;
+ entries_[3][2] = 0;
+ entries_[3][3] = 1;
}
void Matrix::Transpose() {
@@ -62,155 +73,93 @@
}
void Matrix::Inverse() {
- float inv[kEntries];
- inv[0] = entries_[5] * entries_[10] * entries_[15] -
- entries_[5] * entries_[11] * entries_[14] -
- entries_[9] * entries_[6] * entries_[15] +
- entries_[9] * entries_[7] * entries_[14] +
- entries_[13] * entries_[6] * entries_[11] -
- entries_[13] * entries_[7] * entries_[10];
+ const float a00 = entries_[0][0];
+ const float a01 = entries_[0][1];
+ const float a02 = entries_[0][2];
+ const float a03 = entries_[0][3];
+ const float a10 = entries_[1][0];
+ const float a11 = entries_[1][1];
+ const float a12 = entries_[1][2];
+ const float a13 = entries_[1][3];
+ const float a20 = entries_[2][0];
+ const float a21 = entries_[2][1];
+ const float a22 = entries_[2][2];
+ const float a23 = entries_[2][3];
+ const float a30 = entries_[3][0];
+ const float a31 = entries_[3][1];
+ const float a32 = entries_[3][2];
+ const float a33 = entries_[3][3];
- inv[4] = -entries_[4] * entries_[10] * entries_[15] +
- entries_[4] * entries_[11] * entries_[14] +
- entries_[8] * entries_[6] * entries_[15] -
- entries_[8] * entries_[7] * entries_[14] -
- entries_[12] * entries_[6] * entries_[11] +
- entries_[12] * entries_[7] * entries_[10];
+ float b00 = a00 * a11 - a01 * a10;
+ float b01 = a00 * a12 - a02 * a10;
+ float b02 = a00 * a13 - a03 * a10;
+ float b03 = a01 * a12 - a02 * a11;
+ float b04 = a01 * a13 - a03 * a11;
+ float b05 = a02 * a13 - a03 * a12;
+ float b06 = a20 * a31 - a21 * a30;
+ float b07 = a20 * a32 - a22 * a30;
+ float b08 = a20 * a33 - a23 * a30;
+ float b09 = a21 * a32 - a22 * a31;
+ float b10 = a21 * a33 - a23 * a31;
+ float b11 = a22 * a33 - a23 * a32;
- inv[8] = entries_[4] * entries_[9] * entries_[15] -
- entries_[4] * entries_[11] * entries_[13] -
- entries_[8] * entries_[5] * entries_[15] +
- entries_[8] * entries_[7] * entries_[13] +
- entries_[12] * entries_[5] * entries_[11] -
- entries_[12] * entries_[7] * entries_[9];
+ // Calculate the determinant
+ const float det =
+ b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+ LOG_ALWAYS_FATAL_IF(det == 0);
- inv[12] = -entries_[4] * entries_[9] * entries_[14] +
- entries_[4] * entries_[10] * entries_[13] +
- entries_[8] * entries_[5] * entries_[14] -
- entries_[8] * entries_[6] * entries_[13] -
- entries_[12] * entries_[5] * entries_[10] +
- entries_[12] * entries_[6] * entries_[9];
+ const float invdet = 1.0 / det;
+ b00 *= invdet;
+ b01 *= invdet;
+ b02 *= invdet;
+ b03 *= invdet;
+ b04 *= invdet;
+ b05 *= invdet;
+ b06 *= invdet;
+ b07 *= invdet;
+ b08 *= invdet;
+ b09 *= invdet;
+ b10 *= invdet;
+ b11 *= invdet;
- inv[1] = -entries_[1] * entries_[10] * entries_[15] +
- entries_[1] * entries_[11] * entries_[14] +
- entries_[9] * entries_[2] * entries_[15] -
- entries_[9] * entries_[3] * entries_[14] -
- entries_[13] * entries_[2] * entries_[11] +
- entries_[13] * entries_[3] * entries_[10];
-
- inv[5] = entries_[0] * entries_[10] * entries_[15] -
- entries_[0] * entries_[11] * entries_[14] -
- entries_[8] * entries_[2] * entries_[15] +
- entries_[8] * entries_[3] * entries_[14] +
- entries_[12] * entries_[2] * entries_[11] -
- entries_[12] * entries_[3] * entries_[10];
-
- inv[9] = -entries_[0] * entries_[9] * entries_[15] +
- entries_[0] * entries_[11] * entries_[13] +
- entries_[8] * entries_[1] * entries_[15] -
- entries_[8] * entries_[3] * entries_[13] -
- entries_[12] * entries_[1] * entries_[11] +
- entries_[12] * entries_[3] * entries_[9];
-
- inv[13] = entries_[0] * entries_[9] * entries_[14] -
- entries_[0] * entries_[10] * entries_[13] -
- entries_[8] * entries_[1] * entries_[14] +
- entries_[8] * entries_[2] * entries_[13] +
- entries_[12] * entries_[1] * entries_[10] -
- entries_[12] * entries_[2] * entries_[9];
-
- inv[2] = entries_[1] * entries_[6] * entries_[15] -
- entries_[1] * entries_[7] * entries_[14] -
- entries_[5] * entries_[2] * entries_[15] +
- entries_[5] * entries_[3] * entries_[14] +
- entries_[13] * entries_[2] * entries_[7] -
- entries_[13] * entries_[3] * entries_[6];
-
- inv[6] = -entries_[0] * entries_[6] * entries_[15] +
- entries_[0] * entries_[7] * entries_[14] +
- entries_[4] * entries_[2] * entries_[15] -
- entries_[4] * entries_[3] * entries_[14] -
- entries_[12] * entries_[2] * entries_[7] +
- entries_[12] * entries_[3] * entries_[6];
-
- inv[10] = entries_[0] * entries_[5] * entries_[15] -
- entries_[0] * entries_[7] * entries_[13] -
- entries_[4] * entries_[1] * entries_[15] +
- entries_[4] * entries_[3] * entries_[13] +
- entries_[12] * entries_[1] * entries_[7] -
- entries_[12] * entries_[3] * entries_[5];
-
- inv[14] = -entries_[0] * entries_[5] * entries_[14] +
- entries_[0] * entries_[6] * entries_[13] +
- entries_[4] * entries_[1] * entries_[14] -
- entries_[4] * entries_[2] * entries_[13] -
- entries_[12] * entries_[1] * entries_[6] +
- entries_[12] * entries_[2] * entries_[5];
-
- inv[3] = -entries_[1] * entries_[6] * entries_[11] +
- entries_[1] * entries_[7] * entries_[10] +
- entries_[5] * entries_[2] * entries_[11] -
- entries_[5] * entries_[3] * entries_[10] -
- entries_[9] * entries_[2] * entries_[7] +
- entries_[9] * entries_[3] * entries_[6];
-
- inv[7] = entries_[0] * entries_[6] * entries_[11] -
- entries_[0] * entries_[7] * entries_[10] -
- entries_[4] * entries_[2] * entries_[11] +
- entries_[4] * entries_[3] * entries_[10] +
- entries_[8] * entries_[2] * entries_[7] -
- entries_[8] * entries_[3] * entries_[6];
-
- inv[11] = -entries_[0] * entries_[5] * entries_[11] +
- entries_[0] * entries_[7] * entries_[9] +
- entries_[4] * entries_[1] * entries_[11] -
- entries_[4] * entries_[3] * entries_[9] -
- entries_[8] * entries_[1] * entries_[7] +
- entries_[8] * entries_[3] * entries_[5];
-
- inv[15] = entries_[0] * entries_[5] * entries_[10] -
- entries_[0] * entries_[6] * entries_[9] -
- entries_[4] * entries_[1] * entries_[10] +
- entries_[4] * entries_[2] * entries_[9] +
- entries_[8] * entries_[1] * entries_[6] -
- entries_[8] * entries_[2] * entries_[5];
-
- float det = entries_[0] * inv[0] + entries_[1] * inv[4]
- + entries_[2] * inv[8] + entries_[3] * inv[12];
-
- LOG_ALWAYS_FATAL_IF(det == 0.f);
- if (det != 0.f) {
- det = 1.0f / det;
- for (int i = 0; i < kEntries; ++i) {
- entries_[i] = inv[i] * det;
- }
- }
+ entries_[0][0] = a11 * b11 - a12 * b10 + a13 * b09;
+ entries_[0][1] = a02 * b10 - a01 * b11 - a03 * b09;
+ entries_[0][2] = a31 * b05 - a32 * b04 + a33 * b03;
+ entries_[0][3] = a22 * b04 - a21 * b05 - a23 * b03;
+ entries_[1][0] = a12 * b08 - a10 * b11 - a13 * b07;
+ entries_[1][1] = a00 * b11 - a02 * b08 + a03 * b07;
+ entries_[1][2] = a32 * b02 - a30 * b05 - a33 * b01;
+ entries_[1][3] = a20 * b05 - a22 * b02 + a23 * b01;
+ entries_[2][0] = a10 * b10 - a11 * b08 + a13 * b06;
+ entries_[2][1] = a01 * b08 - a00 * b10 - a03 * b06;
+ entries_[2][2] = a30 * b04 - a31 * b02 + a33 * b00;
+ entries_[2][3] = a21 * b02 - a20 * b04 - a23 * b00;
+ entries_[3][0] = a11 * b07 - a10 * b09 - a12 * b06;
+ entries_[3][1] = a00 * b09 - a01 * b07 + a02 * b06;
+ entries_[3][2] = a31 * b01 - a30 * b03 - a32 * b00;
+ entries_[3][3] = a20 * b03 - a21 * b01 + a22 * b00;
}
void Matrix::AssignMatrixMultiply(const Matrix& a, const Matrix& b) {
- // We need a separate copy of the result since we cannot assume that
- // this->entries_ is different from a's and b's entries.
- Matrix result;
+ // If a or b is this matrix, we cannot store result in place, so have to use
+ // an extra matrix object.
+ const bool use_storage = (this == &a || this == &b);
+ Matrix storage(UNINITIALIZED_CONSTRUCTOR);
+ Matrix* result = use_storage ? &storage : this;
+
for (int a_row = 0; a_row < kN; ++a_row) {
for (int b_col = 0; b_col < kN; ++b_col) {
float dp = 0.0f;
- for (int k = 0; k < kN; ++k)
+ for (int k = 0; k < kN; ++k) {
dp += a.Get(a_row, k) * b.Get(k, b_col);
- result.Set(a_row, b_col, dp);
+ }
+ result->Set(a_row, b_col, dp);
}
}
- *this = result;
-}
-Matrix Matrix::GenerateColumnMajor(const float* entries) {
- // It's safe to memcpy because entries are stored in column-major order.
- Matrix result;
- memcpy(result.entries_, entries, sizeof(result.entries_));
- return result;
-}
-
-float* Matrix::GetColumnMajorArray(float (&entries)[kEntries]) const {
- return GetColumnMajorArray(entries, kEntries);
+ if (use_storage) {
+ *this = storage;
+ }
}
float* Matrix::GetColumnMajorArray(float* entries, size_t count) const {
@@ -219,6 +168,10 @@
return entries;
}
+void Matrix::SetColumnMajorArray(const float *entries) {
+ memcpy(entries_, entries, sizeof(entries[0]) * kEntries);
+}
+
Matrix Matrix::GeneratePerspective(float left, float right,
float bottom, float top,
float z_near, float z_far) {
@@ -227,13 +180,13 @@
LOG_ALWAYS_FATAL_IF(z_near == z_far);
// See http://www.songho.ca/opengl/gl_projectionmatrix.html.
- return Matrix((2.f * z_near) / (right - left),
+ return Matrix((2.0f * z_near) / (right - left),
0.0f,
(right + left) / (right - left),
0.0f,
0.0f,
- (2.f * z_near) / (top - bottom),
+ (2.0f * z_near) / (top - bottom),
(top + bottom) / (top - bottom),
0.0f,
@@ -275,19 +228,19 @@
}
Matrix Matrix::GenerateScale(const Vector& v) {
- Matrix m;
+ Matrix result;
for (int i = 0; i < kN; ++i) {
- m.Set(i, i, v.Get(i));
+ result.Set(i, i, v.Get(i));
}
- return m;
+ return result;
}
Matrix Matrix::GenerateTranslation(const Vector& v) {
- Matrix m;
+ Matrix result;
for (int i = 0; i < kN; ++i) {
- m.Set(i, 3, v.Get(i));
+ result.Set(i, 3, v.Get(i));
}
- return m;
+ return result;
}
Matrix Matrix::GenerateRotationByDegrees(float degrees,
diff --git a/src/common/matrix.h b/src/common/matrix.h
index 65edd7f..86ff00f 100644
--- a/src/common/matrix.h
+++ b/src/common/matrix.h
@@ -25,19 +25,23 @@
AssignIdentity();
}
- Matrix(float m00, float m01, float m02, float m03,
- float m10, float m11, float m12, float m13,
- float m20, float m21, float m22, float m23,
- float m30, float m31, float m32, float m33);
+ explicit Matrix(const float* entries) {
+ SetColumnMajorArray(entries);
+ }
+
+ Matrix(float row0col0, float row0col1, float row0col2, float row0col3,
+ float row1col0, float row1col1, float row1col2, float row1col3,
+ float row2col0, float row2col1, float row2col2, float row2col3,
+ float row3col0, float row3col1, float row3col2, float tow3col3);
void Set(int row, int col, float value) {
// The entries are stored in column-major order.
- entries_[col * kN + row] = value;
+ entries_[col][row] = value;
}
float Get(int row, int col) const {
// The entries are stored in column-major order.
- return entries_[col * kN + row];
+ return entries_[col][row];
}
void Inverse();
@@ -56,10 +60,13 @@
return *this;
}
- float* GetColumnMajorArray(float (&entries)[kEntries]) const;
+ float* GetColumnMajorArray(float (&entries)[kEntries]) const {
+ return GetColumnMajorArray(entries, kEntries);
+ }
+
float* GetColumnMajorArray(float* entries, size_t count) const;
- static Matrix GenerateColumnMajor(const float* entries);
+ void SetColumnMajorArray(const float *entries);
static Matrix GenerateScale(const Vector& v);
@@ -77,7 +84,14 @@
float z_near, float z_far);
private:
- float entries_[kEntries];
+ enum UninitializedConstructor {
+ UNINITIALIZED_CONSTRUCTOR
+ };
+
+ explicit Matrix(UninitializedConstructor) {
+ }
+
+ float entries_[kN][kN];
};
inline Matrix operator* (Matrix a, const Matrix& b) {
diff --git a/src/common/matrix_test.cc b/src/common/matrix_test.cc
index 6fbd0ed..cf9d44f 100644
--- a/src/common/matrix_test.cc
+++ b/src/common/matrix_test.cc
@@ -70,7 +70,7 @@
for (int i = 0; i < Matrix::kEntries; ++i) {
arr[i] = static_cast<float>(i+1);
}
- Matrix m = Matrix::GenerateColumnMajor(arr);
+ Matrix m(arr);
EXPECT_TRUE(AlmostEquals(m, kTransposedFunMatrix));
}
diff --git a/src/common/plugin_handle.h b/src/common/plugin_handle.h
index 936ec67..b75f4cc 100644
--- a/src/common/plugin_handle.h
+++ b/src/common/plugin_handle.h
@@ -22,10 +22,6 @@
LOG_ALWAYS_FATAL_IF(!plugin_);
return plugin_->GetRenderer();
}
- SWRendererInterface* GetSWRenderer() const {
- LOG_ALWAYS_FATAL_IF(!plugin_);
- return plugin_->GetSWRenderer();
- }
GPURendererInterface* GetGPURenderer() const {
LOG_ALWAYS_FATAL_IF(!plugin_);
return plugin_->GetGPURenderer();
diff --git a/src/common/plugin_interface.h b/src/common/plugin_interface.h
index edc275a..365f6a8 100644
--- a/src/common/plugin_interface.h
+++ b/src/common/plugin_interface.h
@@ -59,33 +59,6 @@
virtual void SetResizeObserver(ResizeObserver* observer) = 0;
};
-class SWRendererInterface {
- public:
- enum BitmapFormat {
- RGBA8,
- BGRA8
- };
- struct SWRenderParams {
- // Image format that will be presented to Chrome in the software
- // renderer.
- BitmapFormat format;
- // Bytes per pixel in software renderer.
- int stride;
- // Total size in bytes of software rendered image.
- int size;
- };
- virtual ~SWRendererInterface() {}
-
- // Render the given bitmap. The bitmap data must match
- // the render parameters returned by GetRenderParams. The
- // memory of bitmap will be copied by the time this function
- // returns, so it can be invalidated immediately after.
- virtual void RenderBitmap(void* bitmap) = 0;
-
- // Get the plugin's render characteristics.
- virtual void GetSWRenderParams(SWRenderParams* params) = 0;
-};
-
// Opaque type of GPU context pointers.
struct ContextGPU;
@@ -402,7 +375,6 @@
public:
virtual RendererInterface* GetRenderer() = 0;
virtual GPURendererInterface* GetGPURenderer() = 0;
- virtual SWRendererInterface* GetSWRenderer() = 0;
virtual InputManagerInterface* GetInputManager() = 0;
virtual AudioManagerInterface* GetAudioManager() = 0;
virtual CameraManagerInterface* GetCameraManager() = 0;