Skip to content

Commit becd6f2

Browse files
committed
update vfbdev to account for new fbdev address retriving
1 parent 80d1169 commit becd6f2

3 files changed

Lines changed: 8 additions & 26 deletions

File tree

so3/arch/arm64/thread.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <process.h>
2020
#include <thread.h>
21+
#include <generated/asm-offsets.h>
2122

2223
/**
2324
* Set the CPU registers with thread related information

so3/soo/drivers/vfbdevfront/vfbdev.c

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ typedef struct {
3131
uint32_t hres;
3232
uint32_t vres;
3333
size_t size;
34-
addr_t gnt_paddr[VFBDEV_MAX_REF];
35-
size_t page_count[VFBDEV_MAX_REF];
34+
addr_t fb_paddr;
3635

37-
uint64_t count_ref;
38-
grant_ref_t fb_ref[VFBDEV_MAX_REF];
3936
} vfbdev_priv_t;
4037

4138
/* Our unique uart instance. */
@@ -199,9 +196,9 @@ static int retrieve_data(vfbdev_priv_t *priv)
199196
{
200197
vfbdev_request_t *ring_req;
201198
vfbdev_response_t *ring_rsp;
202-
size_t i;
199+
avz_hyp_t hyp_args;
203200

204-
if (priv->count_ref != 0) {
201+
if (priv->size != 0) {
205202
return 1;
206203
}
207204

@@ -225,18 +222,12 @@ static int retrieve_data(vfbdev_priv_t *priv)
225222
priv->hres = ring_rsp->hres;
226223
priv->vres = ring_rsp->vres;
227224
priv->size = ring_rsp->size;
228-
priv->count_ref = ring_rsp->count_ref;
229-
memcpy(priv->fb_ref, ring_rsp->fb_ref, sizeof(ring_rsp->fb_ref));
230225

231226
vdevfront_processing_end(vfbdev_dev);
232227

233-
if (priv->count_ref == 0) {
234-
return 0;
235-
}
236-
237-
for (i = 0; i < priv->count_ref; i++) {
238-
gnttab_long_get(vfbdev_dev->otherend_id, priv->fb_ref[i], (void*)&priv->gnt_paddr[i], &priv->page_count[i]);
239-
}
228+
hyp_args.cmd = AVZ_FBDEV_GET_ADDR;
229+
avz_hypercall(&hyp_args);
230+
priv->fb_paddr = hyp_args.u.avz_fbdev_addr_args.paddr;
240231

241232
return 1;
242233
}
@@ -246,8 +237,6 @@ static int vfbdev_mmap(int fd, addr_t virt_addr, uint32_t page_count, off_t offs
246237
pcb_t *pcb = current()->pcb;
247238
struct devclass *dev;
248239
vfbdev_priv_t *priv;
249-
size_t i;
250-
size_t next_page;
251240

252241
dev = devclass_by_fd(fd);
253242
priv = devclass_get_priv(dev);
@@ -260,11 +249,7 @@ static int vfbdev_mmap(int fd, addr_t virt_addr, uint32_t page_count, off_t offs
260249
return -1;
261250
}
262251

263-
next_page = 0;
264-
for (i = 0; i < priv->count_ref; i++) {
265-
create_mapping(pcb->pgtable, virt_addr + offset, priv->gnt_paddr[i], priv->page_count[i] * PAGE_SIZE, false);
266-
offset += priv->page_count[i] * PAGE_SIZE;
267-
}
252+
create_mapping(pcb->pgtable, virt_addr, priv->fb_paddr, priv->size, true);
268253

269254
return 0;
270255
}

so3/soo/include/soo/dev/vfbdev.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#define VFBDEV_NAME "vfbdev"
99
#define VFBDEV_PREFIX "[" VFBDEV_NAME "] "
1010

11-
#define VFBDEV_MAX_REF 8
12-
1311
typedef struct {
1412
/* Nothing */
1513
} vfbdev_request_t;
@@ -18,8 +16,6 @@ typedef struct {
1816
uint32_t hres;
1917
uint32_t vres;
2018
uint64_t size;
21-
uint64_t count_ref;
22-
grant_ref_t fb_ref[VFBDEV_MAX_REF];
2319
} vfbdev_response_t;
2420

2521
DEFINE_RING_TYPES(vfbdev, vfbdev_request_t, vfbdev_response_t);

0 commit comments

Comments
 (0)