Bug 91985

Summary: [regression, bisected] FTBFS with commit f9caabe8f1: R600_UCP_CONST_BUFFER is undefined
Product: Mesa Reporter: Kai <kai>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: blocker    
Priority: highest CC: airlied, mesa-dev
Version: gitKeywords: bisected, regression
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Kai 2015-09-12 08:17:00 UTC
The following commit makes compiling Mesa with --enable-opencl impossible, since that pulls r600_llvm.c in.

commit f9f5c92f734c517c1bd486f5a3b1931ea6f871a5
Author: Vincent Lejeune <vljn@ovi.com>
Date:   Sat Jan 19 22:27:16 2013 +0100

    r600g/llvm: Fixes addressspace of basevectors for clipvertex

Excerpt from build log:
> ../../../../../../src/gallium/drivers/r600/r600_llvm.c: In function 'llvm_emit_epilogue':
> ../../../../../../src/gallium/drivers/r600/r600_llvm.c:25:70: error: 'R600_UCP_CONST_BUFFER' undeclared (first use in this function)
> #define CONSTANT_BUFFER_1_ADDR_SPACE (CONSTANT_BUFFER_0_ADDR_SPACE + R600_UCP_CONST_BUFFER)
> ^
> ../../../../../../src/gallium/drivers/r600/r600_llvm.c:271:75: note: in expansion of macro 'CONSTANT_BUFFER_1_ADDR_SPACE'
> LLVMValueRef base_vector = llvm_load_const_buffer(bld_base, offset, CONSTANT_BUFFER_1_ADDR_SPACE);
> ^
> ../../../../../../src/gallium/drivers/r600/r600_llvm.c:25:70: note: each undeclared identifier is reported only once for each function it appears in
> #define CONSTANT_BUFFER_1_ADDR_SPACE (CONSTANT_BUFFER_0_ADDR_SPACE + R600_UCP_CONST_BUFFER)
> ^
> ../../../../../../src/gallium/drivers/r600/r600_llvm.c:271:75: note: in expansion of macro 'CONSTANT_BUFFER_1_ADDR_SPACE'
> LLVMValueRef base_vector = llvm_load_const_buffer(bld_base, offset, CONSTANT_BUFFER_1_ADDR_SPACE);
> ^
> Makefile:834: recipe for target 'r600_llvm.lo' failed
> make[4]: *** [r600_llvm.lo] Error 1

Please revert or fix.
Comment 1 Ilia Mirkin 2015-09-12 08:20:04 UTC
Seems more likely that the culprit is

From f9caabe8f1bff86d19b53d9ecba5c72b238d9e23 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Fri, 11 Sep 2015 04:43:53 +0100
Subject: r600g: lower number of driver const buffers

I'm going to want a driver constant buffer for tess to coordinate
LDS storage, so before I go tackling that I decided to merge the
clip/samplepos and texture info buffers into one. So I can steal
the spare one.

This creates a single constant buffer between the two, with
clip/samplepos taking up a reserved 128 bytes at the start.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

than a commit from 2013...
Comment 2 Kai 2015-09-12 08:24:38 UTC
Ahrg, pasted wrong commit, the following is the correct one:

commit f9caabe8f1bff86d19b53d9ecba5c72b238d9e23
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Sep 11 04:43:53 2015 +0100

    r600g: lower number of driver const buffers
    
    I'm going to want a driver constant buffer for tess to coordinate
    LDS storage, so before I go tackling that I decided to merge the
    clip/samplepos and texture info buffers into one. So I can steal
    the spare one.
    
    This creates a single constant buffer between the two, with
    clip/samplepos taking up a reserved 128 bytes at the start.
    
    Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
    Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

It's basically that R600_UCP_CONST_BUFFER was replaced by R600_BUFFER_INFO_CONST_BUFFER AFAICT and this place in r600_llvm.c was forgotten.
Comment 3 Kai 2015-09-12 08:25:48 UTC
(In reply to Ilia Mirkin from comment #1)
> Seems more likely that the culprit is
> 
> From f9caabe8f1bff86d19b53d9ecba5c72b238d9e23 Mon Sep 17 00:00:00 2001
> From: Dave Airlie <airlied@redhat.com>
> Date: Fri, 11 Sep 2015 04:43:53 +0100
> Subject: r600g: lower number of driver const buffers
> 
> I'm going to want a driver constant buffer for tess to coordinate
> LDS storage, so before I go tackling that I decided to merge the
> clip/samplepos and texture info buffers into one. So I can steal
> the spare one.
> 
> This creates a single constant buffer between the two, with
> clip/samplepos taking up a reserved 128 bytes at the start.
> 
> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
> Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> 
> than a commit from 2013...

Yes, I had – after looking with git blame at r600_llvm.c – the wrong commit in my clipboard and worked with that. Since both start with f9 I didn't notice. Sorry.
Comment 4 Kai 2015-09-12 08:41:39 UTC
I've sent a patch to the mailing list: http://thread.gmane.org/gmane.comp.video.mesa3d.devel/112810

It at least compiles again for me, but I can't say for sure, if this is the correct fix.
Comment 5 Kai 2015-09-13 06:35:44 UTC
Fixed by:
commit d6fbcf6ee28c273b37bf293aea5faf77253029a3
Author: Kai Wasserbäch <kai@dev.carbon-project.org>
Date:   Sat Sep 12 10:39:50 2015 +0200

    r600: Fix llvm build since const buffer changes
    
    In commit f9caabe8f1bff86d19b53d9ecba5c72b238d9e23:
    
    One place in r600_llvm.c was forgotten when replacing
    R600_UCP_CONST_BUFFER with R600_BUFFER_INFO_CONST_BUFFER.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91985
    Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
    Signed-off-by: Dave Airlie <airlied@gmail.com>

Thanks to Dave, for commiting this!

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.