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

Commit 2246fb31 authored by Alex Sakhartchouk's avatar Alex Sakhartchouk Committed by Android (Google) Code Review
Browse files

Merge "More work to make libRS buildable on the host."

parents f24ed1c2 17a8a193
Loading
Loading
Loading
Loading
+60 −2
Original line number Diff line number Diff line
@@ -149,24 +149,82 @@ include $(BUILD_SHARED_LIBRARY)

# Now build a host version for serialization
include $(CLEAR_VARS)
LOCAL_MODULE:= libRS
LOCAL_MODULE_TAGS := optional

intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,HOST,)

# Generate custom headers

GEN := $(addprefix $(intermediates)/, \
            rsgApiStructs.h \
            rsgApiFuncDecl.h \
        )

$(GEN) : PRIVATE_PATH := $(LOCAL_PATH)
$(GEN) : PRIVATE_CUSTOM_TOOL = $(RSG_GENERATOR) $< $@ <$(PRIVATE_PATH)/rs.spec
$(GEN) : $(RSG_GENERATOR) $(LOCAL_PATH)/rs.spec
$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.h.rsg
	$(transform-generated-source)

LOCAL_GENERATED_SOURCES += $(GEN)

# Generate custom source files

GEN := $(addprefix $(intermediates)/, \
            rsgApi.cpp \
            rsgApiReplay.cpp \
        )

$(GEN) : PRIVATE_PATH := $(LOCAL_PATH)
$(GEN) : PRIVATE_CUSTOM_TOOL = $(RSG_GENERATOR) $< $@ <$(PRIVATE_PATH)/rs.spec
$(GEN) : $(RSG_GENERATOR) $(LOCAL_PATH)/rs.spec
$(GEN): $(intermediates)/%.cpp : $(LOCAL_PATH)/%.cpp.rsg
	$(transform-generated-source)

LOCAL_GENERATED_SOURCES += $(GEN)

LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable
LOCAL_CFLAGS += -DANDROID_RS_SERIALIZE
LOCAL_CFLAGS += -fPIC

LOCAL_SRC_FILES:= \
	rsAdapter.cpp \
	rsAllocation.cpp \
	rsAnimation.cpp \
	rsComponent.cpp \
	rsContext.cpp \
	rsDevice.cpp \
	rsElement.cpp \
	rsFBOCache.cpp \
	rsFifoSocket.cpp \
	rsFileA3D.cpp \
	rsFont.cpp \
	rsLocklessFifo.cpp \
	rsObjectBase.cpp \
	rsMatrix2x2.cpp \
	rsMatrix3x3.cpp \
	rsMatrix4x4.cpp \
	rsMesh.cpp \
	rsMutex.cpp \
	rsProgram.cpp \
	rsProgramFragment.cpp \
	rsProgramStore.cpp \
	rsProgramRaster.cpp \
	rsProgramVertex.cpp \
	rsSampler.cpp \
	rsScript.cpp \
	rsScriptC.cpp \
	rsScriptC_Lib.cpp \
	rsScriptC_LibGL.cpp \
	rsSignal.cpp \
	rsStream.cpp \
	rsThreadIO.cpp \
	rsType.cpp

LOCAL_STATIC_LIBRARIES := libcutils libutils

LOCAL_LDLIBS := -lpthread
LOCAL_MODULE:= libRSserialize
LOCAL_MODULE_TAGS := optional

include $(BUILD_HOST_STATIC_LIBRARY)

+0 −8
Original line number Diff line number Diff line
@@ -55,15 +55,7 @@ void rsDeviceSetConfig(RsDevice dev, RsDeviceParam p, int32_t value);
RsContext rsContextCreate(RsDevice dev, uint32_t version);
RsContext rsContextCreateGL(RsDevice dev, uint32_t version, RsSurfaceConfig sc, uint32_t dpi);



#ifdef ANDROID_RS_SERIALIZE
#define NO_RS_FUNCS
#endif

#ifndef NO_RS_FUNCS
#include "rsgApiFuncDecl.h"
#endif

#ifdef __cplusplus
};
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include <cutils/sched_policy.h>
#include <sys/syscall.h>
#include <string.h>
#include <bcc/bcc.h>

using namespace android;
using namespace android::renderscript;
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
#define RSD_CORE_H

#include <rs_hal.h>
#include <bcc/bcc.h>

#include "rsMutex.h"
#include "rsSignal.h"
+4 −14
Original line number Diff line number Diff line
@@ -168,13 +168,10 @@ void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
}

void Allocation::addProgramToDirty(const Program *p) {
#ifndef ANDROID_RS_SERIALIZE
    mToDirtyList.push(p);
#endif //ANDROID_RS_SERIALIZE
}

void Allocation::removeProgramToDirty(const Program *p) {
#ifndef ANDROID_RS_SERIALIZE
    for (size_t ct=0; ct < mToDirtyList.size(); ct++) {
        if (mToDirtyList[ct] == p) {
            mToDirtyList.removeAt(ct);
@@ -182,7 +179,6 @@ void Allocation::removeProgramToDirty(const Program *p) {
        }
    }
    rsAssert(0);
#endif //ANDROID_RS_SERIALIZE
}

void Allocation::dumpLOGV(const char *prefix) const {
@@ -254,11 +250,9 @@ Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
}

void Allocation::sendDirty(const Context *rsc) const {
#ifndef ANDROID_RS_SERIALIZE
    for (size_t ct=0; ct < mToDirtyList.size(); ct++) {
        mToDirtyList[ct]->forceDirty();
    }
#endif //ANDROID_RS_SERIALIZE
    mRSC->mHal.funcs.allocation.markDirty(rsc, this);
}

@@ -312,8 +306,6 @@ void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {

/////////////////
//
#ifndef ANDROID_RS_SERIALIZE


namespace android {
namespace renderscript {
@@ -413,25 +405,25 @@ void rsi_AllocationCopyToBitmap(Context *rsc, RsAllocation va, void *data, size_
}

void rsi_Allocation1DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t lod,
                          uint32_t count, const void *data, uint32_t sizeBytes) {
                          uint32_t count, const void *data, size_t sizeBytes) {
    Allocation *a = static_cast<Allocation *>(va);
    a->data(rsc, xoff, lod, count, data, sizeBytes);
}

void rsi_Allocation2DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t y, uint32_t lod, RsAllocationCubemapFace face,
                                 const void *data, uint32_t eoff, uint32_t sizeBytes) {
                                 const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
    Allocation *a = static_cast<Allocation *>(va);
    a->elementData(rsc, x, y, data, eoff, sizeBytes);
}

void rsi_Allocation1DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t lod,
                                 const void *data, uint32_t eoff, uint32_t sizeBytes) {
                                 const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
    Allocation *a = static_cast<Allocation *>(va);
    a->elementData(rsc, x, data, eoff, sizeBytes);
}

void rsi_Allocation2DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
                          uint32_t w, uint32_t h, const void *data, uint32_t sizeBytes) {
                          uint32_t w, uint32_t h, const void *data, size_t sizeBytes) {
    Allocation *a = static_cast<Allocation *>(va);
    a->data(rsc, xoff, yoff, lod, face, w, h, data, sizeBytes);
}
@@ -549,5 +541,3 @@ const void * rsaAllocationGetType(RsContext con, RsAllocation va) {

    return a->getType();
}

#endif //ANDROID_RS_SERIALIZE
Loading