merge git-change-2580a065d81be645a14af1e91b8441f7e72fcbe4.
This commit is contained in:
parent
3eb83a79ce
commit
5560b89162
6
sys/external/bsd/drm/dist/bsd-core/drmP.h
vendored
6
sys/external/bsd/drm/dist/bsd-core/drmP.h
vendored
@ -757,7 +757,7 @@ struct drm_ati_pcigart_info {
|
||||
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
|
||||
#endif
|
||||
|
||||
#define upper_32_bits(_val) (((u64)(_val)) >> 32)
|
||||
#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
|
||||
|
||||
struct drm_driver_info {
|
||||
int (*load)(struct drm_device *, unsigned long flags);
|
||||
@ -945,8 +945,7 @@ struct drm_device {
|
||||
/* for wraparound handling */
|
||||
int *vblank_enabled; /* so we don't call enable more than */
|
||||
/* once per disable */
|
||||
u32 *vblank_premodeset; /* for compensation of spurious wraparounds */
|
||||
int *vblank_suspend; /* Don't wait while crtc is likely disabled */
|
||||
int *vblank_inmodeset; /* Display driver is setting mode */
|
||||
struct callout vblank_disable_timer;
|
||||
u32 max_vblank_count; /* size of vblank counter register */
|
||||
int num_crtcs;
|
||||
@ -1100,7 +1099,6 @@ 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_update_vblank_count(struct drm_device *dev, int crtc);
|
||||
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);
|
||||
|
100
sys/external/bsd/drm/dist/bsd-core/drm_irq.c
vendored
100
sys/external/bsd/drm/dist/bsd-core/drm_irq.c
vendored
@ -148,9 +148,7 @@ static void drm_vblank_cleanup(struct drm_device *dev)
|
||||
dev->num_crtcs, DRM_MEM_DRIVER);
|
||||
drm_free(dev->last_vblank, sizeof(*dev->last_vblank) * dev->num_crtcs,
|
||||
DRM_MEM_DRIVER);
|
||||
drm_free(dev->vblank_premodeset, sizeof(*dev->vblank_premodeset) *
|
||||
dev->num_crtcs, DRM_MEM_DRIVER);
|
||||
drm_free(dev->vblank_suspend, sizeof(*dev->vblank_suspend) *
|
||||
drm_free(dev->vblank_inmodeset, sizeof(*dev->vblank_inmodeset) *
|
||||
dev->num_crtcs, DRM_MEM_DRIVER);
|
||||
|
||||
dev->num_crtcs = 0;
|
||||
@ -197,14 +195,9 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
|
||||
if (!dev->last_vblank)
|
||||
goto err;
|
||||
|
||||
dev->vblank_premodeset = drm_calloc(num_crtcs, sizeof(u32),
|
||||
dev->vblank_inmodeset = drm_calloc(num_crtcs, sizeof(int),
|
||||
DRM_MEM_DRIVER);
|
||||
if (!dev->vblank_premodeset)
|
||||
goto err;
|
||||
|
||||
dev->vblank_suspend = drm_calloc(num_crtcs, sizeof(int),
|
||||
DRM_MEM_DRIVER);
|
||||
if (!dev->vblank_suspend)
|
||||
if (!dev->vblank_inmodeset)
|
||||
goto err;
|
||||
|
||||
/* Zero per-crtc vblank stuff */
|
||||
@ -390,13 +383,10 @@ u32 drm_vblank_count(struct drm_device *dev, int crtc)
|
||||
return atomic_read(&dev->_vblank_count[crtc]);
|
||||
}
|
||||
|
||||
void drm_update_vblank_count(struct drm_device *dev, int crtc)
|
||||
static void drm_update_vblank_count(struct drm_device *dev, int crtc)
|
||||
{
|
||||
u32 cur_vblank, diff;
|
||||
|
||||
if (dev->vblank_suspend[crtc])
|
||||
return;
|
||||
|
||||
/*
|
||||
* Interrupts were disabled prior to this call, so deal with counter
|
||||
* wrap if needed.
|
||||
@ -405,21 +395,13 @@ void drm_update_vblank_count(struct drm_device *dev, int crtc)
|
||||
* a long time.
|
||||
*/
|
||||
cur_vblank = dev->driver.get_vblank_counter(dev, crtc);
|
||||
diff = cur_vblank - dev->last_vblank[crtc];
|
||||
if (cur_vblank < dev->last_vblank[crtc]) {
|
||||
if (cur_vblank == dev->last_vblank[crtc] - 1) {
|
||||
diff = 0;
|
||||
} else {
|
||||
diff = dev->max_vblank_count -
|
||||
dev->last_vblank[crtc];
|
||||
diff += cur_vblank;
|
||||
}
|
||||
diff += dev->max_vblank_count;
|
||||
|
||||
DRM_DEBUG("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n",
|
||||
crtc, dev->last_vblank[crtc], cur_vblank, diff);
|
||||
} else {
|
||||
diff = cur_vblank - dev->last_vblank[crtc];
|
||||
}
|
||||
dev->last_vblank[crtc] = cur_vblank;
|
||||
|
||||
DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n",
|
||||
crtc, diff);
|
||||
@ -458,7 +440,7 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
|
||||
/* Last user schedules interrupt disable */
|
||||
atomic_subtract_acq_int(&dev->vblank_refcount[crtc], 1);
|
||||
if (dev->vblank_refcount[crtc] == 0)
|
||||
callout_reset(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ,
|
||||
callout_reset(&dev->vblank_disable_timer, 5 * DRM_HZ,
|
||||
#ifdef __FreeBSD__
|
||||
(timeout_t *)
|
||||
#endif
|
||||
@ -471,39 +453,40 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
|
||||
{
|
||||
struct drm_modeset_ctl *modeset = data;
|
||||
unsigned long irqflags;
|
||||
u32 new, diff;
|
||||
int crtc, ret = 0;
|
||||
|
||||
/* If drm_vblank_init() hasn't been called yet, just no-op */
|
||||
if (!dev->num_crtcs)
|
||||
goto out;
|
||||
|
||||
crtc = modeset->crtc;
|
||||
if (crtc >= dev->num_crtcs) {
|
||||
ret = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* To avoid all the problems that might happen if interrupts
|
||||
* were enabled/disabled around or between these calls, we just
|
||||
* have the kernel take a reference on the CRTC (just once though
|
||||
* to avoid corrupting the count if multiple, mismatch calls occur),
|
||||
* so that interrupts remain enabled in the interim.
|
||||
*/
|
||||
switch (modeset->cmd) {
|
||||
case _DRM_PRE_MODESET:
|
||||
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
|
||||
dev->vblank_disable_allowed = 1;
|
||||
if (!dev->vblank_enabled[crtc]) {
|
||||
dev->vblank_premodeset[crtc] =
|
||||
dev->driver.get_vblank_counter(dev, crtc);
|
||||
dev->vblank_suspend[crtc] = 1;
|
||||
if (!dev->vblank_inmodeset[crtc]) {
|
||||
dev->vblank_inmodeset[crtc] = 1;
|
||||
drm_vblank_get(dev, crtc);
|
||||
}
|
||||
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
|
||||
break;
|
||||
case _DRM_POST_MODESET:
|
||||
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
|
||||
dev->vblank_disable_allowed = 1;
|
||||
new = dev->driver.get_vblank_counter(dev, crtc);
|
||||
if (dev->vblank_suspend[crtc] && !dev->vblank_enabled[crtc]) {
|
||||
if (new > dev->vblank_premodeset[crtc])
|
||||
diff = dev->vblank_premodeset[crtc] - new;
|
||||
else
|
||||
diff = new;
|
||||
atomic_add(diff, &dev->_vblank_count[crtc]);
|
||||
if (dev->vblank_inmodeset[crtc]) {
|
||||
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
|
||||
dev->vblank_disable_allowed = 1;
|
||||
dev->vblank_inmodeset[crtc] = 0;
|
||||
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
|
||||
drm_vblank_put(dev, crtc);
|
||||
}
|
||||
dev->vblank_suspend[crtc] = 0;
|
||||
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
|
||||
break;
|
||||
default:
|
||||
ret = EINVAL;
|
||||
@ -537,6 +520,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
|
||||
if (crtc >= dev->num_crtcs)
|
||||
return EINVAL;
|
||||
|
||||
ret = drm_vblank_get(dev, crtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
seq = drm_vblank_count(dev, crtc);
|
||||
|
||||
switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
|
||||
@ -546,7 +532,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
|
||||
case _DRM_VBLANK_ABSOLUTE:
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
ret = EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((flags & _DRM_VBLANK_NEXTONMISS) &&
|
||||
@ -561,9 +548,6 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
|
||||
if (vbl_sig == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
if (dev->vblank_suspend[crtc])
|
||||
return EBUSY;
|
||||
|
||||
vbl_sig->sequence = vblwait->request.sequence;
|
||||
vbl_sig->signo = vblwait->request.signal;
|
||||
vbl_sig->pid = DRM_CURRENTPID;
|
||||
@ -577,19 +561,13 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
|
||||
#endif
|
||||
ret = EINVAL;
|
||||
} else {
|
||||
if (!dev->vblank_suspend[crtc]) {
|
||||
DRM_LOCK();
|
||||
/* shared code returns -errno */
|
||||
DRM_LOCK();
|
||||
/* shared code returns -errno */
|
||||
|
||||
ret = drm_vblank_get(dev, crtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
|
||||
((drm_vblank_count(dev, crtc)
|
||||
- vblwait->request.sequence) <= (1 << 23)));
|
||||
drm_vblank_put(dev, crtc);
|
||||
DRM_UNLOCK();
|
||||
}
|
||||
DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
|
||||
((drm_vblank_count(dev, crtc)
|
||||
- vblwait->request.sequence) <= (1 << 23)));
|
||||
DRM_UNLOCK();
|
||||
|
||||
if (ret != EINTR) {
|
||||
struct timeval now;
|
||||
@ -601,6 +579,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
drm_vblank_put(dev, crtc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ do { \
|
||||
OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \
|
||||
OUT_RING(RADEON_RB3D_ZC_FLUSH | RADEON_RB3D_ZC_FREE); \
|
||||
} else { \
|
||||
OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \
|
||||
OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); \
|
||||
OUT_RING(R300_ZC_FLUSH | R300_ZC_FREE); \
|
||||
} \
|
||||
} while (0)
|
||||
|
Loading…
Reference in New Issue
Block a user