File dma_l2l.c changed (mode: 100644) (index d1abd92..1de18e9) |
12 |
12 |
#include <error.h> |
#include <error.h> |
13 |
13 |
#include <sys/types.h> |
#include <sys/types.h> |
14 |
14 |
#include <unistd.h> |
#include <unistd.h> |
|
15 |
|
#include <errno.h> |
15 |
16 |
|
|
16 |
17 |
#include <linux/types.h> |
#include <linux/types.h> |
17 |
18 |
|
|
|
21 |
22 |
#include <alga/amd/si/ioctl.h> |
#include <alga/amd/si/ioctl.h> |
22 |
23 |
|
|
23 |
24 |
#define e(m,...) error(0,0,m,##__VA_ARGS__) |
#define e(m,...) error(0,0,m,##__VA_ARGS__) |
24 |
|
#define o(m,...) printf(m,##__VA_ARGS__) |
|
|
25 |
|
#define o(m,...) printf(m "\n",##__VA_ARGS__) |
25 |
26 |
#define unsignedl unsigned long |
#define unsignedl unsigned long |
26 |
27 |
#define unsignedll unsigned long long |
#define unsignedll unsigned long long |
27 |
28 |
|
|
28 |
29 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
29 |
30 |
{ |
{ |
30 |
31 |
if(argc<5){ |
if(argc<5){ |
31 |
|
e("missing arguments\n"); |
|
|
32 |
|
e("missing arguments"); |
32 |
33 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
33 |
34 |
} |
} |
34 |
35 |
|
|
|
... |
... |
int main(int argc, char *argv[]) |
38 |
39 |
uint64_t arg_pixel_fmt=strtoul(argv[4],NULL,10); |
uint64_t arg_pixel_fmt=strtoul(argv[4],NULL,10); |
39 |
40 |
uint8_t pixel_fmt=arg_pixel_fmt; |
uint8_t pixel_fmt=arg_pixel_fmt; |
40 |
41 |
|
|
|
42 |
|
errno=0; |
41 |
43 |
int f=open("/dev/si0", O_RDWR); |
int f=open("/dev/si0", O_RDWR); |
42 |
44 |
if(f==-1){ |
if(f==-1){ |
43 |
|
e("open failed\n"); |
|
|
45 |
|
e("open failed:%s",strerror(errno)); |
44 |
46 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
45 |
47 |
} |
} |
46 |
48 |
|
|
47 |
49 |
uint64_t sz=h*w*alga_pixel_fmts_sz[pixel_fmt]; |
uint64_t sz=h*w*alga_pixel_fmts_sz[pixel_fmt]; |
|
50 |
|
|
|
51 |
|
errno=0; |
48 |
52 |
void *dma_buffer0=mmap(NULL,sz,PROT_READ|PROT_WRITE,MAP_SHARED,f,0); |
void *dma_buffer0=mmap(NULL,sz,PROT_READ|PROT_WRITE,MAP_SHARED,f,0); |
49 |
53 |
if(dma_buffer0==MAP_FAILED){ |
if(dma_buffer0==MAP_FAILED){ |
50 |
|
e("unable to mmap a dma buffer0\n"); |
|
|
54 |
|
e("unable to mmap a dma buffer0:%s",strerror(errno)); |
51 |
55 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
52 |
56 |
} |
} |
53 |
57 |
|
|
|
... |
... |
int main(int argc, char *argv[]) |
62 |
66 |
|
|
63 |
67 |
struct si_dma dma; |
struct si_dma dma; |
64 |
68 |
struct si_dma_l2l *l2l=&dma.params.l2l; |
struct si_dma_l2l *l2l=&dma.params.l2l; |
|
69 |
|
struct si_timeouts_info *t_info=&dma.t_info; |
65 |
70 |
dma.type=SI_DMA_TYPE_L2L; |
dma.type=SI_DMA_TYPE_L2L; |
66 |
71 |
dma.dir=SI_DMA_TO_DEVICE; |
dma.dir=SI_DMA_TO_DEVICE; |
|
72 |
|
//we don't really care here lets put one seconde! |
|
73 |
|
t_info->ring.n_max=1; |
|
74 |
|
t_info->ring.us=1000000; |
|
75 |
|
t_info->fence.n_max=1; |
|
76 |
|
t_info->fence.us=1000000; |
67 |
77 |
l2l->src_addr=(uint64_t)dma_buffer0; |
l2l->src_addr=(uint64_t)dma_buffer0; |
68 |
78 |
l2l->dst_addr=fb_gpu_addr; |
l2l->dst_addr=fb_gpu_addr; |
69 |
79 |
l2l->sz=sz; |
l2l->sz=sz; |
70 |
80 |
unsignedl req=_IOW('d',SI_DMA,dma); |
unsignedl req=_IOW('d',SI_DMA,dma); |
|
81 |
|
errno=0; |
71 |
82 |
int r=ioctl(f,req,&dma); |
int r=ioctl(f,req,&dma); |
72 |
|
if(r==-1){ |
|
73 |
|
e("dma cpy failed\n"); |
|
|
83 |
|
switch(r){ |
|
84 |
|
case -1: |
|
85 |
|
e("dma l2l failed:%s",strerror(errno)); |
|
86 |
|
return EXIT_FAILURE; |
|
87 |
|
case SI_RING_TIMEOUT: |
|
88 |
|
e("dma l2l failed:ring timeout"); |
|
89 |
|
return EXIT_FAILURE; |
|
90 |
|
case SI_FENCE_TIMEOUT: |
|
91 |
|
e("dma l2l failed:fence timeout"); |
74 |
92 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
75 |
93 |
} |
} |
76 |
94 |
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
File dma_u32_fill.c changed (mode: 100644) (index 0e8dbd9..bd9e1db) |
12 |
12 |
#include <error.h> |
#include <error.h> |
13 |
13 |
#include <sys/types.h> |
#include <sys/types.h> |
14 |
14 |
#include <unistd.h> |
#include <unistd.h> |
|
15 |
|
#include <errno.h> |
15 |
16 |
|
|
16 |
17 |
#include <linux/types.h> |
#include <linux/types.h> |
17 |
18 |
|
|
|
21 |
22 |
#include <alga/amd/si/ioctl.h> |
#include <alga/amd/si/ioctl.h> |
22 |
23 |
|
|
23 |
24 |
#define e(m,...) error(0,0,m,##__VA_ARGS__) |
#define e(m,...) error(0,0,m,##__VA_ARGS__) |
24 |
|
#define o(m,...) printf(m,##__VA_ARGS__) |
|
|
25 |
|
#define o(m,...) printf(m "\n",##__VA_ARGS__) |
25 |
26 |
#define unsignedl unsigned long |
#define unsignedl unsigned long |
26 |
27 |
#define unsignedll unsigned long long |
#define unsignedll unsigned long long |
27 |
28 |
|
|
28 |
29 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
29 |
30 |
{ |
{ |
30 |
31 |
if(argc<3){ |
if(argc<3){ |
31 |
|
e("missing arguments\n"); |
|
|
32 |
|
e("missing arguments"); |
32 |
33 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
33 |
34 |
} |
} |
34 |
35 |
|
|
|
36 |
|
errno=0; |
35 |
37 |
int f=open("/dev/si0", O_RDWR); |
int f=open("/dev/si0", O_RDWR); |
36 |
38 |
if(f==-1){ |
if(f==-1){ |
37 |
|
e("open failed\n"); |
|
|
39 |
|
e("open failed:%s",strerror(errno)); |
38 |
40 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
39 |
41 |
} |
} |
40 |
42 |
|
|
41 |
43 |
struct si_dma dma; |
struct si_dma dma; |
42 |
44 |
struct si_dma_u32_fill *u32_fill=&dma.params.u32_fill; |
struct si_dma_u32_fill *u32_fill=&dma.params.u32_fill; |
|
45 |
|
struct si_timeouts_info *t_info=&dma.t_info; |
43 |
46 |
dma.type=SI_DMA_TYPE_U32_FILL; |
dma.type=SI_DMA_TYPE_U32_FILL; |
44 |
47 |
dma.dir=SI_DMA_ON_DEVICE; |
dma.dir=SI_DMA_ON_DEVICE; |
|
48 |
|
//we don't really care here lets put one seconde! |
|
49 |
|
t_info->ring.n_max=1; |
|
50 |
|
t_info->ring.us=1000000; |
|
51 |
|
t_info->fence.n_max=1; |
|
52 |
|
t_info->fence.us=1000000; |
45 |
53 |
u32_fill->dst_addr=strtoul(argv[1],NULL,16); |
u32_fill->dst_addr=strtoul(argv[1],NULL,16); |
46 |
54 |
u32_fill->dws_n=strtoul(argv[2],NULL,16); |
u32_fill->dws_n=strtoul(argv[2],NULL,16); |
47 |
55 |
u32_fill->constant=strtoul(argv[3],NULL,16); |
u32_fill->constant=strtoul(argv[3],NULL,16); |
48 |
56 |
unsignedl req=_IOW('d',SI_DMA,dma); |
unsignedl req=_IOW('d',SI_DMA,dma); |
|
57 |
|
errno=0; |
49 |
58 |
int r=ioctl(f,req,&dma); |
int r=ioctl(f,req,&dma); |
50 |
|
if(r==-1){ |
|
51 |
|
e("dma fill failed\n"); |
|
|
59 |
|
switch(r){ |
|
60 |
|
case -1: |
|
61 |
|
e("dma fill failed:%s",strerror(errno)); |
|
62 |
|
return EXIT_FAILURE; |
|
63 |
|
case SI_RING_TIMEOUT: |
|
64 |
|
e("dma fill failed:ring timeout"); |
|
65 |
|
return EXIT_FAILURE; |
|
66 |
|
case SI_FENCE_TIMEOUT: |
|
67 |
|
e("dma fill failed:fence timeout"); |
52 |
68 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
53 |
69 |
} |
} |
54 |
70 |
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
File pf.c changed (mode: 100644) (index 20650fb..ccfb304) |
11 |
11 |
#include <sys/mman.h> |
#include <sys/mman.h> |
12 |
12 |
#include <error.h> |
#include <error.h> |
13 |
13 |
#include <sys/epoll.h> |
#include <sys/epoll.h> |
|
14 |
|
#include <errno.h> |
14 |
15 |
|
|
15 |
16 |
#include <linux/types.h> |
#include <linux/types.h> |
16 |
17 |
|
|
|
27 |
28 |
|
|
28 |
29 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
29 |
30 |
{ |
{ |
|
31 |
|
errno=0; |
30 |
32 |
int d_fd=open("/dev/si0", O_RDWR); |
int d_fd=open("/dev/si0", O_RDWR); |
31 |
33 |
if(d_fd==-1){ |
if(d_fd==-1){ |
32 |
|
e("open failed"); |
|
|
34 |
|
e("open failed:%s\n",strerror(errno)); |
33 |
35 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
34 |
36 |
} |
} |
35 |
37 |
|
|
36 |
38 |
uint8_t idx=strtoul(argv[1],NULL,10); |
uint8_t idx=strtoul(argv[1],NULL,10); |
37 |
39 |
unsignedl req=_IOW('d',SI_DCE_PF,idx); |
unsignedl req=_IOW('d',SI_DCE_PF,idx); |
|
40 |
|
errno=0; |
38 |
41 |
int r=ioctl(d_fd,req,&idx); |
int r=ioctl(d_fd,req,&idx); |
39 |
42 |
if(r==-1){ |
if(r==-1){ |
40 |
|
e("pf failed"); |
|
|
43 |
|
e("pf failed:%s",strerror(errno)); |
41 |
44 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
42 |
45 |
} |
} |
43 |
46 |
|
|
|
47 |
|
errno=0; |
44 |
48 |
int efd=epoll_create1(0); |
int efd=epoll_create1(0); |
45 |
49 |
if(efd==-1){ |
if(efd==-1){ |
46 |
|
e("epoll_create"); |
|
|
50 |
|
e("epoll_create:%s",strerror(errno)); |
47 |
51 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
48 |
52 |
} |
} |
49 |
53 |
|
|
50 |
54 |
struct epoll_event evt; |
struct epoll_event evt; |
51 |
55 |
evt.events=EPOLLIN; |
evt.events=EPOLLIN; |
52 |
56 |
evt.data.fd=d_fd; |
evt.data.fd=d_fd; |
|
57 |
|
errno=0; |
53 |
58 |
r=epoll_ctl(efd,EPOLL_CTL_ADD,d_fd,&evt); |
r=epoll_ctl(efd,EPOLL_CTL_ADD,d_fd,&evt); |
54 |
59 |
if(r==-1){ |
if(r==-1){ |
55 |
|
e("epoll_ctl:add driver file descriptor"); |
|
|
60 |
|
e("epoll_ctl:add driver file descriptor:%s",strerror(errno)); |
56 |
61 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
57 |
62 |
} |
} |
58 |
63 |
|
|
59 |
64 |
struct epoll_event evts[EVTS_MAX]; |
struct epoll_event evts[EVTS_MAX]; |
60 |
65 |
memset(&evts,0,sizeof(evts)); |
memset(&evts,0,sizeof(evts)); |
|
66 |
|
errno=0; |
61 |
67 |
int fds_n=epoll_wait(efd,&evts[0],EVTS_MAX,-1); |
int fds_n=epoll_wait(efd,&evts[0],EVTS_MAX,-1); |
62 |
68 |
if(fds_n==-1){ |
if(fds_n==-1){ |
63 |
|
e("epoll_wait"); |
|
|
69 |
|
e("epoll_wait:%s",strerror(errno)); |
64 |
70 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
65 |
71 |
} |
} |
66 |
72 |
|
|
|
... |
... |
int main(int argc, char *argv[]) |
76 |
82 |
|
|
77 |
83 |
//XXX:the driver file has no end and read will block if there is no |
//XXX:the driver file has no end and read will block if there is no |
78 |
84 |
//event available. |
//event available. |
|
85 |
|
errno=0; |
79 |
86 |
ssize_t rd=read(d_fd,&si_evt,sizeof(si_evt)); |
ssize_t rd=read(d_fd,&si_evt,sizeof(si_evt)); |
80 |
87 |
o("read one event of %ld bytes",(long)rd); |
o("read one event of %ld bytes",(long)rd); |
81 |
88 |
if(rd==-1){ |
if(rd==-1){ |
82 |
|
e("read"); |
|
|
89 |
|
e("read:%s",strerror(errno)); |
83 |
90 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
84 |
91 |
} |
} |
85 |
92 |
struct si_evt_pf *si_evt_pf=&si_evt.params.pf; |
struct si_evt_pf *si_evt_pf=&si_evt.params.pf; |
File tri.c changed (mode: 100644) (index cc36516..2371677) |
19 |
19 |
#include <error.h> |
#include <error.h> |
20 |
20 |
#include <sys/mman.h> |
#include <sys/mman.h> |
21 |
21 |
#include <endian.h> |
#include <endian.h> |
|
22 |
|
#include <errno.h> |
22 |
23 |
|
|
23 |
24 |
#include <linux/types.h> |
#include <linux/types.h> |
24 |
25 |
|
|
|
... |
... |
int main(int argc, char *argv[]) |
927 |
928 |
(ull)h); |
(ull)h); |
928 |
929 |
|
|
929 |
930 |
//---------------------------------------------------------------------------- |
//---------------------------------------------------------------------------- |
|
931 |
|
errno=0; |
930 |
932 |
int f=open("/dev/si0",O_RDWR); |
int f=open("/dev/si0",O_RDWR); |
931 |
933 |
if(f==-1){ |
if(f==-1){ |
932 |
|
e("open failed"); |
|
|
934 |
|
e("open failed:%s",strerror(errno)); |
933 |
935 |
r0=EXIT_FAILURE; |
r0=EXIT_FAILURE; |
934 |
936 |
goto exit; |
goto exit; |
935 |
937 |
} |
} |
|
... |
... |
int main(int argc, char *argv[]) |
959 |
961 |
struct si_mem mem; |
struct si_mem mem; |
960 |
962 |
mem.align=256;//worst alignment is vs and ps |
mem.align=256;//worst alignment is vs and ps |
961 |
963 |
mem.sz=vram_buf_sz; |
mem.sz=vram_buf_sz; |
|
964 |
|
errno=0; |
962 |
965 |
ul req=_IOWR('d',SI_MEM_ALLOC,mem); |
ul req=_IOWR('d',SI_MEM_ALLOC,mem); |
963 |
966 |
r1=ioctl(f,req,&mem); |
r1=ioctl(f,req,&mem); |
964 |
967 |
if(r1==-1){ |
if(r1==-1){ |
965 |
|
e("alloc vram buffer failed"); |
|
|
968 |
|
e("alloc vram buffer failed:%s",strerror(errno)); |
966 |
969 |
r0=EXIT_FAILURE; |
r0=EXIT_FAILURE; |
967 |
970 |
goto exit; |
goto exit; |
968 |
971 |
} |
} |
|
... |
... |
int main(int argc, char *argv[]) |
986 |
989 |
//---------------------------------------------------------------------------- |
//---------------------------------------------------------------------------- |
987 |
990 |
o("mmaping an aperture..."); |
o("mmaping an aperture..."); |
988 |
991 |
//get an aperture of the size of our vram buffer for dma |
//get an aperture of the size of our vram buffer for dma |
|
992 |
|
errno=0; |
989 |
993 |
void *dma_buffer=mmap(NULL,vram_buf_sz,PROT_READ|PROT_WRITE,MAP_SHARED,f,0); |
void *dma_buffer=mmap(NULL,vram_buf_sz,PROT_READ|PROT_WRITE,MAP_SHARED,f,0); |
990 |
994 |
if(dma_buffer==MAP_FAILED){ |
if(dma_buffer==MAP_FAILED){ |
991 |
|
e("unable to mmap an aperture buffer"); |
|
|
995 |
|
e("unable to mmap an aperture buffer:%s",strerror(errno)); |
992 |
996 |
r0=EXIT_FAILURE; |
r0=EXIT_FAILURE; |
993 |
997 |
goto free_vram_buf; |
goto free_vram_buf; |
994 |
998 |
} |
} |
|
... |
... |
int main(int argc, char *argv[]) |
1028 |
1032 |
o("dma-ing the cpu buffer to vram buffer..."); |
o("dma-ing the cpu buffer to vram buffer..."); |
1029 |
1033 |
struct si_dma dma; |
struct si_dma dma; |
1030 |
1034 |
struct si_dma_l2l *l2l=&dma.params.l2l; |
struct si_dma_l2l *l2l=&dma.params.l2l; |
|
1035 |
|
struct si_timeouts_info *t_info=&dma.t_info; |
1031 |
1036 |
dma.type=SI_DMA_TYPE_L2L; |
dma.type=SI_DMA_TYPE_L2L; |
1032 |
1037 |
dma.dir=SI_DMA_TO_DEVICE; |
dma.dir=SI_DMA_TO_DEVICE; |
|
1038 |
|
//we don't really care here lets put one seconde! |
|
1039 |
|
t_info->ring.n_max=1; |
|
1040 |
|
t_info->ring.us=1000000; |
|
1041 |
|
t_info->fence.n_max=1; |
|
1042 |
|
t_info->fence.us=1000000; |
1033 |
1043 |
l2l->src_addr=(uint64_t)dma_buffer; |
l2l->src_addr=(uint64_t)dma_buffer; |
1034 |
1044 |
l2l->dst_addr=mem.gpu_addr; |
l2l->dst_addr=mem.gpu_addr; |
1035 |
1045 |
l2l->sz=vram_buf_sz; |
l2l->sz=vram_buf_sz; |
1036 |
1046 |
req=_IOW('d',SI_DMA,dma); |
req=_IOW('d',SI_DMA,dma); |
|
1047 |
|
errno=0; |
1037 |
1048 |
r1=ioctl(f,req,&dma); |
r1=ioctl(f,req,&dma); |
1038 |
|
if(r1==-1){ |
|
1039 |
|
e("dma cpy of the vram buffer from cpu to vram failed"); |
|
|
1049 |
|
switch(r1){ |
|
1050 |
|
case -1: |
|
1051 |
|
e("dma l2l failed:%s",strerror(errno)); |
|
1052 |
|
r0=EXIT_FAILURE; |
|
1053 |
|
goto free_vram_buf; |
|
1054 |
|
case SI_RING_TIMEOUT: |
|
1055 |
|
e("dma l2l failed:ring timeout"); |
|
1056 |
|
r0=EXIT_FAILURE; |
|
1057 |
|
goto free_vram_buf; |
|
1058 |
|
case SI_FENCE_TIMEOUT: |
|
1059 |
|
e("dma l2l failed:fence timeout"); |
1040 |
1060 |
r0=EXIT_FAILURE; |
r0=EXIT_FAILURE; |
1041 |
1061 |
goto free_vram_buf; |
goto free_vram_buf; |
1042 |
1062 |
} |
} |
|
... |
... |
int main(int argc, char *argv[]) |
1046 |
1066 |
//---------------------------------------------------------------------------- |
//---------------------------------------------------------------------------- |
1047 |
1067 |
o("running the ib..."); |
o("running the ib..."); |
1048 |
1068 |
struct si_gfx_ib gfx_ib; |
struct si_gfx_ib gfx_ib; |
|
1069 |
|
struct si_timeout_info *ring_t_info=&gfx_ib.ring_t_info; |
|
1070 |
|
//we don't really care here lets put one seconde! |
|
1071 |
|
ring_t_info->n_max=1; |
|
1072 |
|
ring_t_info->us=1000000; |
1049 |
1073 |
gfx_ib.gpu_addr=mem.gpu_addr+ib_of; |
gfx_ib.gpu_addr=mem.gpu_addr+ib_of; |
1050 |
1074 |
gfx_ib.dws_n=ib_dws_n; |
gfx_ib.dws_n=ib_dws_n; |
1051 |
1075 |
req=_IOW('d',SI_GFX_IB,gfx_ib); |
req=_IOW('d',SI_GFX_IB,gfx_ib); |
|
1076 |
|
errno=0; |
1052 |
1077 |
r1=ioctl(f,req,&gfx_ib); |
r1=ioctl(f,req,&gfx_ib); |
1053 |
|
if(r1==-1){ |
|
1054 |
|
e("running the GFX indirecting buffer failed"); |
|
|
1078 |
|
switch(r1){ |
|
1079 |
|
case -1: |
|
1080 |
|
e("running the GFX indirecting buffer failed:%s",strerror(errno)); |
|
1081 |
|
r0=EXIT_FAILURE; |
|
1082 |
|
goto free_vram_buf; |
|
1083 |
|
case SI_RING_TIMEOUT: |
|
1084 |
|
e("running the GFX indirecting buffer failed:ring timeout"); |
1055 |
1085 |
r0=EXIT_FAILURE; |
r0=EXIT_FAILURE; |
1056 |
1086 |
goto free_vram_buf; |
goto free_vram_buf; |
1057 |
1087 |
} |
} |
|
... |
... |
int main(int argc, char *argv[]) |
1060 |
1090 |
|
|
1061 |
1091 |
//---------------------------------------------------------------------------- |
//---------------------------------------------------------------------------- |
1062 |
1092 |
o("fencing..."); |
o("fencing..."); |
1063 |
|
req=_IO('d',SI_GFX_FENCE); |
|
1064 |
|
r1=ioctl(f,req,NULL); |
|
1065 |
|
if(r1==-1){ |
|
1066 |
|
e("waiting for fence failed"); |
|
|
1093 |
|
struct si_gfx_fence gfx_fence; |
|
1094 |
|
t_info=&gfx_fence.t_info; |
|
1095 |
|
//we don't really care here lets put one seconde! |
|
1096 |
|
t_info->ring.n_max=1; |
|
1097 |
|
t_info->ring.us=1000000; |
|
1098 |
|
t_info->fence.n_max=1; |
|
1099 |
|
t_info->fence.us=1000000; |
|
1100 |
|
req=_IOW('d',SI_GFX_FENCE,gfx_fence); |
|
1101 |
|
errno=0; |
|
1102 |
|
r1=ioctl(f,req,&gfx_fence); |
|
1103 |
|
switch(r1){ |
|
1104 |
|
case -1: |
|
1105 |
|
e("waiting for fence failed:%s",strerror(errno)); |
|
1106 |
|
r0=EXIT_FAILURE; |
|
1107 |
|
break; |
|
1108 |
|
case SI_RING_TIMEOUT: |
|
1109 |
|
e("waiting for fence failed:ring timeout"); |
|
1110 |
|
r0=EXIT_FAILURE; |
|
1111 |
|
break; |
|
1112 |
|
case SI_FENCE_TIMEOUT: |
|
1113 |
|
e("waiting for fence failed:fence timeout"); |
1067 |
1114 |
r0=EXIT_FAILURE; |
r0=EXIT_FAILURE; |
|
1115 |
|
break; |
1068 |
1116 |
} |
} |
1069 |
1117 |
o("fencing done"); |
o("fencing done"); |
1070 |
1118 |
//---------------------------------------------------------------------------- |
//---------------------------------------------------------------------------- |
|
... |
... |
free_vram_buf: |
1073 |
1121 |
//---------------------------------------------------------------------------- |
//---------------------------------------------------------------------------- |
1074 |
1122 |
o("freeing vram buffer..."); |
o("freeing vram buffer..."); |
1075 |
1123 |
req=_IOW('d',SI_MEM_FREE,mem.gpu_addr); |
req=_IOW('d',SI_MEM_FREE,mem.gpu_addr); |
|
1124 |
|
errno=0; |
1076 |
1125 |
r1=ioctl(f,req,&mem.gpu_addr); |
r1=ioctl(f,req,&mem.gpu_addr); |
1077 |
1126 |
if(r1==-1){ |
if(r1==-1){ |
1078 |
|
e("free vram buffer failed (LEAK!)"); |
|
|
1127 |
|
e("free vram buffer failed (LEAK!):%s",strerror(errno)); |
1079 |
1128 |
r0=EXIT_FAILURE; |
r0=EXIT_FAILURE; |
1080 |
1129 |
} |
} |
1081 |
1130 |
o("freeing vram buffer done"); |
o("freeing vram buffer done"); |