convert all crtc values passed in from userland to be unsigned instead

of signed.  there's still some more internal to the i915 driver that
should be converted.

tested on a radeon x1550.
This commit is contained in:
mrg 2011-02-24 07:59:44 +00:00
parent a95aa984dc
commit 310cb41fcc
14 changed files with 59 additions and 58 deletions

View File

@ -728,9 +728,9 @@ struct drm_driver_info {
int (*irq_postinstall)(struct drm_device *dev);
void (*irq_uninstall)(struct drm_device *dev);
irqreturn_t (*irq_handler)(DRM_IRQ_ARGS);
u32 (*get_vblank_counter)(struct drm_device *dev, int crtc);
int (*enable_vblank)(struct drm_device *dev, int crtc);
void (*disable_vblank)(struct drm_device *dev, int crtc);
u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int crtc);
int (*enable_vblank)(struct drm_device *dev, unsigned int crtc);
void (*disable_vblank)(struct drm_device *dev, unsigned int crtc);
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
@ -1075,14 +1075,14 @@ irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
void drm_driver_irq_preinstall(struct drm_device *dev);
void drm_driver_irq_postinstall(struct drm_device *dev);
void drm_driver_irq_uninstall(struct drm_device *dev);
void drm_handle_vblank(struct drm_device *dev, int crtc);
u32 drm_vblank_count(struct drm_device *dev, int crtc);
int drm_vblank_get(struct drm_device *dev, int crtc);
void drm_vblank_put(struct drm_device *dev, int crtc);
void drm_handle_vblank(struct drm_device *dev, unsigned int crtc);
u32 drm_vblank_count(struct drm_device *dev, unsigned int crtc);
int drm_vblank_get(struct drm_device *dev, unsigned int crtc);
void drm_vblank_put(struct drm_device *dev, unsigned int crtc);
void drm_vblank_cleanup(struct drm_device *dev);
int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
int drm_vblank_init(struct drm_device *dev, int num_crtcs);
void drm_vbl_send_signals(struct drm_device *dev, int crtc);
void drm_vbl_send_signals(struct drm_device *dev, unsigned int crtc);
int drm_modeset_ctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);

View File

@ -79,7 +79,7 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS)
static void vblank_disable_fn(void *arg)
{
struct drm_device *dev = (struct drm_device *)arg;
int i;
unsigned int i;
#if defined(__NetBSD__)
mutex_enter(&dev->vbl_lock);
@ -298,12 +298,12 @@ int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv)
}
}
u32 drm_vblank_count(struct drm_device *dev, int crtc)
u32 drm_vblank_count(struct drm_device *dev, unsigned int crtc)
{
return atomic_read(&dev->vblank[crtc].count);
}
static void drm_update_vblank_count(struct drm_device *dev, int crtc)
static void drm_update_vblank_count(struct drm_device *dev, unsigned int crtc)
{
u32 cur_vblank, diff;
@ -329,7 +329,7 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
atomic_add(diff, &dev->vblank[crtc].count);
}
int drm_vblank_get(struct drm_device *dev, int crtc)
int drm_vblank_get(struct drm_device *dev, unsigned int crtc)
{
unsigned long irqflags;
int ret = 0;
@ -353,7 +353,7 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
return ret;
}
void drm_vblank_put(struct drm_device *dev, int crtc)
void drm_vblank_put(struct drm_device *dev, unsigned int crtc)
{
unsigned long irqflags;
@ -375,7 +375,8 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
{
struct drm_modeset_ctl *modeset = data;
unsigned long irqflags;
int crtc, ret = 0;
int ret = 0;
unsigned int crtc;
DRM_DEBUG("num_crtcs=%d\n", dev->num_crtcs);
/* If drm_vblank_init() hasn't been called yet, just no-op */
@ -527,12 +528,12 @@ done:
return ret;
}
void drm_vbl_send_signals(struct drm_device *dev, int crtc)
void drm_vbl_send_signals(struct drm_device *dev, unsigned int crtc)
{
}
#if 0 /* disabled */
void drm_vbl_send_signals(struct drm_device *dev, int crtc )
void drm_vbl_send_signals(struct drm_device *dev, unsigned int crtc )
{
drm_vbl_sig_t *vbl_sig;
unsigned int vbl_seq = atomic_read( &dev->vbl_received );
@ -558,7 +559,7 @@ void drm_vbl_send_signals(struct drm_device *dev, int crtc )
}
#endif
void drm_handle_vblank(struct drm_device *dev, int crtc)
void drm_handle_vblank(struct drm_device *dev, unsigned int crtc)
{
atomic_inc(&dev->vblank[crtc].count);
DRM_WAKEUP(&dev->vblank[crtc].queue);

View File

@ -432,10 +432,10 @@ extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int i915_enable_vblank(struct drm_device *dev, int crtc);
extern void i915_disable_vblank(struct drm_device *dev, int crtc);
extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc);
extern u32 gm45_get_vblank_counter(struct drm_device *dev, int crtc);
extern int i915_enable_vblank(struct drm_device *dev, unsigned int crtc);
extern void i915_disable_vblank(struct drm_device *dev, unsigned int crtc);
extern u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int crtc);
extern u32 gm45_get_vblank_counter(struct drm_device *dev, unsigned int crtc);
extern int i915_vblank_swap(struct drm_device *dev, void *data,
struct drm_file *file_priv);

View File

@ -133,7 +133,7 @@ i915_pipe_enabled(struct drm_device *dev, int pipe)
/* Called from drm generic code, passed a 'crtc', which
* we use as a pipe index
*/
u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
{
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
unsigned long high_frame;
@ -167,7 +167,7 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
return count;
}
u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
u32 gm45_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
{
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45;
@ -376,7 +376,7 @@ int i915_irq_wait(struct drm_device *dev, void *data,
/* Called from drm generic code, passed 'crtc' which
* we use as a pipe index
*/
int i915_enable_vblank(struct drm_device *dev, int pipe)
int i915_enable_vblank(struct drm_device *dev, unsigned int pipe)
{
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
unsigned long irqflags;
@ -400,7 +400,7 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
/* Called from drm generic code, passed 'crtc' which
* we use as a pipe index
*/
void i915_disable_vblank(struct drm_device *dev, int pipe)
void i915_disable_vblank(struct drm_device *dev, unsigned int pipe)
{
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
unsigned long irqflags;

View File

@ -164,9 +164,9 @@ extern int mach64_get_param(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int mach64_driver_load(struct drm_device * dev, unsigned long flags);
extern u32 mach64_get_vblank_counter(struct drm_device *dev, int crtc);
extern int mach64_enable_vblank(struct drm_device *dev, int crtc);
extern void mach64_disable_vblank(struct drm_device *dev, int crtc);
extern u32 mach64_get_vblank_counter(struct drm_device *dev, unsigned int crtc);
extern int mach64_enable_vblank(struct drm_device *dev, unsigned int crtc);
extern void mach64_disable_vblank(struct drm_device *dev, unsigned int crtc);
extern irqreturn_t mach64_driver_irq_handler(DRM_IRQ_ARGS);
extern void mach64_driver_irq_preinstall(struct drm_device *dev);
extern int mach64_driver_irq_postinstall(struct drm_device *dev);

View File

@ -68,7 +68,7 @@ irqreturn_t mach64_driver_irq_handler(DRM_IRQ_ARGS)
return IRQ_NONE;
}
u32 mach64_get_vblank_counter(struct drm_device * dev, int crtc)
u32 mach64_get_vblank_counter(struct drm_device * dev, unsigned int crtc)
{
const drm_mach64_private_t *const dev_priv = dev->dev_private;
@ -78,7 +78,7 @@ u32 mach64_get_vblank_counter(struct drm_device * dev, int crtc)
return atomic_read(&dev_priv->vbl_received);
}
int mach64_enable_vblank(struct drm_device * dev, int crtc)
int mach64_enable_vblank(struct drm_device * dev, unsigned int crtc)
{
drm_mach64_private_t *dev_priv = dev->dev_private;
u32 status = MACH64_READ(MACH64_CRTC_INT_CNTL);
@ -98,7 +98,7 @@ int mach64_enable_vblank(struct drm_device * dev, int crtc)
return 0;
}
void mach64_disable_vblank(struct drm_device * dev, int crtc)
void mach64_disable_vblank(struct drm_device * dev, unsigned int crtc)
{
if (crtc != 0) {
DRM_ERROR("tried to disable vblank on non-existent crtc %d\n",
@ -112,7 +112,7 @@ void mach64_disable_vblank(struct drm_device * dev, int crtc)
*/
}
static void mach64_disable_vblank_local(struct drm_device * dev, int crtc)
static void mach64_disable_vblank_local(struct drm_device * dev, unsigned int crtc)
{
drm_mach64_private_t *dev_priv = dev->dev_private;
u32 status = MACH64_READ(MACH64_CRTC_INT_CNTL);

View File

@ -182,9 +182,9 @@ extern int mga_warp_install_microcode(drm_mga_private_t * dev_priv);
extern int mga_warp_init(drm_mga_private_t * dev_priv);
/* mga_irq.c */
extern int mga_enable_vblank(struct drm_device *dev, int crtc);
extern void mga_disable_vblank(struct drm_device *dev, int crtc);
extern u32 mga_get_vblank_counter(struct drm_device *dev, int crtc);
extern int mga_enable_vblank(struct drm_device *dev, unsigned int crtc);
extern void mga_disable_vblank(struct drm_device *dev, unsigned int crtc);
extern u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int crtc);
extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence);
extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS);

View File

@ -36,7 +36,7 @@
#include "mga_drm.h"
#include "mga_drv.h"
u32 mga_get_vblank_counter(struct drm_device *dev, int crtc)
u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int crtc)
{
const drm_mga_private_t *const dev_priv =
(drm_mga_private_t *) dev->dev_private;
@ -92,7 +92,7 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS)
return IRQ_NONE;
}
int mga_enable_vblank(struct drm_device *dev, int crtc)
int mga_enable_vblank(struct drm_device *dev, unsigned int crtc)
{
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
@ -107,7 +107,7 @@ int mga_enable_vblank(struct drm_device *dev, int crtc)
}
void mga_disable_vblank(struct drm_device *dev, int crtc)
void mga_disable_vblank(struct drm_device *dev, unsigned int crtc)
{
if (crtc != 0) {
DRM_ERROR("tried to disable vblank on non-existent crtc %d\n",

View File

@ -151,9 +151,9 @@ extern int r128_wait_ring(drm_r128_private_t * dev_priv, int n);
extern int r128_do_cce_idle(drm_r128_private_t * dev_priv);
extern int r128_do_cleanup_cce(struct drm_device * dev);
extern int r128_enable_vblank(struct drm_device *dev, int crtc);
extern void r128_disable_vblank(struct drm_device *dev, int crtc);
extern u32 r128_get_vblank_counter(struct drm_device *dev, int crtc);
extern int r128_enable_vblank(struct drm_device *dev, unsigned int crtc);
extern void r128_disable_vblank(struct drm_device *dev, unsigned int crtc);
extern u32 r128_get_vblank_counter(struct drm_device *dev, unsigned int crtc);
extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS);
extern void r128_driver_irq_preinstall(struct drm_device * dev);
extern int r128_driver_irq_postinstall(struct drm_device * dev);

View File

@ -35,7 +35,7 @@
#include "r128_drm.h"
#include "r128_drv.h"
u32 r128_get_vblank_counter(struct drm_device *dev, int crtc)
u32 r128_get_vblank_counter(struct drm_device *dev, unsigned int crtc)
{
const drm_r128_private_t *dev_priv = dev->dev_private;
@ -63,7 +63,7 @@ irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS)
return IRQ_NONE;
}
int r128_enable_vblank(struct drm_device *dev, int crtc)
int r128_enable_vblank(struct drm_device *dev, unsigned int crtc)
{
drm_r128_private_t *dev_priv = dev->dev_private;
@ -76,7 +76,7 @@ int r128_enable_vblank(struct drm_device *dev, int crtc)
return 0;
}
void r128_disable_vblank(struct drm_device *dev, int crtc)
void r128_disable_vblank(struct drm_device *dev, unsigned int crtc)
{
if (crtc != 0)
DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc);

View File

@ -473,9 +473,9 @@ extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *
extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern void radeon_do_release(struct drm_device * dev);
extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc);
extern int radeon_enable_vblank(struct drm_device *dev, int crtc);
extern void radeon_disable_vblank(struct drm_device *dev, int crtc);
extern u32 radeon_get_vblank_counter(struct drm_device *dev, unsigned int crtc);
extern int radeon_enable_vblank(struct drm_device *dev, unsigned int crtc);
extern void radeon_disable_vblank(struct drm_device *dev, unsigned int crtc);
extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS);
extern void radeon_driver_irq_preinstall(struct drm_device * dev);
extern int radeon_driver_irq_postinstall(struct drm_device * dev);

View File

@ -61,7 +61,7 @@ static void r500_vbl_irq_set_state(struct drm_device *dev, u32 mask, int state)
RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg);
}
int radeon_enable_vblank(struct drm_device *dev, int crtc)
int radeon_enable_vblank(struct drm_device *dev, unsigned int crtc)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
@ -99,7 +99,7 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc)
return 0;
}
void radeon_disable_vblank(struct drm_device *dev, int crtc)
void radeon_disable_vblank(struct drm_device *dev, unsigned int crtc)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
@ -287,7 +287,7 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr)
return ret;
}
u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc)
u32 radeon_get_vblank_counter(struct drm_device *dev, unsigned int crtc)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
@ -298,7 +298,7 @@ u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc)
if (!dev_priv->mmio)
return 0;
if (crtc < 0 || crtc > 1) {
if (crtc > 1) {
DRM_ERROR("Invalid crtc %d\n", crtc);
return -EINVAL;
}

View File

@ -132,9 +132,9 @@ extern int via_init_context(struct drm_device * dev, int context);
extern int via_final_context(struct drm_device * dev, int context);
extern int via_do_cleanup_map(struct drm_device * dev);
extern uint32_t via_get_vblank_counter(struct drm_device *dev, int crtc);
extern int via_enable_vblank(struct drm_device *dev, int crtc);
extern void via_disable_vblank(struct drm_device *dev, int crtc);
extern uint32_t via_get_vblank_counter(struct drm_device *dev, unsigned int crtc);
extern int via_enable_vblank(struct drm_device *dev, unsigned int crtc);
extern void via_disable_vblank(struct drm_device *dev, unsigned int crtc);
extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
extern void via_driver_irq_preinstall(struct drm_device * dev);

View File

@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: via_irq.c,v 1.3 2011/02/18 14:26:10 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: via_irq.c,v 1.4 2011/02/24 07:59:44 mrg Exp $");
#include "drmP.h"
#include "drm.h"
@ -99,7 +99,7 @@ static unsigned time_diff(struct timeval *now, struct timeval *then)
1000000 - (then->tv_usec - now->tv_usec);
}
uint32_t via_get_vblank_counter(struct drm_device *dev, int crtc)
uint32_t via_get_vblank_counter(struct drm_device *dev, unsigned int crtc)
{
drm_via_private_t *dev_priv = dev->dev_private;
if (crtc != 0)
@ -175,7 +175,7 @@ static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv)
}
}
int via_enable_vblank(struct drm_device *dev, int crtc)
int via_enable_vblank(struct drm_device *dev, unsigned int crtc)
{
drm_via_private_t *dev_priv = dev->dev_private;
uint32_t status;
@ -194,7 +194,7 @@ int via_enable_vblank(struct drm_device *dev, int crtc)
return 0;
}
void via_disable_vblank(struct drm_device *dev, int crtc)
void via_disable_vblank(struct drm_device *dev, unsigned int crtc)
{
drm_via_private_t *dev_priv = dev->dev_private;