ac/gpu: add code to detect if kernel supports sync objects.
authorDave Airlie <airlied@redhat.com>
Mon, 5 Jun 2017 00:54:52 +0000 (01:54 +0100)
committerDave Airlie <airlied@redhat.com>
Fri, 21 Jul 2017 20:31:54 +0000 (21:31 +0100)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_gpu_info.c
src/amd/common/ac_gpu_info.h

index ced7183cf64210cbb75174c812d184da3f5d0a2a..929dfd2946ff4e27129a5794b88efdc3ed4b1fd1 100644 (file)
@@ -84,6 +84,14 @@ static unsigned cik_get_num_tile_pipes(struct amdgpu_gpu_info *info)
    }
 }
 
+static bool has_syncobj(int fd)
+{
+       uint64_t value;
+       if (drmGetCap(fd, DRM_CAP_SYNCOBJ, &value))
+               return false;
+       return value ? true : false;
+}
+
 bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
                       struct radeon_info *info,
                       struct amdgpu_gpu_info *amdinfo)
@@ -258,6 +266,7 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
        info->vce_fw_version =
                vce.available_rings ? vce_version : 0;
        info->has_userptr = true;
+       info->has_syncobj = has_syncobj(fd);
        info->num_render_backends = amdinfo->rb_pipes;
        info->clock_crystal_freq = amdinfo->gpu_counter_freq;
        if (!info->clock_crystal_freq) {
index 72a850624668db5f2f71eef4495d65ca53ed48bf..20907c2620f915c162deb0dcd408cb5764f8ca92 100644 (file)
@@ -76,6 +76,7 @@ struct radeon_info {
        uint32_t                    drm_minor;
        uint32_t                    drm_patchlevel;
        bool                        has_userptr;
+       bool                        has_syncobj;
 
        /* Shader cores. */
        uint32_t                    r600_max_quad_pipes; /* wave size / 16 */