mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-16 23:15:57 +01:00
drm/atomic: clip damage to pixel size
ref https://github.com/hyprwm/Hyprland/issues/7356
This commit is contained in:
parent
589346162f
commit
e947af7894
1 changed files with 4 additions and 2 deletions
|
@ -221,6 +221,7 @@ Aquamarine::CDRMAtomicImpl::CDRMAtomicImpl(Hyprutils::Memory::CSharedPointer<CDR
|
|||
bool Aquamarine::CDRMAtomicImpl::prepareConnector(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data) {
|
||||
const auto& STATE = connector->output->state->state();
|
||||
const bool enable = STATE.enabled;
|
||||
const auto& MODE = STATE.mode ? STATE.mode : STATE.customMode;
|
||||
|
||||
if (data.modeset) {
|
||||
if (!enable)
|
||||
|
@ -262,11 +263,12 @@ bool Aquamarine::CDRMAtomicImpl::prepareConnector(Hyprutils::Memory::CSharedPoin
|
|||
}
|
||||
}
|
||||
|
||||
if (STATE.committed & COutputState::AQ_OUTPUT_STATE_DAMAGE && connector->crtc->primary->props.fb_damage_clips) {
|
||||
if ((STATE.committed & COutputState::AQ_OUTPUT_STATE_DAMAGE) && connector->crtc->primary->props.fb_damage_clips && MODE) {
|
||||
if (STATE.damage.empty())
|
||||
data.atomic.fbDamage = 0;
|
||||
else {
|
||||
std::vector<pixman_box32_t> rects = STATE.damage.getRects();
|
||||
TRACE(connector->backend->backend->log(AQ_LOG_TRACE, std::format("atomic drm: clipping damage to pixel size {}", MODE->pixelSize)));
|
||||
std::vector<pixman_box32_t> rects = STATE.damage.copy().intersect(CBox{{}, MODE->pixelSize}).getRects();
|
||||
if (drmModeCreatePropertyBlob(connector->backend->gpu->fd, rects.data(), sizeof(pixman_box32_t) * rects.size(), &data.atomic.fbDamage)) {
|
||||
connector->backend->backend->log(AQ_LOG_ERROR, "atomic drm: failed to create a damage blob");
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue