Rev 2344 | Rev 3243 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2344 | Rev 3031 | ||
---|---|---|---|
Line 27... | Line 27... | ||
27 | * |
27 | * |
28 | * The older chips had a separate interface for programming plane related |
28 | * The older chips had a separate interface for programming plane related |
29 | * registers; newer ones are much simpler and we can use the new DRM plane |
29 | * registers; newer ones are much simpler and we can use the new DRM plane |
30 | * support. |
30 | * support. |
31 | */ |
31 | */ |
32 | #include "drmP.h" |
32 | #include |
33 | #include "drm_crtc.h" |
33 | #include |
34 | #include "drm_fourcc.h" |
34 | #include |
35 | #include "intel_drv.h" |
35 | #include "intel_drv.h" |
36 | #include "i915_drm.h" |
36 | #include |
37 | #include "i915_drv.h" |
37 | #include "i915_drv.h" |
Line 38... | Line 38... | ||
38 | 38 | ||
39 | static void |
39 | static void |
40 | ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, |
40 | ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, |
Line 54... | Line 54... | ||
54 | 54 | ||
55 | /* Mask out pixel format bits in case we change it */ |
55 | /* Mask out pixel format bits in case we change it */ |
56 | sprctl &= ~SPRITE_PIXFORMAT_MASK; |
56 | sprctl &= ~SPRITE_PIXFORMAT_MASK; |
57 | sprctl &= ~SPRITE_RGB_ORDER_RGBX; |
57 | sprctl &= ~SPRITE_RGB_ORDER_RGBX; |
- | 58 | sprctl &= ~SPRITE_YUV_BYTE_ORDER_MASK; |
|
Line 58... | Line 59... | ||
58 | sprctl &= ~SPRITE_YUV_BYTE_ORDER_MASK; |
59 | sprctl &= ~SPRITE_TILED; |
59 | 60 | ||
60 | switch (fb->pixel_format) { |
61 | switch (fb->pixel_format) { |
61 | case DRM_FORMAT_XBGR8888: |
62 | case DRM_FORMAT_XBGR8888: |
62 | sprctl |= SPRITE_FORMAT_RGBX888; |
63 | sprctl |= SPRITE_FORMAT_RGBX888 | SPRITE_RGB_ORDER_RGBX; |
63 | pixel_size = 4; |
64 | pixel_size = 4; |
64 | break; |
65 | break; |
65 | case DRM_FORMAT_XRGB8888: |
66 | case DRM_FORMAT_XRGB8888: |
66 | sprctl |= SPRITE_FORMAT_RGBX888 | SPRITE_RGB_ORDER_RGBX; |
67 | sprctl |= SPRITE_FORMAT_RGBX888; |
67 | pixel_size = 4; |
68 | pixel_size = 4; |
68 | break; |
69 | break; |
69 | case DRM_FORMAT_YUYV: |
70 | case DRM_FORMAT_YUYV: |
Line 82... | Line 83... | ||
82 | sprctl |= SPRITE_FORMAT_YUV422 | SPRITE_YUV_ORDER_VYUY; |
83 | sprctl |= SPRITE_FORMAT_YUV422 | SPRITE_YUV_ORDER_VYUY; |
83 | pixel_size = 2; |
84 | pixel_size = 2; |
84 | break; |
85 | break; |
85 | default: |
86 | default: |
86 | DRM_DEBUG_DRIVER("bad pixel format, assuming RGBX888\n"); |
87 | DRM_DEBUG_DRIVER("bad pixel format, assuming RGBX888\n"); |
87 | sprctl |= DVS_FORMAT_RGBX888; |
88 | sprctl |= SPRITE_FORMAT_RGBX888; |
88 | pixel_size = 4; |
89 | pixel_size = 4; |
89 | break; |
90 | break; |
90 | } |
91 | } |
Line 91... | Line 92... | ||
91 | 92 | ||
92 | if (obj->tiling_mode != I915_TILING_NONE) |
93 | if (obj->tiling_mode != I915_TILING_NONE) |
Line 93... | Line 94... | ||
93 | sprctl |= SPRITE_TILED; |
94 | sprctl |= SPRITE_TILED; |
94 | 95 | ||
95 | /* must disable */ |
96 | /* must disable */ |
96 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; |
- | |
Line 97... | Line 97... | ||
97 | sprctl |= SPRITE_ENABLE; |
97 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; |
98 | sprctl |= SPRITE_DEST_KEY; |
98 | sprctl |= SPRITE_ENABLE; |
99 | 99 | ||
100 | /* Sizes are 0 based */ |
100 | /* Sizes are 0 based */ |
Line 109... | Line 109... | ||
109 | * IVB workaround: must disable low power watermarks for at least |
109 | * IVB workaround: must disable low power watermarks for at least |
110 | * one frame before enabling scaling. LP watermarks can be re-enabled |
110 | * one frame before enabling scaling. LP watermarks can be re-enabled |
111 | * when scaling is disabled. |
111 | * when scaling is disabled. |
112 | */ |
112 | */ |
113 | if (crtc_w != src_w || crtc_h != src_h) { |
113 | if (crtc_w != src_w || crtc_h != src_h) { |
- | 114 | if (!dev_priv->sprite_scaling_enabled) { |
|
114 | dev_priv->sprite_scaling_enabled = true; |
115 | dev_priv->sprite_scaling_enabled = true; |
115 | sandybridge_update_wm(dev); |
116 | intel_update_watermarks(dev); |
116 | intel_wait_for_vblank(dev, pipe); |
117 | intel_wait_for_vblank(dev, pipe); |
- | 118 | } |
|
117 | sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h; |
119 | sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h; |
118 | } else { |
120 | } else { |
- | 121 | if (dev_priv->sprite_scaling_enabled) { |
|
119 | dev_priv->sprite_scaling_enabled = false; |
122 | dev_priv->sprite_scaling_enabled = false; |
120 | /* potentially re-enable LP watermarks */ |
123 | /* potentially re-enable LP watermarks */ |
121 | sandybridge_update_wm(dev); |
124 | intel_update_watermarks(dev); |
- | 125 | } |
|
122 | } |
126 | } |
Line 123... | Line 127... | ||
123 | 127 | ||
124 | I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]); |
128 | I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]); |
125 | I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x); |
129 | I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x); |
Line 132... | Line 136... | ||
132 | I915_WRITE(SPRLINOFF(pipe), offset); |
136 | I915_WRITE(SPRLINOFF(pipe), offset); |
133 | } |
137 | } |
134 | I915_WRITE(SPRSIZE(pipe), (crtc_h << 16) | crtc_w); |
138 | I915_WRITE(SPRSIZE(pipe), (crtc_h << 16) | crtc_w); |
135 | I915_WRITE(SPRSCALE(pipe), sprscale); |
139 | I915_WRITE(SPRSCALE(pipe), sprscale); |
136 | I915_WRITE(SPRCTL(pipe), sprctl); |
140 | I915_WRITE(SPRCTL(pipe), sprctl); |
137 | I915_WRITE(SPRSURF(pipe), obj->gtt_offset); |
141 | I915_MODIFY_DISPBASE(SPRSURF(pipe), obj->gtt_offset); |
138 | POSTING_READ(SPRSURF(pipe)); |
142 | POSTING_READ(SPRSURF(pipe)); |
139 | } |
143 | } |
Line 140... | Line 144... | ||
140 | 144 | ||
141 | static void |
145 | static void |
Line 148... | Line 152... | ||
148 | 152 | ||
149 | I915_WRITE(SPRCTL(pipe), I915_READ(SPRCTL(pipe)) & ~SPRITE_ENABLE); |
153 | I915_WRITE(SPRCTL(pipe), I915_READ(SPRCTL(pipe)) & ~SPRITE_ENABLE); |
150 | /* Can't leave the scaler enabled... */ |
154 | /* Can't leave the scaler enabled... */ |
151 | I915_WRITE(SPRSCALE(pipe), 0); |
155 | I915_WRITE(SPRSCALE(pipe), 0); |
152 | /* Activate double buffered register update */ |
156 | /* Activate double buffered register update */ |
153 | I915_WRITE(SPRSURF(pipe), 0); |
157 | I915_MODIFY_DISPBASE(SPRSURF(pipe), 0); |
- | 158 | POSTING_READ(SPRSURF(pipe)); |
|
- | 159 | ||
- | 160 | dev_priv->sprite_scaling_enabled = false; |
|
154 | POSTING_READ(SPRSURF(pipe)); |
161 | intel_update_watermarks(dev); |
Line 155... | Line 162... | ||
155 | } |
162 | } |
156 | 163 | ||
157 | static int |
164 | static int |
Line 207... | Line 214... | ||
207 | else |
214 | else |
208 | key->flags = I915_SET_COLORKEY_NONE; |
215 | key->flags = I915_SET_COLORKEY_NONE; |
209 | } |
216 | } |
Line 210... | Line 217... | ||
210 | 217 | ||
211 | static void |
218 | static void |
212 | snb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, |
219 | ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, |
213 | struct drm_i915_gem_object *obj, int crtc_x, int crtc_y, |
220 | struct drm_i915_gem_object *obj, int crtc_x, int crtc_y, |
214 | unsigned int crtc_w, unsigned int crtc_h, |
221 | unsigned int crtc_w, unsigned int crtc_h, |
215 | uint32_t x, uint32_t y, |
222 | uint32_t x, uint32_t y, |
216 | uint32_t src_w, uint32_t src_h) |
223 | uint32_t src_w, uint32_t src_h) |
217 | { |
224 | { |
218 | struct drm_device *dev = plane->dev; |
225 | struct drm_device *dev = plane->dev; |
219 | struct drm_i915_private *dev_priv = dev->dev_private; |
226 | struct drm_i915_private *dev_priv = dev->dev_private; |
220 | struct intel_plane *intel_plane = to_intel_plane(plane); |
227 | struct intel_plane *intel_plane = to_intel_plane(plane); |
221 | int pipe = intel_plane->pipe, pixel_size; |
228 | int pipe = intel_plane->pipe, pixel_size; |
Line 222... | Line 229... | ||
222 | u32 dvscntr, dvsscale = 0; |
229 | u32 dvscntr, dvsscale; |
Line 223... | Line 230... | ||
223 | 230 | ||
224 | dvscntr = I915_READ(DVSCNTR(pipe)); |
231 | dvscntr = I915_READ(DVSCNTR(pipe)); |
225 | 232 | ||
226 | /* Mask out pixel format bits in case we change it */ |
233 | /* Mask out pixel format bits in case we change it */ |
- | 234 | dvscntr &= ~DVS_PIXFORMAT_MASK; |
|
Line 227... | Line 235... | ||
227 | dvscntr &= ~DVS_PIXFORMAT_MASK; |
235 | dvscntr &= ~DVS_RGB_ORDER_XBGR; |
228 | dvscntr &= ~DVS_RGB_ORDER_RGBX; |
236 | dvscntr &= ~DVS_YUV_BYTE_ORDER_MASK; |
229 | dvscntr &= ~DVS_YUV_BYTE_ORDER_MASK; |
237 | dvscntr &= ~DVS_TILED; |
230 | 238 | ||
231 | switch (fb->pixel_format) { |
239 | switch (fb->pixel_format) { |
232 | case DRM_FORMAT_XBGR8888: |
240 | case DRM_FORMAT_XBGR8888: |
233 | dvscntr |= DVS_FORMAT_RGBX888; |
241 | dvscntr |= DVS_FORMAT_RGBX888 | DVS_RGB_ORDER_XBGR; |
234 | pixel_size = 4; |
242 | pixel_size = 4; |
235 | break; |
243 | break; |
236 | case DRM_FORMAT_XRGB8888: |
244 | case DRM_FORMAT_XRGB8888: |
237 | dvscntr |= DVS_FORMAT_RGBX888 | DVS_RGB_ORDER_RGBX; |
245 | dvscntr |= DVS_FORMAT_RGBX888; |
238 | pixel_size = 4; |
246 | pixel_size = 4; |
Line 261... | Line 269... | ||
261 | } |
269 | } |
Line 262... | Line 270... | ||
262 | 270 | ||
263 | if (obj->tiling_mode != I915_TILING_NONE) |
271 | if (obj->tiling_mode != I915_TILING_NONE) |
Line 264... | Line 272... | ||
264 | dvscntr |= DVS_TILED; |
272 | dvscntr |= DVS_TILED; |
265 | 273 | ||
266 | /* must disable */ |
274 | if (IS_GEN6(dev)) |
Line 267... | Line 275... | ||
267 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; |
275 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */ |
268 | dvscntr |= DVS_ENABLE; |
276 | dvscntr |= DVS_ENABLE; |
269 | 277 | ||
270 | /* Sizes are 0 based */ |
278 | /* Sizes are 0 based */ |
271 | src_w--; |
279 | src_w--; |
Line 272... | Line 280... | ||
272 | src_h--; |
280 | src_h--; |
Line -... | Line 281... | ||
- | 281 | crtc_w--; |
|
273 | crtc_w--; |
282 | crtc_h--; |
274 | crtc_h--; |
283 | |
Line 275... | Line 284... | ||
275 | 284 | intel_update_sprite_watermarks(dev, pipe, crtc_w, pixel_size); |
|
276 | intel_update_sprite_watermarks(dev, pipe, crtc_w, pixel_size); |
285 | |
277 | 286 | dvsscale = 0; |
|
Line 289... | Line 298... | ||
289 | I915_WRITE(DVSLINOFF(pipe), offset); |
298 | I915_WRITE(DVSLINOFF(pipe), offset); |
290 | } |
299 | } |
291 | I915_WRITE(DVSSIZE(pipe), (crtc_h << 16) | crtc_w); |
300 | I915_WRITE(DVSSIZE(pipe), (crtc_h << 16) | crtc_w); |
292 | I915_WRITE(DVSSCALE(pipe), dvsscale); |
301 | I915_WRITE(DVSSCALE(pipe), dvsscale); |
293 | I915_WRITE(DVSCNTR(pipe), dvscntr); |
302 | I915_WRITE(DVSCNTR(pipe), dvscntr); |
294 | I915_WRITE(DVSSURF(pipe), obj->gtt_offset); |
303 | I915_MODIFY_DISPBASE(DVSSURF(pipe), obj->gtt_offset); |
295 | POSTING_READ(DVSSURF(pipe)); |
304 | POSTING_READ(DVSSURF(pipe)); |
296 | } |
305 | } |
Line 297... | Line 306... | ||
297 | 306 | ||
298 | static void |
307 | static void |
299 | snb_disable_plane(struct drm_plane *plane) |
308 | ilk_disable_plane(struct drm_plane *plane) |
300 | { |
309 | { |
301 | struct drm_device *dev = plane->dev; |
310 | struct drm_device *dev = plane->dev; |
302 | struct drm_i915_private *dev_priv = dev->dev_private; |
311 | struct drm_i915_private *dev_priv = dev->dev_private; |
303 | struct intel_plane *intel_plane = to_intel_plane(plane); |
312 | struct intel_plane *intel_plane = to_intel_plane(plane); |
Line 304... | Line 313... | ||
304 | int pipe = intel_plane->pipe; |
313 | int pipe = intel_plane->pipe; |
305 | 314 | ||
306 | I915_WRITE(DVSCNTR(pipe), I915_READ(DVSCNTR(pipe)) & ~DVS_ENABLE); |
315 | I915_WRITE(DVSCNTR(pipe), I915_READ(DVSCNTR(pipe)) & ~DVS_ENABLE); |
307 | /* Disable the scaler */ |
316 | /* Disable the scaler */ |
308 | I915_WRITE(DVSSCALE(pipe), 0); |
317 | I915_WRITE(DVSSCALE(pipe), 0); |
309 | /* Flush double buffered register updates */ |
318 | /* Flush double buffered register updates */ |
310 | I915_WRITE(DVSSURF(pipe), 0); |
319 | I915_MODIFY_DISPBASE(DVSSURF(pipe), 0); |
Line 311... | Line 320... | ||
311 | POSTING_READ(DVSSURF(pipe)); |
320 | POSTING_READ(DVSSURF(pipe)); |
312 | } |
321 | } |
Line 317... | Line 326... | ||
317 | struct drm_device *dev = crtc->dev; |
326 | struct drm_device *dev = crtc->dev; |
318 | struct drm_i915_private *dev_priv = dev->dev_private; |
327 | struct drm_i915_private *dev_priv = dev->dev_private; |
319 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
328 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
320 | int reg = DSPCNTR(intel_crtc->plane); |
329 | int reg = DSPCNTR(intel_crtc->plane); |
Line -... | Line 330... | ||
- | 330 | ||
- | 331 | if (!intel_crtc->primary_disabled) |
|
- | 332 | return; |
|
- | 333 | ||
- | 334 | intel_crtc->primary_disabled = false; |
|
- | 335 | intel_update_fbc(dev); |
|
321 | 336 | ||
322 | I915_WRITE(reg, I915_READ(reg) | DISPLAY_PLANE_ENABLE); |
337 | I915_WRITE(reg, I915_READ(reg) | DISPLAY_PLANE_ENABLE); |
Line 323... | Line 338... | ||
323 | } |
338 | } |
324 | 339 | ||
Line 328... | Line 343... | ||
328 | struct drm_device *dev = crtc->dev; |
343 | struct drm_device *dev = crtc->dev; |
329 | struct drm_i915_private *dev_priv = dev->dev_private; |
344 | struct drm_i915_private *dev_priv = dev->dev_private; |
330 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
345 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
331 | int reg = DSPCNTR(intel_crtc->plane); |
346 | int reg = DSPCNTR(intel_crtc->plane); |
Line -... | Line 347... | ||
- | 347 | ||
- | 348 | if (intel_crtc->primary_disabled) |
|
- | 349 | return; |
|
332 | 350 | ||
- | 351 | I915_WRITE(reg, I915_READ(reg) & ~DISPLAY_PLANE_ENABLE); |
|
- | 352 | ||
- | 353 | intel_crtc->primary_disabled = true; |
|
333 | I915_WRITE(reg, I915_READ(reg) & ~DISPLAY_PLANE_ENABLE); |
354 | intel_update_fbc(dev); |
Line 334... | Line 355... | ||
334 | } |
355 | } |
335 | 356 | ||
336 | static int |
357 | static int |
337 | snb_update_colorkey(struct drm_plane *plane, |
358 | ilk_update_colorkey(struct drm_plane *plane, |
338 | struct drm_intel_sprite_colorkey *key) |
359 | struct drm_intel_sprite_colorkey *key) |
339 | { |
360 | { |
340 | struct drm_device *dev = plane->dev; |
361 | struct drm_device *dev = plane->dev; |
Line 361... | Line 382... | ||
361 | 382 | ||
362 | return ret; |
383 | return ret; |
Line 363... | Line 384... | ||
363 | } |
384 | } |
364 | 385 | ||
365 | static void |
386 | static void |
366 | snb_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key) |
387 | ilk_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key) |
367 | { |
388 | { |
368 | struct drm_device *dev = plane->dev; |
389 | struct drm_device *dev = plane->dev; |
369 | struct drm_i915_private *dev_priv = dev->dev_private; |
390 | struct drm_i915_private *dev_priv = dev->dev_private; |
Line 409... | Line 430... | ||
409 | intel_fb = to_intel_framebuffer(fb); |
430 | intel_fb = to_intel_framebuffer(fb); |
410 | obj = intel_fb->obj; |
431 | obj = intel_fb->obj; |
Line 411... | Line 432... | ||
411 | 432 | ||
Line -... | Line 433... | ||
- | 433 | old_obj = intel_plane->obj; |
|
- | 434 | ||
- | 435 | src_w = src_w >> 16; |
|
412 | old_obj = intel_plane->obj; |
436 | src_h = src_h >> 16; |
413 | 437 | ||
414 | /* Pipe must be running... */ |
438 | /* Pipe must be running... */ |
Line 415... | Line 439... | ||
415 | if (!(I915_READ(PIPECONF(pipe)) & PIPECONF_ENABLE)) |
439 | if (!(I915_READ(PIPECONF(pipe)) & PIPECONF_ENABLE)) |
Line 473... | Line 497... | ||
473 | 497 | ||
474 | /* |
498 | /* |
475 | * Be sure to re-enable the primary before the sprite is no longer |
499 | * Be sure to re-enable the primary before the sprite is no longer |
476 | * covering it fully. |
500 | * covering it fully. |
477 | */ |
501 | */ |
478 | if (!disable_primary && intel_plane->primary_disabled) { |
502 | if (!disable_primary) |
479 | intel_enable_primary(crtc); |
- | |
480 | intel_plane->primary_disabled = false; |
- | |
Line 481... | Line 503... | ||
481 | } |
503 | intel_enable_primary(crtc); |
482 | 504 | ||
Line 483... | Line 505... | ||
483 | intel_plane->update_plane(plane, fb, obj, crtc_x, crtc_y, |
505 | intel_plane->update_plane(plane, fb, obj, crtc_x, crtc_y, |
484 | crtc_w, crtc_h, x, y, src_w, src_h); |
506 | crtc_w, crtc_h, x, y, src_w, src_h); |
485 | - | ||
486 | if (disable_primary) { |
- | |
Line 487... | Line 507... | ||
487 | intel_disable_primary(crtc); |
507 | |
488 | intel_plane->primary_disabled = true; |
508 | if (disable_primary) |
489 | } |
509 | intel_disable_primary(crtc); |
490 | 510 | ||
Line 499... | Line 519... | ||
499 | if (old_obj != obj) { |
519 | if (old_obj != obj) { |
500 | mutex_unlock(&dev->struct_mutex); |
520 | mutex_unlock(&dev->struct_mutex); |
501 | intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe); |
521 | intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe); |
502 | mutex_lock(&dev->struct_mutex); |
522 | mutex_lock(&dev->struct_mutex); |
503 | } |
523 | } |
504 | i915_gem_object_unpin(old_obj); |
524 | intel_unpin_fb_obj(old_obj); |
505 | } |
525 | } |
Line 506... | Line 526... | ||
506 | 526 | ||
507 | out_unlock: |
527 | out_unlock: |
508 | mutex_unlock(&dev->struct_mutex); |
528 | mutex_unlock(&dev->struct_mutex); |
Line 515... | Line 535... | ||
515 | { |
535 | { |
516 | struct drm_device *dev = plane->dev; |
536 | struct drm_device *dev = plane->dev; |
517 | struct intel_plane *intel_plane = to_intel_plane(plane); |
537 | struct intel_plane *intel_plane = to_intel_plane(plane); |
518 | int ret = 0; |
538 | int ret = 0; |
Line 519... | Line 539... | ||
519 | 539 | ||
520 | if (intel_plane->primary_disabled) { |
540 | if (plane->crtc) |
521 | intel_enable_primary(plane->crtc); |
- | |
522 | intel_plane->primary_disabled = false; |
- | |
523 | } |
- | |
524 | 541 | intel_enable_primary(plane->crtc); |
|
Line 525... | Line 542... | ||
525 | intel_plane->disable_plane(plane); |
542 | intel_plane->disable_plane(plane); |
526 | 543 | ||
Line 527... | Line 544... | ||
527 | if (!intel_plane->obj) |
544 | if (!intel_plane->obj) |
528 | goto out; |
545 | goto out; |
529 | 546 | ||
530 | mutex_lock(&dev->struct_mutex); |
547 | mutex_lock(&dev->struct_mutex); |
531 | i915_gem_object_unpin(intel_plane->obj); |
548 | intel_unpin_fb_obj(intel_plane->obj); |
Line 532... | Line 549... | ||
532 | intel_plane->obj = NULL; |
549 | intel_plane->obj = NULL; |
Line 546... | Line 563... | ||
546 | 563 | ||
547 | int intel_sprite_set_colorkey(struct drm_device *dev, void *data, |
564 | int intel_sprite_set_colorkey(struct drm_device *dev, void *data, |
548 | struct drm_file *file_priv) |
565 | struct drm_file *file_priv) |
549 | { |
566 | { |
550 | struct drm_intel_sprite_colorkey *set = data; |
- | |
551 | struct drm_i915_private *dev_priv = dev->dev_private; |
567 | struct drm_intel_sprite_colorkey *set = data; |
552 | struct drm_mode_object *obj; |
568 | struct drm_mode_object *obj; |
553 | struct drm_plane *plane; |
569 | struct drm_plane *plane; |
554 | struct intel_plane *intel_plane; |
570 | struct intel_plane *intel_plane; |
Line 555... | Line 571... | ||
555 | int ret = 0; |
571 | int ret = 0; |
556 | 572 | ||
Line 557... | Line 573... | ||
557 | if (!dev_priv) |
573 | // if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
558 | return -EINVAL; |
574 | // return -ENODEV; |
559 | 575 | ||
Line 580... | Line 596... | ||
580 | 596 | ||
581 | int intel_sprite_get_colorkey(struct drm_device *dev, void *data, |
597 | int intel_sprite_get_colorkey(struct drm_device *dev, void *data, |
582 | struct drm_file *file_priv) |
598 | struct drm_file *file_priv) |
583 | { |
599 | { |
584 | struct drm_intel_sprite_colorkey *get = data; |
- | |
585 | struct drm_i915_private *dev_priv = dev->dev_private; |
600 | struct drm_intel_sprite_colorkey *get = data; |
586 | struct drm_mode_object *obj; |
601 | struct drm_mode_object *obj; |
587 | struct drm_plane *plane; |
602 | struct drm_plane *plane; |
588 | struct intel_plane *intel_plane; |
603 | struct intel_plane *intel_plane; |
Line 589... | Line 604... | ||
589 | int ret = 0; |
604 | int ret = 0; |
590 | 605 | ||
Line 591... | Line 606... | ||
591 | if (!dev_priv) |
606 | // if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
Line 592... | Line 607... | ||
592 | return -EINVAL; |
607 | // return -ENODEV; |
593 | 608 | ||
Line 612... | Line 627... | ||
612 | .update_plane = intel_update_plane, |
627 | .update_plane = intel_update_plane, |
613 | .disable_plane = intel_disable_plane, |
628 | .disable_plane = intel_disable_plane, |
614 | .destroy = intel_destroy_plane, |
629 | .destroy = intel_destroy_plane, |
615 | }; |
630 | }; |
Line -... | Line 631... | ||
- | 631 | ||
- | 632 | static uint32_t ilk_plane_formats[] = { |
|
- | 633 | DRM_FORMAT_XRGB8888, |
|
- | 634 | DRM_FORMAT_YUYV, |
|
- | 635 | DRM_FORMAT_YVYU, |
|
- | 636 | DRM_FORMAT_UYVY, |
|
- | 637 | DRM_FORMAT_VYUY, |
|
- | 638 | }; |
|
616 | 639 | ||
617 | static uint32_t snb_plane_formats[] = { |
640 | static uint32_t snb_plane_formats[] = { |
618 | DRM_FORMAT_XBGR8888, |
641 | DRM_FORMAT_XBGR8888, |
619 | DRM_FORMAT_XRGB8888, |
642 | DRM_FORMAT_XRGB8888, |
620 | DRM_FORMAT_YUYV, |
643 | DRM_FORMAT_YUYV, |
Line 626... | Line 649... | ||
626 | int |
649 | int |
627 | intel_plane_init(struct drm_device *dev, enum pipe pipe) |
650 | intel_plane_init(struct drm_device *dev, enum pipe pipe) |
628 | { |
651 | { |
629 | struct intel_plane *intel_plane; |
652 | struct intel_plane *intel_plane; |
630 | unsigned long possible_crtcs; |
653 | unsigned long possible_crtcs; |
- | 654 | const uint32_t *plane_formats; |
|
- | 655 | int num_plane_formats; |
|
631 | int ret; |
656 | int ret; |
Line 632... | Line 657... | ||
632 | 657 | ||
633 | if (!(IS_GEN6(dev) || IS_GEN7(dev))) |
658 | if (INTEL_INFO(dev)->gen < 5) |
Line 634... | Line 659... | ||
634 | return -ENODEV; |
659 | return -ENODEV; |
635 | 660 | ||
636 | intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL); |
661 | intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL); |
Line 637... | Line 662... | ||
637 | if (!intel_plane) |
662 | if (!intel_plane) |
- | 663 | return -ENOMEM; |
|
- | 664 | ||
638 | return -ENOMEM; |
665 | switch (INTEL_INFO(dev)->gen) { |
639 | 666 | case 5: |
|
640 | if (IS_GEN6(dev)) { |
667 | case 6: |
641 | intel_plane->max_downscale = 16; |
668 | intel_plane->max_downscale = 16; |
642 | intel_plane->update_plane = snb_update_plane; |
669 | intel_plane->update_plane = ilk_update_plane; |
- | 670 | intel_plane->disable_plane = ilk_disable_plane; |
|
643 | intel_plane->disable_plane = snb_disable_plane; |
671 | intel_plane->update_colorkey = ilk_update_colorkey; |
- | 672 | intel_plane->get_colorkey = ilk_get_colorkey; |
|
- | 673 | ||
- | 674 | if (IS_GEN6(dev)) { |
|
- | 675 | plane_formats = snb_plane_formats; |
|
- | 676 | num_plane_formats = ARRAY_SIZE(snb_plane_formats); |
|
- | 677 | } else { |
|
- | 678 | plane_formats = ilk_plane_formats; |
|
- | 679 | num_plane_formats = ARRAY_SIZE(ilk_plane_formats); |
|
- | 680 | } |
|
644 | intel_plane->update_colorkey = snb_update_colorkey; |
681 | break; |
645 | intel_plane->get_colorkey = snb_get_colorkey; |
682 | |
646 | } else if (IS_GEN7(dev)) { |
683 | case 7: |
647 | intel_plane->max_downscale = 2; |
684 | intel_plane->max_downscale = 2; |
648 | intel_plane->update_plane = ivb_update_plane; |
685 | intel_plane->update_plane = ivb_update_plane; |
- | 686 | intel_plane->disable_plane = ivb_disable_plane; |
|
- | 687 | intel_plane->update_colorkey = ivb_update_colorkey; |
|
- | 688 | intel_plane->get_colorkey = ivb_get_colorkey; |
|
- | 689 | ||
- | 690 | plane_formats = snb_plane_formats; |
|
- | 691 | num_plane_formats = ARRAY_SIZE(snb_plane_formats); |
|
- | 692 | break; |
|
- | 693 | ||
649 | intel_plane->disable_plane = ivb_disable_plane; |
694 | default: |
Line 650... | Line 695... | ||
650 | intel_plane->update_colorkey = ivb_update_colorkey; |
695 | kfree(intel_plane); |
651 | intel_plane->get_colorkey = ivb_get_colorkey; |
696 | return -ENODEV; |
652 | } |
697 | } |
653 | 698 | ||
654 | intel_plane->pipe = pipe; |
699 | intel_plane->pipe = pipe; |
- | 700 | possible_crtcs = (1 << pipe); |
|
655 | possible_crtcs = (1 << pipe); |
701 | ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs, |
656 | ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs, |
702 | &intel_plane_funcs, |
Line 657... | Line 703... | ||
657 | &intel_plane_funcs, snb_plane_formats, |
703 | plane_formats, num_plane_formats, |
658 | ARRAY_SIZE(snb_plane_formats), false); |
704 | false); |
659 | if (ret) |
- |