diff --git a/src/drm.cpp b/src/drm.cpp index 17bf234..cac1786 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -1074,8 +1074,10 @@ drm_prepare_basic( struct drm_t *drm, const struct Composite_t *pComposite, cons if ( g_bRotated ) { + int64_t imageH = pPipeline->layerBindings[ 0 ].imageHeight / pComposite->data.vScale[ 0 ].y; + int64_t tmp = crtcX; - crtcX = g_nOutputHeight - crtcH - crtcY; + crtcX = g_nOutputHeight - imageH - crtcY; crtcY = tmp; tmp = crtcW; @@ -1135,9 +1137,11 @@ drm_prepare_liftoff( struct drm_t *drm, const struct Composite_t *pComposite, co uint64_t crtcH = srcHeight / pComposite->data.vScale[ i ].y; if (g_bRotated) { + int64_t imageH = pPipeline->layerBindings[ i ].imageHeight / pComposite->data.vScale[ i ].y; + const int32_t x = crtcX; const uint64_t w = crtcW; - crtcX = g_nOutputHeight - crtcH - crtcY; + crtcX = g_nOutputHeight - imageH - crtcY; crtcY = x; crtcW = crtcH; crtcH = w; diff --git a/src/rendervulkan.hpp b/src/rendervulkan.hpp index 81ded19..4d2c3cd 100644 --- a/src/rendervulkan.hpp +++ b/src/rendervulkan.hpp @@ -33,6 +33,9 @@ struct VulkanPipeline_t { int surfaceWidth; int surfaceHeight; + + int imageWidth; + int imageHeight; std::shared_ptr tex; uint32_t fbid; diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 5e13a92..6bc11d8 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -1067,12 +1067,17 @@ bool MouseCursor::getTexture() m_hotspotX = image->xhot; m_hotspotY = image->yhot; - m_width = image->width; - m_height = image->height; + m_imageWidth = image->width; + m_imageHeight = image->height; if ( BIsNested() == false && alwaysComposite == false ) { - m_width = g_DRM.cursor_width; - m_height = g_DRM.cursor_height; + m_surfaceWidth = g_DRM.cursor_width; + m_surfaceHeight = g_DRM.cursor_height; + } + else + { + m_surfaceWidth = m_imageWidth; + m_surfaceHeight = m_imageHeight; } m_texture = nullptr; @@ -1080,12 +1085,12 @@ bool MouseCursor::getTexture() // Assume the cursor is fully translucent unless proven otherwise. bool bNoCursor = true; - auto cursorBuffer = std::vector(m_width * m_height); + auto cursorBuffer = std::vector(m_surfaceWidth * m_surfaceHeight); for (int i = 0; i < image->height; i++) { for (int j = 0; j < image->width; j++) { - cursorBuffer[i * m_width + j] = image->pixels[i * image->width + j]; + cursorBuffer[i * m_surfaceWidth + j] = image->pixels[i * image->width + j]; - if ( cursorBuffer[i * m_width + j] & 0xff000000 ) { + if ( cursorBuffer[i * m_surfaceWidth + j] & 0xff000000 ) { bNoCursor = false; } } @@ -1111,7 +1116,7 @@ bool MouseCursor::getTexture() // TODO: choose format & modifiers from cursor plane } - m_texture = vulkan_create_texture_from_bits(m_width, m_height, DRM_FORMAT_ARGB8888, texCreateFlags, cursorBuffer.data()); + m_texture = vulkan_create_texture_from_bits(m_surfaceWidth, m_surfaceHeight, DRM_FORMAT_ARGB8888, texCreateFlags, cursorBuffer.data()); assert(m_texture); XFree(image); m_dirty = false; @@ -1183,8 +1188,11 @@ void MouseCursor::paint(win *window, win *fit, struct Composite_t *pComposite, pComposite->data.vOffset[ curLayer ].x = -scaledX; pComposite->data.vOffset[ curLayer ].y = -scaledY; - pPipeline->layerBindings[ curLayer ].surfaceWidth = m_width; - pPipeline->layerBindings[ curLayer ].surfaceHeight = m_height; + pPipeline->layerBindings[ curLayer ].surfaceWidth = m_surfaceWidth; + pPipeline->layerBindings[ curLayer ].surfaceHeight = m_surfaceHeight; + + pPipeline->layerBindings[ curLayer ].imageWidth = m_imageWidth; + pPipeline->layerBindings[ curLayer ].imageHeight = m_imageHeight; pPipeline->layerBindings[ curLayer ].zpos = g_zposCursor; // cursor, on top of both bottom layers @@ -1380,6 +1388,9 @@ paint_window(win *w, win *scaleW, struct Composite_t *pComposite, pPipeline->layerBindings[ curLayer ].surfaceWidth = w->a.width; pPipeline->layerBindings[ curLayer ].surfaceHeight = w->a.height; + pPipeline->layerBindings[ curLayer ].imageWidth = w->a.width; + pPipeline->layerBindings[ curLayer ].imageHeight = w->a.height; + pPipeline->layerBindings[ curLayer ].zpos = g_zposBase; if ( w != scaleW ) @@ -1687,6 +1698,9 @@ paint_all() pipeline.layerBindings[ 0 ].surfaceWidth = g_nOutputWidth; pipeline.layerBindings[ 0 ].surfaceHeight = g_nOutputHeight; + pipeline.layerBindings[ 0 ].imageWidth = g_nOutputWidth; + pipeline.layerBindings[ 0 ].imageHeight = g_nOutputHeight; + pipeline.layerBindings[ 0 ].fbid = vulkan_get_last_composite_fbid(); pipeline.layerBindings[ 0 ].bFilter = false; diff --git a/src/steamcompmgr.hpp b/src/steamcompmgr.hpp index a68c40e..6798d6e 100644 --- a/src/steamcompmgr.hpp +++ b/src/steamcompmgr.hpp @@ -72,7 +72,8 @@ private: int m_x = 0, m_y = 0; int m_hotspotX = 0, m_hotspotY = 0; - int m_width = 0, m_height = 0; + int m_surfaceWidth = 0, m_surfaceHeight = 0; + int m_imageWidth = 0, m_imageHeight = 0; std::shared_ptr m_texture; bool m_dirty;