aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500/cdv_intel_display.c
diff options
context:
space:
mode:
authorPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2013-07-10 11:58:04 -0400
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2013-07-23 19:47:21 -0400
commit3c447166536c80209f0dcb300cdffd76686187aa (patch)
treea955ba4a4e0360c1ba595883a9d5e38954b4bf3e /drivers/gpu/drm/gma500/cdv_intel_display.c
parent4855177ed0d94621eaf1c6bec64f16318a8be5fe (diff)
drm/gma500/cdv: Convert to gma_pipe_set_base()
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/gma500/cdv_intel_display.c')
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_display.c77
1 files changed, 1 insertions, 76 deletions
diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index ae57b93bdadf..9eee57b3cc59 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -452,81 +452,6 @@ static bool cdv_intel_find_dp_pll(const struct gma_limit_t *limit,
452 return true; 452 return true;
453} 453}
454 454
455static int cdv_intel_pipe_set_base(struct drm_crtc *crtc,
456 int x, int y, struct drm_framebuffer *old_fb)
457{
458 struct drm_device *dev = crtc->dev;
459 struct drm_psb_private *dev_priv = dev->dev_private;
460 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
461 struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
462 int pipe = psb_intel_crtc->pipe;
463 const struct psb_offset *map = &dev_priv->regmap[pipe];
464 unsigned long start, offset;
465 u32 dspcntr;
466 int ret = 0;
467
468 if (!gma_power_begin(dev, true))
469 return 0;
470
471 /* no fb bound */
472 if (!crtc->fb) {
473 dev_err(dev->dev, "No FB bound\n");
474 goto psb_intel_pipe_cleaner;
475 }
476
477
478 /* We are displaying this buffer, make sure it is actually loaded
479 into the GTT */
480 ret = psb_gtt_pin(psbfb->gtt);
481 if (ret < 0)
482 goto psb_intel_pipe_set_base_exit;
483 start = psbfb->gtt->offset;
484 offset = y * crtc->fb->pitches[0] + x * (crtc->fb->bits_per_pixel / 8);
485
486 REG_WRITE(map->stride, crtc->fb->pitches[0]);
487
488 dspcntr = REG_READ(map->cntr);
489 dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
490
491 switch (crtc->fb->bits_per_pixel) {
492 case 8:
493 dspcntr |= DISPPLANE_8BPP;
494 break;
495 case 16:
496 if (crtc->fb->depth == 15)
497 dspcntr |= DISPPLANE_15_16BPP;
498 else
499 dspcntr |= DISPPLANE_16BPP;
500 break;
501 case 24:
502 case 32:
503 dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
504 break;
505 default:
506 dev_err(dev->dev, "Unknown color depth\n");
507 ret = -EINVAL;
508 goto psb_intel_pipe_set_base_exit;
509 }
510 REG_WRITE(map->cntr, dspcntr);
511
512 dev_dbg(dev->dev,
513 "Writing base %08lX %08lX %d %d\n", start, offset, x, y);
514
515 REG_WRITE(map->base, offset);
516 REG_READ(map->base);
517 REG_WRITE(map->surf, start);
518 REG_READ(map->surf);
519
520psb_intel_pipe_cleaner:
521 /* If there was a previous display we can now unpin it */
522 if (old_fb)
523 psb_gtt_unpin(to_psb_fb(old_fb)->gtt);
524
525psb_intel_pipe_set_base_exit:
526 gma_power_end(dev);
527 return ret;
528}
529
530#define FIFO_PIPEA (1 << 0) 455#define FIFO_PIPEA (1 << 0)
531#define FIFO_PIPEB (1 << 1) 456#define FIFO_PIPEB (1 << 1)
532 457
@@ -1596,7 +1521,7 @@ const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = {
1596 .dpms = cdv_intel_crtc_dpms, 1521 .dpms = cdv_intel_crtc_dpms,
1597 .mode_fixup = gma_crtc_mode_fixup, 1522 .mode_fixup = gma_crtc_mode_fixup,
1598 .mode_set = cdv_intel_crtc_mode_set, 1523 .mode_set = cdv_intel_crtc_mode_set,
1599 .mode_set_base = cdv_intel_pipe_set_base, 1524 .mode_set_base = gma_pipe_set_base,
1600 .prepare = gma_crtc_prepare, 1525 .prepare = gma_crtc_prepare,
1601 .commit = gma_crtc_commit, 1526 .commit = gma_crtc_commit,
1602 .disable = gma_crtc_disable, 1527 .disable = gma_crtc_disable,