aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-08-02 15:07:50 -0400
committerJason Wessel <jason.wessel@windriver.com>2010-08-05 10:22:31 -0400
commit81255565dbf5958187bdb6cc4e3aa0db9ce4d237 (patch)
tree4b0ec3f39a2dd9527276c0ef6b08db9d041fa606 /drivers/gpu/drm
parent1a7aba7f4e45014c5a4741164b1ecb4ffe616fb7 (diff)
drm/i915: use new fb debug hooks
Implement atomic kernel mode settings using the fb layer's debug hook system for supporting debugger interaction. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c98
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c2
2 files changed, 99 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5e21b3119824..eff28e5de4dc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -975,7 +975,10 @@ void
975intel_wait_for_vblank(struct drm_device *dev) 975intel_wait_for_vblank(struct drm_device *dev)
976{ 976{
977 /* Wait for 20ms, i.e. one cycle at 50hz. */ 977 /* Wait for 20ms, i.e. one cycle at 50hz. */
978 msleep(20); 978 if (in_dbg_master())
979 mdelay(20); /* The kernel debugger cannot call msleep() */
980 else
981 msleep(20);
979} 982}
980 983
981/* Parameters have changed, update FBC info */ 984/* Parameters have changed, update FBC info */
@@ -1314,6 +1317,98 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj)
1314 return 0; 1317 return 0;
1315} 1318}
1316 1319
1320/* Assume fb object is pinned & idle & fenced and just update base pointers */
1321static int
1322intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1323 int x, int y)
1324{
1325 struct drm_device *dev = crtc->dev;
1326 struct drm_i915_private *dev_priv = dev->dev_private;
1327 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1328 struct intel_framebuffer *intel_fb;
1329 struct drm_i915_gem_object *obj_priv;
1330 struct drm_gem_object *obj;
1331 int plane = intel_crtc->plane;
1332 unsigned long Start, Offset;
1333 int dspbase = (plane == 0 ? DSPAADDR : DSPBADDR);
1334 int dspsurf = (plane == 0 ? DSPASURF : DSPBSURF);
1335 int dspstride = (plane == 0) ? DSPASTRIDE : DSPBSTRIDE;
1336 int dsptileoff = (plane == 0 ? DSPATILEOFF : DSPBTILEOFF);
1337 int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR;
1338 u32 dspcntr;
1339
1340 switch (plane) {
1341 case 0:
1342 case 1:
1343 break;
1344 default:
1345 DRM_ERROR("Can't update plane %d in SAREA\n", plane);
1346 return -EINVAL;
1347 }
1348
1349 intel_fb = to_intel_framebuffer(fb);
1350 obj = intel_fb->obj;
1351 obj_priv = to_intel_bo(obj);
1352
1353 dspcntr = I915_READ(dspcntr_reg);
1354 /* Mask out pixel format bits in case we change it */
1355 dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
1356 switch (fb->bits_per_pixel) {
1357 case 8:
1358 dspcntr |= DISPPLANE_8BPP;
1359 break;
1360 case 16:
1361 if (fb->depth == 15)
1362 dspcntr |= DISPPLANE_15_16BPP;
1363 else
1364 dspcntr |= DISPPLANE_16BPP;
1365 break;
1366 case 24:
1367 case 32:
1368 dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
1369 break;
1370 default:
1371 DRM_ERROR("Unknown color depth\n");
1372 return -EINVAL;
1373 }
1374 if (IS_I965G(dev)) {
1375 if (obj_priv->tiling_mode != I915_TILING_NONE)
1376 dspcntr |= DISPPLANE_TILED;
1377 else
1378 dspcntr &= ~DISPPLANE_TILED;
1379 }
1380
1381 if (IS_IRONLAKE(dev))
1382 /* must disable */
1383 dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
1384
1385 I915_WRITE(dspcntr_reg, dspcntr);
1386
1387 Start = obj_priv->gtt_offset;
1388 Offset = y * fb->pitch + x * (fb->bits_per_pixel / 8);
1389
1390 DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y);
1391 I915_WRITE(dspstride, fb->pitch);
1392 if (IS_I965G(dev)) {
1393 I915_WRITE(dspbase, Offset);
1394 I915_READ(dspbase);
1395 I915_WRITE(dspsurf, Start);
1396 I915_READ(dspsurf);
1397 I915_WRITE(dsptileoff, (y << 16) | x);
1398 } else {
1399 I915_WRITE(dspbase, Start + Offset);
1400 I915_READ(dspbase);
1401 }
1402
1403 if ((IS_I965G(dev) || plane == 0))
1404 intel_update_fbc(crtc, &crtc->mode);
1405
1406 intel_wait_for_vblank(dev);
1407 intel_increase_pllclock(crtc, true);
1408
1409 return 0;
1410}
1411
1317static int 1412static int
1318intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, 1413intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
1319 struct drm_framebuffer *old_fb) 1414 struct drm_framebuffer *old_fb)
@@ -4814,6 +4909,7 @@ static const struct drm_crtc_helper_funcs intel_helper_funcs = {
4814 .mode_fixup = intel_crtc_mode_fixup, 4909 .mode_fixup = intel_crtc_mode_fixup,
4815 .mode_set = intel_crtc_mode_set, 4910 .mode_set = intel_crtc_mode_set,
4816 .mode_set_base = intel_pipe_set_base, 4911 .mode_set_base = intel_pipe_set_base,
4912 .mode_set_base_atomic = intel_pipe_set_base_atomic,
4817 .prepare = intel_crtc_prepare, 4913 .prepare = intel_crtc_prepare,
4818 .commit = intel_crtc_commit, 4914 .commit = intel_crtc_commit,
4819 .load_lut = intel_crtc_load_lut, 4915 .load_lut = intel_crtc_load_lut,
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 3e18c9e7729b..54acd8b534df 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -61,6 +61,8 @@ static struct fb_ops intelfb_ops = {
61 .fb_pan_display = drm_fb_helper_pan_display, 61 .fb_pan_display = drm_fb_helper_pan_display,
62 .fb_blank = drm_fb_helper_blank, 62 .fb_blank = drm_fb_helper_blank,
63 .fb_setcmap = drm_fb_helper_setcmap, 63 .fb_setcmap = drm_fb_helper_setcmap,
64 .fb_debug_enter = drm_fb_helper_debug_enter,
65 .fb_debug_leave = drm_fb_helper_debug_leave,
64}; 66};
65 67
66static int intelfb_create(struct intel_fbdev *ifbdev, 68static int intelfb_create(struct intel_fbdev *ifbdev,