drm: Branch 'master' - 2 commits

[email protected] (Alex Deucher)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 amdgpu/amdgpu_cs.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit c05049b4205e446a2e319ab620a5ca949c7a7380
Author: Tom St Denis <[email protected]>
Date:   Tue Nov 17 10:58:36 2015 -0500

    amdgpu:  Make amdgpu_cs_calculate_timeout() return something sensible on error
    
    Signed-off-by: Tom St Denis <[email protected]>
    Reviewed-by: Christian König <[email protected]>

diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index aa594c4..6747158 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -291,8 +291,10 @@ drm_private uint64_t amdgpu_cs_calculate_timeout(uint64_t timeout)
 		struct timespec current;
 		uint64_t current_ns;
 		r = clock_gettime(CLOCK_MONOTONIC, &current);
-		if (r)
-			return r;
+		if (r) {
+			fprintf(stderr, "clock_gettime() returned error (%d)!", errno);
+			return AMDGPU_TIMEOUT_INFINITE;
+		}
 
 		current_ns = ((uint64_t)current.tv_sec) * 1000000000ull;
 		current_ns += current.tv_nsec;
commit 9c15b4aacdd9265339aba6febd36a7e2c41b6968
Author: Jammy Zhou <[email protected]>
Date:   Tue Nov 17 17:14:35 2015 +0800

    amdgpu: fix overflow for timeout calculation
    
    Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens
    
    Signed-off-by: Jammy Zhou <[email protected]>
    Reviewed-by: Christian König <[email protected]>

diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 4da9821..aa594c4 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -289,12 +289,16 @@ drm_private uint64_t amdgpu_cs_calculate_timeout(uint64_t timeout)
 
 	if (timeout != AMDGPU_TIMEOUT_INFINITE) {
 		struct timespec current;
+		uint64_t current_ns;
 		r = clock_gettime(CLOCK_MONOTONIC, &current);
 		if (r)
 			return r;
 
-		timeout += ((uint64_t)current.tv_sec) * 1000000000ull;
-		timeout += current.tv_nsec;
+		current_ns = ((uint64_t)current.tv_sec) * 1000000000ull;
+		current_ns += current.tv_nsec;
+		timeout += current_ns;
+		if (timeout < current_ns)
+			timeout = AMDGPU_TIMEOUT_INFINITE;
 	}
 	return timeout;
 }

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140

--
_______________________________________________
Dri-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.