Commit Graph

13 Commits

Author SHA1 Message Date
Robert Phillips
e7a959d8fe Expand SkMessageBus to support different unique key types
Bug: skia:11728
Change-Id: I16fb8250fa5c04ce3fe369a50d0c61a0bee46811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383696
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-03-11 20:38:00 +00:00
Peng Huang
0408afc573 Fix GrGpuBuffer::onRelease() crash problem.
The crash is because method GrGpuBuffer::onRelease() is called on wrong
thread. SkMessageBus::Post(const Message& m) takes a const ref of the
message, so there is a little possibility the GPU thread received and
handled the message before SkMessageBus::Post() is returned. In that
case, the caller of SkMessageBus::Post() (AsyncReadResult) still holds
the last ref of the GrGpuBuffer, and then GrGpuBuffer() will just be
released on the wrong thread.

Bug: chromium:1185489
Change-Id: I28665dbb1db7925d59ec574e9e26385e845ff4df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380696
Commit-Queue: Peng Huang <penghuang@chromium.org>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Peng Huang <penghuang@chromium.org>
2021-03-09 18:10:00 +00:00
John Stiles
a6841be235 Enable ClangTidy check llvm-namespace-comment.
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).

Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-06 19:07:52 +00:00
Ben Wagner
21bca28bda Move SkMessageBus.h into src/core
Not used by anything else in the include directory, probably don't want
to accidentially expose it either.

Change-Id: I50d255e2cac43d8405305a825fd194bb36edd8fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213826
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-15 15:33:48 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Chris Dalton
9a986cfd5f ccpr: Use SkMessageBus for thread-safe eviction of cache entries
Bug: skia:
Change-Id: I87725b95761deb689333315ce681a4968d98190a
Reviewed-on: https://skia-review.googlesource.com/c/163511
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2018-10-19 00:25:20 +00:00
Brian Salomon
238069b3f5 Reland "Make GPU cache invalidation SkMessageBus messages go to one GrContext."
This is a reland of f4c5bb9aba

Original change's description:
> Make GPU cache invalidation SkMessageBus messages go to one GrContext.
> 
> Makes it so the template param to SkMessageBus must implement:
> bool shouldSend(uint32_t inboxID) const
> 
> Updates all GPU backend message types to only go to the GrContext that
> is adding a cache entry.
> 
> Bug: skia:
> Change-Id: I3e8a4eb90654b7b8ac57cac9fb508c0ef1d51058
> Reviewed-on: https://skia-review.googlesource.com/140220
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

Bug: skia:
Change-Id: I8402bfe3ed0170c99936d47050458817030b473b
Reviewed-on: https://skia-review.googlesource.com/140801
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-07-11 20:36:38 +00:00
Brian Salomon
143cf8e599 Revert "Make GPU cache invalidation SkMessageBus messages go to one GrContext."
This reverts commit f4c5bb9aba.

Reason for revert: Accidentally submitted without CQ

Original change's description:
> Make GPU cache invalidation SkMessageBus messages go to one GrContext.
> 
> Makes it so the template param to SkMessageBus must implement:
> bool shouldSend(uint32_t inboxID) const
> 
> Updates all GPU backend message types to only go to the GrContext that
> is adding a cache entry.
> 
> Bug: skia:
> Change-Id: I3e8a4eb90654b7b8ac57cac9fb508c0ef1d51058
> Reviewed-on: https://skia-review.googlesource.com/140220
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: Iadb667d8027341703d254325320ddaa528fb33a1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/140800
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-07-11 20:01:28 +00:00
Brian Salomon
f4c5bb9aba Make GPU cache invalidation SkMessageBus messages go to one GrContext.
Makes it so the template param to SkMessageBus must implement:
bool shouldSend(uint32_t inboxID) const

Updates all GPU backend message types to only go to the GrContext that
is adding a cache entry.

Bug: skia:
Change-Id: I3e8a4eb90654b7b8ac57cac9fb508c0ef1d51058
Reviewed-on: https://skia-review.googlesource.com/140220
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2018-07-11 20:00:11 +00:00
bsalomon
23e619cf46 Reimplement gpu message bus for invalidated bitmap gen IDs
Review URL: https://codereview.chromium.org/902873002
2015-02-06 11:54:28 -08:00
commit-bot@chromium.org
c665804300 Move SkMessageBus::Get out of header, and retry crrev.com/106563002.
BUG=
R=bsalomon@google.com, kkinnunen@nvidia.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/140053002

git-svn-id: http://skia.googlecode.com/svn/trunk@13104 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-15 23:09:01 +00:00
commit-bot@chromium.org
e2eac8b2fd Move macros from TestClassDef.h to Test.h
Motivation: those macros don't make any sense without the definitions
in Test.h.

BUG=
R=mtklein@google.com

Author: halcanary@google.com

Review URL: https://codereview.chromium.org/138563004

git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-14 21:04:37 +00:00
commit-bot@chromium.org
50a3043194 We want to give SkPixelRef a way to signal over to GrResourceCache that it's become pointless to keep around textures based on that SkPixelRef when its pixels change, so that it can be a good citizen and free those textures.
This adds an invalidation listener mechanism to SkPixelRef to let it send this message while still staying ignorant of who's listening.

These messages are tricky to deliver.  The SkPixelRefs they originates from and the GrResourceCaches they ultimately end up at may be on different threads; neither class is threadsafe; their object lifetimes are totally independent; it's a many-senders-to-many-receivers relation; and neither codebase should really know about the other.

So I've added a per-message-type global message bus to broadcast messages to threadsafe inboxes.  Anyone can post() a message, which will show up in all the inboxes of that type, read whenever the inbox's owner calls poll().  The implementation is _dumb_; it can be improved in several dimensions (inbox size limits, lock-free message delivery) if we find the need.

I took some care to make sure not to send the invalidation message for any SkPixelRef that's sharing a generation ID with another SkPixelRef.

BUG=
R=bsalomon@google.com, scroggo@google.com, reed@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/26734003

git-svn-id: http://skia.googlecode.com/svn/trunk@11949 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-24 17:44:27 +00:00