Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d201bca9
Commit
d201bca9
authored
Apr 28, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRI CVS merge: make sure to clean up irq and DMA on final close.
parent
04499b41
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
137 additions
and
67 deletions
+137
-67
drivers/char/drm/gamma.h
drivers/char/drm/gamma.h
+6
-0
drivers/char/drm/gamma_dma.c
drivers/char/drm/gamma_dma.c
+12
-0
drivers/char/drm/i810.h
drivers/char/drm/i810.h
+6
-1
drivers/char/drm/i810_dma.c
drivers/char/drm/i810_dma.c
+10
-2
drivers/char/drm/i810_drv.h
drivers/char/drm/i810_drv.h
+1
-2
drivers/char/drm/i830.h
drivers/char/drm/i830.h
+6
-30
drivers/char/drm/i830_dma.c
drivers/char/drm/i830_dma.c
+11
-11
drivers/char/drm/i830_drv.h
drivers/char/drm/i830_drv.h
+1
-2
drivers/char/drm/i830_irq.c
drivers/char/drm/i830_irq.c
+36
-5
drivers/char/drm/mga.h
drivers/char/drm/mga.h
+1
-1
drivers/char/drm/mga_dma.c
drivers/char/drm/mga_dma.c
+10
-0
drivers/char/drm/mga_irq.c
drivers/char/drm/mga_irq.c
+5
-4
drivers/char/drm/r128.h
drivers/char/drm/r128.h
+1
-1
drivers/char/drm/r128_cce.c
drivers/char/drm/r128_cce.c
+11
-0
drivers/char/drm/r128_irq.c
drivers/char/drm/r128_irq.c
+5
-4
drivers/char/drm/radeon_cp.c
drivers/char/drm/radeon_cp.c
+10
-0
drivers/char/drm/radeon_irq.c
drivers/char/drm/radeon_irq.c
+5
-4
No files found.
drivers/char/drm/gamma.h
View file @
d201bca9
...
...
@@ -63,6 +63,12 @@
#define __HAVE_COUNTER9 _DRM_STAT_SPECIAL
#define __HAVE_COUNTER10 _DRM_STAT_MISSED
/* Driver customization:
*/
#define DRIVER_PRETAKEDOWN() do { \
gamma_do_cleanup_dma( dev ); \
} while (0)
/* DMA customization:
*/
#define __HAVE_DMA 1
...
...
drivers/char/drm/gamma_dma.c
View file @
d201bca9
...
...
@@ -639,6 +639,14 @@ int gamma_do_cleanup_dma( drm_device_t *dev )
{
DRM_DEBUG
(
"%s
\n
"
,
__FUNCTION__
);
#if _HAVE_DMA_IRQ
/* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
if
(
dev
->
irq
)
DRM
(
irq_uninstall
)(
dev
);
#endif
if
(
dev
->
dev_private
)
{
drm_gamma_private_t
*
dev_priv
=
dev
->
dev_private
;
...
...
@@ -660,6 +668,8 @@ int gamma_dma_init( struct inode *inode, struct file *filp,
drm_device_t
*
dev
=
priv
->
dev
;
drm_gamma_init_t
init
;
LOCK_TEST_WITH_RETURN
(
dev
,
filp
);
if
(
copy_from_user
(
&
init
,
(
drm_gamma_init_t
*
)
arg
,
sizeof
(
init
)
)
)
return
-
EFAULT
;
...
...
@@ -832,6 +842,8 @@ void DRM(driver_irq_postinstall)( drm_device_t *dev ) {
void
DRM
(
driver_irq_uninstall
)(
drm_device_t
*
dev
)
{
drm_gamma_private_t
*
dev_priv
=
(
drm_gamma_private_t
*
)
dev
->
dev_private
;
if
(
!
dev_priv
)
return
;
while
(
GAMMA_READ
(
GAMMA_INFIFOSPACE
)
<
3
);
...
...
drivers/char/drm/i810.h
View file @
d201bca9
...
...
@@ -86,7 +86,11 @@
*/
#define __HAVE_RELEASE 1
#define DRIVER_RELEASE() do { \
i810_reclaim_buffers( filp ); \
i810_reclaim_buffers( filp ); \
} while (0)
#define DRIVER_PRETAKEDOWN() do { \
i810_dma_cleanup( dev ); \
} while (0)
/* DMA customization:
...
...
@@ -104,6 +108,7 @@
/* Don't need an irq any more. The template code will make sure that
* a noop stub is generated for compatibility.
*/
/* XXX: Add vblank support? */
#define __HAVE_DMA_IRQ 0
/* Buffer customization:
...
...
drivers/char/drm/i810_dma.c
View file @
d201bca9
...
...
@@ -227,11 +227,19 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
return
retcode
;
}
static
int
i810_dma_cleanup
(
drm_device_t
*
dev
)
int
i810_dma_cleanup
(
drm_device_t
*
dev
)
{
drm_device_dma_t
*
dma
=
dev
->
dma
;
if
(
dev
->
dev_private
)
{
#if _HAVE_DMA_IRQ
/* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
if
(
dev
->
irq
)
DRM
(
irq_uninstall
)(
dev
);
#endif
if
(
dev
->
dev_private
)
{
int
i
;
drm_i810_private_t
*
dev_priv
=
(
drm_i810_private_t
*
)
dev
->
dev_private
;
...
...
drivers/char/drm/i810_drv.h
View file @
d201bca9
...
...
@@ -38,8 +38,6 @@ typedef struct drm_i810_buf_priv {
int
currently_mapped
;
void
*
virtual
;
void
*
kernel_virtual
;
int
map_count
;
struct
vm_area_struct
*
vma
;
}
drm_i810_buf_priv_t
;
typedef
struct
_drm_i810_ring_buffer
{
...
...
@@ -86,6 +84,7 @@ extern int i810_getbuf(struct inode *inode, struct file *filp,
unsigned
int
cmd
,
unsigned
long
arg
);
extern
int
i810_dma_init
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
arg
);
extern
int
i810_dma_cleanup
(
drm_device_t
*
dev
);
extern
int
i810_flush_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
arg
);
extern
void
i810_reclaim_buffers
(
struct
file
*
filp
);
...
...
drivers/char/drm/i830.h
View file @
d201bca9
...
...
@@ -87,7 +87,11 @@
*/
#define __HAVE_RELEASE 1
#define DRIVER_RELEASE() do { \
i830_reclaim_buffers( filp ); \
i830_reclaim_buffers( filp ); \
} while (0)
#define DRIVER_PRETAKEDOWN() do { \
i830_dma_cleanup( dev ); \
} while (0)
/* DMA customization:
...
...
@@ -107,45 +111,17 @@
* the card, but are subject to subtle interactions between bios,
* hardware and the driver.
*/
/* XXX: Add vblank support? */
#define USE_IRQS 0
#if USE_IRQS
#define __HAVE_DMA_IRQ 1
#define __HAVE_SHARED_IRQ 1
#define DRIVER_PREINSTALL() do { \
drm_i830_private_t *dev_priv = \
(drm_i830_private_t *)dev->dev_private; \
\
I830_WRITE16( I830REG_HWSTAM, 0xffff ); \
I830_WRITE16( I830REG_INT_MASK_R, 0x0 ); \
I830_WRITE16( I830REG_INT_ENABLE_R, 0x0 ); \
} while (0)
#define DRIVER_POSTINSTALL() do { \
drm_i830_private_t *dev_priv = \
(drm_i830_private_t *)dev->dev_private; \
I830_WRITE16( I830REG_INT_ENABLE_R, 0x2 ); \
atomic_set(&dev_priv->irq_received, 0); \
atomic_set(&dev_priv->irq_emitted, 0); \
init_waitqueue_head(&dev_priv->irq_queue); \
} while (0)
/* This gets called too late to be useful: dev_priv has already been
* freed.
*/
#define DRIVER_UNINSTALL() do { \
} while (0)
#else
#define __HAVE_DMA_IRQ 0
#endif
/* Buffer customization:
*/
...
...
drivers/char/drm/i830_dma.c
View file @
d201bca9
...
...
@@ -227,16 +227,24 @@ static int i830_dma_get_buffer(drm_device_t *dev, drm_i830_dma_t *d,
return
retcode
;
}
static
int
i830_dma_cleanup
(
drm_device_t
*
dev
)
int
i830_dma_cleanup
(
drm_device_t
*
dev
)
{
drm_device_dma_t
*
dma
=
dev
->
dma
;
if
(
dev
->
dev_private
)
{
#if _HAVE_DMA_IRQ
/* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
if
(
dev
->
irq
)
DRM
(
irq_uninstall
)(
dev
);
#endif
if
(
dev
->
dev_private
)
{
int
i
;
drm_i830_private_t
*
dev_priv
=
(
drm_i830_private_t
*
)
dev
->
dev_private
;
if
(
dev_priv
->
ring
.
virtual_start
)
{
if
(
dev_priv
->
ring
.
virtual_start
)
{
DRM
(
ioremapfree
)((
void
*
)
dev_priv
->
ring
.
virtual_start
,
dev_priv
->
ring
.
Size
);
}
...
...
@@ -248,14 +256,6 @@ static int i830_dma_cleanup(drm_device_t *dev)
I830_WRITE
(
0x02080
,
0x1ffff000
);
}
/* Disable interrupts here because after dev_private
* is freed, it's too late.
*/
if
(
dev
->
irq
)
{
I830_WRITE16
(
I830REG_INT_MASK_R
,
0xffff
);
I830_WRITE16
(
I830REG_INT_ENABLE_R
,
0x0
);
}
DRM
(
free
)(
dev
->
dev_private
,
sizeof
(
drm_i830_private_t
),
DRM_MEM_DRIVER
);
dev
->
dev_private
=
NULL
;
...
...
drivers/char/drm/i830_drv.h
View file @
d201bca9
...
...
@@ -38,8 +38,6 @@ typedef struct drm_i830_buf_priv {
int
currently_mapped
;
void
*
virtual
;
void
*
kernel_virtual
;
int
map_count
;
struct
vm_area_struct
*
vma
;
}
drm_i830_buf_priv_t
;
typedef
struct
_drm_i830_ring_buffer
{
...
...
@@ -99,6 +97,7 @@ extern int i830_getbuf(struct inode *inode, struct file *filp,
unsigned
int
cmd
,
unsigned
long
arg
);
extern
int
i830_dma_init
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
arg
);
extern
int
i830_dma_cleanup
(
drm_device_t
*
dev
);
extern
int
i830_flush_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
arg
);
extern
void
i830_reclaim_buffers
(
struct
file
*
filp
);
...
...
drivers/char/drm/i830_irq.c
View file @
d201bca9
...
...
@@ -40,12 +40,12 @@ void DRM(dma_service)(int irq, void *device, struct pt_regs *regs)
drm_device_t
*
dev
=
(
drm_device_t
*
)
device
;
drm_i830_private_t
*
dev_priv
=
(
drm_i830_private_t
*
)
dev
->
dev_private
;
u16
temp
;
temp
=
I830_READ16
(
I830REG_INT_IDENTITY_R
);
printk
(
"%s: %x
\n
"
,
__FUNCTION__
,
temp
);
if
(
temp
==
0
)
return
;
DRM_DEBUG
(
"%x
\n
"
,
temp
);
if
(
temp
==
0
)
return
;
I830_WRITE16
(
I830REG_INT_IDENTITY_R
,
temp
);
...
...
@@ -175,3 +175,34 @@ int i830_irq_wait( struct inode *inode, struct file *filp, unsigned int cmd,
return
i830_wait_irq
(
dev
,
irqwait
.
irq_seq
);
}
/* drm_dma.h hooks
*/
void
DRM
(
driver_irq_preinstall
)(
drm_device_t
*
dev
)
{
drm_i830_private_t
*
dev_priv
=
(
drm_i830_private_t
*
)
dev
->
dev_private
;
I830_WRITE16
(
I830REG_HWSTAM
,
0xffff
);
I830_WRITE16
(
I830REG_INT_MASK_R
,
0x0
);
I830_WRITE16
(
I830REG_INT_ENABLE_R
,
0x0
);
atomic_set
(
&
dev_priv
->
irq_received
,
0
);
atomic_set
(
&
dev_priv
->
irq_emitted
,
0
);
init_waitqueue_head
(
&
dev_priv
->
irq_queue
);
}
void
DRM
(
driver_irq_postinstall
)(
drm_device_t
*
dev
)
{
drm_i830_private_t
*
dev_priv
=
(
drm_i830_private_t
*
)
dev
->
dev_private
;
I830_WRITE16
(
I830REG_INT_ENABLE_R
,
0x2
);
}
void
DRM
(
driver_irq_uninstall
)(
drm_device_t
*
dev
)
{
drm_i830_private_t
*
dev_priv
=
(
drm_i830_private_t
*
)
dev
->
dev_private
;
if
(
!
dev_priv
)
return
;
I830_WRITE16
(
I830REG_INT_MASK_R
,
0xffff
);
I830_WRITE16
(
I830REG_INT_ENABLE_R
,
0x0
);
}
drivers/char/drm/mga.h
View file @
d201bca9
...
...
@@ -72,7 +72,7 @@
/* Driver customization:
*/
#define DRIVER_PRETAKEDOWN() do { \
if ( dev->dev_private ) mga_do_cleanup_dma( dev );
\
mga_do_cleanup_dma( dev );
\
} while (0)
/* DMA customization:
...
...
drivers/char/drm/mga_dma.c
View file @
d201bca9
...
...
@@ -639,6 +639,14 @@ int mga_do_cleanup_dma( drm_device_t *dev )
{
DRM_DEBUG
(
"
\n
"
);
#if _HAVE_DMA_IRQ
/* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
if
(
dev
->
irq
)
DRM
(
irq_uninstall
)(
dev
);
#endif
if
(
dev
->
dev_private
)
{
drm_mga_private_t
*
dev_priv
=
dev
->
dev_private
;
...
...
@@ -666,6 +674,8 @@ int mga_dma_init( DRM_IOCTL_ARGS )
DRM_DEVICE
;
drm_mga_init_t
init
;
LOCK_TEST_WITH_RETURN
(
dev
,
filp
);
DRM_COPY_FROM_USER_IOCTL
(
init
,
(
drm_mga_init_t
*
)
data
,
sizeof
(
init
)
);
switch
(
init
.
func
)
{
...
...
drivers/char/drm/mga_irq.c
View file @
d201bca9
...
...
@@ -95,8 +95,9 @@ void mga_driver_irq_postinstall( drm_device_t *dev ) {
void
mga_driver_irq_uninstall
(
drm_device_t
*
dev
)
{
drm_mga_private_t
*
dev_priv
=
(
drm_mga_private_t
*
)
dev
->
dev_private
;
if
(
dev_priv
)
{
/* Disable *all* interrupts */
MGA_WRITE
(
MGA_IEN
,
0
);
}
if
(
!
dev_priv
)
return
;
/* Disable *all* interrupts */
MGA_WRITE
(
MGA_IEN
,
0
);
}
drivers/char/drm/r128.h
View file @
d201bca9
...
...
@@ -85,7 +85,7 @@
} while (0)
#define DRIVER_PRETAKEDOWN() do { \
if ( dev->dev_private ) r128_do_cleanup_cce( dev );
\
r128_do_cleanup_cce( dev );
\
} while (0)
/* DMA customization:
...
...
drivers/char/drm/r128_cce.c
View file @
d201bca9
...
...
@@ -613,6 +613,15 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
int
r128_do_cleanup_cce
(
drm_device_t
*
dev
)
{
#if _HAVE_DMA_IRQ
/* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
if
(
dev
->
irq
)
DRM
(
irq_uninstall
)(
dev
);
#endif
if
(
dev
->
dev_private
)
{
drm_r128_private_t
*
dev_priv
=
dev
->
dev_private
;
...
...
@@ -649,6 +658,8 @@ int r128_cce_init( DRM_IOCTL_ARGS )
DRM_DEBUG
(
"
\n
"
);
LOCK_TEST_WITH_RETURN
(
dev
,
filp
);
DRM_COPY_FROM_USER_IOCTL
(
init
,
(
drm_r128_init_t
*
)
data
,
sizeof
(
init
)
);
switch
(
init
.
func
)
{
...
...
drivers/char/drm/r128_irq.c
View file @
d201bca9
...
...
@@ -95,8 +95,9 @@ void r128_driver_irq_postinstall( drm_device_t *dev ) {
void
r128_driver_irq_uninstall
(
drm_device_t
*
dev
)
{
drm_r128_private_t
*
dev_priv
=
(
drm_r128_private_t
*
)
dev
->
dev_private
;
if
(
dev_priv
)
{
/* Disable *all* interrupts */
R128_WRITE
(
R128_GEN_INT_CNTL
,
0
);
}
if
(
!
dev_priv
)
return
;
/* Disable *all* interrupts */
R128_WRITE
(
R128_GEN_INT_CNTL
,
0
);
}
drivers/char/drm/radeon_cp.c
View file @
d201bca9
...
...
@@ -1266,6 +1266,14 @@ int radeon_do_cleanup_cp( drm_device_t *dev )
{
DRM_DEBUG
(
"
\n
"
);
#if _HAVE_DMA_IRQ
/* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private
* is freed, it's too late.
*/
if
(
dev
->
irq
)
DRM
(
irq_uninstall
)(
dev
);
#endif
if
(
dev
->
dev_private
)
{
drm_radeon_private_t
*
dev_priv
=
dev
->
dev_private
;
...
...
@@ -1298,6 +1306,8 @@ int radeon_cp_init( DRM_IOCTL_ARGS )
DRM_DEVICE
;
drm_radeon_init_t
init
;
LOCK_TEST_WITH_RETURN
(
dev
,
filp
);
DRM_COPY_FROM_USER_IOCTL
(
init
,
(
drm_radeon_init_t
*
)
data
,
sizeof
(
init
)
);
switch
(
init
.
func
)
{
...
...
drivers/char/drm/radeon_irq.c
View file @
d201bca9
...
...
@@ -250,8 +250,9 @@ void DRM(driver_irq_postinstall)( drm_device_t *dev ) {
void
DRM
(
driver_irq_uninstall
)(
drm_device_t
*
dev
)
{
drm_radeon_private_t
*
dev_priv
=
(
drm_radeon_private_t
*
)
dev
->
dev_private
;
if
(
dev_priv
)
{
/* Disable *all* interrupts */
RADEON_WRITE
(
RADEON_GEN_INT_CNTL
,
0
);
}
if
(
!
dev_priv
)
return
;
/* Disable *all* interrupts */
RADEON_WRITE
(
RADEON_GEN_INT_CNTL
,
0
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment