2009-11-02 23:36:12 +03:00
|
|
|
|
|
|
|
#include <drm/drmP.h>
|
2014-09-01 15:49:48 +04:00
|
|
|
#include <drm/radeon_drm.h>
|
2009-11-02 23:36:12 +03:00
|
|
|
#include "radeon.h"
|
|
|
|
#include "radeon_object.h"
|
|
|
|
|
2011-07-17 20:57:53 +04:00
|
|
|
extern int radeon_benchmarking;
|
|
|
|
|
2009-11-02 23:36:12 +03:00
|
|
|
static int my_atoi(char **cmd)
|
|
|
|
{
|
|
|
|
char* p = *cmd;
|
|
|
|
int val = 0;
|
|
|
|
|
|
|
|
for (;; *p++) {
|
|
|
|
switch (*p) {
|
|
|
|
case '0' ... '9':
|
|
|
|
val = 10*val+(*p-'0');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*cmd = p;
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-12 16:55:15 +03:00
|
|
|
char* parse_mode(char *p, videomode_t *mode)
|
2009-11-02 23:36:12 +03:00
|
|
|
{
|
|
|
|
char c;
|
|
|
|
|
|
|
|
while( (c = *p++) == ' ');
|
|
|
|
|
|
|
|
if( c )
|
|
|
|
{
|
|
|
|
p--;
|
|
|
|
|
|
|
|
mode->width = my_atoi(&p);
|
|
|
|
if(*p == 'x') p++;
|
|
|
|
|
|
|
|
mode->height = my_atoi(&p);
|
|
|
|
if(*p == 'x') p++;
|
|
|
|
|
|
|
|
mode->bpp = 32;
|
|
|
|
|
|
|
|
mode->freq = my_atoi(&p);
|
|
|
|
|
|
|
|
if( mode->freq == 0 )
|
|
|
|
mode->freq = 60;
|
|
|
|
}
|
|
|
|
|
|
|
|
return p;
|
|
|
|
};
|
|
|
|
|
|
|
|
char* parse_path(char *p, char *log)
|
|
|
|
{
|
|
|
|
char c;
|
|
|
|
|
|
|
|
while( (c = *p++) == ' ');
|
|
|
|
p--;
|
|
|
|
while( (c = *log++ = *p++) && (c != ' '));
|
|
|
|
*log = 0;
|
|
|
|
|
|
|
|
return p;
|
|
|
|
};
|
|
|
|
|
2010-02-12 16:55:15 +03:00
|
|
|
void parse_cmdline(char *cmdline, videomode_t *mode, char *log, int *kms)
|
2009-11-02 23:36:12 +03:00
|
|
|
{
|
|
|
|
char *p = cmdline;
|
|
|
|
|
|
|
|
char c = *p++;
|
|
|
|
|
|
|
|
while( c )
|
|
|
|
{
|
|
|
|
if( c == '-')
|
|
|
|
{
|
|
|
|
switch(*p++)
|
|
|
|
{
|
2011-07-17 20:57:53 +04:00
|
|
|
case 'b':
|
|
|
|
radeon_benchmarking = 1;
|
2009-11-02 23:36:12 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'l':
|
|
|
|
p = parse_path(p, log);
|
|
|
|
break;
|
|
|
|
|
2011-07-17 20:57:53 +04:00
|
|
|
case 'm':
|
|
|
|
p = parse_mode(p, mode);
|
|
|
|
break;
|
|
|
|
|
2009-11-02 23:36:12 +03:00
|
|
|
case 'n':
|
|
|
|
*kms = 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
c = *p++;
|
|
|
|
};
|
|
|
|
};
|