aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c102
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c6
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c4
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c2
4 files changed, 107 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6bb5ffc76ced..5ec10e02341b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -980,7 +980,10 @@ void
980intel_wait_for_vblank(struct drm_device *dev) 980intel_wait_for_vblank(struct drm_device *dev)
981{ 981{
982 /* Wait for 20ms, i.e. one cycle at 50hz. */ 982 /* Wait for 20ms, i.e. one cycle at 50hz. */
983 msleep(20); 983 if (in_dbg_master())
984 mdelay(20); /* The kernel debugger cannot call msleep() */
985 else
986 msleep(20);
984} 987}
985 988
986/* Parameters have changed, update FBC info */ 989/* Parameters have changed, update FBC info */
@@ -1314,6 +1317,10 @@ static void intel_update_fbc(struct drm_crtc *crtc,
1314 goto out_disable; 1317 goto out_disable;
1315 } 1318 }
1316 1319
1320 /* If the kernel debugger is active, always disable compression */
1321 if (in_dbg_master())
1322 goto out_disable;
1323
1317 if (intel_fbc_enabled(dev)) { 1324 if (intel_fbc_enabled(dev)) {
1318 /* We can re-enable it in this case, but need to update pitch */ 1325 /* We can re-enable it in this case, but need to update pitch */
1319 if ((fb->pitch > dev_priv->cfb_pitch) || 1326 if ((fb->pitch > dev_priv->cfb_pitch) ||
@@ -1385,6 +1392,98 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj)
1385 return 0; 1392 return 0;
1386} 1393}
1387 1394
1395/* Assume fb object is pinned & idle & fenced and just update base pointers */
1396static int
1397intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1398 int x, int y)
1399{
1400 struct drm_device *dev = crtc->dev;
1401 struct drm_i915_private *dev_priv = dev->dev_private;
1402 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1403 struct intel_framebuffer *intel_fb;
1404 struct drm_i915_gem_object *obj_priv;
1405 struct drm_gem_object *obj;
1406 int plane = intel_crtc->plane;
1407 unsigned long Start, Offset;
1408 int dspbase = (plane == 0 ? DSPAADDR : DSPBADDR);
1409 int dspsurf = (plane == 0 ? DSPASURF : DSPBSURF);
1410 int dspstride = (plane == 0) ? DSPASTRIDE : DSPBSTRIDE;
1411 int dsptileoff = (plane == 0 ? DSPATILEOFF : DSPBTILEOFF);
1412 int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR;
1413 u32 dspcntr;
1414
1415 switch (plane) {
1416 case 0:
1417 case 1:
1418 break;
1419 default:
1420 DRM_ERROR("Can't update plane %d in SAREA\n", plane);
1421 return -EINVAL;
1422 }
1423
1424 intel_fb = to_intel_framebuffer(fb);
1425 obj = intel_fb->obj;
1426 obj_priv = to_intel_bo(obj);
1427
1428 dspcntr = I915_READ(dspcntr_reg);
1429 /* Mask out pixel format bits in case we change it */
1430 dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
1431 switch (fb->bits_per_pixel) {
1432 case 8:
1433 dspcntr |= DISPPLANE_8BPP;
1434 break;
1435 case 16:
1436 if (fb->depth == 15)
1437 dspcntr |= DISPPLANE_15_16BPP;
1438 else
1439 dspcntr |= DISPPLANE_16BPP;
1440 break;
1441 case 24:
1442 case 32:
1443 dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
1444 break;
1445 default:
1446 DRM_ERROR("Unknown color depth\n");
1447 return -EINVAL;
1448 }
1449 if (IS_I965G(dev)) {
1450 if (obj_priv->tiling_mode != I915_TILING_NONE)
1451 dspcntr |= DISPPLANE_TILED;
1452 else
1453 dspcntr &= ~DISPPLANE_TILED;
1454 }
1455
1456 if (IS_IRONLAKE(dev))
1457 /* must disable */
1458 dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
1459
1460 I915_WRITE(dspcntr_reg, dspcntr);
1461
1462 Start = obj_priv->gtt_offset;
1463 Offset = y * fb->pitch + x * (fb->bits_per_pixel / 8);
1464
1465 DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y);
1466 I915_WRITE(dspstride, fb->pitch);
1467 if (IS_I965G(dev)) {
1468 I915_WRITE(dspbase, Offset);
1469 I915_READ(dspbase);
1470 I915_WRITE(dspsurf, Start);
1471 I915_READ(dspsurf);
1472 I915_WRITE(dsptileoff, (y << 16) | x);
1473 } else {
1474 I915_WRITE(dspbase, Start + Offset);
1475 I915_READ(dspbase);
1476 }
1477
1478 if ((IS_I965G(dev) || plane == 0))
1479 intel_update_fbc(crtc, &crtc->mode);
1480
1481 intel_wait_for_vblank(dev);
1482 intel_increase_pllclock(crtc, true);
1483
1484 return 0;
1485}
1486
1388static int 1487static int
1389intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, 1488intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
1390 struct drm_framebuffer *old_fb) 1489 struct drm_framebuffer *old_fb)
@@ -5040,6 +5139,7 @@ static const struct drm_crtc_helper_funcs intel_helper_funcs = {
5040 .mode_fixup = intel_crtc_mode_fixup, 5139 .mode_fixup = intel_crtc_mode_fixup,
5041 .mode_set = intel_crtc_mode_set, 5140 .mode_set = intel_crtc_mode_set,
5042 .mode_set_base = intel_pipe_set_base, 5141 .mode_set_base = intel_pipe_set_base,
5142 .mode_set_base_atomic = intel_pipe_set_base_atomic,
5043 .prepare = intel_crtc_prepare, 5143 .prepare = intel_crtc_prepare,
5044 .commit = intel_crtc_commit, 5144 .commit = intel_crtc_commit,
5045 .load_lut = intel_crtc_load_lut, 5145 .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 1d2d67ce4a84..7bdc96256bf5 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,
@@ -130,7 +132,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
130 132
131 strcpy(info->fix.id, "inteldrmfb"); 133 strcpy(info->fix.id, "inteldrmfb");
132 134
133 info->flags = FBINFO_DEFAULT; 135 info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
134 info->fbops = &intelfb_ops; 136 info->fbops = &intelfb_ops;
135 137
136 /* setup aperture base/size for vesafb takeover */ 138 /* setup aperture base/size for vesafb takeover */
@@ -148,8 +150,6 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
148 info->fix.smem_start = dev->mode_config.fb_base + obj_priv->gtt_offset; 150 info->fix.smem_start = dev->mode_config.fb_base + obj_priv->gtt_offset;
149 info->fix.smem_len = size; 151 info->fix.smem_len = size;
150 152
151 info->flags = FBINFO_DEFAULT;
152
153 info->screen_base = ioremap_wc(dev->agp->base + obj_priv->gtt_offset, 153 info->screen_base = ioremap_wc(dev->agp->base + obj_priv->gtt_offset,
154 size); 154 size);
155 if (!info->screen_base) { 155 if (!info->screen_base) {
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 8b2bfc005c59..d9d4d51aa89e 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -392,13 +392,13 @@ static void intel_sdvo_debug_write(struct intel_encoder *intel_encoder, u8 cmd,
392 DRM_LOG_KMS("%02X ", ((u8 *)args)[i]); 392 DRM_LOG_KMS("%02X ", ((u8 *)args)[i]);
393 for (; i < 8; i++) 393 for (; i < 8; i++)
394 DRM_LOG_KMS(" "); 394 DRM_LOG_KMS(" ");
395 for (i = 0; i < sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]); i++) { 395 for (i = 0; i < ARRAY_SIZE(sdvo_cmd_names); i++) {
396 if (cmd == sdvo_cmd_names[i].cmd) { 396 if (cmd == sdvo_cmd_names[i].cmd) {
397 DRM_LOG_KMS("(%s)", sdvo_cmd_names[i].name); 397 DRM_LOG_KMS("(%s)", sdvo_cmd_names[i].name);
398 break; 398 break;
399 } 399 }
400 } 400 }
401 if (i == sizeof(sdvo_cmd_names)/ sizeof(sdvo_cmd_names[0])) 401 if (i == ARRAY_SIZE(sdvo_cmd_names))
402 DRM_LOG_KMS("(%02X)", cmd); 402 DRM_LOG_KMS("(%02X)", cmd);
403 DRM_LOG_KMS("\n"); 403 DRM_LOG_KMS("\n");
404} 404}
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d61ffbc381e5..cc3726a4a1cb 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1422,7 +1422,7 @@ intel_tv_get_modes(struct drm_connector *connector)
1422 int j, count = 0; 1422 int j, count = 0;
1423 u64 tmp; 1423 u64 tmp;
1424 1424
1425 for (j = 0; j < sizeof(input_res_table) / sizeof(input_res_table[0]); 1425 for (j = 0; j < ARRAY_SIZE(input_res_table);
1426 j++) { 1426 j++) {
1427 struct input_res *input = &input_res_table[j]; 1427 struct input_res *input = &input_res_table[j];
1428 unsigned int hactive_s = input->w; 1428 unsigned int hactive_s = input->w;