brw,elk: Fix opening flags on dumping shader binaries

Truncation is needed for overwriting correctly in cases when old file is
bigger than the one we want to dump (e.g. when the old one was edited
inplace). Also, creation permissions are way too broad.

Fixes: 4f41c44d ("intel/compiler: Add variable to dump binaries of all compiled shaders")
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30581>
(cherry picked from commit 09122e2be0)
This commit is contained in:
Sviatoslav Peleshko 2024-08-08 23:51:35 +03:00 committed by Eric Engestrom
parent 54db037efb
commit d9608d4a52
3 changed files with 3 additions and 3 deletions

View File

@ -244,7 +244,7 @@
"description": "brw,elk: Fix opening flags on dumping shader binaries",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "4f41c44df22116d351d06c3a03711e8ee68a7869",
"notes": null

View File

@ -310,7 +310,7 @@ void brw_dump_shader_bin(void *assembly, int start_offset, int end_offset,
debug_get_option_shader_bin_dump_path(),
identifier);
int fd = open(name, O_CREAT | O_WRONLY, 0777);
int fd = open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644);
ralloc_free(name);
if (fd < 0)

View File

@ -376,7 +376,7 @@ void elk_dump_shader_bin(void *assembly, int start_offset, int end_offset,
debug_get_option_shader_bin_dump_path(),
identifier);
int fd = open(name, O_CREAT | O_WRONLY, 0777);
int fd = open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644);
ralloc_free(name);
if (fd < 0)