summaryrefslogtreecommitdiff
path: root/shared-core/i915_init.c
AgeCommit message (Expand)Author
2007-09-25Hack out i915_mem_takedownJesse Barnes
2007-09-24Merge branch 'master' into modesetting-101 - TTM & typedef removalJesse Barnes
2007-06-29Move out the code from i915_dma_cleanup to unload to matchAlan Hourihane
2007-06-29merge fixesAlan Hourihane
2007-06-29Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into mode...Alan Hourihane
2007-05-22Call preallocated space VRAM instead of PRIV0 to be more consistent withJesse Barnes
2007-05-17Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm ...Jesse Barnes
2007-05-17Fix FB pitch value (we had it wrong and were working around it in a fewJesse Barnes
2007-05-10Just some minor cleanups.Alan Hourihane
2007-04-18clean up ring buffer and TTM in i915_driver_unloadDavid Airlie
2007-04-17Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm ...Jesse Barnes
2007-04-17Move initial framebuffer allocation and configuration to drm_initial_config,Jesse Barnes
2007-04-17Correct PCI ID for i845Alan Hourihane
2007-04-17another large overhaul of interactions with userspace...Dave Airlie
2007-04-14Fix PRIV0 memory initialization (mm_init takes pages, not bytes), align fbJesse Barnes
2007-04-13i915/drm: clean up a lot of the i915/drm startup/teardown sequencesDavid Airlie
2007-04-12Initialize the hw lock waitqueue so we don't hang in drm_lastclose.Jesse Barnes
2007-04-12Don't use drm_setup, do SAREA allocation and mapping directly instead.Jesse Barnes
2007-04-11Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm ...Jesse Barnes
2007-04-11Remove debug statement about buffer objectsJesse Barnes
2007-04-12only initialise modes when fbcon or fbset asks for itDave Airlie
2007-04-11Use new kernel buffer object type and cleanup agp probing.Jesse Barnes
2007-04-11Add aperture size and preallocation probing (from intelfb), cleanup load code...Jesse Barnes
2007-04-11fix modeset cleanup for LVDS and reenable it in i915.Jesse Barnes
2007-04-11Various changes for in-kernel modesetting:Jesse Barnes
2007-04-11add initial drm_fb framebufferDave Airlie
2007-04-11comment out unworkable codeDave Airlie
2007-04-11use the baseaddr at leastDave Airlie
2007-04-10Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm ...Jesse Barnes
2007-04-10Move i915 init code to new file, i915_init.c, and create a new high levelJesse Barnes
lass="hl kwb">struct nv50_crtc *crtc) { struct mem_block *block; struct drm_file *file_priv = kzalloc(sizeof(struct drm_file), GFP_KERNEL); uint32_t flags = NOUVEAU_MEM_FB | NOUVEAU_MEM_MAPPED; int rval = 0; NV50_DEBUG("\n"); if (!file_priv) return -ENOMEM; /* Any file_priv should do as it's pointer is used as identification. */ block = nouveau_mem_alloc(crtc->dev, 0, 4096, flags, file_priv); if (!block) { rval = -ENOMEM; goto out; } crtc->lut->block = block; return 0; out: if (file_priv) kfree(file_priv); return rval; } static int nv50_lut_free(struct nv50_crtc *crtc) { struct drm_file *file_priv = crtc->lut->block->file_priv; NV50_DEBUG("\n"); nouveau_mem_free(crtc->dev, crtc->lut->block); kfree(file_priv); return 0; } #define NV50_LUT_INDEX(val, w) ((val << (8 - w)) | (val >> ((w << 1) - 8))) static int nv50_lut_set(struct nv50_crtc *crtc, uint16_t *red, uint16_t *green, uint16_t *blue) { uint32_t index = 0, i; struct drm_nouveau_private *dev_priv = crtc->dev->dev_private; void __iomem *lut = NULL; NV50_DEBUG("\n"); if (!crtc->lut || !crtc->lut->block) { DRM_ERROR("Something wrong with the LUT\n"); return -EINVAL; } /* 16 bits, red, green, blue, unused, total of 64 bits per index */ /* maybe switch to ioremap_wc once it becomes available. */ lut = ioremap(dev_priv->fb_phys + crtc->lut->block->start, crtc->lut->block->size); if (!lut) { DRM_ERROR("ioremap failed on LUT\n"); return -EINVAL; } /* 10 bits lut, with 14 bits values. */ switch (crtc->fb->depth) { case 15: /* R5G5B5 */ for (i = 0; i < 32; i++) { index = NV50_LUT_INDEX(i, 5); writew(red[i] >> 2, lut + 8*index + 0); writew(green[i] >> 2, lut + 8*index + 2); writew(blue[i] >> 2, lut + 8*index + 4); } break; case 16: /* R5G6B5 */ for (i = 0; i < 32; i++) { index = NV50_LUT_INDEX(i, 5); writew(red[i] >> 2, lut + 8*index + 0); writew(blue[i] >> 2, lut + 8*index + 4); } /* Green has an extra bit. */ for (i = 0; i < 64; i++) { index = NV50_LUT_INDEX(i, 6); writew(green[i] >> 2, lut + 8*index + 2); } break; default: /* R8G8B8 */ for (i = 0; i < 256; i++) { writew(red[i] >> 2, lut + 8*i + 0); writew(green[i] >> 2, lut + 8*i + 2); writew(blue[i] >> 2, lut + 8*i + 4); } break; } crtc->lut->depth = crtc->fb->depth; /* Cleaning time. */ iounmap(lut); return 0; } int nv50_lut_create(struct nv50_crtc *crtc) { int rval = 0; NV50_DEBUG("\n"); if (!crtc) return -EINVAL; crtc->lut = kzalloc(sizeof(struct nv50_lut), GFP_KERNEL); if (!crtc->lut) return -ENOMEM; rval = nv50_lut_alloc(crtc); if (rval != 0) { goto out; } /* lut will be inited when fb is bound */ crtc->lut->depth = 0; /* function pointers */ crtc->lut->set = nv50_lut_set; return 0; out: if (crtc->lut) kfree(crtc->lut); return rval; } int nv50_lut_destroy(struct nv50_crtc *crtc) { int rval = 0; NV50_DEBUG("\n"); if (!crtc) return -EINVAL; rval = nv50_lut_free(crtc); kfree(crtc->lut); crtc->lut = NULL; if (rval != 0) return rval; return 0; }