protocols: Remove incorrect CM proto debug check and fix preferred image description (#11023)

This commit is contained in:
UjinT34
2025-07-14 23:54:43 +03:00
committed by GitHub
parent 06fcdbd9c7
commit bc764f7065
3 changed files with 18 additions and 4 deletions

View File

@@ -362,6 +362,11 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana
m_resource->setGetPreferred([this](CWpColorManagementSurfaceFeedbackV1* r, uint32_t id) {
LOGM(TRACE, "Get preferred for id {}", id);
if (m_surface.expired()) {
r->error(WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT, "Surface is inert");
return;
}
if (m_currentPreferred.valid())
PROTO::colorManagement->destroyResource(m_currentPreferred.get());
@@ -377,15 +382,15 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana
RESOURCE->m_self = RESOURCE;
m_currentPreferred = RESOURCE;
m_currentPreferred->m_settings = g_pCompositor->getPreferredImageDescription();
m_currentPreferred->m_settings = m_surface->getPreferredImageDescription();
RESOURCE->resource()->sendReady(m_currentPreferred->m_settings.updateId());
});
m_resource->setGetPreferredParametric([this](CWpColorManagementSurfaceFeedbackV1* r, uint32_t id) {
LOGM(TRACE, "Get preferred for id {}", id);
if (!PROTO::colorManagement->m_debug) {
r->error(WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, "Parametric descriptions are not supported");
if (m_surface.expired()) {
r->error(WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT, "Surface is inert");
return;
}
@@ -404,7 +409,7 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana
RESOURCE->m_self = RESOURCE;
m_currentPreferred = RESOURCE;
m_currentPreferred->m_settings = g_pCompositor->getPreferredImageDescription();
m_currentPreferred->m_settings = m_surface->getPreferredImageDescription();
if (!PROTO::colorManagement->m_debug && m_currentPreferred->m_settings.icc.fd) {
LOGM(ERR, "FIXME: parse icc profile");
r->error(WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported");

View File

@@ -1,4 +1,5 @@
#include "Compositor.hpp"
#include "../../Compositor.hpp"
#include "Output.hpp"
#include "Seat.hpp"
#include "../types/WLBuffer.hpp"
@@ -17,6 +18,8 @@
#include "render/Texture.hpp"
#include <cstring>
using namespace NColorManagement;
class CDefaultSurfaceRole : public ISurfaceRole {
public:
virtual eSurfaceRole role() {
@@ -535,6 +538,10 @@ void CWLSurfaceResource::commitState(SSurfaceState& state) {
dropCurrentBuffer();
}
SImageDescription CWLSurfaceResource::getPreferredImageDescription() {
return m_enteredOutputs.size() == 1 ? m_enteredOutputs[0]->m_imageDescription : g_pCompositor->getPreferredImageDescription();
}
void CWLSurfaceResource::updateCursorShm(CRegion damage) {
if (damage.empty())
return;

View File

@@ -18,6 +18,7 @@
#include "../../helpers/math/Math.hpp"
#include "../../helpers/time/Time.hpp"
#include "../types/Buffer.hpp"
#include "../types/ColorManagement.hpp"
#include "../types/SurfaceRole.hpp"
#include "../types/SurfaceState.hpp"
@@ -107,6 +108,7 @@ class CWLSurfaceResource {
SP<CWLSurfaceResource> findFirstPreorder(std::function<bool(SP<CWLSurfaceResource>)> fn);
void presentFeedback(const Time::steady_tp& when, PHLMONITOR pMonitor, bool discarded = false);
void commitState(SSurfaceState& state);
NColorManagement::SImageDescription getPreferredImageDescription();
// returns a pair: found surface (null if not found) and surface local coords.
// localCoords param is relative to 0,0 of this surface