Bug 110698 - tu_device.c:900:4: error: initializer element is not constant
Summary: tu_device.c:900:4: error: initializer element is not constant
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/Freedreno (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Rob Clark
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-16 22:53 UTC by Vinson Lee
Modified: 2019-06-06 02:23 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Vinson Lee 2019-05-16 22:53:00 UTC
In file included from ../src/freedreno/ir3/ir3_shader.h:33:0,
                 from ../src/freedreno/ir3/ir3_compiler.h:30,
                 from ../src/freedreno/vulkan/tu_private.h:56,
                 from ../src/freedreno/vulkan/tu_device.c:28:
../src/compiler/nir/nir.h:2059:1: warning: ‘__returns_nonnull__’ attribute directive ignored [-Wattributes]
 {
 ^
../src/compiler/nir/nir.h:2065:1: warning: ‘__returns_nonnull__’ attribute directive ignored [-Wattributes]
 {
 ^
../src/freedreno/vulkan/tu_device.c:900:4: error: initializer element is not constant
    .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
    ^
Comment 1 Kristian Høgsberg 2019-05-16 23:05:31 UTC
It's part of a bigger initializer so we don't need to use a compound initializer for minImageTransferGranularity. Can you verify that it works if you delete "(VkExtent3D)"?
Comment 2 Vinson Lee 2019-05-17 21:23:50 UTC
(In reply to Kristian Høgsberg from comment #1)
> It's part of a bigger initializer so we don't need to use a compound
> initializer for minImageTransferGranularity. Can you verify that it works if
> you delete "(VkExtent3D)"?

Yes, it works. This patch fixes the build error.

diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 2e930d9841fe..fdb9e1e0a1e2 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -897,7 +897,7 @@ static const VkQueueFamilyProperties tu_queue_family_properties = {
       VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT,
    .queueCount = 1,
    .timestampValidBits = 64,
-   .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
+   .minImageTransferGranularity = { 1, 1, 1 },
 };
Comment 3 Vinson Lee 2019-06-06 02:23:25 UTC
commit d4e70be7396b5330fca5b5ece2327a3e1c42b6e7
Author: Vinson Lee <vlee@freedesktop.org>
Date:   Thu May 30 14:47:37 2019 -0700

    freedreno: Fix GCC build error.
    
    ../src/freedreno/vulkan/tu_device.c:900:4: error: initializer element is not constant
        .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
        ^
    
    Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110698
    Signed-off-by: Vinson Lee <vlee@freedesktop.org>
    Reviewed-by: Rob Clark <robdclark@gmail.com>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.