Aníbal Limón
b50f40fa5a
src/util/disk_cache_os.c: Add missing headers for open/fcntl
...
Fixes, strict musl build [1],
...
17:25:31 ../git/src/util/disk_cache_os.c: In function 'disk_cache_load_item':
17:25:31 ../git/src/util/disk_cache_os.c:526:9: error: implicit declaration of function 'open'; did you mean 'popen'? [-Werror=implicit-function-declaration]
17:25:31 526 | fd = open(filename, O_RDONLY | O_CLOEXEC);
17:25:31 | ^~~~
17:25:31 | popen
17:25:31 ../git/src/util/disk_cache_os.c:526:24: error: 'O_RDONLY' undeclared (first use in this function)
17:25:31 526 | fd = open(filename, O_RDONLY | O_CLOEXEC);
17:25:31 | ^~~~~~~~
17:25:31 ../git/src/util/disk_cache_os.c:526:24: note: each undeclared identifier is reported only once for each function it appears in
17:25:31 ../git/src/util/disk_cache_os.c:526:35: error: 'O_CLOEXEC' undeclared (first use in this function); did you mean 'MFD_CLOEXEC'?
17:25:31 526 | fd = open(filename, O_RDONLY | O_CLOEXEC);
17:25:31 | ^~~~~~~~~
17:25:31 | MFD_CLOEXEC
17:25:31 ../git/src/util/disk_cache_os.c: In function 'disk_cache_write_item_to_disk':
17:25:31 ../git/src/util/disk_cache_os.c:666:28: error: 'O_WRONLY' undeclared (first use in this function)
17:25:31 666 | fd = open(filename_tmp, O_WRONLY | O_CLOEXEC | O_CREAT, 0644);
17:25:31 | ^~~~~~~~
17:25:31 ../git/src/util/disk_cache_os.c:666:39: error: 'O_CLOEXEC' undeclared (first use in this function); did you mean 'MFD_CLOEXEC'?
17:25:31 666 | fd = open(filename_tmp, O_WRONLY | O_CLOEXEC | O_CREAT, 0644);
17:25:31 | ^~~~~~~~~
17:25:31 | MFD_CLOEXEC
17:25:31 ../git/src/util/disk_cache_os.c:666:51: error: 'O_CREAT' undeclared (first use in this function)
17:25:31 666 | fd = open(filename_tmp, O_WRONLY | O_CLOEXEC | O_CREAT, 0644);
17:25:31 | ^~~~~~~
17:25:31 ../git/src/util/disk_cache_os.c:705:30: error: 'O_RDONLY' undeclared (first use in this function)
17:25:31 705 | fd_final = open(filename, O_RDONLY | O_CLOEXEC);
17:25:31 | ^~~~~~~~
17:25:31 ../git/src/util/disk_cache_os.c: In function 'disk_cache_mmap_cache_index':
17:25:31 ../git/src/util/disk_cache_os.c:902:20: error: 'O_RDWR' undeclared (first use in this function)
17:25:31 902 | fd = open(path, O_RDWR | O_CREAT | O_CLOEXEC, 0644);
17:25:31 | ^~~~~~
17:25:31 ../git/src/util/disk_cache_os.c:902:29: error: 'O_CREAT' undeclared (first use in this function)
17:25:31 902 | fd = open(path, O_RDWR | O_CREAT | O_CLOEXEC, 0644);
17:25:31 | ^~~~~~~
17:25:31 ../git/src/util/disk_cache_os.c:902:39: error: 'O_CLOEXEC' undeclared (first use in this function); did you mean 'MFD_CLOEXEC'?
17:25:31 902 | fd = open(path, O_RDWR | O_CREAT | O_CLOEXEC, 0644);
17:25:31 | ^~~~~~~~~
17:25:31 | MFD_CLOEXEC
17:25:31 cc1: some warnings being treated as errors
...
[1] https://ci.linaro.org/job/lt-qcom-openembedded-meta-qcom-master-premerge/MACHINE=qrb5165-rb5,TCLIBC=musl,label=docker-buster-amd64/87/console
Signed-off-by: Aníbal Limón <anibal.limon@linaro.org >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7146 >
2020-10-22 22:28:40 +00:00
John Bates
5de56937a3
disk_cache: build option for disabled-by-default
...
On some systems it is problematic to have the shader cache enabled
by default. This adds a build option to support the disk cache but
keep it disabled unless the environment variable
MESA_GLSL_CACHE_DISABLE=false.
For example, on Chrome OS, Chrome already has it's own shader
disk cache implementation so it disables the mesa feature. Tests
do not want the shader disk cache enabled because it can cause
inconsistent performance results and the default 1GB for the
disk cache could lead to problems that require more effort to
work around. The Mesa shader disk cache is useful for VMs though,
where it is easy to configure the feature with environment
variables. With the current version of Mesa, Chrome OS would need
to have a system-wide environment variable to disable the disk
cache everywhere except where needed. More elegant to just build
Mesa with the cache feature disabled by default.
Reviewed-by: Rob Clark <robdclark@chromium.org >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6967 >
2020-10-09 16:52:49 +00:00
Timothy Arceri
91ace074d2
util/disk_cache: remove unused function param
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7059 >
2020-10-08 22:26:24 +00:00
Vinson Lee
1b862716dd
disk_cache: Fix filename leak on error path.
...
Remove filename ralloc comment. filename is allocated by asprintf.
Clean up disk_cache_get dead code left over from 367ac07efc
("disk_cache: move cache item loading code into
disk_cache_load_item() helper").
Fix defect reported by Coverity Scan.
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement:
free(filename);
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6738 >
2020-09-17 15:42:44 -07:00
Timothy Arceri
367ac07efc
disk_cache: move cache item loading code into disk_cache_load_item() helper
...
This should be helpful if someone chooses to implement cache support on
windows. Also providing this greater level of abstraction makes it easier
to implement alterative cache layouts in future.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
8598dc1a75
disk_cache: add new OS specific helper disk_cache_evict_item()
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
7893dc405c
disk_cache: move get_cache_file() to an OS specific helper
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
593ef166ae
disk_cache: create new helper for writing cache items to disk
...
This pulls out the cache item writing code from cache_put() into
a new helper. In this patch we also move various functions called
by this code into the new disk_cache_os.c file.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
b4a3a80403
disk_cache: move evict_lru_item() to an OS specific helper
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
e1236470dc
disk_cache: move munmap into an OS specific helper
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
889356e731
disk_cache: move index mmap into OS specific helper
...
This will make windows support easier to add in future.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
62c4339118
disk_cache: add disk_cache_enabled() helper
...
This will make windows support easier to add in future.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
4339ecde35
disk_cache: move cache dir generation into OS specific helper file
...
This will make windows support easier to add in future. To avoid code
churn this temporarily duplicates the mkdir_if_needed() function, we
will delete the duplicate in a following patch.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00