intel / external-mesa

16 stars 57 forks source link

Add FP16 support on Android #124

Open renchenglei opened 5 years ago

renchenglei commented 5 years ago

Android 10 is already public. On latest android, we will need support FP16 format. @strassek could you help back port your upstream patches set to github? Thanks a lot! We will also have related minigbm changes for FP16 to enable the whole function on Android. Upstream patch set: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/794 CC @tpalli

strassek commented 5 years ago

I can help with the backport but I'll want to have the Android platform code in place before we push to master. Can you open an upstream PR? If it helps, I can make a topic branch available for you with the current fp16 code backported to external-mesa master.

renchenglei commented 5 years ago

I can help with the backport but I'll want to have the Android platform code in place before we push to master. Can you open an upstream PR? If it helps, I can make a topic branch available for you with the current fp16 code backported to external-mesa master.

Do you mean Android 10 code? Now, we could download latest Celadon with Android 10, :)

strassek commented 5 years ago

There are some (hopefully) minor changes needed in the Android driver for EGL in order to make FP16 available to Android apps, the patch series that we landed upstream only covers GBM platform. @renchenglei I was under the impression that you had started that work, is that true?

btw, can you list the relevant CTS tests here?

renchenglei commented 5 years ago

@strassek, yes, in fact, we have back ported your FP16 patches on GP 2.1 based on mesa 19.0.6. And have passed all related CTS test. Besides your FP16 patch set, we also need enable FP16 on Android platform(https://lists.freedesktop.org/archives/mesa-dev/2019-August/222379.html). Here are some cases related to FP16: CtsDeqpTestCases dEQP-VK.api.external.memory.android_hardware_buffer.image_formats#r16g16b16a16_sfloat(this may failed on x86 platform) CtsDeqpTestCases dEQP-VK.wsi.android.incremental_present.scale_none.mailbox.* CtsGraphicsTestCases android.graphics.cts.ImageDecoderTest#testTargetColorSpace CtsGraphicsTestCases android.graphics.cts.BitmapColorSpaceTest#test16bitHardware CtsNativeHardwareTestCases "here you could run the whole module"

strassek commented 5 years ago

Interesting, I didn't see that patch. I guess that satisfies some checks to see if the HAL format is mapped to something, but I can tell you it doesn't actually expose the visual or enable fp16 in the dri driver. In other words, apps aren't going to find an fp16 egl config.

I used these tests in the past to check if a fp16 config can be found, without support in place they will pass as NotSupported: dEQP-EGL.functional.wide_color.fp16 dEQP-EGL.functional.wide_color.window_fp16_default_colorspace

strassek commented 5 years ago

@renchenglei Was something like this needed in your GP 2.1 backport?

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f968cd7af27..82a0bed5c62 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -65,6 +65,7 @@
 #include "util/u_atomic.h"
 #include "util/u_vector.h"
 #include "mapi/glapi/glapi.h"
+#include "util/bitscan.h"

 /* Additional definitions not yet in the drm_fourcc.h.
  */

Submitted as https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1973

renchenglei commented 5 years ago

@strassek, for the two fp16 test, I tried on Android, and it does pass with "Not Supported". You are right, maybe we need some other more config to enable FP16? For the ffs issue, we didn't encounter on GP 2.1.

strassek commented 5 years ago

We need the Android equivalent of what Ajax did for Wayland and Surfaceless: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1942

And then we need to switch it on by setting "allow_fp16_configs" to "true" in driconf.

strassek commented 5 years ago

I've backported the fp16 patches and pushed to master. I'll leave this issue open until we add in the Android surface support.