summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/legacy_crtc.c10
-rw-r--r--src/radeon.h9
-rw-r--r--src/radeon_driver.c63
-rw-r--r--src/radeon_reg.h2
-rw-r--r--src/radeon_video.c256
5 files changed, 5 insertions, 335 deletions
diff --git a/src/legacy_crtc.c b/src/legacy_crtc.c
index 2c35498..f7216f9 100644
--- a/src/legacy_crtc.c
+++ b/src/legacy_crtc.c
@@ -872,7 +872,6 @@ RADEONInitCrtcRegisters(xf86CrtcPtr crtc, RADEONSavePtr save,
int hsync_start;
int hsync_wid;
int vsync_wid;
- int fix_inter;
switch (info->CurrentLayout.pixel_code) {
case 4: format = 1; break;
@@ -924,17 +923,14 @@ RADEONInitCrtcRegisters(xf86CrtcPtr crtc, RADEONSavePtr save,
? RADEON_CRTC_H_SYNC_POL
: 0));
- /* fixup for interlaced modes */
- fix_inter = (mode->Flags & V_INTERLACE) ? 2 : 1;
-
/* This works for double scan mode. */
- save->crtc_v_total_disp = (((mode->CrtcVTotal * fix_inter - 1) & 0xffff)
- | ((mode->CrtcVDisplay * fix_inter - 1) << 16));
+ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
+ | ((mode->CrtcVDisplay - 1) << 16));
vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart;
if (!vsync_wid) vsync_wid = 1;
- save->crtc_v_sync_strt_wid = (((mode->CrtcVSyncStart * fix_inter - 1) & 0xfff)
+ save->crtc_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff)
| ((vsync_wid & 0x1f) << 16)
| ((mode->Flags & V_NVSYNC)
? RADEON_CRTC_V_SYNC_POL
diff --git a/src/radeon.h b/src/radeon.h
index 2f4bc95..5191808 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -204,10 +204,7 @@ typedef enum {
OPTION_TVSTD,
OPTION_IGNORE_LID_STATUS,
OPTION_DEFAULT_TVDAC_ADJ,
- OPTION_INT10,
- OPTION_SYNC_FIELDS,
- OPTION_SCHED_PRIO,
- OPTION_SYF_DEBUG,
+ OPTION_INT10
} RADEONOpts;
@@ -805,10 +802,6 @@ typedef struct {
Bool r600_shadow_fb;
void *fb_shadow;
- Bool sync_fields;
- int SchedPrio;
- Bool SYF_debug;
-
int num_gb_pipes;
Bool has_tcl;
} RADEONInfoRec, *RADEONInfoPtr;
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 0bba6f9..b6e1990 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -111,8 +111,6 @@
#include "radeon_chipset_gen.h"
-#include <errno.h>
-#include "sys/resource.h"
#include "radeon_chipinfo_gen.h"
/* Forward definitions for driver functions */
@@ -194,10 +192,7 @@ static const OptionInfoRec RADEONOptions[] = {
{ OPTION_IGNORE_LID_STATUS, "IgnoreLidStatus", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DEFAULT_TVDAC_ADJ, "DefaultTVDACAdj", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_INT10, "Int10", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SYNC_FIELDS, "SyncFields", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SCHED_PRIO, "SF_SchedPrio", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SYF_DEBUG, "SF_Debug", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
};
const OptionInfoRec *RADEONOptionsWeak(void) { return RADEONOptions; }
@@ -2668,7 +2663,6 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags)
int crtc_max_X, crtc_max_Y;
RADEONEntPtr pRADEONEnt;
DevUnion* pPriv;
- MessageType from = X_PROBED;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
"RADEONPreInit\n");
@@ -2947,61 +2941,6 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags)
goto fail;
}
- /* read sync fields options */
- if (xf86GetOptValBool(info->Options, OPTION_SYNC_FIELDS, &info->sync_fields)) {
- from = X_CONFIG;
- } else {
- info->sync_fields = TRUE;
- from = X_DEFAULT;
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "sync fields %sactivated\n",
- info->sync_fields ? "" : "de");
- if (xf86GetOptValInteger(info->Options, OPTION_SCHED_PRIO, &info->SchedPrio)) {
- from = X_CONFIG;
- } else {
- info->SchedPrio = 0;
- from = X_DEFAULT;
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "scheduling priority requested %d\n",
- info->SchedPrio);
- if (xf86GetOptValBool(info->Options, OPTION_SYF_DEBUG, &info->SYF_debug)) {
- from = X_CONFIG;
- } else {
- info->SYF_debug = FALSE;
- from = X_DEFAULT;
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "sync fields debug %sactivated\n",
- info->SYF_debug ? "" : "de");
-
- /* control sync fields options consistency */
- if (!(pScrn->currentMode->Flags & V_INTERLACE)
- && info->sync_fields) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot support sync fields on non interlaced displays, disabled\n");
- info->sync_fields = 0;
- }
-
- /*
- * sync_fields only works with
- * Modeline "720x576_50i" 13.875 720 744 808 888 576 580 585 625 -hsync -vsync interlace
- */
- if ((pScrn->currentMode->Clock != 13875
- || pScrn->currentMode->HDisplay != 720
- || pScrn->currentMode->VDisplay != 576)
- && info->sync_fields) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot support sync fields with current timing, disabled\n");
- info->sync_fields = 0;
- }
- if (info->sync_fields) {
- if (info->SchedPrio) {
- if (setpriority(PRIO_PROCESS, 0, info->SchedPrio)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "failed to setpriority as requested: %s\n", strerror(errno));
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "set scheduling priority to %d\n", getpriority(PRIO_PROCESS, 0));
- }
- }
- }
/* Free int10 info */
if (pInt10)
diff --git a/src/radeon_reg.h b/src/radeon_reg.h
index 1971a02..3b3a8e5 100644
--- a/src/radeon_reg.h
+++ b/src/radeon_reg.h
@@ -470,7 +470,6 @@
#define RADEON_CRTC2_PITCH 0x032c
#define RADEON_CRTC_STATUS 0x005c
-# define RADEON_CRTC_CURRENT_FIELD (1 << 3)
# define RADEON_CRTC_VBLANK_SAVE (1 << 1)
# define RADEON_CRTC_VBLANK_SAVE_CLEAR (1 << 1)
#define RADEON_CRTC2_STATUS 0x03fc
@@ -500,7 +499,6 @@
# define RADEON_CRTC2_V_DISP_SHIFT 16
#define RADEON_CRTC_VLINE_CRNT_VLINE 0x0210
# define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16)
-# define RADEON_CRTC_CRNT_VLINE_SHIFT 16
#define RADEON_CRTC2_CRNT_FRAME 0x0314
#define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318
#define RADEON_CRTC2_STATUS 0x03fc
diff --git a/src/radeon_video.c b/src/radeon_video.c
index cb98694..ac60166 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -8,13 +8,6 @@
#include <stdio.h>
#include <math.h>
-#define _RADEON_COMMON_H_
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <xf86drm.h>
-#include <drm/radeon_drm.h>
-extern void vga_sync_fields();
-
#include "radeon.h"
#include "radeon_reg.h"
#include "radeon_macros.h"
@@ -2868,9 +2861,6 @@ RADEONDisplayVideo(
scale_cntl = RADEON_SCALER_ADAPTIVE_DEINT | RADEON_SCALER_DOUBLE_BUFFER
| RADEON_SCALER_ENABLE | RADEON_SCALER_SMART_SWITCH | (0x7f<<16) | scaler_src;
- if (info->sync_fields) {
- scale_cntl |= RADEON_SCALER_VERT_PICK_NEAREST;
- }
switch(id){
case FOURCC_UYVY:
scale_cntl |= RADEON_SCALER_SOURCE_YVYU422;
@@ -2943,10 +2933,6 @@ RADEONPutImage(
uint32_t tmp;
xf86CrtcPtr crtc;
- if (info->sync_fields) {
- vga_sync_fields(info);
- }
-
/*
* s2offset, s3offset - byte offsets into U and V plane of the
* source where copying starts. Y plane is
@@ -4022,245 +4008,3 @@ switch(pPriv->encoding){
}
}
-/* --- 8< --- */
-/*
- * field cycle duration in usecs for PAL
- */
-#define SYF_PAL_FIELD_CYCLE 20000
-
-/*
- * frame cycle duration in usecs for PAL
- */
-#define SYF_PAL_FRAME_CYCLE (SYF_PAL_FIELD_CYCLE << 1)
-
-/*
- * dependent on interlaced (progressive) input frame rate 25 (50) fps
- * we set this to 0 (1). other params should adjust accordingly.
- */
-#define SYF_INPUT_DOUBLE_RATE 0
-
-/*
- * prefilter to prevent stray updates.
- * our software PLL will not try to lock for these.
- */
-#define SYF_CATCH_RANGE (18000 >> SYF_INPUT_DOUBLE_RATE)
-
-/*
- * updates outside time window defined by this
- * value spawn warnings when in debug mode
- */
-#define SYF_WARN_RANGE (15000 >> SYF_INPUT_DOUBLE_RATE)
-
-/*
- * we average 25 (50) frames to yield a cycle time of
- * about one second for analysis of frame rate data.
- * this serves as frequency divider for our software PLL.
- */
-#define SYF_PLL_DIVIDER (25 << SYF_INPUT_DOUBLE_RATE)
-
-/*
- * input frame cycle duration in usecs for 25 (50) fps
- */
-#define SYF_FRAME_CYCLE (SYF_PAL_FRAME_CYCLE >> SYF_INPUT_DOUBLE_RATE)
-
-/*
- * offset in usecs from double buffer switch where we try to place double
- * buffer updates.
- * this minimizes sensivity to jitter of our software PLL phase comparator.
- */
-#define SYF_SYNC_POINT (SYF_FRAME_CYCLE >> 1)
-
-/*
- * one trim increment compensates drift speed for about 29usec/sec.
- * this represents resolution of our VCO input.
- */
-#define SYF_MIN_STEP_USEC 100
-
-/* NOT CURRENTLY USED
- * factor weighting drift against sync point displacement
- * when calculating overall compensation
- */
-#define SYF_DISP_DRIFT_FACTOR 1
-
-/* NOT CURRENTLY USED
- * to allow for smooth adaption also on slower devices we delimit maximum
- * trim change per step size.
- * this implements some kind of low pass filter for our VCO input.
- */
-#define SYF_MAX_TRIM_REL 1000
-
-/*
- * maximum absolute trim values allowed due to current
- * hardware/driver contraints.
- * this delimits 'maximum voltage' controlling our VCO.
- * currently allowed range is defined symmetrically around the center voltage.
- */
-#define SYF_MAX_TRIM_ABS 37
-
-#define DEBUG
-#ifdef DEBUG
-#define ERRORF ErrorF
-#else
-#define ERRORF(...)
-#endif
-
-#define USE_METER
-#ifdef USE_METER
-#define OUT_GRAPHIC meter_out
-#else
-#define OUT_GRAPHIC(...)
-#endif
-
-#ifdef STANDALONE
-#define ErrorF printf
-#define B(a) (*(argv + (a)) ? *(argv + (a)) : 0)
-#define min(a, b) ((a) <= (b) ? (a) : (b))
-#define max(a, b) ((a) >= (b) ? (a) : (b))
-#define abs(a) ((a) >= 0 ? (a) : -(a))
-#else
-#define B(a) (a)
-#endif
-
-typedef struct _syf {
- int cnt;
- int tsum;
- int trim;
- int drift;
- int spoint;
-} syf_t;
-
-void
-meter_out(val, symb)
-{
- static char meter[81];
- static char headr[81] = "|<- -20ms 0 +20ms ->|";
-
- if (!symb || symb == 1) {
- if (!symb) ErrorF("%s", headr);
- if (symb == 1) ErrorF("%s", meter);
- memset(meter, '-', 80);
- return;
- }
- val /= 500;
- val = min(val, 39);
- val = max(val, -40);
- meter[40 + val] = symb;
-}
-/* --- 8< --- */
-
-void
-vga_sync_fields(info)
- RADEONInfoPtr info;
-{
- static syf_t syf, syf_clear;
- static struct timeval skew2vbl_prev;
- static drm_radeon_syncf_t syncf_prev;
- static drm_radeon_setparam_t vbl_activate;
-
- drm_radeon_syncf_t syncf;
- struct timeval skew2vbl;
- struct timeval tv_usecs;
- int usecs;
-
- if (!vbl_activate.param) {
- vbl_activate.param = RADEON_SETPARAM_VBLANK_CRTC;
- vbl_activate.value = DRM_RADEON_VBLANK_CRTC1;
- if (ioctl(info->drmFD, DRM_IOCTL_RADEON_SETPARAM, &vbl_activate)) {
- ErrorF("DRM_IOCTL_RADEON_SETPARAM: %s\n", strerror(errno));
- }
- }
-
-/* --- 8< --- */
- syncf.trim = 0;
- if (ioctl(info->drmFD, DRM_IOCTL_RADEON_SYNCF, &syncf)) {
- ErrorF("DRM_IOCTL_RADEON_SYNCF: %s\n", strerror(errno)); exit(-1);
- }
- VSF_SUB(syncf.tv_now, syncf_prev.tv_now, tv_usecs);
- VSF_TV2USEC(tv_usecs, usecs);
-#ifdef STANDALONE
- if (syncf_prev.tv_now.tv_sec) {
- usleepv += SYF_FRAME_CYCLE - usecs;
- }
-#endif
- syncf_prev = syncf;
- if (abs(usecs - SYF_FRAME_CYCLE) > SYF_CATCH_RANGE) {
-
- /*
- * toss stray intervals and reset
- */
- syf = syf_clear;
- skew2vbl_prev.tv_sec = ~0;
- OUT_GRAPHIC(0, 0);
- ErrorF(" R %11d\n", usecs);
-#ifdef STANDALONE
- goto main_loop_end;
-#else
- return;
-#endif
- }
- if (abs(usecs - SYF_FRAME_CYCLE) > SYF_WARN_RANGE) {
- OUT_GRAPHIC(0, 0);
- ErrorF(" W %11d\n", usecs);
- }
-
-#ifndef STANDALONE
-{
- /*
- * we must delay the next double buffer update
- * until even field has been processed.
- */
- unsigned char *RADEONMMIO = info->MMIO;
- int vline = (INREG(RADEON_CRTC_VLINE_CRNT_VLINE) & RADEON_CRTC_CRNT_VLINE_MASK) >> RADEON_CRTC_CRNT_VLINE_SHIFT;
- int stat = INREG(RADEON_CRTC_STATUS) & RADEON_CRTC_CURRENT_FIELD;
- if (!stat) {
- usleep(64 * (311 - (vline >> 1) + 1));
- }
-}
-#endif
- VSF_SUB(syncf.tv_now, syncf.tv_vbl, skew2vbl)
- if (skew2vbl_prev.tv_sec != ~0) {
- syf.tsum += usecs;
- syf.spoint += skew2vbl.tv_usec - SYF_SYNC_POINT;
- VSF_SUB(skew2vbl, skew2vbl_prev, tv_usecs);
- VSF_TV2USEC(tv_usecs, usecs);
- syf.drift += usecs;
- ++syf.cnt;
- }
- if (skew2vbl_prev.tv_sec != ~0 && !(syf.cnt % SYF_PLL_DIVIDER)) {
- syf.spoint /= SYF_PLL_DIVIDER;
- if (info->SYF_debug) {
- OUT_GRAPHIC(0, '+');
- OUT_GRAPHIC(syf.spoint, '|');
- OUT_GRAPHIC(syf.drift, '*');
- OUT_GRAPHIC(0, 1);
- }
- syf.trim = (syf.drift + syf.spoint / SYF_DISP_DRIFT_FACTOR) / SYF_MIN_STEP_USEC;
- syf.trim = max(syf.trim, -SYF_MAX_TRIM_REL);
- syf.trim = min(syf.trim, SYF_MAX_TRIM_REL);
- if (info->SYF_debug) {
- ERRORF("%7d %7d [%3d%+4d] %7d\n", syf.drift, syf.spoint,
- (char)(syncf.trim & 0xff), syf.trim, syf.tsum);
- }
- syf.spoint = 0;
- syf.drift = 0;
- syf.tsum = 0;
- }
- if (B(1) && syf.trim) {
- int t = (char)(syncf.trim & 0xff);
-
- if (syf.trim > 0) {
- t = min(t + 1, SYF_MAX_TRIM_ABS);
- --syf.trim;
- } else {
- t = max(t - 1, -SYF_MAX_TRIM_ABS);
- ++syf.trim;
- }
- syncf.trim = VSF_SET_TRIM | VSF_TEMPLATE | t & 0xff;
- if (ioctl(info->drmFD, DRM_IOCTL_RADEON_SYNCF, &syncf)) {
- ErrorF("DRM_IOCTL_RADEON_SYNCF: %s\n", strerror(errno)); exit(-1);
- }
- }
- skew2vbl_prev = skew2vbl;
-/* --- 8< --- */
-
-}