rpms/radeontool/F-7 radeontool-1.5.diff, NONE, 1.1 radeontool-fix-option-handling.diff, NONE, 1.1 radeontool-get-rid-of-lspci.diff, NONE, 1.1 radeontool.spec, NONE, 1.1 sources, 1.1, 1.2
Till Maas (till)
fedora-extras-commits at redhat.com
Tue Sep 11 14:19:39 UTC 2007
- Previous message (by thread): rpms/vbetool/F-7 vbetool-0.3-fix-gcc4bug.patch, NONE, 1.1 vbetool-libz.patch, NONE, 1.1 vbetool.spec, NONE, 1.1 sources, 1.1, 1.2
- Next message (by thread): rpms/flac/devel flac-1.2.0-gnu-stack.patch, NONE, 1.1 flac.spec, 1.30, 1.31 flac-1.1.3-gnu-stack.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: till
Update of /cvs/pkgs/rpms/radeontool/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4093
Modified Files:
sources
Added Files:
radeontool-1.5.diff radeontool-fix-option-handling.diff
radeontool-get-rid-of-lspci.diff radeontool.spec
Log Message:
sync with devel
radeontool-1.5.diff:
--- NEW FILE radeontool-1.5.diff ---
--- radeontool.c
+++ radeontool.c
@@ -21,7 +21,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
-#include <asm/page.h>
#include "radeon_reg.h"
@@ -30,7 +29,7 @@
/* *radeon_cntl_mem is mapped to the actual device's memory mapped control area. */
/* Not the address but what it points to is volatile. */
-unsigned char * volatile radeon_cntl_mem;
+volatile unsigned char * radeon_cntl_mem;
static void fatal(char *why)
{
@@ -47,7 +46,7 @@
printf("internal error\n");
exit(-2);
};
- value = *(unsigned long * volatile)(radeon_cntl_mem+offset);
+ value = *(volatile unsigned long *)(radeon_cntl_mem+offset);
if(debug)
printf("%08lx\n",value);
return value;
@@ -60,7 +59,7 @@
printf("internal error\n");
exit(-2);
};
- *(unsigned long * volatile)(radeon_cntl_mem+offset) = value;
+ *(volatile unsigned long *)(radeon_cntl_mem+offset) = value;
}
static void usage(void)
@@ -83,10 +82,10 @@
/* with /dev/mem, then I could write this whole program in perl, */
/* but sadly this is only the size of physical RAM. If you */
/* want to be truely bad and poke into device memory you have to mmap() */
-static unsigned char * map_devince_memory(unsigned int base,unsigned int length)
+static volatile unsigned char * map_device_memory(unsigned int base,unsigned int length)
{
int mem_fd;
- unsigned char *device_mem;
+ volatile unsigned char *device_mem;
/* open /dev/mem */
if ((mem_fd = open("/dev/mem", O_RDWR) ) < 0) {
@@ -94,12 +93,12 @@
}
/* mmap graphics memory */
- if ((device_mem = malloc(length + (PAGE_SIZE-1))) == NULL) {
+ if ((device_mem = malloc(length + (getpagesize()-1))) == NULL) {
fatal("allocation error \n");
}
- if ((unsigned long)device_mem % PAGE_SIZE)
- device_mem += PAGE_SIZE - ((unsigned long)device_mem % PAGE_SIZE);
- device_mem = (unsigned char *)mmap(
+ if ((unsigned long)device_mem % getpagesize())
+ device_mem += getpagesize() - ((unsigned long)device_mem % getpagesize());
+ device_mem = (volatile unsigned char *)mmap(
(caddr_t)device_mem,
length,
PROT_READ|PROT_WRITE,
@@ -107,9 +106,9 @@
mem_fd,
base
);
- if ((long)device_mem < 0) {
+ if (device_mem == (volatile unsigned char *)-1) {
if(debug)
- fprintf(stderr,"mmap returned %d\n",(int)device_mem);
+ fprintf(stderr,"mmap returned %d\n",(int)(long)device_mem);
fatal("mmap error \n");
}
return device_mem;
@@ -316,7 +315,7 @@
}
if(debug)
printf("Radeon found. Base control address is %x.\n",base);
- radeon_cntl_mem = map_devince_memory(base,0x2000);
+ radeon_cntl_mem = map_device_memory(base,0x2000);
}
int main(int argc,char *argv[])
radeontool-fix-option-handling.diff:
--- NEW FILE radeontool-fix-option-handling.diff ---
--- radeontool.c.options 2007-02-20 14:48:20.000000000 -0500
+++ radeontool.c 2007-02-20 14:53:07.000000000 -0500
@@ -320,18 +320,21 @@
int main(int argc,char *argv[])
{
+ int found_other = 0;
+ while (argc > 1 && !found_other) {
+ if(strcmp(argv[1],"--debug") == 0) {
+ debug=1;
+ argv++; argc--;
+ } else if(strncmp(argv[1],"--skip=",7) == 0) {
+ skip=atoi(argv[1]+7);
+ argv++; argc--;
+ } else {
+ found_other = 1;
+ }
+ }
if(argc == 1) {
- map_radeon_cntl_mem();
usage();
}
- if(strcmp(argv[1],"--debug") == 0) {
- debug=1;
- argv++; argc--;
- };
- if(strcmp(argv[1],"--skip=") == 0) {
- skip=atoi(argv[1]+7);
- argv++; argc--;
- };
map_radeon_cntl_mem();
if(argc == 2) {
if(strcmp(argv[1],"regs") == 0) {
radeontool-get-rid-of-lspci.diff:
--- NEW FILE radeontool-get-rid-of-lspci.diff ---
--- radeontool.c 2006/02/22 11:07:50 1.3
+++ radeontool.c 2006/03/08 00:37:25
@@ -21,6 +21,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
+#include <pci/pci.h>
#include "radeon_reg.h"
@@ -231,7 +232,7 @@ void radeon_cmd_stretch(char *param)
radeon_set(RADEON_FP_VERT_STRETCH,"RADEON_FP_VERT_STRETCH",fp_vert_stretch);
}
-
+#if 0
/* Here we fork() and exec() the lspci command to look for the Radeon hardware address. */
static void map_radeon_cntl_mem(void)
{
@@ -317,6 +318,62 @@ We need to look through it to find the s
printf("Radeon found. Base control address is %x.\n",base);
radeon_cntl_mem = map_device_memory(base,0x2000);
}
+#else
+static u32
+conf2long(unsigned char *c, unsigned int p)
+{
+ return c[p] | (c[p+1] << 8) | (c[p+2] << 16) | (c[p+3] << 24);
+}
+
+static void map_radeon_cntl_mem(void)
+{
+ struct pci_access *pacc;
+ struct pci_dev *dev;
+ unsigned int class;
+ int i;
+ int base = -1;
+ unsigned char *config;
+
+ config = malloc(64);
+ if (!config)
+ fatal("malloc(64) failed\n");
+ pacc = pci_alloc();
+ pci_init(pacc);
+ pci_scan_bus(pacc);
+ for(dev=pacc->devices; dev; dev=dev->next) { /* Iterate over all devices */
+ pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES);/* Fill in header info we need */
+ class = pci_read_word(dev, PCI_CLASS_DEVICE); /* Read config register directly */
+ if (dev->vendor_id == 0x1002 && class == 0x300) { /* ATI && Graphics card */
+ if (debug)
+ printf("Found: %02x:%02x.%d vendor=%04x device=%04x class=%04x\n",
+ dev->bus, dev->dev, dev->func, dev->vendor_id, dev->device_id, class);
+ if (skip-- < 1) {
+ pci_read_block(dev, 0, config, 64);
+ for (i=0; i<6; i++){
+ u32 flag = conf2long(config, PCI_BASE_ADDRESS_0 + 4*i);
+ if (flag & PCI_BASE_ADDRESS_SPACE_IO) /* I/O-Ports, not memory */
+ continue;
+ /* the original code parsed lspci for "emory" and "K", so it
+ * has to be at least 1K and less than 1M
+ */
+ if (dev->size[i] >=1024 && dev->size[i] < 1024*1024) {
+ base = dev->base_addr[i];
+ goto found;
+ }
+ }
+ }
+ }
+ }
+ found:
+ pci_cleanup(pacc);
+ free(config);
+ if (base == -1)
+ fatal("Radeon not found.\n");
+ if (debug)
+ printf("Radeon found. Base control address is %x.\n",base);
+ radeon_cntl_mem = map_device_memory(base,0x2000);
+}
+#endif
int main(int argc,char *argv[])
{
--- Makefile.no-lspci 2007-02-20 14:56:57.000000000 -0500
+++ Makefile 2007-02-20 14:56:42.000000000 -0500
@@ -1,7 +1,7 @@
radeontool: radeontool.c
- gcc -Wall -O2 radeontool.c -o radeontool
+ gcc -Wall -O2 radeontool.c -o radeontool -lpci
--- NEW FILE radeontool.spec ---
Name: radeontool
Version: 1.5
Release: 2%{?dist}
Summary: Backlight and video output configuration tool for radeon cards
Group: System Environment/Base
License: zlib
URL: http://fdd.com/software/radeon/
Source0: http://fdd.com/software/radeon/radeontool-%{version}.tar.gz
Patch20: radeontool-1.5.diff
Patch21: radeontool-fix-option-handling.diff
Patch22: radeontool-get-rid-of-lspci.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pciutils-devel zlib-devel
# radeontool is included in (some of) these pm-utils releases
Conflicts: pm-utils <= 0.99.3-11
%description
Radeontool may switch the backlight and external video output on and off. Use
radeontool at your own risk, it may damage your hardware.
%prep
%setup -q
%patch20 -p0 -b .volatile
%patch21 -p0 -b .options
%patch22 -p0 -b .no-lspci
%build
gcc $RPM_OPT_FLAGS -o radeontool radeontool.c -lpci -lz
%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
install -D -m 755 radeontool $RPM_BUILD_ROOT/%{_sbindir}/radeontool
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc CHANGES
%{_sbindir}/radeontool
%changelog
* Fri Sep 07 2007 Till Maas <opensource till name> - 1.5-2
- add Conflicts with old pm-utils package
* Fri Aug 31 2007 Till Maas <opensource till name> - 1.5-1
- initial release for Fedora with patches from pm-utils package
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/radeontool/F-7/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 9 Sep 2007 22:23:11 -0000 1.1
+++ sources 11 Sep 2007 14:19:06 -0000 1.2
@@ -0,0 +1 @@
+8065eebe5a2b163e43b40461bfe49a56 radeontool-1.5.tar.gz
- Previous message (by thread): rpms/vbetool/F-7 vbetool-0.3-fix-gcc4bug.patch, NONE, 1.1 vbetool-libz.patch, NONE, 1.1 vbetool.spec, NONE, 1.1 sources, 1.1, 1.2
- Next message (by thread): rpms/flac/devel flac-1.2.0-gnu-stack.patch, NONE, 1.1 flac.spec, 1.30, 1.31 flac-1.1.3-gnu-stack.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list