summaryrefslogtreecommitdiff
path: root/linux
AgeCommit message (Collapse)Author
2004-08-29fix up some small things ffb (no idea if it works or not ..)Dave Airlie
2004-08-29remove hacky context thing that was gamma onlyDave Airlie
2004-08-29Drop GAMMA DRM from a great height ...Dave Airlie
2004-08-29fixup issue caused by fntbl-2 mergeDave Airlie
2004-08-28Initialize pdev to NULL correctly so that pci_get_subsys() will work.Jon Smirl
2004-08-27run i915 through lindentDave Airlie
2004-08-27__NO_VERSION__ hasn't been needed since 2.3 days ditch it...Dave Airlie
2004-08-27Make DRM detect vesafb and revert to stealth mode to avoid resourceJon Smirl
conflicts
2004-08-24Merged drmfntbl-0-0-2Dave Airlie
2004-08-24addmap-base-2 patch from Jon Smirl:Dave Airlie
sets up the DRM to have the ability to have permanent maps while the driver is loaded...
2004-08-24This patch adds three new ioctl's to the VIA Unichrome/Pro DRM driver:Erdi Chen
DRM_IOCTL_VIA_DMA_INIT DRM_IOCTL_VIA_CMDBUFFER DRM_IOCTL_VIA_FLUSH The first ioctl sets up an area in AGP memory that will be used as the ring buffer. The second ioctl copies a command buffer from user space memory to the ring buffer. The third ioctl waits for engine idle until it returns. The motivation for this patch is to avoid the wait for engine idle call before each buffer flush in the current DRI driver. With this patch, the DRI driver can continue to flush its buffer as long as there is free space in the ring buffer. This patch adds an additional copy operation on the command buffer. This buffer copying is necessary to support multiple DRI clients rendering simultaneously. Otherwise, more CPU time will be spent in the busy loop waiting for engine idle between DRI context switch. Even in the single client case, the tradeoff is reasonable in comparision to the kernel call to check for free buffer space for the client to render directly to the ring buffer.
2004-08-17Merged drmfntbl-0-0-1Dave Airlie
2004-08-172.6.8.1 has changed the links in /lib/modulesDave Airlie
2004-08-15Fix warning about unused ddev variableJon Smirl
2004-08-15Add dev to DRIVER_CTX_DTOR( dev, pos->handle) so that sis driver willJon Smirl
compile #if 0 get_pci_driver use in hotplug function until fbdev work around is written
2004-08-14Add a "dev" argument to DRIVER_CTX_[CD]TOR. This will be used in anEric Anholt
upcoming commit for the SiS driver.
2004-08-11minor patch from Jon Smirl : sets up some things for later useDave Airlie
2004-08-10Patch from Jon Smirl to add attribute field to the pciids, and use this forDave Airlie
certain radeon combinations - intel drivers can probably use this for dual head capable devices etc..
2004-08-042.4 compatDave Airlie
2004-08-042.4 hotplug compatDave Airlie
2004-08-03fix for drm in /proc - from Jon SmirlDave Airlie
2004-07-31Add a hotplug event to DRM. Parameters match the ones from the general PCIJon Smirl
hotplug event plus the addition of one requesting RESET. Put your scripts in /etc/hotplug.d/drm to run. kernel class_simple generates the ADD/REMOVE events. No cards currently request RESET, the flag is there to stop you from resetting your boot display.
2004-07-31fixes for using userspace pointers found by sparse utilityDave Airlie
From: Dave Airlie
2004-07-31athe patch below optimises the drm code to not do put_user() on memory theDave Airlie
kernel allocated and then mmap-installed to userspace, but instead makes it use the kernel virtual address directly instead. From: Arjan van de Ven <arjanv@redhat.com>
2004-07-25sync up with current 2.6 kernel bk tree - mostly __user annotationsDave Airlie
2004-07-25whitespace merge with kernelDave Airlie
2004-07-25if the driver has already register don't do another intermodule registerDave Airlie
2004-07-25Patch from Tom Arbuckle for missing bus_addressDave Airlie
2004-07-22another logic error returns 0 or greater for successDave Airlie
2004-07-21ATI Rage 128 and Radeon DRM unconditionally depend on PCIDave Airlie
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2004-07-21add some more debugging fix ++ and --Dave Airlie
2004-07-20first set of __user annotations from kernel (Al Viro)Dave Airlie
2004-07-20Kconfig update add i915 bring over some stuff from kernelDave Airlie
2004-07-20add x86_64 architecture defines from kernel (leave AMD64 defines in forDave Airlie
backwards compat)
2004-07-20fix some more NULLs from kernelDave Airlie
2004-07-20attempt to clean up stub_register, register_chrdev isn't good enough toDave Airlie
make the decision for multiple cards with one drm ..
2004-07-15sparse cleanups from kernel: Al ViroDave Airlie
2004-07-14Fix reference counting for stub for new Linux PCI probeDave Airlie
2004-07-14allow O= usage for Linux 2.6 kernel building in another directoryDave Airlie
2004-07-11split out backwards compat into a separate file makes it easier for mergingDave Airlie
to 2.6
2004-07-11fix issue in 2.4 kernels with returning NULL from this functionDave Airlie
2004-07-08Add two items to Makefile clean XFree86 bug: Reported by: Submitted by:Jon Smirl
Reviewed by: Obtained from:
2004-07-05fixes from kernel for 0 vs NULL - mikaDave Airlie
2004-06-21fix bug with pci_disable_device in the wrong place (Paul Mackerras) removeDave Airlie
hack code from me..
2004-06-12dirty hack to make mach64 work, (don't worry I'll get around to fixing itDave Airlie
asap..)
2004-06-10A few changes for recent redhat.Keith Whitwell
2004-06-10i915 drm moduleKeith Whitwell
2004-06-10gamma_dma_priority and gamma_dma_send_buffers both deref d->send_indicesDave Airlie
and/or d->send_sizes. When these functions are called from gamma_dma, these pointers are user pointers and are thus not safe to deref. This patch copies over the pointers inside gamma_dma_priority and gamma_dma_send_buffers. Submitted-by: Robert T. Johnson <rtjohnso@eecs.berkeley.edu> Signed-off-by: Dave Airlie <airlied@linux.ie>
2004-06-07The dev->devname being passed to request_irq in drm_irq.h is null. With theDave Airlie
old DRM interface, the devname was set in DRM(setunique), but with the current DRM interface >=1.1 the devname is not being set in DRM(set_busid). From: Alan Swanson Approved-by: Dave Airlie <airlied@linux.ie>
2004-05-302.4 compatDave Airlie
='n628' href='#n628'>628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903
/* mach64_state.c -- State support for mach64 (Rage Pro) driver -*- linux-c -*-
 * Created: Sun Dec 03 19:20:26 2000 by gareth@valinux.com
 */
/*
 * Copyright 2000 Gareth Hughes
 * Copyright 2002-2003 Leif Delgass
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT OWNER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors:
 *    Gareth Hughes <gareth@valinux.com>
 *    Leif Delgass <ldelgass@retinalburn.net>
 *    Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
 */

#include "drmP.h"
#include "drm.h"
#include "mach64_drm.h"
#include "mach64_drv.h"

/* Interface history:
 *
 * 1.0 - Initial mach64 DRM
 *
 */
struct drm_ioctl_desc mach64_ioctls[] = {
	[DRM_IOCTL_NR(DRM_MACH64_INIT)] = {mach64_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
	[DRM_IOCTL_NR(DRM_MACH64_CLEAR)] = {mach64_dma_clear, DRM_AUTH},
	[DRM_IOCTL_NR(DRM_MACH64_SWAP)] = {mach64_dma_swap, DRM_AUTH},
	[DRM_IOCTL_NR(DRM_MACH64_IDLE)] = {mach64_dma_idle, DRM_AUTH},
	[DRM_IOCTL_NR(DRM_MACH64_RESET)] = {mach64_engine_reset, DRM_AUTH},
	[DRM_IOCTL_NR(DRM_MACH64_VERTEX)] = {mach64_dma_vertex, DRM_AUTH},
	[DRM_IOCTL_NR(DRM_MACH64_BLIT)] = {mach64_dma_blit, DRM_AUTH},
	[DRM_IOCTL_NR(DRM_MACH64_FLUSH)] = {mach64_dma_flush, DRM_AUTH},
	[DRM_IOCTL_NR(DRM_MACH64_GETPARAM)] = {mach64_get_param, DRM_AUTH},
};

int mach64_max_ioctl = DRM_ARRAY_SIZE(mach64_ioctls);

/* ================================================================
 * DMA hardware state programming functions
 */

static void mach64_print_dirty(const char *msg, unsigned int flags)
{
	DRM_DEBUG("%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\n",
		  msg,
		  flags,
		  (flags & MACH64_UPLOAD_DST_OFF_PITCH) ? "dst_off_pitch, " :
		  "",
		  (flags & MACH64_UPLOAD_Z_ALPHA_CNTL) ? "z_alpha_cntl, " : "",
		  (flags & MACH64_UPLOAD_SCALE_3D_CNTL) ? "scale_3d_cntl, " :
		  "", (flags & MACH64_UPLOAD_DP_FOG_CLR) ? "dp_fog_clr, " : "",
		  (flags & MACH64_UPLOAD_DP_WRITE_MASK) ? "dp_write_mask, " :
		  "",
		  (flags & MACH64_UPLOAD_DP_PIX_WIDTH) ? "dp_pix_width, " : "",
		  (flags & MACH64_UPLOAD_SETUP_CNTL) ? "setup_cntl, " : "",
		  (flags & MACH64_UPLOAD_MISC) ? "misc, " : "",
		  (flags & MACH64_UPLOAD_TEXTURE) ? "texture, " : "",
		  (flags & MACH64_UPLOAD_TEX0IMAGE) ? "tex0 image, " : "",
		  (flags & MACH64_UPLOAD_TEX1IMAGE) ? "tex1 image, " : "",
		  (flags & MACH64_UPLOAD_CLIPRECTS) ? "cliprects, " : "");
}

/* Mach64 doesn't have hardware cliprects, just one hardware scissor,
 * so the GL scissor is intersected with each cliprect here
 */
/* This function returns 0 on success, 1 for no intersection, and
 * negative for an error
 */
static int mach64_emit_cliprect(DRMFILE filp, drm_mach64_private_t * dev_priv,
				struct drm_clip_rect * box)
{
	u32 sc_left_right, sc_top_bottom;
	struct drm_clip_rect scissor;
	drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
	drm_mach64_context_regs_t *regs = &sarea_priv->context_state;
	DMALOCALS;

	DRM_DEBUG("%s: box=%p\n", __FUNCTION__, box);

	/* Get GL scissor */
	/* FIXME: store scissor in SAREA as a cliprect instead of in
	 * hardware format, or do intersection client-side
	 */
	scissor.x1 = regs->sc_left_right & 0xffff;
	scissor.x2 = (regs->sc_left_right & 0xffff0000) >> 16;
	scissor.y1 = regs->sc_top_bottom & 0xffff;
	scissor.y2 = (regs->sc_top_bottom & 0xffff0000) >> 16;

	/* Intersect GL scissor with cliprect */
	if (box->x1 > scissor.x1)
		scissor.x1 = box->x1;
	if (box->y1 > scissor.y1)
		scissor.y1 = box->y1;
	if (box->x2 < scissor.x2)
		scissor.x2 = box->x2;
	if (box->y2 < scissor.y2)
		scissor.y2 = box->y2;
	/* positive return means skip */
	if (scissor.x1 >= scissor.x2)
		return 1;
	if (scissor.y1 >= scissor.y2)
		return 1;

	DMAGETPTR(filp, dev_priv, 2);	/* returns on failure to get buffer */

	sc_left_right = ((scissor.x1 << 0) | (scissor.x2 << 16));
	sc_top_bottom = ((scissor.y1 << 0) | (scissor.y2 << 16));

	DMAOUTREG(MACH64_SC_LEFT_RIGHT, sc_left_right);
	DMAOUTREG(MACH64_SC_TOP_BOTTOM, sc_top_bottom);

	DMAADVANCE(dev_priv, 1);

	return 0;
}

static __inline__ int mach64_emit_state(DRMFILE filp,
					drm_mach64_private_t * dev_priv)
{
	drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
	drm_mach64_context_regs_t *regs = &sarea_priv->context_state;
	unsigned int dirty = sarea_priv->dirty;
	u32 offset = ((regs->tex_size_pitch & 0xf0) >> 2);
	DMALOCALS;

	if (MACH64_VERBOSE) {
		mach64_print_dirty(__FUNCTION__, dirty);
	} else {