Skip to content

Commit 66cd2da

Browse files
Merge remote-tracking branch 'upstream/chrome/m151' into skia-sync/release-4.151.x
# Conflicts: # DEPS
2 parents bdd0c3a + 7ad44b7 commit 66cd2da

9 files changed

Lines changed: 97 additions & 53 deletions

File tree

DEPS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ vars = {
2020
'googlefonts_testdata_version': 'version:20230913',
2121

2222
# Pre-built task drivers from this repo, used for CI.
23-
'task_drivers_revision': 'git_revision:b5d31abb7bc772a69f800de45783768768437675',
23+
'task_drivers_revision': 'git_revision:5e4f3217c17a8d88195d4c2924613420a256457b',
24+
25+
'checkout_agents_internal': False,
2426
}
2527

2628
# If you modify this file, you will need to regenerate the Bazel version of this file (bazel/deps.bzl).

include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,44 @@
66
// DO NOT EDIT!
77

88
#ifndef GPU_DRIVER_BUG_WORKAROUNDS
9-
#define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) \
10-
GPU_OP(ADD_AND_TRUE_TO_LOOP_CONDITION, \
11-
add_and_true_to_loop_condition) \
12-
GPU_OP(DISABLE_BLEND_EQUATION_ADVANCED, \
13-
disable_blend_equation_advanced) \
14-
GPU_OP(DISABLE_DISCARD_FRAMEBUFFER, \
15-
disable_discard_framebuffer) \
16-
GPU_OP(DISABLE_DUAL_SOURCE_BLENDING_SUPPORT, \
17-
disable_dual_source_blending_support) \
18-
GPU_OP(DISABLE_TEXTURE_STORAGE, \
19-
disable_texture_storage) \
20-
GPU_OP(DISALLOW_LARGE_INSTANCED_DRAW, \
21-
disallow_large_instanced_draw) \
22-
GPU_OP(EMULATE_ABS_INT_FUNCTION, \
23-
emulate_abs_int_function) \
24-
GPU_OP(ENSURE_PREVIOUS_FRAMEBUFFER_NOT_DELETED, \
25-
ensure_previous_framebuffer_not_deleted) \
26-
GPU_OP(FLUSH_ON_FRAMEBUFFER_CHANGE, \
27-
flush_on_framebuffer_change) \
28-
GPU_OP(FORCE_UPDATE_SCISSOR_STATE_WHEN_BINDING_FBO0, \
29-
force_update_scissor_state_when_binding_fbo0) \
30-
GPU_OP(GL_CLEAR_BROKEN, \
31-
gl_clear_broken) \
32-
GPU_OP(MAX_FRAGMENT_UNIFORM_VECTORS_32, \
33-
max_fragment_uniform_vectors_32) \
34-
GPU_OP(MAX_MSAA_SAMPLE_COUNT_4, \
35-
max_msaa_sample_count_4) \
36-
GPU_OP(PACK_PARAMETERS_WORKAROUND_WITH_PACK_BUFFER, \
37-
pack_parameters_workaround_with_pack_buffer) \
38-
GPU_OP(REMOVE_POW_WITH_CONSTANT_EXPONENT, \
39-
remove_pow_with_constant_exponent) \
40-
GPU_OP(REWRITE_DO_WHILE_LOOPS, \
41-
rewrite_do_while_loops) \
42-
GPU_OP(UNBIND_ATTACHMENTS_ON_BOUND_RENDER_FBO_DELETE, \
43-
unbind_attachments_on_bound_render_fbo_delete) \
44-
GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION, \
45-
unfold_short_circuit_as_ternary_operation) \
9+
#define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) \
10+
GPU_OP(ADD_AND_TRUE_TO_LOOP_CONDITION, \
11+
add_and_true_to_loop_condition) \
12+
GPU_OP(DISABLE_BLEND_EQUATION_ADVANCED, \
13+
disable_blend_equation_advanced) \
14+
GPU_OP(DISABLE_DISCARD_FRAMEBUFFER, \
15+
disable_discard_framebuffer) \
16+
GPU_OP(DISABLE_DUAL_SOURCE_BLENDING_SUPPORT, \
17+
disable_dual_source_blending_support) \
18+
GPU_OP(DISABLE_TEXTURE_STORAGE, \
19+
disable_texture_storage) \
20+
GPU_OP(DISALLOW_LARGE_INSTANCED_DRAW, \
21+
disallow_large_instanced_draw) \
22+
GPU_OP(EMULATE_ABS_INT_FUNCTION, \
23+
emulate_abs_int_function) \
24+
GPU_OP(ENSURE_PREVIOUS_FRAMEBUFFER_NOT_DELETED, \
25+
ensure_previous_framebuffer_not_deleted) \
26+
GPU_OP(FLUSH_ON_FRAMEBUFFER_CHANGE, \
27+
flush_on_framebuffer_change) \
28+
GPU_OP(FLUSH_QUERIES_BEFORE_DELETING_OR_UNBINDING_FBO, \
29+
flush_queries_before_deleting_or_unbinding_fbo) \
30+
GPU_OP(FORCE_UPDATE_SCISSOR_STATE_WHEN_BINDING_FBO0, \
31+
force_update_scissor_state_when_binding_fbo0) \
32+
GPU_OP(GL_CLEAR_BROKEN, \
33+
gl_clear_broken) \
34+
GPU_OP(MAX_FRAGMENT_UNIFORM_VECTORS_32, \
35+
max_fragment_uniform_vectors_32) \
36+
GPU_OP(MAX_MSAA_SAMPLE_COUNT_4, \
37+
max_msaa_sample_count_4) \
38+
GPU_OP(PACK_PARAMETERS_WORKAROUND_WITH_PACK_BUFFER, \
39+
pack_parameters_workaround_with_pack_buffer) \
40+
GPU_OP(REMOVE_POW_WITH_CONSTANT_EXPONENT, \
41+
remove_pow_with_constant_exponent) \
42+
GPU_OP(REWRITE_DO_WHILE_LOOPS, \
43+
rewrite_do_while_loops) \
44+
GPU_OP(UNBIND_ATTACHMENTS_ON_BOUND_RENDER_FBO_DELETE, \
45+
unbind_attachments_on_bound_render_fbo_delete) \
46+
GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION, \
47+
unfold_short_circuit_as_ternary_operation) \
4648

4749
#endif // GPU_DRIVER_BUG_WORKAROUNDS

infra/bots/deps/deps_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infra/bots/tasks.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,7 +3861,7 @@
38613861
{
38623862
"name": "skia/tools/bazel_build/${platform}",
38633863
"path": "task_drivers",
3864-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
3864+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
38653865
}
38663866
],
38673867
"command": [
@@ -3941,7 +3941,7 @@
39413941
{
39423942
"name": "skia/tools/bazel_build/${platform}",
39433943
"path": "task_drivers",
3944-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
3944+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
39453945
}
39463946
],
39473947
"command": [
@@ -4097,7 +4097,7 @@
40974097
{
40984098
"name": "skia/tools/bazel_build/${platform}",
40994099
"path": "task_drivers",
4100-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
4100+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
41014101
}
41024102
],
41034103
"command": [
@@ -4177,7 +4177,7 @@
41774177
{
41784178
"name": "skia/tools/bazel_build/${platform}",
41794179
"path": "task_drivers",
4180-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
4180+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
41814181
}
41824182
],
41834183
"command": [
@@ -4257,7 +4257,7 @@
42574257
{
42584258
"name": "skia/tools/bazel_build/${platform}",
42594259
"path": "task_drivers",
4260-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
4260+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
42614261
}
42624262
],
42634263
"command": [
@@ -4413,7 +4413,7 @@
44134413
{
44144414
"name": "skia/tools/bazel_build/${platform}",
44154415
"path": "task_drivers",
4416-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
4416+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
44174417
}
44184418
],
44194419
"command": [
@@ -4493,7 +4493,7 @@
44934493
{
44944494
"name": "skia/tools/bazel_build/${platform}",
44954495
"path": "task_drivers",
4496-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
4496+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
44974497
}
44984498
],
44994499
"command": [
@@ -4582,7 +4582,7 @@
45824582
{
45834583
"name": "skia/tools/bazel_build/${platform}",
45844584
"path": "task_drivers",
4585-
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
4585+
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
45864586
}
45874587
],
45884588
"command": [

src/gpu/ganesh/GrResourceProvider.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,13 @@ sk_sp<GrTexture> GrResourceProvider::writePixels(sk_sp<GrTexture> texture,
922922
if (tempColorType == GrColorType::kUnknown) {
923923
return nullptr;
924924
}
925-
SkAssertResult(fGpu->writePixels(texture.get(),
926-
SkIRect::MakeSize(baseSize),
927-
colorType,
928-
tempColorType,
929-
tmpTexels.get(),
930-
mipLevelCount));
925+
if (!fGpu->writePixels(texture.get(),
926+
SkIRect::MakeSize(baseSize),
927+
colorType,
928+
tempColorType,
929+
tmpTexels.get(),
930+
mipLevelCount)) {
931+
return nullptr;
932+
}
931933
return texture;
932934
}

src/gpu/ganesh/gl/GrGLCaps.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
676676
if (ctxInfo.vendor() == GrGLVendor::kARM) {
677677
// On Mali G71, RT's above 4k have been observed to incur a performance cost.
678678
fMaxPreferredRenderTargetSize = std::min(4096, fMaxPreferredRenderTargetSize);
679+
fDriverBugWorkarounds.flush_queries_before_deleting_or_unbinding_fbo = true;
679680
}
680681

681682
fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker");

src/gpu/ganesh/gl/GrGLGpu.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3214,6 +3214,10 @@ void GrGLGpu::onFBOChanged() {
32143214
if (this->caps()->workarounds().flush_on_framebuffer_change) {
32153215
this->flush(FlushType::kForce);
32163216
}
3217+
if (fHasUnflushedQueries &&
3218+
this->caps()->workarounds().flush_queries_before_deleting_or_unbinding_fbo) {
3219+
this->forcefullyFlushQueries();
3220+
}
32173221
#ifdef SK_DEBUG
32183222
if (fIsExecutingCommandBuffer_DebugOnly) {
32193223
SkDebugf("WARNING: GL FBO binding changed while executing a command buffer. "
@@ -3234,6 +3238,10 @@ void GrGLGpu::deleteFramebuffer(GrGLuint fboid) {
32343238
// We're relying on the GL state shadowing being correct in the workaround code below so we
32353239
// need to handle a dirty context.
32363240
this->handleDirtyContext();
3241+
if (fHasUnflushedQueries &&
3242+
this->caps()->workarounds().flush_queries_before_deleting_or_unbinding_fbo) {
3243+
this->forcefullyFlushQueries();
3244+
}
32373245
if (fboid == fBoundDrawFramebuffer) {
32383246
if (this->caps()->workarounds().unbind_attachments_on_bound_render_fbo_delete) {
32393247
// This workaround only applies to deleting currently bound framebuffers
@@ -4469,6 +4477,29 @@ void GrGLGpu::waitSemaphore(GrSemaphore* semaphore) {
44694477
#endif
44704478
}
44714479

4480+
void GrGLGpu::forcefullyFlushQueries() {
4481+
if (!fHasUnflushedQueries) {
4482+
return;
4483+
}
4484+
if (this->glCaps().fenceType() == GrGLCaps::FenceType::kSyncObject) {
4485+
GrGLsync sync;
4486+
GL_CALL_RET(sync, FenceSync(GR_GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
4487+
if (sync) {
4488+
#if defined(__EMSCRIPTEN__) && __EMSCRIPTEN_major__ < 5
4489+
GL_CALL(ClientWaitSync(sync, GR_GL_SYNC_FLUSH_COMMANDS_BIT, 0, 0));
4490+
#else
4491+
GL_CALL(ClientWaitSync(sync, GR_GL_SYNC_FLUSH_COMMANDS_BIT, 0));
4492+
#endif
4493+
GL_CALL(DeleteSync(sync));
4494+
fHasUnflushedQueries = false;
4495+
return;
4496+
}
4497+
}
4498+
4499+
GL_CALL(Finish());
4500+
fHasUnflushedQueries = false;
4501+
}
4502+
44724503
std::optional<GrTimerQuery> GrGLGpu::startTimerQuery() {
44734504
if (glCaps().timerQueryType() == GrGLCaps::TimerQueryType::kNone) {
44744505
return {};
@@ -4484,6 +4515,7 @@ std::optional<GrTimerQuery> GrGLGpu::startTimerQuery() {
44844515
GR_GL_GetIntegerv(this->glInterface(), GR_GL_GPU_DISJOINT, &_);
44854516
}
44864517
GL_CALL(BeginQuery(GR_GL_TIME_ELAPSED, glQuery));
4518+
fHasUnflushedQueries = true;
44874519
return GrTimerQuery{glQuery};
44884520
}
44894521

@@ -4493,6 +4525,7 @@ void GrGLGpu::endTimerQuery(const GrTimerQuery& timerQuery) {
44934525
// Since only one query of a particular type can be active at once, glEndQuery doesn't take a
44944526
// query parameter.
44954527
GL_CALL(EndQuery(GR_GL_TIME_ELAPSED));
4528+
fHasUnflushedQueries = true;
44964529
}
44974530

44984531
uint64_t GrGLGpu::getTimerQueryResult(GrGLuint query) {

src/gpu/ganesh/gl/GrGLGpu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,9 @@ class GrGLGpu final : public GrGpu {
876876
// we call glFlush and reset this to false.
877877
bool fNeedsGLFlush = false;
878878

879+
bool fHasUnflushedQueries = false;
880+
void forcefullyFlushQueries();
881+
879882
SkDEBUGCODE(bool fIsExecutingCommandBuffer_DebugOnly = false;)
880883

881884
friend class GrGLPathRendering; // For accessing setTextureUnit.

src/gpu/gpu_workaround_list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ disallow_large_instanced_draw
66
emulate_abs_int_function
77
ensure_previous_framebuffer_not_deleted
88
flush_on_framebuffer_change
9+
flush_queries_before_deleting_or_unbinding_fbo
910
force_update_scissor_state_when_binding_fbo0
1011
gl_clear_broken
1112
max_fragment_uniform_vectors_32

0 commit comments

Comments
 (0)