nv10_fb.c 915 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "drmP.h"
  2. #include "drm.h"
  3. #include "nouveau_drv.h"
  4. #include "nouveau_drm.h"
  5. void
  6. nv10_fb_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
  7. uint32_t size, uint32_t pitch)
  8. {
  9. struct drm_nouveau_private *dev_priv = dev->dev_private;
  10. uint32_t limit = max(1u, addr + size) - 1;
  11. if (pitch) {
  12. if (dev_priv->card_type >= NV_20)
  13. addr |= 1;
  14. else
  15. addr |= 1 << 31;
  16. }
  17. nv_wr32(dev, NV10_PFB_TLIMIT(i), limit);
  18. nv_wr32(dev, NV10_PFB_TSIZE(i), pitch);
  19. nv_wr32(dev, NV10_PFB_TILE(i), addr);
  20. }
  21. int
  22. nv10_fb_init(struct drm_device *dev)
  23. {
  24. struct drm_nouveau_private *dev_priv = dev->dev_private;
  25. struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
  26. int i;
  27. pfb->num_tiles = NV10_PFB_TILE__SIZE;
  28. /* Turn all the tiling regions off. */
  29. for (i = 0; i < pfb->num_tiles; i++)
  30. pfb->set_region_tiling(dev, i, 0, 0, 0);
  31. return 0;
  32. }
  33. void
  34. nv10_fb_takedown(struct drm_device *dev)
  35. {
  36. }