aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/render
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-07-31 20:47:26 +0100
committerGitHub <[email protected]>2024-07-31 21:47:26 +0200
commit37e1411e8d94fe8f3fb678588a7df9b8f931910f (patch)
treece91aa3984b646f8a8569976edb8e78c85919ee5 /src/render
parent548968279926a73d7ff19a9a185c977c50d56756 (diff)
downloadHyprland-37e1411e8d94fe8f3fb678588a7df9b8f931910f.tar.gz
Hyprland-37e1411e8d94fe8f3fb678588a7df9b8f931910f.zip
core/surface/buffer: Buffer lock/release fixes (#7110)
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Renderer.cpp14
-rw-r--r--src/render/Texture.cpp3
-rw-r--r--src/render/Texture.hpp1
3 files changed, 11 insertions, 7 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index e4f97895..127ae187 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -102,10 +102,10 @@ CHyprRenderer::~CHyprRenderer() {
}
static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* data) {
- if (!surface->current.buffer || !surface->current.buffer->texture)
+ if (!surface->current.texture)
return;
- const auto& TEXTURE = surface->current.buffer->texture;
+ const auto& TEXTURE = surface->current.texture;
const auto RDATA = (SRenderData*)data;
const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow.lock() == RDATA->pWindow && g_pInputManager->dragMode == MBIND_RESIZE;
@@ -192,8 +192,8 @@ static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* da
windowBox.round();
const bool MISALIGNEDFSV1 = std::floor(RDATA->pMonitor->scale) != RDATA->pMonitor->scale /* Fractional */ && surface->current.scale == 1 /* fs protocol */ &&
- windowBox.size() != surface->current.buffer->size /* misaligned */ && DELTALESSTHAN(windowBox.width, surface->current.buffer->size.x, 3) &&
- DELTALESSTHAN(windowBox.height, surface->current.buffer->size.y, 3) /* off by one-or-two */ &&
+ windowBox.size() != surface->current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, surface->current.bufferSize.x, 3) &&
+ DELTALESSTHAN(windowBox.height, surface->current.bufferSize.y, 3) /* off by one-or-two */ &&
(!RDATA->pWindow || (!RDATA->pWindow->m_vRealSize.isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */;
g_pHyprRenderer->calculateUVForSurface(RDATA->pWindow, surface, RDATA->surface == surface, windowBox.size(), MISALIGNEDFSV1);
@@ -1014,7 +1014,7 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
if (pSurface->current.viewport.hasSource) {
// we stretch it to dest. if no dest, to 1,1
- Vector2D bufferSize = pSurface->current.buffer->size;
+ Vector2D bufferSize = pSurface->current.bufferSize;
auto bufferSource = pSurface->current.viewport.source;
// calculate UV for the basic src_box. Assume dest == size. Scale to dest later
@@ -1030,8 +1030,8 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
if (projSize != Vector2D{} && fixMisalignedFSV1) {
// instead of nearest_neighbor (we will repeat / skip)
// just cut off / expand surface
- const Vector2D PIXELASUV = Vector2D{1, 1} / pSurface->current.buffer->size;
- const Vector2D MISALIGNMENT = pSurface->current.buffer->size - projSize;
+ const Vector2D PIXELASUV = Vector2D{1, 1} / pSurface->current.bufferSize;
+ const Vector2D MISALIGNMENT = pSurface->current.bufferSize - projSize;
if (MISALIGNMENT != Vector2D{})
uvBR -= MISALIGNMENT * PIXELASUV;
}
diff --git a/src/render/Texture.cpp b/src/render/Texture.cpp
index 0f5b4c4c..94d00184 100644
--- a/src/render/Texture.cpp
+++ b/src/render/Texture.cpp
@@ -28,6 +28,8 @@ CTexture::CTexture(const SP<Aquamarine::IBuffer> buffer) {
if (!buffer)
return;
+ m_bOpaque = buffer->opaque;
+
auto attrs = buffer->dmabuf();
if (!attrs.success) {
@@ -86,6 +88,7 @@ void CTexture::createFromDma(const Aquamarine::SDMABUFAttrs& attrs, void* image)
return;
}
+ m_bOpaque = FormatUtils::isFormatOpaque(attrs.format);
m_iTarget = GL_TEXTURE_2D;
m_iType = TEXTURE_RGBA;
m_vSize = attrs.size;
diff --git a/src/render/Texture.hpp b/src/render/Texture.hpp
index a54be8c5..e0ef5503 100644
--- a/src/render/Texture.hpp
+++ b/src/render/Texture.hpp
@@ -41,6 +41,7 @@ class CTexture {
Vector2D m_vSize = {};
void* m_pEglImage = nullptr;
eTransform m_eTransform = HYPRUTILS_TRANSFORM_NORMAL;
+ bool m_bOpaque = false;
private:
void createFromShm(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const Vector2D& size);