Commit | Line | Data |
---|---|---|
7ff0ebcc RV |
1 | /* |
2 | * Copyright © 2014 Intel Corporation | |
3 | * | |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | |
5 | * copy of this software and associated documentation files (the "Software"), | |
6 | * to deal in the Software without restriction, including without limitation | |
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
8 | * and/or sell copies of the Software, and to permit persons to whom the | |
9 | * Software is furnished to do so, subject to the following conditions: | |
10 | * | |
11 | * The above copyright notice and this permission notice (including the next | |
12 | * paragraph) shall be included in all copies or substantial portions of the | |
13 | * Software. | |
14 | * | |
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
21 | * DEALINGS IN THE SOFTWARE. | |
22 | */ | |
23 | ||
94b83957 RV |
24 | /** |
25 | * DOC: Frame Buffer Compression (FBC) | |
26 | * | |
27 | * FBC tries to save memory bandwidth (and so power consumption) by | |
28 | * compressing the amount of memory used by the display. It is total | |
29 | * transparent to user space and completely handled in the kernel. | |
7ff0ebcc RV |
30 | * |
31 | * The benefits of FBC are mostly visible with solid backgrounds and | |
94b83957 RV |
32 | * variation-less patterns. It comes from keeping the memory footprint small |
33 | * and having fewer memory pages opened and accessed for refreshing the display. | |
7ff0ebcc | 34 | * |
94b83957 RV |
35 | * i915 is responsible to reserve stolen memory for FBC and configure its |
36 | * offset on proper registers. The hardware takes care of all | |
37 | * compress/decompress. However there are many known cases where we have to | |
38 | * forcibly disable it to allow proper screen updates. | |
7ff0ebcc RV |
39 | */ |
40 | ||
94b83957 RV |
41 | #include "intel_drv.h" |
42 | #include "i915_drv.h" | |
43 | ||
7ff0ebcc RV |
44 | static void i8xx_fbc_disable(struct drm_device *dev) |
45 | { | |
46 | struct drm_i915_private *dev_priv = dev->dev_private; | |
47 | u32 fbc_ctl; | |
48 | ||
49 | dev_priv->fbc.enabled = false; | |
50 | ||
51 | /* Disable compression */ | |
52 | fbc_ctl = I915_READ(FBC_CONTROL); | |
53 | if ((fbc_ctl & FBC_CTL_EN) == 0) | |
54 | return; | |
55 | ||
56 | fbc_ctl &= ~FBC_CTL_EN; | |
57 | I915_WRITE(FBC_CONTROL, fbc_ctl); | |
58 | ||
59 | /* Wait for compressing bit to clear */ | |
60 | if (wait_for((I915_READ(FBC_STATUS) & FBC_STAT_COMPRESSING) == 0, 10)) { | |
61 | DRM_DEBUG_KMS("FBC idle timed out\n"); | |
62 | return; | |
63 | } | |
64 | ||
65 | DRM_DEBUG_KMS("disabled FBC\n"); | |
66 | } | |
67 | ||
68 | static void i8xx_fbc_enable(struct drm_crtc *crtc) | |
69 | { | |
70 | struct drm_device *dev = crtc->dev; | |
71 | struct drm_i915_private *dev_priv = dev->dev_private; | |
72 | struct drm_framebuffer *fb = crtc->primary->fb; | |
73 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | |
74 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | |
75 | int cfb_pitch; | |
76 | int i; | |
77 | u32 fbc_ctl; | |
78 | ||
79 | dev_priv->fbc.enabled = true; | |
80 | ||
60ee5cd2 JN |
81 | /* Note: fbc.threshold == 1 for i8xx */ |
82 | cfb_pitch = dev_priv->fbc.uncompressed_size / FBC_LL_SIZE; | |
7ff0ebcc RV |
83 | if (fb->pitches[0] < cfb_pitch) |
84 | cfb_pitch = fb->pitches[0]; | |
85 | ||
86 | /* FBC_CTL wants 32B or 64B units */ | |
87 | if (IS_GEN2(dev)) | |
88 | cfb_pitch = (cfb_pitch / 32) - 1; | |
89 | else | |
90 | cfb_pitch = (cfb_pitch / 64) - 1; | |
91 | ||
92 | /* Clear old tags */ | |
93 | for (i = 0; i < (FBC_LL_SIZE / 32) + 1; i++) | |
94 | I915_WRITE(FBC_TAG + (i * 4), 0); | |
95 | ||
96 | if (IS_GEN4(dev)) { | |
97 | u32 fbc_ctl2; | |
98 | ||
99 | /* Set it up... */ | |
100 | fbc_ctl2 = FBC_CTL_FENCE_DBL | FBC_CTL_IDLE_IMM | FBC_CTL_CPU_FENCE; | |
101 | fbc_ctl2 |= FBC_CTL_PLANE(intel_crtc->plane); | |
102 | I915_WRITE(FBC_CONTROL2, fbc_ctl2); | |
103 | I915_WRITE(FBC_FENCE_OFF, crtc->y); | |
104 | } | |
105 | ||
106 | /* enable it... */ | |
107 | fbc_ctl = I915_READ(FBC_CONTROL); | |
108 | fbc_ctl &= 0x3fff << FBC_CTL_INTERVAL_SHIFT; | |
109 | fbc_ctl |= FBC_CTL_EN | FBC_CTL_PERIODIC; | |
110 | if (IS_I945GM(dev)) | |
111 | fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ | |
112 | fbc_ctl |= (cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT; | |
113 | fbc_ctl |= obj->fence_reg; | |
114 | I915_WRITE(FBC_CONTROL, fbc_ctl); | |
115 | ||
116 | DRM_DEBUG_KMS("enabled FBC, pitch %d, yoff %d, plane %c\n", | |
117 | cfb_pitch, crtc->y, plane_name(intel_crtc->plane)); | |
118 | } | |
119 | ||
120 | static bool i8xx_fbc_enabled(struct drm_device *dev) | |
121 | { | |
122 | struct drm_i915_private *dev_priv = dev->dev_private; | |
123 | ||
124 | return I915_READ(FBC_CONTROL) & FBC_CTL_EN; | |
125 | } | |
126 | ||
127 | static void g4x_fbc_enable(struct drm_crtc *crtc) | |
128 | { | |
129 | struct drm_device *dev = crtc->dev; | |
130 | struct drm_i915_private *dev_priv = dev->dev_private; | |
131 | struct drm_framebuffer *fb = crtc->primary->fb; | |
132 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | |
133 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | |
134 | u32 dpfc_ctl; | |
135 | ||
136 | dev_priv->fbc.enabled = true; | |
137 | ||
138 | dpfc_ctl = DPFC_CTL_PLANE(intel_crtc->plane) | DPFC_SR_EN; | |
139 | if (drm_format_plane_cpp(fb->pixel_format, 0) == 2) | |
140 | dpfc_ctl |= DPFC_CTL_LIMIT_2X; | |
141 | else | |
142 | dpfc_ctl |= DPFC_CTL_LIMIT_1X; | |
143 | dpfc_ctl |= DPFC_CTL_FENCE_EN | obj->fence_reg; | |
144 | ||
145 | I915_WRITE(DPFC_FENCE_YOFF, crtc->y); | |
146 | ||
147 | /* enable it... */ | |
148 | I915_WRITE(DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); | |
149 | ||
150 | DRM_DEBUG_KMS("enabled fbc on plane %c\n", plane_name(intel_crtc->plane)); | |
151 | } | |
152 | ||
153 | static void g4x_fbc_disable(struct drm_device *dev) | |
154 | { | |
155 | struct drm_i915_private *dev_priv = dev->dev_private; | |
156 | u32 dpfc_ctl; | |
157 | ||
158 | dev_priv->fbc.enabled = false; | |
159 | ||
160 | /* Disable compression */ | |
161 | dpfc_ctl = I915_READ(DPFC_CONTROL); | |
162 | if (dpfc_ctl & DPFC_CTL_EN) { | |
163 | dpfc_ctl &= ~DPFC_CTL_EN; | |
164 | I915_WRITE(DPFC_CONTROL, dpfc_ctl); | |
165 | ||
166 | DRM_DEBUG_KMS("disabled FBC\n"); | |
167 | } | |
168 | } | |
169 | ||
170 | static bool g4x_fbc_enabled(struct drm_device *dev) | |
171 | { | |
172 | struct drm_i915_private *dev_priv = dev->dev_private; | |
173 | ||
174 | return I915_READ(DPFC_CONTROL) & DPFC_CTL_EN; | |
175 | } | |
176 | ||
dbef0f15 | 177 | static void intel_fbc_nuke(struct drm_i915_private *dev_priv) |
7ff0ebcc | 178 | { |
dbef0f15 PZ |
179 | I915_WRITE(MSG_FBC_REND_STATE, FBC_REND_NUKE); |
180 | POSTING_READ(MSG_FBC_REND_STATE); | |
7ff0ebcc RV |
181 | } |
182 | ||
183 | static void ilk_fbc_enable(struct drm_crtc *crtc) | |
184 | { | |
185 | struct drm_device *dev = crtc->dev; | |
186 | struct drm_i915_private *dev_priv = dev->dev_private; | |
187 | struct drm_framebuffer *fb = crtc->primary->fb; | |
188 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | |
189 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | |
190 | u32 dpfc_ctl; | |
ce65e47b | 191 | int threshold = dev_priv->fbc.threshold; |
7ff0ebcc RV |
192 | |
193 | dev_priv->fbc.enabled = true; | |
194 | ||
195 | dpfc_ctl = DPFC_CTL_PLANE(intel_crtc->plane); | |
196 | if (drm_format_plane_cpp(fb->pixel_format, 0) == 2) | |
ce65e47b | 197 | threshold++; |
7ff0ebcc | 198 | |
ce65e47b | 199 | switch (threshold) { |
7ff0ebcc RV |
200 | case 4: |
201 | case 3: | |
202 | dpfc_ctl |= DPFC_CTL_LIMIT_4X; | |
203 | break; | |
204 | case 2: | |
205 | dpfc_ctl |= DPFC_CTL_LIMIT_2X; | |
206 | break; | |
207 | case 1: | |
208 | dpfc_ctl |= DPFC_CTL_LIMIT_1X; | |
209 | break; | |
210 | } | |
211 | dpfc_ctl |= DPFC_CTL_FENCE_EN; | |
212 | if (IS_GEN5(dev)) | |
213 | dpfc_ctl |= obj->fence_reg; | |
214 | ||
215 | I915_WRITE(ILK_DPFC_FENCE_YOFF, crtc->y); | |
216 | I915_WRITE(ILK_FBC_RT_BASE, i915_gem_obj_ggtt_offset(obj) | ILK_FBC_RT_VALID); | |
217 | /* enable it... */ | |
218 | I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); | |
219 | ||
220 | if (IS_GEN6(dev)) { | |
221 | I915_WRITE(SNB_DPFC_CTL_SA, | |
222 | SNB_CPU_FENCE_ENABLE | obj->fence_reg); | |
223 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, crtc->y); | |
7ff0ebcc RV |
224 | } |
225 | ||
dbef0f15 PZ |
226 | intel_fbc_nuke(dev_priv); |
227 | ||
7ff0ebcc RV |
228 | DRM_DEBUG_KMS("enabled fbc on plane %c\n", plane_name(intel_crtc->plane)); |
229 | } | |
230 | ||
231 | static void ilk_fbc_disable(struct drm_device *dev) | |
232 | { | |
233 | struct drm_i915_private *dev_priv = dev->dev_private; | |
234 | u32 dpfc_ctl; | |
235 | ||
236 | dev_priv->fbc.enabled = false; | |
237 | ||
238 | /* Disable compression */ | |
239 | dpfc_ctl = I915_READ(ILK_DPFC_CONTROL); | |
240 | if (dpfc_ctl & DPFC_CTL_EN) { | |
241 | dpfc_ctl &= ~DPFC_CTL_EN; | |
242 | I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl); | |
243 | ||
244 | DRM_DEBUG_KMS("disabled FBC\n"); | |
245 | } | |
246 | } | |
247 | ||
248 | static bool ilk_fbc_enabled(struct drm_device *dev) | |
249 | { | |
250 | struct drm_i915_private *dev_priv = dev->dev_private; | |
251 | ||
252 | return I915_READ(ILK_DPFC_CONTROL) & DPFC_CTL_EN; | |
253 | } | |
254 | ||
255 | static void gen7_fbc_enable(struct drm_crtc *crtc) | |
256 | { | |
257 | struct drm_device *dev = crtc->dev; | |
258 | struct drm_i915_private *dev_priv = dev->dev_private; | |
259 | struct drm_framebuffer *fb = crtc->primary->fb; | |
260 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | |
261 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | |
262 | u32 dpfc_ctl; | |
ce65e47b | 263 | int threshold = dev_priv->fbc.threshold; |
7ff0ebcc RV |
264 | |
265 | dev_priv->fbc.enabled = true; | |
266 | ||
d8514d63 PZ |
267 | dpfc_ctl = 0; |
268 | if (IS_IVYBRIDGE(dev)) | |
269 | dpfc_ctl |= IVB_DPFC_CTL_PLANE(intel_crtc->plane); | |
270 | ||
7ff0ebcc | 271 | if (drm_format_plane_cpp(fb->pixel_format, 0) == 2) |
ce65e47b | 272 | threshold++; |
7ff0ebcc | 273 | |
ce65e47b | 274 | switch (threshold) { |
7ff0ebcc RV |
275 | case 4: |
276 | case 3: | |
277 | dpfc_ctl |= DPFC_CTL_LIMIT_4X; | |
278 | break; | |
279 | case 2: | |
280 | dpfc_ctl |= DPFC_CTL_LIMIT_2X; | |
281 | break; | |
282 | case 1: | |
283 | dpfc_ctl |= DPFC_CTL_LIMIT_1X; | |
284 | break; | |
285 | } | |
286 | ||
287 | dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; | |
288 | ||
289 | if (dev_priv->fbc.false_color) | |
290 | dpfc_ctl |= FBC_CTL_FALSE_COLOR; | |
291 | ||
292 | I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); | |
293 | ||
294 | if (IS_IVYBRIDGE(dev)) { | |
295 | /* WaFbcAsynchFlipDisableFbcQueue:ivb */ | |
296 | I915_WRITE(ILK_DISPLAY_CHICKEN1, | |
297 | I915_READ(ILK_DISPLAY_CHICKEN1) | | |
298 | ILK_FBCQ_DIS); | |
299 | } else { | |
300 | /* WaFbcAsynchFlipDisableFbcQueue:hsw,bdw */ | |
301 | I915_WRITE(CHICKEN_PIPESL_1(intel_crtc->pipe), | |
302 | I915_READ(CHICKEN_PIPESL_1(intel_crtc->pipe)) | | |
303 | HSW_FBCQ_DIS); | |
304 | } | |
305 | ||
306 | I915_WRITE(SNB_DPFC_CTL_SA, | |
307 | SNB_CPU_FENCE_ENABLE | obj->fence_reg); | |
308 | I915_WRITE(DPFC_CPU_FENCE_OFFSET, crtc->y); | |
309 | ||
dbef0f15 | 310 | intel_fbc_nuke(dev_priv); |
7ff0ebcc RV |
311 | |
312 | DRM_DEBUG_KMS("enabled fbc on plane %c\n", plane_name(intel_crtc->plane)); | |
313 | } | |
314 | ||
94b83957 RV |
315 | /** |
316 | * intel_fbc_enabled - Is FBC enabled? | |
317 | * @dev: the drm_device | |
318 | * | |
319 | * This function is used to verify the current state of FBC. | |
320 | * FIXME: This should be tracked in the plane config eventually | |
321 | * instead of queried at runtime for most callers. | |
322 | */ | |
7ff0ebcc RV |
323 | bool intel_fbc_enabled(struct drm_device *dev) |
324 | { | |
325 | struct drm_i915_private *dev_priv = dev->dev_private; | |
326 | ||
327 | return dev_priv->fbc.enabled; | |
328 | } | |
329 | ||
7ff0ebcc RV |
330 | static void intel_fbc_work_fn(struct work_struct *__work) |
331 | { | |
332 | struct intel_fbc_work *work = | |
333 | container_of(to_delayed_work(__work), | |
334 | struct intel_fbc_work, work); | |
335 | struct drm_device *dev = work->crtc->dev; | |
336 | struct drm_i915_private *dev_priv = dev->dev_private; | |
337 | ||
25ad93fd | 338 | mutex_lock(&dev_priv->fbc.lock); |
7ff0ebcc RV |
339 | if (work == dev_priv->fbc.fbc_work) { |
340 | /* Double check that we haven't switched fb without cancelling | |
341 | * the prior work. | |
342 | */ | |
343 | if (work->crtc->primary->fb == work->fb) { | |
344 | dev_priv->display.enable_fbc(work->crtc); | |
345 | ||
e35fef21 | 346 | dev_priv->fbc.crtc = to_intel_crtc(work->crtc); |
7ff0ebcc RV |
347 | dev_priv->fbc.fb_id = work->crtc->primary->fb->base.id; |
348 | dev_priv->fbc.y = work->crtc->y; | |
349 | } | |
350 | ||
351 | dev_priv->fbc.fbc_work = NULL; | |
352 | } | |
25ad93fd | 353 | mutex_unlock(&dev_priv->fbc.lock); |
7ff0ebcc RV |
354 | |
355 | kfree(work); | |
356 | } | |
357 | ||
358 | static void intel_fbc_cancel_work(struct drm_i915_private *dev_priv) | |
359 | { | |
25ad93fd PZ |
360 | WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); |
361 | ||
7ff0ebcc RV |
362 | if (dev_priv->fbc.fbc_work == NULL) |
363 | return; | |
364 | ||
365 | DRM_DEBUG_KMS("cancelling pending FBC enable\n"); | |
366 | ||
367 | /* Synchronisation is provided by struct_mutex and checking of | |
368 | * dev_priv->fbc.fbc_work, so we can perform the cancellation | |
369 | * entirely asynchronously. | |
370 | */ | |
371 | if (cancel_delayed_work(&dev_priv->fbc.fbc_work->work)) | |
372 | /* tasklet was killed before being run, clean up */ | |
373 | kfree(dev_priv->fbc.fbc_work); | |
374 | ||
375 | /* Mark the work as no longer wanted so that if it does | |
376 | * wake-up (because the work was already running and waiting | |
377 | * for our mutex), it will discover that is no longer | |
378 | * necessary to run. | |
379 | */ | |
380 | dev_priv->fbc.fbc_work = NULL; | |
381 | } | |
382 | ||
383 | static void intel_fbc_enable(struct drm_crtc *crtc) | |
384 | { | |
385 | struct intel_fbc_work *work; | |
386 | struct drm_device *dev = crtc->dev; | |
387 | struct drm_i915_private *dev_priv = dev->dev_private; | |
388 | ||
25ad93fd PZ |
389 | WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); |
390 | ||
7ff0ebcc RV |
391 | intel_fbc_cancel_work(dev_priv); |
392 | ||
393 | work = kzalloc(sizeof(*work), GFP_KERNEL); | |
394 | if (work == NULL) { | |
395 | DRM_ERROR("Failed to allocate FBC work structure\n"); | |
396 | dev_priv->display.enable_fbc(crtc); | |
397 | return; | |
398 | } | |
399 | ||
400 | work->crtc = crtc; | |
401 | work->fb = crtc->primary->fb; | |
402 | INIT_DELAYED_WORK(&work->work, intel_fbc_work_fn); | |
403 | ||
404 | dev_priv->fbc.fbc_work = work; | |
405 | ||
406 | /* Delay the actual enabling to let pageflipping cease and the | |
407 | * display to settle before starting the compression. Note that | |
408 | * this delay also serves a second purpose: it allows for a | |
409 | * vblank to pass after disabling the FBC before we attempt | |
410 | * to modify the control registers. | |
411 | * | |
412 | * A more complicated solution would involve tracking vblanks | |
413 | * following the termination of the page-flipping sequence | |
414 | * and indeed performing the enable as a co-routine and not | |
415 | * waiting synchronously upon the vblank. | |
416 | * | |
417 | * WaFbcWaitForVBlankBeforeEnable:ilk,snb | |
418 | */ | |
419 | schedule_delayed_work(&work->work, msecs_to_jiffies(50)); | |
420 | } | |
421 | ||
25ad93fd PZ |
422 | static void __intel_fbc_disable(struct drm_device *dev) |
423 | { | |
424 | struct drm_i915_private *dev_priv = dev->dev_private; | |
425 | ||
426 | WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); | |
427 | ||
428 | intel_fbc_cancel_work(dev_priv); | |
429 | ||
25ad93fd PZ |
430 | dev_priv->display.disable_fbc(dev); |
431 | dev_priv->fbc.crtc = NULL; | |
432 | } | |
433 | ||
94b83957 RV |
434 | /** |
435 | * intel_fbc_disable - disable FBC | |
436 | * @dev: the drm_device | |
437 | * | |
438 | * This function disables FBC. | |
439 | */ | |
7ff0ebcc RV |
440 | void intel_fbc_disable(struct drm_device *dev) |
441 | { | |
442 | struct drm_i915_private *dev_priv = dev->dev_private; | |
443 | ||
0bf73c36 PZ |
444 | if (!dev_priv->display.enable_fbc) |
445 | return; | |
446 | ||
25ad93fd PZ |
447 | mutex_lock(&dev_priv->fbc.lock); |
448 | __intel_fbc_disable(dev); | |
449 | mutex_unlock(&dev_priv->fbc.lock); | |
450 | } | |
7ff0ebcc | 451 | |
25ad93fd PZ |
452 | /* |
453 | * intel_fbc_disable_crtc - disable FBC if it's associated with crtc | |
454 | * @crtc: the CRTC | |
455 | * | |
456 | * This function disables FBC if it's associated with the provided CRTC. | |
457 | */ | |
458 | void intel_fbc_disable_crtc(struct intel_crtc *crtc) | |
459 | { | |
460 | struct drm_device *dev = crtc->base.dev; | |
461 | struct drm_i915_private *dev_priv = dev->dev_private; | |
7ff0ebcc | 462 | |
0bf73c36 PZ |
463 | if (!dev_priv->display.enable_fbc) |
464 | return; | |
465 | ||
25ad93fd PZ |
466 | mutex_lock(&dev_priv->fbc.lock); |
467 | if (dev_priv->fbc.crtc == crtc) | |
468 | __intel_fbc_disable(dev); | |
469 | mutex_unlock(&dev_priv->fbc.lock); | |
7ff0ebcc RV |
470 | } |
471 | ||
2e8144a5 PZ |
472 | const char *intel_no_fbc_reason_str(enum no_fbc_reason reason) |
473 | { | |
474 | switch (reason) { | |
475 | case FBC_OK: | |
476 | return "FBC enabled but currently disabled in hardware"; | |
477 | case FBC_UNSUPPORTED: | |
478 | return "unsupported by this chipset"; | |
479 | case FBC_NO_OUTPUT: | |
480 | return "no output"; | |
481 | case FBC_STOLEN_TOO_SMALL: | |
482 | return "not enough stolen memory"; | |
483 | case FBC_UNSUPPORTED_MODE: | |
484 | return "mode incompatible with compression"; | |
485 | case FBC_MODE_TOO_LARGE: | |
486 | return "mode too large for compression"; | |
487 | case FBC_BAD_PLANE: | |
488 | return "FBC unsupported on plane"; | |
489 | case FBC_NOT_TILED: | |
490 | return "framebuffer not tiled or fenced"; | |
491 | case FBC_MULTIPLE_PIPES: | |
492 | return "more than one pipe active"; | |
493 | case FBC_MODULE_PARAM: | |
494 | return "disabled per module param"; | |
495 | case FBC_CHIP_DEFAULT: | |
496 | return "disabled per chip default"; | |
497 | case FBC_ROTATION: | |
498 | return "rotation unsupported"; | |
499 | default: | |
500 | MISSING_CASE(reason); | |
501 | return "unknown reason"; | |
502 | } | |
503 | } | |
504 | ||
505 | static void set_no_fbc_reason(struct drm_i915_private *dev_priv, | |
7ff0ebcc RV |
506 | enum no_fbc_reason reason) |
507 | { | |
508 | if (dev_priv->fbc.no_fbc_reason == reason) | |
2e8144a5 | 509 | return; |
7ff0ebcc RV |
510 | |
511 | dev_priv->fbc.no_fbc_reason = reason; | |
2e8144a5 | 512 | DRM_DEBUG_KMS("Disabling FBC: %s\n", intel_no_fbc_reason_str(reason)); |
7ff0ebcc RV |
513 | } |
514 | ||
95106753 PZ |
515 | static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv) |
516 | { | |
95106753 | 517 | struct drm_crtc *crtc = NULL, *tmp_crtc; |
68b92147 | 518 | enum pipe pipe; |
e489e38e | 519 | bool pipe_a_only = false, one_pipe_only = false; |
68b92147 PZ |
520 | |
521 | if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8) | |
522 | pipe_a_only = true; | |
e489e38e PZ |
523 | else if (INTEL_INFO(dev_priv)->gen <= 4) |
524 | one_pipe_only = true; | |
68b92147 PZ |
525 | |
526 | for_each_pipe(dev_priv, pipe) { | |
527 | tmp_crtc = dev_priv->pipe_to_crtc_mapping[pipe]; | |
95106753 | 528 | |
95106753 | 529 | if (intel_crtc_active(tmp_crtc) && |
b70709a6 | 530 | to_intel_plane_state(tmp_crtc->primary->state)->visible) { |
e489e38e | 531 | if (one_pipe_only && crtc) { |
2e8144a5 | 532 | set_no_fbc_reason(dev_priv, FBC_MULTIPLE_PIPES); |
95106753 PZ |
533 | return NULL; |
534 | } | |
535 | crtc = tmp_crtc; | |
536 | } | |
68b92147 PZ |
537 | |
538 | if (pipe_a_only) | |
539 | break; | |
95106753 PZ |
540 | } |
541 | ||
542 | if (!crtc || crtc->primary->fb == NULL) { | |
2e8144a5 | 543 | set_no_fbc_reason(dev_priv, FBC_NO_OUTPUT); |
95106753 PZ |
544 | return NULL; |
545 | } | |
546 | ||
547 | return crtc; | |
548 | } | |
549 | ||
fc786728 PZ |
550 | static int find_compression_threshold(struct drm_device *dev, |
551 | struct drm_mm_node *node, | |
552 | int size, | |
553 | int fb_cpp) | |
554 | { | |
555 | struct drm_i915_private *dev_priv = dev->dev_private; | |
556 | int compression_threshold = 1; | |
557 | int ret; | |
558 | ||
559 | /* HACK: This code depends on what we will do in *_enable_fbc. If that | |
560 | * code changes, this code needs to change as well. | |
561 | * | |
562 | * The enable_fbc code will attempt to use one of our 2 compression | |
563 | * thresholds, therefore, in that case, we only have 1 resort. | |
564 | */ | |
565 | ||
566 | /* Try to over-allocate to reduce reallocations and fragmentation. */ | |
567 | ret = i915_gem_stolen_insert_node(dev_priv, node, size <<= 1, 4096); | |
568 | if (ret == 0) | |
569 | return compression_threshold; | |
570 | ||
571 | again: | |
572 | /* HW's ability to limit the CFB is 1:4 */ | |
573 | if (compression_threshold > 4 || | |
574 | (fb_cpp == 2 && compression_threshold == 2)) | |
575 | return 0; | |
576 | ||
577 | ret = i915_gem_stolen_insert_node(dev_priv, node, size >>= 1, 4096); | |
578 | if (ret && INTEL_INFO(dev)->gen <= 4) { | |
579 | return 0; | |
580 | } else if (ret) { | |
581 | compression_threshold <<= 1; | |
582 | goto again; | |
583 | } else { | |
584 | return compression_threshold; | |
585 | } | |
586 | } | |
587 | ||
588 | static int intel_fbc_alloc_cfb(struct drm_device *dev, int size, int fb_cpp) | |
589 | { | |
590 | struct drm_i915_private *dev_priv = dev->dev_private; | |
591 | struct drm_mm_node *uninitialized_var(compressed_llb); | |
592 | int ret; | |
593 | ||
594 | ret = find_compression_threshold(dev, &dev_priv->fbc.compressed_fb, | |
595 | size, fb_cpp); | |
596 | if (!ret) | |
597 | goto err_llb; | |
598 | else if (ret > 1) { | |
599 | DRM_INFO("Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n"); | |
600 | ||
601 | } | |
602 | ||
603 | dev_priv->fbc.threshold = ret; | |
604 | ||
605 | if (INTEL_INFO(dev_priv)->gen >= 5) | |
606 | I915_WRITE(ILK_DPFC_CB_BASE, dev_priv->fbc.compressed_fb.start); | |
607 | else if (IS_GM45(dev)) { | |
608 | I915_WRITE(DPFC_CB_BASE, dev_priv->fbc.compressed_fb.start); | |
609 | } else { | |
610 | compressed_llb = kzalloc(sizeof(*compressed_llb), GFP_KERNEL); | |
611 | if (!compressed_llb) | |
612 | goto err_fb; | |
613 | ||
614 | ret = i915_gem_stolen_insert_node(dev_priv, compressed_llb, | |
615 | 4096, 4096); | |
616 | if (ret) | |
617 | goto err_fb; | |
618 | ||
619 | dev_priv->fbc.compressed_llb = compressed_llb; | |
620 | ||
621 | I915_WRITE(FBC_CFB_BASE, | |
622 | dev_priv->mm.stolen_base + dev_priv->fbc.compressed_fb.start); | |
623 | I915_WRITE(FBC_LL_BASE, | |
624 | dev_priv->mm.stolen_base + compressed_llb->start); | |
625 | } | |
626 | ||
627 | dev_priv->fbc.uncompressed_size = size; | |
628 | ||
629 | DRM_DEBUG_KMS("reserved %d bytes of contiguous stolen space for FBC\n", | |
630 | size); | |
631 | ||
632 | return 0; | |
633 | ||
634 | err_fb: | |
635 | kfree(compressed_llb); | |
636 | i915_gem_stolen_remove_node(dev_priv, &dev_priv->fbc.compressed_fb); | |
637 | err_llb: | |
638 | pr_info_once("drm: not enough stolen space for compressed buffer (need %d more bytes), disabling. Hint: you may be able to increase stolen memory size in the BIOS to avoid this.\n", size); | |
639 | return -ENOSPC; | |
640 | } | |
641 | ||
25ad93fd | 642 | static void __intel_fbc_cleanup_cfb(struct drm_device *dev) |
fc786728 PZ |
643 | { |
644 | struct drm_i915_private *dev_priv = dev->dev_private; | |
645 | ||
646 | if (dev_priv->fbc.uncompressed_size == 0) | |
647 | return; | |
648 | ||
649 | i915_gem_stolen_remove_node(dev_priv, &dev_priv->fbc.compressed_fb); | |
650 | ||
651 | if (dev_priv->fbc.compressed_llb) { | |
652 | i915_gem_stolen_remove_node(dev_priv, | |
653 | dev_priv->fbc.compressed_llb); | |
654 | kfree(dev_priv->fbc.compressed_llb); | |
655 | } | |
656 | ||
657 | dev_priv->fbc.uncompressed_size = 0; | |
658 | } | |
659 | ||
25ad93fd PZ |
660 | void intel_fbc_cleanup_cfb(struct drm_device *dev) |
661 | { | |
662 | struct drm_i915_private *dev_priv = dev->dev_private; | |
663 | ||
0bf73c36 PZ |
664 | if (!dev_priv->display.enable_fbc) |
665 | return; | |
666 | ||
25ad93fd PZ |
667 | mutex_lock(&dev_priv->fbc.lock); |
668 | __intel_fbc_cleanup_cfb(dev); | |
669 | mutex_unlock(&dev_priv->fbc.lock); | |
670 | } | |
671 | ||
fc786728 PZ |
672 | static int intel_fbc_setup_cfb(struct drm_device *dev, int size, int fb_cpp) |
673 | { | |
674 | struct drm_i915_private *dev_priv = dev->dev_private; | |
675 | ||
676 | if (size <= dev_priv->fbc.uncompressed_size) | |
677 | return 0; | |
678 | ||
679 | /* Release any current block */ | |
25ad93fd | 680 | __intel_fbc_cleanup_cfb(dev); |
fc786728 PZ |
681 | |
682 | return intel_fbc_alloc_cfb(dev, size, fb_cpp); | |
683 | } | |
684 | ||
7ff0ebcc | 685 | /** |
25ad93fd | 686 | * __intel_fbc_update - enable/disable FBC as needed, unlocked |
7ff0ebcc RV |
687 | * @dev: the drm_device |
688 | * | |
689 | * Set up the framebuffer compression hardware at mode set time. We | |
690 | * enable it if possible: | |
691 | * - plane A only (on pre-965) | |
692 | * - no pixel mulitply/line duplication | |
693 | * - no alpha buffer discard | |
694 | * - no dual wide | |
695 | * - framebuffer <= max_hdisplay in width, max_vdisplay in height | |
696 | * | |
697 | * We can't assume that any compression will take place (worst case), | |
698 | * so the compressed buffer has to be the same size as the uncompressed | |
699 | * one. It also must reside (along with the line length buffer) in | |
700 | * stolen memory. | |
701 | * | |
702 | * We need to enable/disable FBC on a global basis. | |
703 | */ | |
25ad93fd | 704 | static void __intel_fbc_update(struct drm_device *dev) |
7ff0ebcc RV |
705 | { |
706 | struct drm_i915_private *dev_priv = dev->dev_private; | |
95106753 | 707 | struct drm_crtc *crtc = NULL; |
7ff0ebcc RV |
708 | struct intel_crtc *intel_crtc; |
709 | struct drm_framebuffer *fb; | |
710 | struct drm_i915_gem_object *obj; | |
711 | const struct drm_display_mode *adjusted_mode; | |
712 | unsigned int max_width, max_height; | |
713 | ||
25ad93fd PZ |
714 | WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); |
715 | ||
bd49234b YZ |
716 | /* disable framebuffer compression in vGPU */ |
717 | if (intel_vgpu_active(dev)) | |
718 | i915.enable_fbc = 0; | |
719 | ||
7cc65746 | 720 | if (i915.enable_fbc < 0) { |
2e8144a5 | 721 | set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT); |
7cc65746 PZ |
722 | goto out_disable; |
723 | } | |
724 | ||
ab585dea | 725 | if (!i915.enable_fbc) { |
2e8144a5 | 726 | set_no_fbc_reason(dev_priv, FBC_MODULE_PARAM); |
7cc65746 | 727 | goto out_disable; |
7ff0ebcc RV |
728 | } |
729 | ||
730 | /* | |
731 | * If FBC is already on, we just have to verify that we can | |
732 | * keep it that way... | |
733 | * Need to disable if: | |
734 | * - more than one pipe is active | |
735 | * - changing FBC params (stride, fence, mode) | |
736 | * - new fb is too large to fit in compressed buffer | |
737 | * - going to an unsupported config (interlace, pixel multiply, etc.) | |
738 | */ | |
95106753 PZ |
739 | crtc = intel_fbc_find_crtc(dev_priv); |
740 | if (!crtc) | |
7ff0ebcc | 741 | goto out_disable; |
7ff0ebcc RV |
742 | |
743 | intel_crtc = to_intel_crtc(crtc); | |
744 | fb = crtc->primary->fb; | |
745 | obj = intel_fb_obj(fb); | |
6e3c9717 | 746 | adjusted_mode = &intel_crtc->config->base.adjusted_mode; |
7ff0ebcc | 747 | |
7ff0ebcc RV |
748 | if ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) || |
749 | (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)) { | |
2e8144a5 | 750 | set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE); |
7ff0ebcc RV |
751 | goto out_disable; |
752 | } | |
753 | ||
754 | if (INTEL_INFO(dev)->gen >= 8 || IS_HASWELL(dev)) { | |
755 | max_width = 4096; | |
756 | max_height = 4096; | |
757 | } else if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { | |
758 | max_width = 4096; | |
759 | max_height = 2048; | |
760 | } else { | |
761 | max_width = 2048; | |
762 | max_height = 1536; | |
763 | } | |
6e3c9717 ACO |
764 | if (intel_crtc->config->pipe_src_w > max_width || |
765 | intel_crtc->config->pipe_src_h > max_height) { | |
2e8144a5 | 766 | set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE); |
7ff0ebcc RV |
767 | goto out_disable; |
768 | } | |
769 | if ((INTEL_INFO(dev)->gen < 4 || HAS_DDI(dev)) && | |
770 | intel_crtc->plane != PLANE_A) { | |
2e8144a5 | 771 | set_no_fbc_reason(dev_priv, FBC_BAD_PLANE); |
7ff0ebcc RV |
772 | goto out_disable; |
773 | } | |
774 | ||
775 | /* The use of a CPU fence is mandatory in order to detect writes | |
776 | * by the CPU to the scanout and trigger updates to the FBC. | |
777 | */ | |
778 | if (obj->tiling_mode != I915_TILING_X || | |
779 | obj->fence_reg == I915_FENCE_REG_NONE) { | |
2e8144a5 | 780 | set_no_fbc_reason(dev_priv, FBC_NOT_TILED); |
7ff0ebcc RV |
781 | goto out_disable; |
782 | } | |
783 | if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) && | |
8e7d688b | 784 | crtc->primary->state->rotation != BIT(DRM_ROTATE_0)) { |
2e8144a5 | 785 | set_no_fbc_reason(dev_priv, FBC_ROTATION); |
7ff0ebcc RV |
786 | goto out_disable; |
787 | } | |
788 | ||
789 | /* If the kernel debugger is active, always disable compression */ | |
790 | if (in_dbg_master()) | |
791 | goto out_disable; | |
792 | ||
fc786728 PZ |
793 | if (intel_fbc_setup_cfb(dev, obj->base.size, |
794 | drm_format_plane_cpp(fb->pixel_format, 0))) { | |
2e8144a5 | 795 | set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL); |
7ff0ebcc RV |
796 | goto out_disable; |
797 | } | |
798 | ||
799 | /* If the scanout has not changed, don't modify the FBC settings. | |
800 | * Note that we make the fundamental assumption that the fb->obj | |
801 | * cannot be unpinned (and have its GTT offset and fence revoked) | |
802 | * without first being decoupled from the scanout and FBC disabled. | |
803 | */ | |
e35fef21 | 804 | if (dev_priv->fbc.crtc == intel_crtc && |
7ff0ebcc RV |
805 | dev_priv->fbc.fb_id == fb->base.id && |
806 | dev_priv->fbc.y == crtc->y) | |
807 | return; | |
808 | ||
809 | if (intel_fbc_enabled(dev)) { | |
810 | /* We update FBC along two paths, after changing fb/crtc | |
811 | * configuration (modeswitching) and after page-flipping | |
812 | * finishes. For the latter, we know that not only did | |
813 | * we disable the FBC at the start of the page-flip | |
814 | * sequence, but also more than one vblank has passed. | |
815 | * | |
816 | * For the former case of modeswitching, it is possible | |
817 | * to switch between two FBC valid configurations | |
818 | * instantaneously so we do need to disable the FBC | |
819 | * before we can modify its control registers. We also | |
820 | * have to wait for the next vblank for that to take | |
821 | * effect. However, since we delay enabling FBC we can | |
822 | * assume that a vblank has passed since disabling and | |
823 | * that we can safely alter the registers in the deferred | |
824 | * callback. | |
825 | * | |
826 | * In the scenario that we go from a valid to invalid | |
827 | * and then back to valid FBC configuration we have | |
828 | * no strict enforcement that a vblank occurred since | |
829 | * disabling the FBC. However, along all current pipe | |
830 | * disabling paths we do need to wait for a vblank at | |
831 | * some point. And we wait before enabling FBC anyway. | |
832 | */ | |
833 | DRM_DEBUG_KMS("disabling active FBC for update\n"); | |
25ad93fd | 834 | __intel_fbc_disable(dev); |
7ff0ebcc RV |
835 | } |
836 | ||
837 | intel_fbc_enable(crtc); | |
838 | dev_priv->fbc.no_fbc_reason = FBC_OK; | |
839 | return; | |
840 | ||
841 | out_disable: | |
842 | /* Multiple disables should be harmless */ | |
843 | if (intel_fbc_enabled(dev)) { | |
844 | DRM_DEBUG_KMS("unsupported config, disabling FBC\n"); | |
25ad93fd | 845 | __intel_fbc_disable(dev); |
7ff0ebcc | 846 | } |
25ad93fd PZ |
847 | __intel_fbc_cleanup_cfb(dev); |
848 | } | |
849 | ||
850 | /* | |
851 | * intel_fbc_update - enable/disable FBC as needed | |
852 | * @dev: the drm_device | |
853 | * | |
854 | * This function reevaluates the overall state and enables or disables FBC. | |
855 | */ | |
856 | void intel_fbc_update(struct drm_device *dev) | |
857 | { | |
858 | struct drm_i915_private *dev_priv = dev->dev_private; | |
859 | ||
0bf73c36 PZ |
860 | if (!dev_priv->display.enable_fbc) |
861 | return; | |
862 | ||
25ad93fd PZ |
863 | mutex_lock(&dev_priv->fbc.lock); |
864 | __intel_fbc_update(dev); | |
865 | mutex_unlock(&dev_priv->fbc.lock); | |
7ff0ebcc RV |
866 | } |
867 | ||
dbef0f15 PZ |
868 | void intel_fbc_invalidate(struct drm_i915_private *dev_priv, |
869 | unsigned int frontbuffer_bits, | |
870 | enum fb_op_origin origin) | |
871 | { | |
872 | struct drm_device *dev = dev_priv->dev; | |
873 | unsigned int fbc_bits; | |
874 | ||
0bf73c36 PZ |
875 | if (!dev_priv->display.enable_fbc) |
876 | return; | |
877 | ||
dbef0f15 PZ |
878 | if (origin == ORIGIN_GTT) |
879 | return; | |
880 | ||
25ad93fd PZ |
881 | mutex_lock(&dev_priv->fbc.lock); |
882 | ||
dbef0f15 PZ |
883 | if (dev_priv->fbc.enabled) |
884 | fbc_bits = INTEL_FRONTBUFFER_PRIMARY(dev_priv->fbc.crtc->pipe); | |
885 | else if (dev_priv->fbc.fbc_work) | |
886 | fbc_bits = INTEL_FRONTBUFFER_PRIMARY( | |
887 | to_intel_crtc(dev_priv->fbc.fbc_work->crtc)->pipe); | |
888 | else | |
889 | fbc_bits = dev_priv->fbc.possible_framebuffer_bits; | |
890 | ||
891 | dev_priv->fbc.busy_bits |= (fbc_bits & frontbuffer_bits); | |
892 | ||
893 | if (dev_priv->fbc.busy_bits) | |
25ad93fd PZ |
894 | __intel_fbc_disable(dev); |
895 | ||
896 | mutex_unlock(&dev_priv->fbc.lock); | |
dbef0f15 PZ |
897 | } |
898 | ||
899 | void intel_fbc_flush(struct drm_i915_private *dev_priv, | |
900 | unsigned int frontbuffer_bits) | |
901 | { | |
902 | struct drm_device *dev = dev_priv->dev; | |
903 | ||
0bf73c36 PZ |
904 | if (!dev_priv->display.enable_fbc) |
905 | return; | |
906 | ||
25ad93fd PZ |
907 | mutex_lock(&dev_priv->fbc.lock); |
908 | ||
dbef0f15 | 909 | if (!dev_priv->fbc.busy_bits) |
25ad93fd | 910 | goto out; |
dbef0f15 PZ |
911 | |
912 | dev_priv->fbc.busy_bits &= ~frontbuffer_bits; | |
913 | ||
914 | if (!dev_priv->fbc.busy_bits) | |
25ad93fd PZ |
915 | __intel_fbc_update(dev); |
916 | ||
917 | out: | |
918 | mutex_unlock(&dev_priv->fbc.lock); | |
dbef0f15 PZ |
919 | } |
920 | ||
94b83957 RV |
921 | /** |
922 | * intel_fbc_init - Initialize FBC | |
923 | * @dev_priv: the i915 device | |
924 | * | |
925 | * This function might be called during PM init process. | |
926 | */ | |
7ff0ebcc RV |
927 | void intel_fbc_init(struct drm_i915_private *dev_priv) |
928 | { | |
dbef0f15 PZ |
929 | enum pipe pipe; |
930 | ||
25ad93fd PZ |
931 | mutex_init(&dev_priv->fbc.lock); |
932 | ||
7ff0ebcc RV |
933 | if (!HAS_FBC(dev_priv)) { |
934 | dev_priv->fbc.enabled = false; | |
104618b3 | 935 | dev_priv->fbc.no_fbc_reason = FBC_UNSUPPORTED; |
7ff0ebcc RV |
936 | return; |
937 | } | |
938 | ||
dbef0f15 PZ |
939 | for_each_pipe(dev_priv, pipe) { |
940 | dev_priv->fbc.possible_framebuffer_bits |= | |
941 | INTEL_FRONTBUFFER_PRIMARY(pipe); | |
942 | ||
943 | if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8) | |
944 | break; | |
945 | } | |
946 | ||
7ff0ebcc RV |
947 | if (INTEL_INFO(dev_priv)->gen >= 7) { |
948 | dev_priv->display.fbc_enabled = ilk_fbc_enabled; | |
949 | dev_priv->display.enable_fbc = gen7_fbc_enable; | |
950 | dev_priv->display.disable_fbc = ilk_fbc_disable; | |
951 | } else if (INTEL_INFO(dev_priv)->gen >= 5) { | |
952 | dev_priv->display.fbc_enabled = ilk_fbc_enabled; | |
953 | dev_priv->display.enable_fbc = ilk_fbc_enable; | |
954 | dev_priv->display.disable_fbc = ilk_fbc_disable; | |
955 | } else if (IS_GM45(dev_priv)) { | |
956 | dev_priv->display.fbc_enabled = g4x_fbc_enabled; | |
957 | dev_priv->display.enable_fbc = g4x_fbc_enable; | |
958 | dev_priv->display.disable_fbc = g4x_fbc_disable; | |
959 | } else { | |
960 | dev_priv->display.fbc_enabled = i8xx_fbc_enabled; | |
961 | dev_priv->display.enable_fbc = i8xx_fbc_enable; | |
962 | dev_priv->display.disable_fbc = i8xx_fbc_disable; | |
963 | ||
964 | /* This value was pulled out of someone's hat */ | |
965 | I915_WRITE(FBC_CONTROL, 500 << FBC_CTL_INTERVAL_SHIFT); | |
966 | } | |
967 | ||
968 | dev_priv->fbc.enabled = dev_priv->display.fbc_enabled(dev_priv->dev); | |
969 | } |