OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014-2015 Travis Geiselbrecht | 2 * Copyright (c) 2014-2015 Travis Geiselbrecht |
3 * | 3 * |
4 * Permission is hereby granted, free of charge, to any person obtaining | 4 * Permission is hereby granted, free of charge, to any person obtaining |
5 * a copy of this software and associated documentation files | 5 * a copy of this software and associated documentation files |
6 * (the "Software"), to deal in the Software without restriction, | 6 * (the "Software"), to deal in the Software without restriction, |
7 * including without limitation the rights to use, copy, modify, merge, | 7 * including without limitation the rights to use, copy, modify, merge, |
8 * publish, distribute, sublicense, and/or sell copies of the Software, | 8 * publish, distribute, sublicense, and/or sell copies of the Software, |
9 * and to permit persons to whom the Software is furnished to do so, | 9 * and to permit persons to whom the Software is furnished to do so, |
10 * subject to the following conditions: | 10 * subject to the following conditions: |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #include <assert.h> | 26 #include <assert.h> |
27 #include <trace.h> | 27 #include <trace.h> |
28 #include <compiler.h> | 28 #include <compiler.h> |
29 #include <list.h> | 29 #include <list.h> |
30 #include <err.h> | 30 #include <err.h> |
31 #include <string.h> | 31 #include <string.h> |
32 #include <kernel/thread.h> | 32 #include <kernel/thread.h> |
33 #include <kernel/event.h> | 33 #include <kernel/event.h> |
34 #include <kernel/mutex.h> | 34 #include <kernel/mutex.h> |
35 #include <kernel/vm.h> | 35 #include <kernel/vm.h> |
36 #include <lib/gfx.h> | |
37 #include <dev/display.h> | 36 #include <dev/display.h> |
38 | 37 |
39 #include "virtio_gpu.h" | 38 #include "virtio_gpu.h" |
40 | 39 |
41 #define LOCAL_TRACE 0 | 40 #define LOCAL_TRACE 0 |
42 | 41 |
43 static enum handler_return virtio_gpu_irq_driver_callback(struct virtio_device * dev, uint ring, const struct vring_used_elem *e); | 42 static enum handler_return virtio_gpu_irq_driver_callback(struct virtio_device * dev, uint ring, const struct vring_used_elem *e); |
44 static enum handler_return virtio_gpu_config_change_callback(struct virtio_devic e *dev); | 43 static enum handler_return virtio_gpu_config_change_callback(struct virtio_devic e *dev); |
45 static int virtio_gpu_flush_thread(void *arg); | 44 static int virtio_gpu_flush_thread(void *arg); |
46 | 45 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
550 } | 549 } |
551 | 550 |
552 return 0; | 551 return 0; |
553 } | 552 } |
554 | 553 |
555 void virtio_gpu_gfx_flush(uint starty, uint endy) | 554 void virtio_gpu_gfx_flush(uint starty, uint endy) |
556 { | 555 { |
557 event_signal(&the_gdev->flush_event, !arch_ints_disabled()); | 556 event_signal(&the_gdev->flush_event, !arch_ints_disabled()); |
558 } | 557 } |
559 | 558 |
559 status_t display_get_framebuffer(struct display_framebuffer *fb) | |
560 { | |
gkalsi
2016/03/09 21:13:37
nit: DEBUG_ASSERT(fb);
cdotstout
2016/03/09 22:48:00
Done.
| |
561 memset(fb, 0, sizeof(*fb)); | |
562 | |
563 if (!the_gdev) | |
564 return ERR_NOT_FOUND; | |
565 | |
566 fb->image.pixels = the_gdev->fb; | |
567 fb->image.format = IMAGE_FORMAT_RGB_x888; | |
568 fb->image.width = the_gdev->pmode.r.width; | |
569 fb->image.height = the_gdev->pmode.r.height; | |
570 fb->image.rowbytes = fb->image.width; | |
571 fb->flush = virtio_gpu_gfx_flush; | |
572 fb->format = DISPLAY_FORMAT_RGB_x888; | |
573 | |
574 return NO_ERROR; | |
575 } | |
576 | |
560 status_t display_get_info(struct display_info *info) | 577 status_t display_get_info(struct display_info *info) |
gkalsi
2016/03/09 21:13:37
nit: DEBUG_ASSERT(info);
cdotstout
2016/03/09 22:47:59
Done.
| |
561 { | 578 { |
562 memset(info, 0, sizeof(*info)); | 579 memset(info, 0, sizeof(*info)); |
563 | 580 |
564 if (!the_gdev) | 581 if (!the_gdev) |
565 return ERR_NOT_FOUND; | 582 return ERR_NOT_FOUND; |
566 | 583 |
567 info->framebuffer = the_gdev->fb; | 584 info->format = DISPLAY_FORMAT_RGB_x888; |
568 info->format = GFX_FORMAT_RGB_x888; | |
569 info->width = the_gdev->pmode.r.width; | 585 info->width = the_gdev->pmode.r.width; |
570 info->height = the_gdev->pmode.r.height; | 586 info->height = the_gdev->pmode.r.height; |
571 info->stride = info->width; | |
572 info->flush = virtio_gpu_gfx_flush; | |
573 | 587 |
574 return NO_ERROR; | 588 return NO_ERROR; |
575 } | 589 } |
576 | |
577 | |
OLD | NEW |