Skip to content

Commit

Permalink
nouveau: imported nouveau (out of tree module) patched for gdev
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinpei Kato committed Mar 8, 2012
1 parent a993703 commit 598985d
Show file tree
Hide file tree
Showing 576 changed files with 341,088 additions and 15 deletions.
32 changes: 18 additions & 14 deletions common/gdev_nvidia_nvc0.c
Expand Up @@ -405,24 +405,28 @@ static void nvc0_init(struct gdev_ctx *ctx)
struct gdev_vas *vas = ctx->vas;
struct gdev_device *gdev = vas->gdev;

/* setup subchannels. */
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_COMPUTE, 0, 1);
__gdev_out_ring(ctx, 0x90c0); /* COMPUTE */
#ifdef GDEV_NVIDIA_MEMCPY_PCOPY
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_PCOPY0, 0, 1);
__gdev_out_ring(ctx, 0x490b5); /* PCOPY0 */
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_PCOPY1, 0, 1);
__gdev_out_ring(ctx, 0x590b8 /* 0x590b5 */); /* PCOPY1 */
#else
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_M2MF, 0, 1);
__gdev_out_ring(ctx, 0x9039); /* M2MF */
#endif
__gdev_fire_ring(ctx);

/* initialize the fence values. */
for (i = 0; i < GDEV_FENCE_COUNT; i++)
nvc0_fence_reset(ctx, i);

/* set each subchannel twice - it ensures there are no ghost commands
remaining at least in the second setup. */
for (i = 0; i < 2; i++) {
/* setup subchannels. */
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_COMPUTE, 0, 1);
__gdev_out_ring(ctx, 0x90c0); /* COMPUTE */
#ifdef GDEV_NVIDIA_MEMCPY_PCOPY
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_PCOPY0, 0, 1);
__gdev_out_ring(ctx, 0x490b5); /* PCOPY0 */
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_PCOPY1, 0, 1);
__gdev_out_ring(ctx, 0x590b8 /* 0x590b5 */); /* PCOPY1 */
#else
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_M2MF, 0, 1);
__gdev_out_ring(ctx, 0x9039); /* M2MF */
#endif
__gdev_fire_ring(ctx);
}

/* the blob places NOP at the beginning. */
__gdev_begin_ring_nvc0(ctx, GDEV_SUBCH_NV_COMPUTE, 0x100, 1);
__gdev_out_ring(ctx, 0); /* GRAPH_NOP */
Expand Down
1 change: 1 addition & 0 deletions driver/gdev/gdev_fops.c
Expand Up @@ -26,6 +26,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

#include <linux/module.h>
#include <linux/version.h>
#include "gdev_api.h"
#include "gdev_device.h"
Expand Down
122 changes: 122 additions & 0 deletions driver/nouveau/Makefile
@@ -0,0 +1,122 @@
# This Makefile is loosely based on the drm.git/linux-core/Makefile and
# the preliminary work by Christopher James Halse Rogers.
# Edited by Pekka Paalanen <pq@iki.fi>

# By default, the build is done against the running linux kernel source.
# To build against a different kernel source tree, set LINUXDIR:
#
# make LINUXDIR=/path/to/kernel/source

# By default, it is assumed the Nouveau kernel tree is found in $PWD/../.
# To use a different path to the Nouveau kernel tree, set NOUVEAUROOTDIR:
#
# make NOUVEAUROOTDIR=/path/to/nouveau/linux-2.6

# 'make headers' will install the headers by default to
# $NOUVEAUROOTDIR/usr/include/drm. To use a different location,
# set HEADERINSDIR:
#
# make HEADERINSDIR=/path/to/install/headers

ifndef LINUXDIR
RUNNING_REL := $(shell uname -r)

LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/build ]; then \
echo /lib/modules/$(RUNNING_REL)/build; \
else echo /lib/modules/$(RUNNING_REL)/source; fi)
endif

NOUVEAUGITREMOTE ?= origin
NOUVEAUROOTDIR ?= $(CURDIR)/..
override NOUVEAUROOTDIR := $(abspath $(NOUVEAUROOTDIR))
HEADERINSDIR ?= $(NOUVEAUROOTDIR)/usr/include/drm
override HEADERINSDIR := $(abspath $(HEADERINSDIR))

TESTFILE := include/drm/nouveau_drm.h
ifeq ($(wildcard $(NOUVEAUROOTDIR)/$(TESTFILE)),)
$(error $(NOUVEAUROOTDIR) does not look like the right kernel tree, \
please set NOUVEAUROOTDIR)
endif

GIT_REVISION := $(shell GIT_DIR=$(NOUVEAUROOTDIR)/.git \
git describe --always --abbrev=17 2> /dev/null)

DRMINC := $(NOUVEAUROOTDIR)/include/drm
DRMDIR := $(NOUVEAUROOTDIR)/drivers/gpu/drm
DRMCFG := \
CONFIG_DRM=m \
CONFIG_DRM_KMS_HELPER=m \
CONFIG_DRM_TTM=m \
CONFIG_DRM_NOUVEAU=m \
CONFIG_DRM_NOUVEAU_KMS=n \
CONFIG_DRM_NOUVEAU_BACKLIGHT=y \
CONFIG_DRM_NOUVEAU_DEBUG=y \
CONFIG_DRM_I2C_CH7006=m \
CONFIG_DRM_I2C_SIL164=m \
CONFIG_DRM_TDFX=n \
CONFIG_DRM_R128=n \
CONFIG_DRM_RADEON=n \
CONFIG_DRM_MGA=n \
CONFIG_DRM_I810=n \
CONFIG_DRM_I830=n \
CONFIG_DRM_I915=n \
CONFIG_DRM_SIS=n \
CONFIG_DRM_SAVAGE=n \
CONFIG_DRM_VIA=n \
CONFIG_DRM_VMWGFX=n

EXTRA_CFLAGS :=
MYEXTRA_CFLAGS :=
MYEXTRA_CFLAGS += -DCONFIG_DRM_NOUVEAU_BACKLIGHT
MYEXTRA_CFLAGS += -DCONFIG_DRM_NOUVEAU_DEBUG

ifneq ($(GIT_REVISION),)
MYEXTRA_CFLAGS += '-DGIT_REVISION=\"$(GIT_REVISION)\"'
endif

MYPARMS := -C $(LINUXDIR) KCPPFLAGS="-I$(DRMINC)" SUBDIRS="$(DRMDIR)" $(DRMCFG)

MYEXTRA_CFLAGS += $(EXTRA_CFLAGS)
ifneq ($(MYEXTRA_CFLAGS),)
MYPARMS += EXTRA_CFLAGS="$(MYEXTRA_CFLAGS)"
endif

# include user headers information
unifdef-y :=
include $(DRMINC)/Kbuild


.PHONY: all modules install clean archive headers FORCE

all: modules
FORCE:

modules:
$(MAKE) $(MYPARMS) modules

install:
$(MAKE) $(MYPARMS) modules_install

clean:
$(MAKE) $(MYPARMS) clean

headers:
mkdir -p $(HEADERINSDIR)
cd $(LINUXDIR) && \
perl scripts/headers_install.pl $(DRMINC) $(HEADERINSDIR) dummy \
$(unifdef-y)

archive: newttm-devel-compat.tar.gz newttm-devel.tar.gz master.tar.gz

newttm-devel-compat.tar.gz: EXTRAS=nouveau README-nouveau

%.tar: FORCE
GIT_DIR=$(NOUVEAUROOTDIR)/.git \
git archive --format=tar --prefix=$*/ $(NOUVEAUGITREMOTE)/$* \
drivers/gpu/drm include/drm $(EXTRAS) > $@

%.tar.gz: %.tar
gzip -9 -c $< > $@

# The commit id of the archive can be read with
# $ zcat foo.tar.gz | git get-tar-commit-id
167 changes: 167 additions & 0 deletions driver/nouveau/drivers/gpu/drm/Kconfig
@@ -0,0 +1,167 @@
#
# Drm device configuration
#
# This driver provides support for the
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
#
menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU
select I2C
select I2C_ALGOBIT
help
Kernel-level support for the Direct Rendering Infrastructure (DRI)
introduced in XFree86 4.0. If you say Y here, you need to select
the module that's right for your graphics card from the list below.
These modules provide support for synchronization, security, and
DMA transfers. Please see <http://dri.sourceforge.net/> for more
details. You should also select and configure AGP
(/dev/agpgart) support if it is available for your platform.

config DRM_KMS_HELPER
tristate
depends on DRM
select FB
select FRAMEBUFFER_CONSOLE if !EXPERT
select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
help
FB and CRTC helpers for KMS drivers.

config DRM_TTM
tristate
depends on DRM
help
GPU memory management subsystem for devices with multiple
GPU memory types. Will be enabled automatically if a device driver
uses it.

config DRM_TDFX
tristate "3dfx Banshee/Voodoo3+"
depends on DRM && PCI
help
Choose this option if you have a 3dfx Banshee or Voodoo3 (or later),
graphics card. If M is selected, the module will be called tdfx.

config DRM_R128
tristate "ATI Rage 128"
depends on DRM && PCI
select FW_LOADER
help
Choose this option if you have an ATI Rage 128 graphics card. If M
is selected, the module will be called r128. AGP support for
this card is strongly suggested (unless you have a PCI version).

config DRM_RADEON
tristate "ATI Radeon"
depends on DRM && PCI
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
select FW_LOADER
select DRM_KMS_HELPER
select DRM_TTM
select POWER_SUPPLY
select HWMON
help
Choose this option if you have an ATI Radeon graphics card. There
are both PCI and AGP versions. You don't need to choose this to
run the Radeon in plain VGA mode.

If M is selected, the module will be called radeon.

source "drivers/gpu/drm/radeon/Kconfig"

config DRM_I810
tristate "Intel I810"
# !PREEMPT because of missing ioctl locking
depends on DRM && AGP && AGP_INTEL && (!PREEMPT || BROKEN)
help
Choose this option if you have an Intel I810 graphics card. If M is
selected, the module will be called i810. AGP support is required
for this driver to work.

config DRM_I915
tristate "Intel 8xx/9xx/G3x/G4x/HD Graphics"
depends on DRM
depends on AGP
depends on AGP_INTEL
# we need shmfs for the swappable backing store, and in particular
# the shmem_readpage() which depends upon tmpfs
select SHMEM
select TMPFS
select DRM_KMS_HELPER
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
# i915 depends on ACPI_VIDEO when ACPI is enabled
# but for select to work, need to select ACPI_VIDEO's dependencies, ick
select BACKLIGHT_LCD_SUPPORT if ACPI
select BACKLIGHT_CLASS_DEVICE if ACPI
select VIDEO_OUTPUT_CONTROL if ACPI
select INPUT if ACPI
select ACPI_VIDEO if ACPI
select ACPI_BUTTON if ACPI
help
Choose this option if you have a system that has "Intel Graphics
Media Accelerator" or "HD Graphics" integrated graphics,
including 830M, 845G, 852GM, 855GM, 865G, 915G, 945G, 965G,
G35, G41, G43, G45 chipsets and Celeron, Pentium, Core i3,
Core i5, Core i7 as well as Atom CPUs with integrated graphics.
If M is selected, the module will be called i915. AGP support
is required for this driver to work. This driver is used by
the Intel driver in X.org 6.8 and XFree86 4.4 and above. It
replaces the older i830 module that supported a subset of the
hardware in older X.org releases.

Note that the older i810/i815 chipsets require the use of the
i810 driver instead, and the Atom z5xx series has an entirely
different implementation.

config DRM_I915_KMS
bool "Enable modesetting on intel by default"
depends on DRM_I915
help
Choose this option if you want kernel modesetting enabled by default,
and you have a new enough userspace to support this. Running old
userspaces with this enabled will cause pain. Note that this causes
the driver to bind to PCI devices, which precludes loading things
like intelfb.

config DRM_MGA
tristate "Matrox g200/g400"
depends on DRM && PCI
select FW_LOADER
help
Choose this option if you have a Matrox G200, G400 or G450 graphics
card. If M is selected, the module will be called mga. AGP
support is required for this driver to work.

config DRM_SIS
tristate "SiS video cards"
depends on DRM && AGP
depends on FB_SIS || FB_SIS=n
help
Choose this option if you have a SiS 630 or compatible video
chipset. If M is selected the module will be called sis. AGP
support is required for this driver to work.

config DRM_VIA
tristate "Via unichrome video cards"
depends on DRM && PCI
help
Choose this option if you have a Via unichrome or compatible video
chipset. If M is selected the module will be called via.

config DRM_SAVAGE
tristate "Savage video cards"
depends on DRM && PCI
help
Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
chipset. If M is selected the module will be called savage.

source "drivers/gpu/drm/exynos/Kconfig"

source "drivers/gpu/drm/vmwgfx/Kconfig"

source "drivers/gpu/drm/gma500/Kconfig"

40 changes: 40 additions & 0 deletions driver/nouveau/drivers/gpu/drm/Makefile
@@ -0,0 +1,40 @@
#
# Makefile for the drm device driver. This driver provides support for the
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.

ccflags-y := -Iinclude/drm

drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
drm_context.o drm_dma.o \
drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
drm_crtc.o drm_modes.o drm_edid.o \
drm_info.o drm_debugfs.o drm_encoder_slave.o \
drm_trace_points.o drm_global.o drm_usb.o

drm-$(CONFIG_COMPAT) += drm_ioc32.o

drm_kms_helper-y := drm_fb_helper.o drm_crtc_helper.o drm_dp_i2c_helper.o

obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o

CFLAGS_drm_trace_points.o := -I$(src)

obj-$(CONFIG_DRM) += drm.o
obj-$(CONFIG_DRM_TTM) += ttm/
obj-$(CONFIG_DRM_TDFX) += tdfx/
obj-$(CONFIG_DRM_R128) += r128/
obj-$(CONFIG_DRM_RADEON)+= radeon/
obj-$(CONFIG_DRM_MGA) += mga/
obj-$(CONFIG_DRM_I810) += i810/
obj-$(CONFIG_DRM_I915) += i915/
obj-$(CONFIG_DRM_SIS) += sis/
obj-$(CONFIG_DRM_SAVAGE)+= savage/
obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/
obj-$(CONFIG_DRM_VIA) +=via/
obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/
obj-$(CONFIG_DRM_EXYNOS) +=exynos/
obj-$(CONFIG_DRM_GMA500) += gma500/
obj-y += i2c/

0 comments on commit 598985d

Please sign in to comment.