[Mesa-dev] [PATCH 7/7] android: set '/sdcard/' as MESA_GLSL_CACHE_DIR by default
Tapani Pälli
tapani.palli at intel.com
Fri Jan 19 11:03:43 UTC 2018
On 01/19/2018 11:22 AM, Jordan Justen wrote:
> On 2018-01-18 22:08:17, Tapani Pälli wrote:
>>
>>
>> On 01/18/2018 08:18 PM, Jordan Justen wrote:
>>> On 2018-01-15 04:31:43, Tapani Pälli wrote:
>>>> This can/should be modified depending on needs. AFAIK by default,
>>>> this is the only path that can be read/written to by anyone.
>>>>
>>>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>>>> ---
>>>> Android.common.mk | 1 +
>>>> 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/Android.common.mk b/Android.common.mk
>>>> index 52dc7bff3b..7edbbfc0f2 100644
>>>> --- a/Android.common.mk
>>>> +++ b/Android.common.mk
>>>> @@ -47,6 +47,7 @@ LOCAL_CFLAGS += \
>>>> LOCAL_CFLAGS += \
>>>> -DANDROID_API_LEVEL=$(PLATFORM_SDK_VERSION) \
>>>> -DENABLE_SHADER_CACHE \
>>>> + -DMESA_GLSL_CACHE_DIR="/sdcard" \
>>>
>>> Is this used when EGL_ANDROID_blob_cache is being used?
>>>
>>> My thought is that if we are running under android with
>>> EGL_ANDROID_blob_cache, then we should never attempt to write any
>>> files with src/util/disk_cache.c. This might cause a little rework,
>>> since the shader cache want to write/manage the index file, but can we
>>> skip this and only use the blob cache read/write function when
>>> EGL_ANDROID_blob_cache is available?
>>
>> I'm a bit pessimistic about that. Since cache location depends on
>> running app that would mean every app has it's own index (that not
>> really a problem though but is different from desktop).
>
> I suspect that the blob_cache is app specific. Therefore it also makes
> sense that the index would be app specific.
>
>> The big problem I see there that index will be then 'just another
>> cache entry', I'll have to get more familiar with Android's
>> implementation to see if there would be way to make this entry
>> 'special' so that it would not touch it.
>
> My suggestion was that we should scrap the index entirely when in
> EGL_ANDROID_blob_cache mode. Essentially the Android OS is managing
> the cache index for us, so hopefully we don't need to maintain one.
One issue to tackle is that currently _mesa_glsl_compile_shader uses
disk_cache_has_key() for detecting if we can skip shader compilation.
This uses 'stored_keys' which is mmap of the index file.
I guess this could be done by inserting items for those shaders to
blob_cache so disk_cache_has_key() could use get() for implementing this
functionality. It seemed easier (and more optimal) to go with existing
'index' for this but I can try alternative approach also.
> I wouldn't be surprise if you told me that I'm not thinking about
> something that the disk cache provides that EGL_ANDROID_blob_cache
> couldn't, but it seems like we could rely on the OS to manage the
> index.
>
// Tapani
More information about the mesa-dev
mailing list