Bug 101358

Summary: piglit_drm_dma_buf.c:265:12: error: ‘GBM_FORMAT_R8’ undeclared
Product: piglit Reporter: Vinson Lee <vlee>
Component: testsAssignee: Piglit Mailing List <piglit>
Status: RESOLVED FIXED QA Contact: Piglit Mailing List <piglit>
Severity: normal    
Priority: medium CC: baker.dylan.c, jv356
Version: unspecifiedKeywords: bisected, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Include gbm even without gbm_bo_map
cmake: Reintroduce version check to gbm_bo_map check

Description Vinson Lee 2017-06-08 21:21:02 UTC
piglit: bc6ef16dfa432c181e3c0e44223a651e3ea50f76 (master)
libgbm-dev: 12.0.6-0ubuntu0.16.10.1

[  0%] Building C object target_api/gl/tests/util/CMakeFiles/piglitutil_gl.dir/piglit-framework-gl/piglit_drm_dma_buf.c.o
piglit/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c: In function ‘piglit_gbm_buf_create’:
piglit/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c:265:12: error: ‘GBM_FORMAT_R8’ undeclared (first use in this function)
   format = GBM_FORMAT_R8;
            ^~~~~~~~~~~~~
piglit/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c:265:12: note: each undeclared identifier is reported only once for each function it appears in
piglit/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c:271:12: error: ‘GBM_FORMAT_GR88’ undeclared (first use in this function)
   format = GBM_FORMAT_GR88;
            ^~~~~~~~~~~~~~~


Build error introduced with this commit.

commit 2217871ac93765a0722c77427d5880154ae91ef9
Author: Daniel Diaz <daniel.diaz@linaro.org>
Date:   Tue May 16 19:06:40 2017 -0500

    CMake: define GBM_BO_MAP only when symbol is found
    
    gbm_bo_map() and _unmap() have been added recently to Mesa,
    and this update may not have reached all implementations of
    GBM, such as the one provided by Mali r6, where said
    definitions can be found in the header file but not in the
    library itself. This leads to errors like the following when
    linking:
      ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_unmap'
      ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_map'
      collect2: error: ld returned 1 exit status
      make[2]: *** [bin/point-sprite] Error 1
    
    Instead of relying on the header file, actually try to link
    using that symbol to determine if PIGLIT_HAS_GBM_BO_MAP
    should be defined.
    
    Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
    Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
    Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Comment 1 Jan Vesely 2017-06-09 11:31:26 UTC
Created attachment 131826 [details] [review]
Include gbm even without gbm_bo_map

Does this patch help?
Comment 2 Vinson Lee 2017-06-09 23:14:15 UTC
(In reply to Jan Vesely from comment #1)
> Created attachment 131826 [details] [review] [review]
> Include gbm even without gbm_bo_map
> 
> Does this patch help?

No.
Comment 3 Jan Vesely 2017-06-10 12:41:08 UTC
Created attachment 131841 [details] [review]
cmake: Reintroduce version check to gbm_bo_map check

new patch. it reintroduces the old check so PIGLIT_HAS_GBM_BO_MAP is only defined if both vesion >= 12.1 AND the function is available
Comment 4 Vinson Lee 2017-06-12 18:57:06 UTC
(In reply to Jan Vesely from comment #3)
> Created attachment 131841 [details] [review] [review]
> cmake: Reintroduce version check to gbm_bo_map check
> 
> new patch. it reintroduces the old check so PIGLIT_HAS_GBM_BO_MAP is only
> defined if both vesion >= 12.1 AND the function is available

This patch fixes the build for me.

Tested-by: Vinson Lee <vlee@freedesktop.org>
Comment 5 Vinson Lee 2017-06-17 00:29:38 UTC
commit ae373e3d56159a3f371deed6c6796bb1ba887364
Author: Jan Vesely <jano.vesely@gmail.com>
Date:   Sat Jun 10 14:31:55 2017 +0200

    cmake: Reintroduce version check to gbm_bo_map check
    
    Fixes: 2217871ac937 ("CMake: define GBM_BO_MAP only when symbol is found")
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101358
    Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
    Tested-by: Vinson Lee <vlee@freedesktop.org>

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.