Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@knopp
Copy link
Member

@knopp knopp commented Feb 25, 2021

flutter/flutter#76789

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.
  • The reviewer has submitted any presubmit flakes in this PR using the engine presubmit flakes form before re-triggering the failure.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@knopp knopp changed the title WIP: Add option to use Direct Composition for presenting flutter surface Add option to use Direct Composition for presenting flutter surface Feb 25, 2021
Copy link

@clarkezone clarkezone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a SetCompositionMode API that is not conditionalized to win32, with an enum of values None, DirectComposition, WinUIComposition returning a bool. The success failure would be delegated via WindowBindingHandler to either win32 or UWP subsystem which would each run the appropriate checks to see if the requested mode is supported. Would also be good to have a default mode for each respective platform; that could be part of this change or come in a subsequent patch. In the failure case, the mode isn't changed and false is returned.

Please make sure that win7 support isn't broken by this change.


#ifndef WINUWP

FLUTTER_EXPORT void FlutterDesktopViewControllerEnableDirectComposition(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather this wasn't conditionalized but instead was a FlutterSetDesktopCompositionMode taking an enum with values None, DirectComposition, WinUIComposition returning a bool to indicate success

}
}

#ifndef WINUWP

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have a SetCompositionMode style API, then that should be indirected through WindowBindingHandler to the respective win32 or winuwp window. rather than ifdef'ing here. Each underlying impl can figure out if the requested mode is supported and configure, return true else false. For Win32 it would succeed if composition mode is DirectComposition and OS version >= win8. In the future we can also succeed for WinUIComp once the angle parts land with a version check. For Win32 mode, only WinUIComp mode would succeed. It would also be good to have a prefereddefault method on the binding handler to allow each platform to express a preference for the default for the case when setcompositionmode isn't called. for win32 that can default to none initially and we can then flip it to DirectComposition at the point we're happy with the stability.

We should also verify that linking changes don't break win7.. will need to loadlibrary / getprocaddress and dcomp calls

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angle already does that. It loads the direct composition calls through loadlibrary. we could do the same to determine whether dcomp si supported so that API can return true if supported.

}

#ifndef WINUWP
void FlutterWindowsView::EnableDirectComposition(bool enable) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetCompositionMode and not conditionalized

// Tells the engine to generate a new frame
void ForceRedraw();

#ifndef WINUWP

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetCompositionMode and not conditionalized


// Enables or disables the use of Direct Composition API when presenting
// flutter view surface to screen.
FLUTTER_EXPORT void FlutterDesktopViewControllerEnableDirectComposition(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetCompositionMode and not conditionalized

// Target represents the visual entity to bind to. Width and
// height represent dimensions surface is created at.
bool CreateSurface(WindowsRenderTarget* render_target,
#ifndef WINUWP

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much of the angle code will need to be conditionalized vs a case statement. Maybe the entrypoint won't but the internals will, that will become obvious as you work through it.

@knopp
Copy link
Member Author

knopp commented Mar 1, 2021

Closed in favor of #24705

@knopp knopp closed this Mar 1, 2021
@knopp knopp deleted the direct_composition branch July 17, 2021 09:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants