Rev 6320 | Rev 6937 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6320 | Rev 6660 | ||
---|---|---|---|
Line 1920... | Line 1920... | ||
1920 | intel_ring_advance(ring); |
1920 | intel_ring_advance(ring); |
Line 1921... | Line 1921... | ||
1921 | 1921 | ||
1922 | return 0; |
1922 | return 0; |
Line -... | Line 1923... | ||
- | 1923 | } |
|
- | 1924 | ||
- | 1925 | static void cleanup_phys_status_page(struct intel_engine_cs *ring) |
|
- | 1926 | { |
|
- | 1927 | struct drm_i915_private *dev_priv = to_i915(ring->dev); |
|
- | 1928 | ||
- | 1929 | if (!dev_priv->status_page_dmah) |
|
- | 1930 | return; |
|
- | 1931 | ||
- | 1932 | drm_pci_free(ring->dev, dev_priv->status_page_dmah); |
|
- | 1933 | ring->status_page.page_addr = NULL; |
|
1923 | } |
1934 | } |
1924 | 1935 | ||
1925 | static void cleanup_status_page(struct intel_engine_cs *ring) |
1936 | static void cleanup_status_page(struct intel_engine_cs *ring) |
Line 1926... | Line 1937... | ||
1926 | { |
1937 | { |
Line 1936... | Line 1947... | ||
1936 | ring->status_page.obj = NULL; |
1947 | ring->status_page.obj = NULL; |
1937 | } |
1948 | } |
Line 1938... | Line 1949... | ||
1938 | 1949 | ||
1939 | static int init_status_page(struct intel_engine_cs *ring) |
1950 | static int init_status_page(struct intel_engine_cs *ring) |
1940 | { |
1951 | { |
Line 1941... | Line 1952... | ||
1941 | struct drm_i915_gem_object *obj; |
1952 | struct drm_i915_gem_object *obj = ring->status_page.obj; |
1942 | 1953 | ||
1943 | if ((obj = ring->status_page.obj) == NULL) { |
1954 | if (obj == NULL) { |
Line 1944... | Line 1955... | ||
1944 | unsigned flags; |
1955 | unsigned flags; |
1945 | int ret; |
1956 | int ret; |
Line 2132... | Line 2143... | ||
2132 | if (I915_NEED_GFX_HWS(dev)) { |
2143 | if (I915_NEED_GFX_HWS(dev)) { |
2133 | ret = init_status_page(ring); |
2144 | ret = init_status_page(ring); |
2134 | if (ret) |
2145 | if (ret) |
2135 | goto error; |
2146 | goto error; |
2136 | } else { |
2147 | } else { |
2137 | BUG_ON(ring->id != RCS); |
2148 | WARN_ON(ring->id != RCS); |
2138 | ret = init_phys_status_page(ring); |
2149 | ret = init_phys_status_page(ring); |
2139 | if (ret) |
2150 | if (ret) |
2140 | goto error; |
2151 | goto error; |
2141 | } |
2152 | } |
Line 2177... | Line 2188... | ||
2177 | ring->buffer = NULL; |
2188 | ring->buffer = NULL; |
Line 2178... | Line 2189... | ||
2178 | 2189 | ||
2179 | if (ring->cleanup) |
2190 | if (ring->cleanup) |
Line -... | Line 2191... | ||
- | 2191 | ring->cleanup(ring); |
|
2180 | ring->cleanup(ring); |
2192 | |
- | 2193 | if (I915_NEED_GFX_HWS(ring->dev)) { |
|
- | 2194 | cleanup_status_page(ring); |
|
- | 2195 | } else { |
|
- | 2196 | WARN_ON(ring->id != RCS); |
|
Line 2181... | Line 2197... | ||
2181 | 2197 | cleanup_phys_status_page(ring); |
|
2182 | cleanup_status_page(ring); |
2198 | } |
2183 | 2199 | ||
Line 2339... | Line 2355... | ||
2339 | need_wrap = true; |
2355 | need_wrap = true; |
2340 | } else { |
2356 | } else { |
2341 | if (unlikely(total_bytes > remain_usable)) { |
2357 | if (unlikely(total_bytes > remain_usable)) { |
2342 | /* |
2358 | /* |
2343 | * The base request will fit but the reserved space |
2359 | * The base request will fit but the reserved space |
2344 | * falls off the end. So only need to to wait for the |
2360 | * falls off the end. So don't need an immediate wrap |
- | 2361 | * and only need to effectively wait for the reserved |
|
2345 | * reserved size after flushing out the remainder. |
2362 | * size space from the start of ringbuffer. |
2346 | */ |
2363 | */ |
2347 | wait_bytes = remain_actual + ringbuf->reserved_size; |
2364 | wait_bytes = remain_actual + ringbuf->reserved_size; |
2348 | need_wrap = true; |
- | |
2349 | } else if (total_bytes > ringbuf->space) { |
2365 | } else if (total_bytes > ringbuf->space) { |
2350 | /* No wrapping required, just waiting. */ |
2366 | /* No wrapping required, just waiting. */ |
2351 | wait_bytes = total_bytes; |
2367 | wait_bytes = total_bytes; |
2352 | } |
2368 | } |
2353 | } |
2369 | } |