Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db66fbf4 authored by Hashcode's avatar Hashcode
Browse files

add BoardConfig flag TARGET_USES_OPENGLES_FOR_SCREEN_CAPTURE

This flag forces usage flags:
GRALLOC_USAGE_HW_TEXTURE and GRALLOC_USAGE_HW_RENDERER
in captureScreenImplLocked regardless of useReadPixels value

This fixes the EGL_NO_IMAGE_KHR error returned from
eglCreateImageKHR (blank images returned from screenshot path)

Change-Id: Ia782a918501b4fd40a58eef71c404584a44b8073
parent 38deda9d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@ else
    LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0
endif

ifeq ($(TARGET_USES_OPENGLES_FOR_SCREEN_CAPTURE),true)
	LOCAL_CFLAGS += -DUSE_OPENGLES_FOR_SCREEN_CAPTURE
endif

LOCAL_CFLAGS += -fvisibility=hidden

LOCAL_SHARED_LIBRARIES := \
+5 −0
Original line number Diff line number Diff line
@@ -3133,9 +3133,14 @@ status_t SurfaceFlinger::captureScreenImplLocked(
    status_t result = NO_ERROR;
    if (native_window_api_connect(window, NATIVE_WINDOW_API_EGL) == NO_ERROR) {
        uint32_t usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
#ifdef USE_OPENGLES_FOR_SCREEN_CAPTURE
        // Make sure that HW_RENDER and HW_TEXTURE flags are used regardless of useReadPixels value
        usage |= GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE;
#else
        if (!useReadPixels) {
            usage |= GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE;
        }
#endif

        int err = 0;
        err = native_window_set_buffers_dimensions(window, reqWidth, reqHeight);