Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Commit

Permalink
Add a userspace tool to set resolution using ioctl binding
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Apr 25, 2018
1 parent ff37c0c commit fef9aa0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
25 changes: 25 additions & 0 deletions apps/set-resolution.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include <kernel/video.h>

int main(int argc, char * argv[]) {
if (argc < 3) {
fprintf(stderr, "Usage: %s width height\n", argv[0]);
}

/* This should be something we do through yutani */
int fd = open("/dev/fb0", O_RDONLY);

struct vid_size s;
s.width = atoi(argv[1]);
s.height = atoi(argv[2]);

ioctl(fd, IO_VID_SET, &s);

return 0;
}
5 changes: 5 additions & 0 deletions base/usr/include/kernel/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#define IO_VID_SET 0x5006
#define IO_VID_STRIDE 0x5007

struct vid_size {
uint32_t width;
uint32_t height;
};

#ifdef _KERNEL_
extern void lfb_set_resolution(uint16_t x, uint16_t y);
extern uint16_t lfb_resolution_x;
Expand Down
5 changes: 0 additions & 5 deletions modules/lfbvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ void lfb_set_resolution(uint16_t x, uint16_t y);
*/
uint8_t * lfb_vid_memory = (uint8_t *)0xE0000000;

struct vid_size {
uint32_t width;
uint32_t height;
};

static int ioctl_vid(fs_node_t * node, int request, void * argp) {
/* TODO: Make this actually support multiple video devices */

Expand Down

0 comments on commit fef9aa0

Please sign in to comment.