freedreno: Centralize UUID generation into new files freedreno_uuid.c/h
The new files are created under a 'common' folder under 'src/freedreno', where shared functionality between GL and Vulkan drivers (that is not registers, layout or compiler) will be placed. Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4847>
This commit is contained in:
parent
cdfede7336
commit
9623debf48
|
@ -0,0 +1,5 @@
|
|||
Overview
|
||||
========
|
||||
|
||||
Common functionality shared between freedreno drivers (that are not
|
||||
registers, layout or the compiler), e.g UUID generation.
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright © 2020 Igalia S.L.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "freedreno_uuid.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* (Re)define UUID_SIZE to avoid including vulkan.h (or p_defines.h) here. */
|
||||
#define UUID_SIZE 16
|
||||
|
||||
void
|
||||
fd_get_driver_uuid(void *uuid)
|
||||
{
|
||||
memset(uuid, 0, UUID_SIZE);
|
||||
snprintf(uuid, UUID_SIZE, "freedreno");
|
||||
}
|
||||
|
||||
void
|
||||
fd_get_device_uuid(void *uuid)
|
||||
{
|
||||
memset(uuid, 0, UUID_SIZE);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright © 2020 Igalia S.L.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __FREEDRENO_UUID_H__
|
||||
#define __FREEDRENO_UUID_H__
|
||||
|
||||
void fd_get_driver_uuid(void *uuid);
|
||||
void fd_get_device_uuid(void *uuid);
|
||||
|
||||
#endif /* __FREEDRENO_UUID_H__ */
|
|
@ -0,0 +1,35 @@
|
|||
# Copyright © 2020 Igalia S.L
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
libfreedreno_common = static_library(
|
||||
'freedreno_common',
|
||||
[
|
||||
'freedreno_uuid.c',
|
||||
'freedreno_uuid.h',
|
||||
],
|
||||
include_directories : [inc_freedreno],
|
||||
c_args : [c_vis_args, no_override_init_args],
|
||||
build_by_default : true,
|
||||
dependencies: [idep_mesautil]
|
||||
)
|
||||
|
||||
idep_libfreedreno_common = declare_dependency(
|
||||
link_with: [libfreedreno_common],
|
||||
)
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
inc_freedreno = include_directories(['.', './registers'])
|
||||
|
||||
subdir('common')
|
||||
subdir('registers')
|
||||
subdir('drm')
|
||||
subdir('ir3')
|
||||
|
|
|
@ -118,6 +118,7 @@ libvulkan_freedreno = shared_library(
|
|||
libfreedreno_layout,
|
||||
],
|
||||
dependencies : [
|
||||
idep_libfreedreno_common,
|
||||
dep_dl,
|
||||
dep_elf,
|
||||
dep_libdrm,
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
|
||||
#include "drm-uapi/msm_drm.h"
|
||||
|
||||
/* for fd_get_driver/device_uuid() */
|
||||
#include "freedreno/common/freedreno_uuid.h"
|
||||
|
||||
static int
|
||||
tu_device_get_cache_uuid(uint16_t family, void *uuid)
|
||||
{
|
||||
|
@ -61,19 +64,6 @@ tu_device_get_cache_uuid(uint16_t family, void *uuid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
tu_get_driver_uuid(void *uuid)
|
||||
{
|
||||
memset(uuid, 0, VK_UUID_SIZE);
|
||||
snprintf(uuid, VK_UUID_SIZE, "freedreno");
|
||||
}
|
||||
|
||||
static void
|
||||
tu_get_device_uuid(void *uuid)
|
||||
{
|
||||
memset(uuid, 0, VK_UUID_SIZE);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
tu_bo_init(struct tu_device *dev,
|
||||
struct tu_bo *bo,
|
||||
|
@ -308,8 +298,8 @@ tu_physical_device_init(struct tu_physical_device *device,
|
|||
fprintf(stderr, "WARNING: tu is not a conformant vulkan implementation, "
|
||||
"testing use only.\n");
|
||||
|
||||
tu_get_driver_uuid(&device->device_uuid);
|
||||
tu_get_device_uuid(&device->device_uuid);
|
||||
fd_get_driver_uuid(device->driver_uuid);
|
||||
fd_get_device_uuid(device->device_uuid);
|
||||
|
||||
tu_physical_device_get_supported_extensions(device, &device->supported_extensions);
|
||||
|
||||
|
|
Loading…
Reference in New Issue