/dpm.c (a458be504b627da28249b6787b60d01d7194c32a) (1260 bytes) (mode 100644) (type blob)
//author Sylvain Bertrand <digital.ragnarok@gmail.com>
//Protected by GNU Affero GPL v3 with some exceptions.
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/mman.h>
#include <error.h>
#include <linux/types.h>
#include <alga/pixel_fmts.h>
#include <alga/amd/dce6/dce6.h>
#include <alga/amd/si/ioctl.h>
#define e(m,...) error(0,0,m,##__VA_ARGS__)
#define unsignedl unsigned long
int main(int argc, char *argv[])
{
if(argc<3){
e("missing argument\n");
goto err;
}
uint64_t fb_gpu_addr=strtoul(argv[2],NULL,16);
int f=open("/dev/si0", O_RDWR);
if(f==-1){
e("open failed\n");
goto err;
}
uint8_t i=(uint8_t)strtoul(argv[1],NULL,10);
unsignedl req=_IOW('d',SI_DCE_DP_DPM,i);
int r=ioctl(f,req,&i);
if(r==-1){
e("dp dpm failed\n");
goto err_file_close;
}
req=_IOW('d',SI_MEM_FREE,fb_gpu_addr);
r=ioctl(f,req,&fb_gpu_addr);
if(r==-1){
e("free vram fb failed (LEAK!)\n");
goto err_file_close;
}
r=close(f);
if(r==-1){
e("close failed\n");
goto err;
}
return 0;
err_file_close:
r=close(f);
if(r==-1) e("close failed\n");
err:
return EXIT_FAILURE;
}
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
35123 |
f891bd326c39a671fddfd210c0d951c97674c7c3 |
LICENSE |
100644 |
blob |
405 |
3ed5aa544d933f7b88b648964752e5443c27df85 |
README.md |
100644 |
blob |
2282 |
1c4b0d5ba77ce6e79cbb62295b3e8d15ec7a9689 |
dma_l2l.c |
100644 |
blob |
1746 |
a4d2242bba822dc989ee13598862483e47ab101f |
dma_u32_fill.c |
100644 |
blob |
1260 |
a458be504b627da28249b6787b60d01d7194c32a |
dpm.c |
100644 |
blob |
1653 |
3650ee140eab2d08eee33d9c30072580a4e7e6e8 |
edid.c |
100644 |
blob |
804 |
7d3d87f7d43f8000784ad4bf16ae9d055e177640 |
makefile |
100644 |
blob |
3029 |
77fa08994a1b8edf40a103d2cb73250e7ef49f81 |
modeset.c |
100644 |
blob |
2452 |
9daad256ae24e196d376e6d1aa2826466be7ee8f |
pf.c |
100644 |
blob |
36311 |
fec6dbe39290da3a33e42c89be93646569d10691 |
tri.c |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/si-user
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/si-user
Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/si-user
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main