11.2 Android显示系统框架

    xiaoxiao2023-11-09  162

    2. 修改tiny4412_Android源码禁用hwc和gpu(厂家不会提供hwc和gpu的源代码,没有源代码就没法分析了,因此在这里禁用该功能并用软件库实现) 最终源码:  git clone https://github.com/weidongshan/SYS_0003_Patch_Disable_HWC_GPU_tiny4412.git 或 git clone https://git.coding.net/weidongshan/SYS_0003_Patch_Disable_HWC_GPU.git 更新: git pull origin

    取出指定版本: git checkout v1 // v1, patch to disable HWC&GPU for tiny4412's android-5.0.2 这个补丁做了3件事: a. 去掉厂家提供的gralloc, hwcopser HAL模块 b. 添加属性让android系统认为自己运行于"没有GPU的模拟器"  修改libagl/Android.mk,给系统添加libGLES_android.so (软件实现的GL) c. 修改系统自带的gralloc模块的BUG

     

    如何获得HAL模块gralloc:

    (1)、从哪里查找文件:/vendor/lib/hw,/system/lib/hw

    (2)、文件名是什么?gralloc.属性值.so:gralloc.tiny4412.so/gralloc.exynos4.so/gralloc.default.so(gralloc.tiny4412.so就是厂家提供的)

     

     

     

    修改源码: a. 去掉厂家提供的gralloc, hwcopser HAL模块 a.1 删除单板上/system/lib/hw(删除的时候需要执行mount -o remount /system   重新挂载/system后才具有删除权限) gralloc.tiny4412.so hwcomposer.exynos4.so a.2 修改源码使得编译结果中不含上述文件 (修改vendor/friendly-arm/tiny4412/device-tiny4412.mk, 参考补丁110和116行)

    出错 : invalid buffer handle given

    发现出错的的函数__egl_platform_create_surface_from_native_buffer出错,但在android系统中搜不到,因此其可能是在厂家提供的库中,

    在系统中执行grep “__egl_platform_create_surface_from_native_buffer” * -nR 发现只在libMali.so中找到,在运行的系统中的/system/lib下搜索Mali相关的库,找到在/system/lib/egl中,把得到的libGLES_android.so复制到单板/system/lib/eg/,并添加读属性,reboot系统

     

    b. 添加属性让android系统认为自己运行于"没有GPU的模拟器"  修改libagl/Android.mk,给系统添加libGLES_android.so (软件实现的GL) b.1 添加软件GPU库 开发板: su, mount -o remount /system 在服务器编译软件GPU库: mmm frameworks/native/opengl/libagl   //执行mmm命令后会得到libGLES_android.so 把得到的libGLES_android.so复制到单板/system/lib/eg/,并添加读属性chmod 777 libGLES_android.so

    b.2 修改frameworks/native/opengl/libagl/Android.mk (参考补丁) b.3 修改属性文件 , 单板 /system/build.prop,添加: ro.kernel.qemu=1 ro.kernel.qemu.gles=0

    或修改源码 device/friendly-arm/tiny4412/system.prop 同样添加上述属性, 然后重新编译系统

    重新启动后出错: no suitable EGLConfig found, giving up

    c. 修改系统自带的gralloc模块的BUG c.1 修改 hardware\libhardware\modules\gralloc\Framebuffer.cpp HAL_PIXEL_FORMAT_BGRA_8888 改为: HAL_PIXEL_FORMAT_RGBA_8888

    mmm hardware/libhardware/modules/gralloc/ 把gralloc.default.so复制到单板/system/lib/hw 重启,出错:BufferQueueProducer( 2320): [FramebufferSurface] dequeueBuffer: createGraphicBuffer failed W/GraphicBufferAllocator( 1918): alloc(800, 480, 1, 00001a33, ...) failed -12 (Out of memory) c.2 继续修改 hardware\libhardware\modules\gralloc\Framebuffer.cpp mmm hardware/libhardware/modules/gralloc/ 把gralloc.default.so复制到单板/system/lib/hw

    成功!

    最新回复(0)