aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-06-05 08:42:42 -0400
committerDave Airlie <airlied@redhat.com>2009-06-14 22:01:53 -0400
commit771fe6b912fca54f03e8a72eb63058b582775362 (patch)
tree58aa5469ba8058c2b564d50807395ad6cd7bd7e4 /include
parentba4e7d973dd09b66912ac4c0856add8b0703a997 (diff)
drm/radeon: introduce kernel modesetting for radeon hardware
Add kernel modesetting support to radeon driver, use the ttm memory manager to manage memory and DRM/GEM to provide userspace API. In order to avoid backward compatibility issue and to allow clean design and code the radeon kernel modesetting use different code path than old radeon/drm driver. When kernel modesetting is enabled the IOCTL of radeon/drm driver are considered as invalid and an error message is printed in the log and they return failure. KMS enabled userspace will use new API to talk with the radeon/drm driver. The new API provide functions to create/destroy/share/mmap buffer object which are then managed by the kernel memory manager (here TTM). In order to submit command to the GPU the userspace provide a buffer holding the command stream, along this buffer userspace have to provide a list of buffer object used by the command stream. The kernel radeon driver will then place buffer in GPU accessible memory and will update command stream to reflect the position of the different buffers. The kernel will also perform security check on command stream provided by the user, we want to catch and forbid any illegal use of the GPU such as DMA into random system memory or into memory not owned by the process supplying the command stream. This part of the code is still incomplete and this why we propose that patch as a staging driver addition, future security might forbid current experimental userspace to run. This code support the following hardware : R1XX,R2XX,R3XX,R4XX,R5XX (radeon up to X1950). Works is underway to provide support for R6XX, R7XX and newer hardware (radeon from HD2XXX to HD4XXX). Authors: Jerome Glisse <jglisse@redhat.com> Dave Airlie <airlied@redhat.com> Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/drm/radeon_drm.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index fe3e3a4b4aed..41862e9a4c20 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -496,6 +496,16 @@ typedef struct {
496#define DRM_RADEON_SETPARAM 0x19 496#define DRM_RADEON_SETPARAM 0x19
497#define DRM_RADEON_SURF_ALLOC 0x1a 497#define DRM_RADEON_SURF_ALLOC 0x1a
498#define DRM_RADEON_SURF_FREE 0x1b 498#define DRM_RADEON_SURF_FREE 0x1b
499/* KMS ioctl */
500#define DRM_RADEON_GEM_INFO 0x1c
501#define DRM_RADEON_GEM_CREATE 0x1d
502#define DRM_RADEON_GEM_MMAP 0x1e
503#define DRM_RADEON_GEM_PREAD 0x21
504#define DRM_RADEON_GEM_PWRITE 0x22
505#define DRM_RADEON_GEM_SET_DOMAIN 0x23
506#define DRM_RADEON_GEM_WAIT_IDLE 0x24
507#define DRM_RADEON_CS 0x26
508#define DRM_RADEON_INFO 0x27
499 509
500#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 510#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
501#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 511#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -524,6 +534,17 @@ typedef struct {
524#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) 534#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
525#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) 535#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
526#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) 536#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
537/* KMS */
538#define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info)
539#define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create)
540#define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap)
541#define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread)
542#define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite)
543#define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain)
544#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
545#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
546#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
547
527 548
528typedef struct drm_radeon_init { 549typedef struct drm_radeon_init {
529 enum { 550 enum {
@@ -682,6 +703,7 @@ typedef struct drm_radeon_indirect {
682#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ 703#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
683#define RADEON_PARAM_FB_LOCATION 14 /* FB location */ 704#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
684#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ 705#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
706#define RADEON_PARAM_DEVICE_ID 16
685 707
686typedef struct drm_radeon_getparam { 708typedef struct drm_radeon_getparam {
687 int param; 709 int param;
@@ -751,4 +773,112 @@ typedef struct drm_radeon_surface_free {
751#define DRM_RADEON_VBLANK_CRTC1 1 773#define DRM_RADEON_VBLANK_CRTC1 1
752#define DRM_RADEON_VBLANK_CRTC2 2 774#define DRM_RADEON_VBLANK_CRTC2 2
753 775
776/*
777 * Kernel modesetting world below.
778 */
779#define RADEON_GEM_DOMAIN_CPU 0x1
780#define RADEON_GEM_DOMAIN_GTT 0x2
781#define RADEON_GEM_DOMAIN_VRAM 0x4
782
783struct drm_radeon_gem_info {
784 uint64_t gart_size;
785 uint64_t vram_size;
786 uint64_t vram_visible;
787};
788
789#define RADEON_GEM_NO_BACKING_STORE 1
790
791struct drm_radeon_gem_create {
792 uint64_t size;
793 uint64_t alignment;
794 uint32_t handle;
795 uint32_t initial_domain;
796 uint32_t flags;
797};
798
799struct drm_radeon_gem_mmap {
800 uint32_t handle;
801 uint32_t pad;
802 uint64_t offset;
803 uint64_t size;
804 uint64_t addr_ptr;
805};
806
807struct drm_radeon_gem_set_domain {
808 uint32_t handle;
809 uint32_t read_domains;
810 uint32_t write_domain;
811};
812
813struct drm_radeon_gem_wait_idle {
814 uint32_t handle;
815 uint32_t pad;
816};
817
818struct drm_radeon_gem_busy {
819 uint32_t handle;
820 uint32_t busy;
821};
822
823struct drm_radeon_gem_pread {
824 /** Handle for the object being read. */
825 uint32_t handle;
826 uint32_t pad;
827 /** Offset into the object to read from */
828 uint64_t offset;
829 /** Length of data to read */
830 uint64_t size;
831 /** Pointer to write the data into. */
832 /* void *, but pointers are not 32/64 compatible */
833 uint64_t data_ptr;
834};
835
836struct drm_radeon_gem_pwrite {
837 /** Handle for the object being written to. */
838 uint32_t handle;
839 uint32_t pad;
840 /** Offset into the object to write to */
841 uint64_t offset;
842 /** Length of data to write */
843 uint64_t size;
844 /** Pointer to read the data from. */
845 /* void *, but pointers are not 32/64 compatible */
846 uint64_t data_ptr;
847};
848
849#define RADEON_CHUNK_ID_RELOCS 0x01
850#define RADEON_CHUNK_ID_IB 0x02
851
852struct drm_radeon_cs_chunk {
853 uint32_t chunk_id;
854 uint32_t length_dw;
855 uint64_t chunk_data;
856};
857
858struct drm_radeon_cs_reloc {
859 uint32_t handle;
860 uint32_t read_domains;
861 uint32_t write_domain;
862 uint32_t flags;
863};
864
865struct drm_radeon_cs {
866 uint32_t num_chunks;
867 uint32_t cs_id;
868 /* this points to uint64_t * which point to cs chunks */
869 uint64_t chunks;
870 /* updates to the limits after this CS ioctl */
871 uint64_t gart_limit;
872 uint64_t vram_limit;
873};
874
875#define RADEON_INFO_DEVICE_ID 0x00
876#define RADEON_INFO_NUM_GB_PIPES 0x01
877
878struct drm_radeon_info {
879 uint32_t request;
880 uint32_t pad;
881 uint64_t value;
882};
883
754#endif 884#endif