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

Commit 1473f46c authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Integrate from //sandbox/mathias/donut/...@145728

SurfaceFlinger rework for new EGL driver model support.
parent 71d83c04
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ ifneq ($(USE_CUSTOM_RUNTIME_HEAP_MAX),)
  LOCAL_CFLAGS += -DCUSTOM_RUNTIME_HEAP_MAX=$(USE_CUSTOM_RUNTIME_HEAP_MAX)
endif

LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES

LOCAL_SRC_FILES:= \
	ActivityManager.cpp \
	AndroidRuntime.cpp \
+4 −21
Original line number Diff line number Diff line
@@ -235,7 +235,8 @@ static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect)

    SkCanvas* nativeCanvas = (SkCanvas*)env->GetIntField(canvas, no.native_canvas);
    SkBitmap bitmap;
    bitmap.setConfig(convertPixelFormat(info.format), info.w, info.h, info.bpr);
    ssize_t bpr = info.s * bytesPerPixel(info.format);
    bitmap.setConfig(convertPixelFormat(info.format), info.w, info.h, bpr);
    if (info.w > 0 && info.h > 0) {
        bitmap.setPixels(info.bits);
    } else {
@@ -289,26 +290,8 @@ static void Surface_unlockCanvasAndPost(
static void Surface_unlockCanvas(
        JNIEnv* env, jobject clazz, jobject argCanvas)
{
    jobject canvas = env->GetObjectField(clazz, so.canvas);
    if (canvas != argCanvas) {
        doThrow(env, "java/lang/IllegalArgumentException", NULL);
        return;
    }
    
    const sp<Surface>& surface = getSurface(env, clazz);
    if (!surface->isValid())
        return;
    
    status_t err = surface->unlock();
    if (err < 0) {
    // XXX: this API has been removed
    doThrow(env, "java/lang/IllegalArgumentException", NULL);
        return;
    }
    SkCanvas* nativeCanvas = (SkCanvas*)env->GetIntField(canvas, no.native_canvas);
    int saveCount = env->GetIntField(clazz, so.saveCount);
    nativeCanvas->restoreToCount(saveCount);
    nativeCanvas->setBitmapDevice(SkBitmap());
    env->SetIntField(clazz, so.saveCount, 0);
}

static void Surface_openTransaction(
+1 −2
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include <EGL/egl.h>
#include <GLES/gl.h>

#include <ui/EGLNativeWindowSurface.h>
#include <ui/Surface.h>
#include <SkBitmap.h>
#include <SkPixelRef.h>
@@ -338,7 +337,7 @@ not_valid_surface:
        goto not_valid_surface;

    jint* base = beginNativeAttribList(_env, attrib_list);
    EGLSurface sur = eglCreateWindowSurface(dpy, cnf, new EGLNativeWindowSurface(window), base);
    EGLSurface sur = eglCreateWindowSurface(dpy, cnf, window, base);
    endNativeAttributeList(_env, attrib_list, base);
    return (jint)sur;
}
(898 B)

File mode changed from 100644 to 100755.

+31 −12
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#endif

#include <private/pixelflinger/ggl_context.h>
#include <hardware/copybit.h>

#include <GLES/gl.h>
#include <GLES/glext.h>
@@ -594,6 +595,16 @@ struct prims_t {
    void (*renderTriangle)(GL, vertex_t*, vertex_t*, vertex_t*);
};

struct copybits_context_t {
    // A handle to the blit engine, if it exists, else NULL.
    copybit_device_t*       blitEngine;
    int32_t                 minScale;
    int32_t                 maxScale;
    // File descriptor of current drawing surface, if it's suitable for use as
    // a copybits destination, else -1.
    int                     drawSurfaceFd;
};

struct ogles_context_t {
    context_t               rasterizer;
    array_machine_t         arrays         __attribute__((aligned(32)));
@@ -617,6 +628,14 @@ struct ogles_context_t {
    uint32_t                transformTextures : 1;
    EGLSurfaceManager*      surfaceManager;
    EGLBufferObjectManager* bufferObjectManager;

    // copybits is only used if LIBAGL_USE_GRALLOC_COPYBITS is
    // defined, but it is always present because ogles_context_t is a public
    // struct that is used by clients of libagl. We want the size and offsets
    // to stay the same, whether or not LIBAGL_USE_GRALLOC_COPYBITS is defined.

    copybits_context_t      copybits;

    GLenum                  error;

    static inline ogles_context_t* get() {
Loading