| 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 { |
| 561 DEBUG_ASSERT(fb); |
| 562 memset(fb, 0, sizeof(*fb)); |
| 563 |
| 564 if (!the_gdev) |
| 565 return ERR_NOT_FOUND; |
| 566 |
| 567 fb->image.pixels = the_gdev->fb; |
| 568 fb->image.format = IMAGE_FORMAT_RGB_x888; |
| 569 fb->image.width = the_gdev->pmode.r.width; |
| 570 fb->image.height = the_gdev->pmode.r.height; |
| 571 fb->image.stride = fb->image.width; |
| 572 fb->image.rowbytes = fb->image.width * 4; |
| 573 fb->flush = virtio_gpu_gfx_flush; |
| 574 fb->format = DISPLAY_FORMAT_RGB_x888; |
| 575 |
| 576 return NO_ERROR; |
| 577 } |
| 578 |
| 560 status_t display_get_info(struct display_info *info) | 579 status_t display_get_info(struct display_info *info) |
| 561 { | 580 { |
| 581 DEBUG_ASSERT(info); |
| 562 memset(info, 0, sizeof(*info)); | 582 memset(info, 0, sizeof(*info)); |
| 563 | 583 |
| 564 if (!the_gdev) | 584 if (!the_gdev) |
| 565 return ERR_NOT_FOUND; | 585 return ERR_NOT_FOUND; |
| 566 | 586 |
| 567 info->framebuffer = the_gdev->fb; | 587 info->format = DISPLAY_FORMAT_RGB_x888; |
| 568 info->format = GFX_FORMAT_RGB_x888; | |
| 569 info->width = the_gdev->pmode.r.width; | 588 info->width = the_gdev->pmode.r.width; |
| 570 info->height = the_gdev->pmode.r.height; | 589 info->height = the_gdev->pmode.r.height; |
| 571 info->stride = info->width; | |
| 572 info->flush = virtio_gpu_gfx_flush; | |
| 573 | 590 |
| 574 return NO_ERROR; | 591 return NO_ERROR; |
| 575 } | 592 } |
| 576 | |
| 577 | |
| OLD | NEW |