Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync changes from mozilla-central gfx/wr #3833

Merged
merged 32 commits into from Jan 15, 2020
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1d95e5d
Bug 1606827 - A corner is not rounded when the radius is zero in eith…
SimonSapin Jan 15, 2020
8e3220d
Bug 1595767 - Don't use rayon for glyph rasterization unless there is…
bpeersmoz Jan 15, 2020
4a2f3cf
Bug 1607352 - Support DirectComposition virtual surface API. r=sotaro
Jan 15, 2020
8b55532
Bug 1606685 - Support empty tiles within compositor surfaces. r=sotaro
Jan 15, 2020
2a5c1b3
Bug 1607419 - Avoid option.expect(&format in hot code. r=jrmuizel
nical Jan 15, 2020
c5a8d9a
Bug 1607697 - Address some clippy lints in WebRender API. r=Gankro
nical Jan 15, 2020
6e0321a
Bug 1607697 - Remove leading zeros in dither matrix litterals. r=Gankro
nical Jan 15, 2020
2958cde
Bug 1607697 - Allow excessive precision in debug color constants. r=G…
nical Jan 15, 2020
4509d8f
Bug 1607697 - Address unwrap_or_else(callback) and functions in callb…
nical Jan 15, 2020
3597f88
Bug 1607697 - Address clippy lints about nested branches. r=Gankro
nical Jan 15, 2020
f4171db
Bug 1607697 - Pass-by-value clippy lints for some small structures. r…
nical Jan 15, 2020
f8796d8
Bug 1607697 - Box the memory reports in enums. r=Gankro
nical Jan 15, 2020
c76840d
Bug 1607697 - Miscellaneous clippy lint fixes. r=Gankro
nical Jan 15, 2020
a74df4e
Backed out 8 changesets (bug 1607697) for Build bustages. CLOSED TREE
dgluca Jan 15, 2020
d3458da
Bug 1607697 - Address some clippy lints in WebRender API. r=Gankro
nical Jan 15, 2020
f7e0447
Bug 1607697 - Remove leading zeros in dither matrix litterals. r=Gankro
nical Jan 15, 2020
8e23cfc
Bug 1607697 - Allow excessive precision in debug color constants. r=G…
nical Jan 15, 2020
4510da2
Bug 1607697 - Address unwrap_or_else(callback) and functions in callb…
nical Jan 15, 2020
d2dab4f
Bug 1607697 - Address clippy lints about nested branches. r=Gankro
nical Jan 15, 2020
4fe4faa
Bug 1607697 - Pass-by-value clippy lints for some small structures. r…
nical Jan 15, 2020
4a21991
Bug 1607697 - Box the memory reports in enums. r=Gankro
nical Jan 15, 2020
7b98dfb
Bug 1607697 - Miscellaneous clippy lint fixes. r=Gankro
nical Jan 15, 2020
b383cb6
Bug 1607697 - Address servo-tidy complaint.
nical Jan 15, 2020
b25c1f8
Bug 1608280 - Support a per-tile clip (valid) region for compositor t…
gw3583 Jan 15, 2020
67f9d48
Bug 1607746 - Part 1: Move opacity to its own shader in WebRender r=n…
cbrewster Jan 15, 2020
b549115
Bug 1607746 - Part 2: Clean up passing filter mode to shader r=nical
cbrewster Jan 15, 2020
3ddb13b
Backed out changeset 7295ca89e880 (bug 1608280) for causing bug 16089…
AndreeaPavel Jan 15, 2020
3b18bde
Merge mozilla-central to autoland on a CLOSED TREE
AndreeaPavel Jan 15, 2020
c9fe1c3
Bug 1609049 - WebRender version bump. r=jrmuizel
nical Jan 15, 2020
3167089
Bug 1609049 - Add required fileds in peek-poke Cargo.toml. r=jrmuizel
nical Jan 15, 2020
2b9f40d
Bug 1609136 - Fix cs_border_solid attribute names r=jrmuizel
kvark Jan 15, 2020
93c7a2b
Bug 1605171 - Replace wrupdater with github-sync r=tomprince
kvark Jan 15, 2020
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Bug 1607352 - Support DirectComposition virtual surface API. r=sotaro

Adds an #ifdef to the DCLayerTree implementation that allows
selecting whether to use the virtual surface API (enabled by
default) or the regular DC surface API.

For now, this is a compile-time switch. As a follow up to this,
we will support both options at runtime (for example, using the
regular surface API for surfaces that have holes or translucency).

Differential Revision: https://phabricator.services.mozilla.com/D58870

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/1d212c2ddb76f5d54fd884e8e08001fc8475e13c
  • Loading branch information
Glenn Watson authored and moz-gfx committed Jan 15, 2020
commit 4a2f3cfbe9a1601b7f2e7ee9da704098d4c6654b
@@ -27,6 +27,9 @@

#define NUM_QUERIES 2

#define USE_VIRTUAL_SURFACES
#define VIRTUAL_OFFSET 512 * 1024

enum SyncMode {
None = 0,
Swap = 1,
@@ -37,10 +40,12 @@ enum SyncMode {

// The OS compositor representation of a picture cache tile.
struct Tile {
#ifndef USE_VIRTUAL_SURFACES
// Represents the underlying DirectComposition surface texture that gets drawn into.
IDCompositionSurface *pSurface;
// Represents the node in the visual tree that defines the properties of this tile (clip, position etc).
IDCompositionVisual2 *pVisual;
#endif
};

struct TileKey {
@@ -66,6 +71,9 @@ struct Surface {
bool is_opaque;
std::unordered_map<TileKey, Tile, TileKeyHasher> tiles;
IDCompositionVisual2 *pVisual;
#ifdef USE_VIRTUAL_SURFACES
IDCompositionVirtualSurface *pVirtualSurface;
#endif
};

struct CachedFrameBuffer {
@@ -216,7 +224,8 @@ extern "C" {
name = L"example-compositor (Simple)";
}

window->hWnd = CreateWindow(
window->hWnd = CreateWindowEx(
WS_EX_NOREDIRECTIONBITMAP,
CLASS_NAME,
name,
WS_OVERLAPPEDWINDOW,
@@ -379,10 +388,12 @@ extern "C" {
for (auto surface_it=window->surfaces.begin() ; surface_it != window->surfaces.end() ; ++surface_it) {
Surface &surface = surface_it->second;

#ifndef USE_VIRTUAL_SURFACES
for (auto tile_it=surface.tiles.begin() ; tile_it != surface.tiles.end() ; ++tile_it) {
tile_it->second.pSurface->Release();
tile_it->second.pVisual->Release();
}
#endif

surface.pVisual->Release();
}
@@ -480,6 +491,23 @@ extern "C" {
HRESULT hr = window->pDCompDevice->CreateVisual(&surface.pVisual);
assert(SUCCEEDED(hr));

#ifdef USE_VIRTUAL_SURFACES
DXGI_ALPHA_MODE alpha_mode = surface.is_opaque ? DXGI_ALPHA_MODE_IGNORE : DXGI_ALPHA_MODE_PREMULTIPLIED;

hr = window->pDCompDevice->CreateVirtualSurface(
VIRTUAL_OFFSET * 2,
VIRTUAL_OFFSET * 2,
DXGI_FORMAT_B8G8R8A8_UNORM,
alpha_mode,
&surface.pVirtualSurface
);
assert(SUCCEEDED(hr));

// Bind the surface memory to this visual
hr = surface.pVisual->SetContent(surface.pVirtualSurface);
assert(SUCCEEDED(hr));
#endif

window->surfaces[id] = surface;
}

@@ -497,6 +525,7 @@ extern "C" {

Tile tile;

#ifndef USE_VIRTUAL_SURFACES
// Create the video memory surface.
DXGI_ALPHA_MODE alpha_mode = surface.is_opaque ? DXGI_ALPHA_MODE_IGNORE : DXGI_ALPHA_MODE_PREMULTIPLIED;
HRESULT hr = window->pDCompDevice->CreateSurface(
@@ -527,6 +556,7 @@ extern "C" {
FALSE,
NULL
);
#endif

surface.tiles[key] = tile;
}
@@ -544,10 +574,12 @@ extern "C" {
assert(surface.tiles.count(key) == 1);
Tile &tile = surface.tiles[key];

#ifndef USE_VIRTUAL_SURFACES
surface.pVisual->RemoveVisual(tile.pVisual);

tile.pVisual->Release();
tile.pSurface->Release();
#endif

surface.tiles.erase(key);
}
@@ -561,11 +593,15 @@ extern "C" {

window->pRoot->RemoveVisual(surface.pVisual);

#ifdef USE_VIRTUAL_SURFACES
surface.pVirtualSurface->Release();
#else
// Release the video memory and visual in the tree
for (auto tile_it=surface.tiles.begin() ; tile_it != surface.tiles.end() ; ++tile_it) {
tile_it->second.pSurface->Release();
tile_it->second.pVisual->Release();
}
#endif

surface.pVisual->Release();
window->surfaces.erase(id);
@@ -591,9 +627,6 @@ extern "C" {
assert(surface.tiles.count(key) == 1);
Tile &tile = surface.tiles[key];

// Store the current surface for unbinding later
window->pCurrentSurface = tile.pSurface;

// Inform DC that we want to draw on this surface. DC uses texture
// atlases when the tiles are small. It returns an offset where the
// client code must draw into this surface when this happens.
@@ -605,17 +638,40 @@ extern "C" {
POINT offset;
D3D11_TEXTURE2D_DESC desc;
ID3D11Texture2D *pTexture;
HRESULT hr = tile.pSurface->BeginDraw(
HRESULT hr;

// Store the current surface for unbinding later
#ifdef USE_VIRTUAL_SURFACES
LONG tile_offset_x = VIRTUAL_OFFSET + tile_x * surface.tile_width;
LONG tile_offset_y = VIRTUAL_OFFSET + tile_y * surface.tile_height;

update_rect.left += tile_offset_x;
update_rect.top += tile_offset_y;
update_rect.right += tile_offset_x;
update_rect.bottom += tile_offset_y;

hr = surface.pVirtualSurface->BeginDraw(
&update_rect,
__uuidof(ID3D11Texture2D),
(void **) &pTexture,
&offset
);
window->pCurrentSurface = surface.pVirtualSurface;
#else
hr = tile.pSurface->BeginDraw(
&update_rect,
__uuidof(ID3D11Texture2D),
(void **) &pTexture,
&offset
);
window->pCurrentSurface = tile.pSurface;
#endif

// DC includes the origin of the dirty / update rect in the draw offset,
// undo that here since WR expects it to be an absolute offset.
assert(SUCCEEDED(hr));
offset.x -= dirty_x0;
offset.y -= dirty_y0;
assert(SUCCEEDED(hr));
pTexture->GetDesc(&desc);
*x_offset = offset.x;
*y_offset = offset.y;
@@ -690,6 +746,10 @@ extern "C" {
// of the slice.
float offset_x = (float) (x + window->client_rect.left);
float offset_y = (float) (y + window->client_rect.top);
#ifdef USE_VIRTUAL_SURFACES
offset_x -= VIRTUAL_OFFSET;
offset_y -= VIRTUAL_OFFSET;
#endif
surface.pVisual->SetOffsetX(offset_x);
surface.pVisual->SetOffsetY(offset_y);

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.