debug_fix_screen_change #2

Merged
xsl merged 35 commits from debug_fix_screen_change into main 2026-04-26 10:58:01 +08:00
9 changed files with 31 additions and 42 deletions
Showing only changes of commit 7ab4274e4f - Show all commits
@@ -94,12 +94,12 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
{
detectFace(image);
}
else
{
image.close();
}
// else
// {
// image.close();
// }
} finally {
//image.close(); // 确保在这里关闭
image.close(); // 确保在这里关闭
//Log.d("Camera", "Image closed, ready for next frame");
}
}
@@ -192,7 +192,7 @@ class FaceLandmarkerHelper(
Bitmap.Config.ARGB_8888
)
imageProxy.use { bitmapBuffer.copyPixelsFromBuffer(imageProxy.planes[0].buffer) }
imageProxy.close()
//imageProxy.close()
val matrix = Matrix().apply {
// Rotate the frame received from the camera to be in the same direction as it'll be shown
+1 -1
View File
@@ -9,7 +9,7 @@ android {
compileSdk 36
defaultConfig {
applicationId "com.inewme.uvmirror.f20251129"
applicationId "com.inewme.uvmirror.f20260113"
minSdk 30
targetSdk 36
versionCode 1
@@ -8,7 +8,6 @@ import com.hmwl.face_sdk.Frame
import com.hmwl.face_sdk.InitArg
import com.hmwl.face_sdk.Motion
import com.hmwl.face_sdk.MotionList
import org.checkerframework.checker.units.qual.radians
import org.json.JSONObject
import java.io.BufferedReader
import java.io.InputStreamReader
+1 -1
View File
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">f20251129</string>
<string name="app_name">f20260113</string>
</resources>
+2 -5
View File
@@ -582,9 +582,6 @@ void Application::drawFrame(long long frameTime)
submitInfo.signalSemaphoreCount = 1;
submitInfo.pSignalSemaphores = signalSemaphores;
// graphicsQueue 与主线程 drawFrame、FaceApp::endSingleTimeCommandsJNI/worker 线程)共用,必须串行
{
std::lock_guard<std::mutex> lock(mtx);
if (vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[currentFrame]) != VK_SUCCESS) {
throw std::runtime_error("failed to submit draw command buffer!");
}
@@ -598,7 +595,7 @@ void Application::drawFrame(long long frameTime)
presentInfo.pSwapchains = swapChains;
presentInfo.pImageIndices = &imageIndex;
result = vkQueuePresentKHR(presentQueue, &presentInfo);
}
if (result != VK_SUCCESS) {
throw std::runtime_error("failed to present swap chain image!");
}
@@ -854,7 +851,7 @@ void Application::createTexture(VkDevice device, VkPhysicalDevice physicalDevice
void Application::processWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& texture, bool srgb, VkCommandPool pool, std::string tex_path)
{
std::unique_lock<std::mutex> lock(mtx);
std::unique_lock<std::mutex> lock(createTextureMtx);
if (texture.image == VK_NULL_HANDLE)
{
createTexture(device, physicalDevice, width, height, texture, srgb, tex_path, dataSize);
+2 -5
View File
@@ -47,7 +47,7 @@ public:
virtual void drawFrame(long long frameTime);
virtual void render(VkCommandBuffer commandBuffer, long long frameTime);
virtual bool isInited() { return _applicationInited; }
std::mutex createTextureMtx;
void processWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& texture, bool srgb, VkCommandPool pool, std::string tex_path);
protected:
@@ -96,10 +96,7 @@ protected:
void endSingleTimeCommands(VkDevice device, VkCommandPool commandPool, VkQueue queue, VkCommandBuffer commandBuffer);
void transitionImageLayout(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout);
void destroy_texture(Texture texture);
std::mutex mtx;
long long _lastDrawFrameTime;
std::mutex changeMotionMtx;
};
+4 -9
View File
@@ -683,10 +683,6 @@ void FaceApp::update_descriptor_set(vector<Texture>& texs, vector<VkDescriptorSe
void FaceApp::render(VkCommandBuffer commandBuffer, long long frameTime)
{
std::unique_lock<std::mutex> lock(mtx);
std::unique_lock<std::mutex> lock_point(mtx_point);
std::unique_lock<std::mutex> lock_changeMotion(changeMotionMtx);
//Application::render(commandBuffer);
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout_bg, 0, 1, &m_descriptor_set_bg, 0, NULL);
@@ -984,12 +980,8 @@ void FaceApp::endSingleTimeCommands(VkCommandBuffer commandBuffer) {
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &commandBuffer;
// 与 Application::drawFrame 共用 graphicsQueue,必须串行,避免驱动内 SIGSEGV
{
std::lock_guard<std::mutex> lock(mtx);
vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
vkQueueWaitIdle(graphicsQueue);
}
vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer);
}
@@ -1460,7 +1452,9 @@ void FaceApp::drawFrame(long long frameTime)
game_time = game_time - actionTime;
}
}
std::unique_lock<std::mutex> lock_point(mtx_point);
std::unique_lock<std::mutex> lock_changeMotion(changeMotionMtx);
std::unique_lock<std::mutex> lock_Texture(createTextureMtx);
Application::drawFrame(frameTime);
}
@@ -1620,3 +1614,4 @@ void FaceApp::StopMotion() {
void FaceApp::ResumeMotion() {
_playMotion = true;
}
+1
View File
@@ -153,6 +153,7 @@ private:
std::map<int, int> vertices_map_3dmax;
std::mutex mtx_point;
std::mutex changeMotionMtx;
long long last_update_time;
VkBuffer uniform_buffer_vs;