Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: dev/virtio/gpu/virtio-gpu.c

Issue 1777783003: [display] Refactor to avoid implicit framebuffer allocation. (Closed) Base URL: https://github.com/littlekernel/lk.git@master
Patch Set: fix stride confusion Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/dev/display.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | include/dev/display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698