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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/dev/display.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dev/virtio/gpu/virtio-gpu.c
diff --git a/dev/virtio/gpu/virtio-gpu.c b/dev/virtio/gpu/virtio-gpu.c
index b5dff6ffea324e79344449c64aecec2623730fde..f9e78bd1941486f5f4ea9c1d3e80ecfff209f7cd 100644
--- a/dev/virtio/gpu/virtio-gpu.c
+++ b/dev/virtio/gpu/virtio-gpu.c
@@ -33,7 +33,6 @@
#include <kernel/event.h>
#include <kernel/mutex.h>
#include <kernel/vm.h>
-#include <lib/gfx.h>
#include <dev/display.h>
#include "virtio_gpu.h"
@@ -557,21 +556,37 @@ void virtio_gpu_gfx_flush(uint starty, uint endy)
event_signal(&the_gdev->flush_event, !arch_ints_disabled());
}
+status_t display_get_framebuffer(struct display_framebuffer *fb)
+{
+ DEBUG_ASSERT(fb);
+ memset(fb, 0, sizeof(*fb));
+
+ if (!the_gdev)
+ return ERR_NOT_FOUND;
+
+ fb->image.pixels = the_gdev->fb;
+ fb->image.format = IMAGE_FORMAT_RGB_x888;
+ fb->image.width = the_gdev->pmode.r.width;
+ fb->image.height = the_gdev->pmode.r.height;
+ fb->image.stride = fb->image.width;
+ fb->image.rowbytes = fb->image.width * 4;
+ fb->flush = virtio_gpu_gfx_flush;
+ fb->format = DISPLAY_FORMAT_RGB_x888;
+
+ return NO_ERROR;
+}
+
status_t display_get_info(struct display_info *info)
{
+ DEBUG_ASSERT(info);
memset(info, 0, sizeof(*info));
if (!the_gdev)
return ERR_NOT_FOUND;
- info->framebuffer = the_gdev->fb;
- info->format = GFX_FORMAT_RGB_x888;
+ info->format = DISPLAY_FORMAT_RGB_x888;
info->width = the_gdev->pmode.r.width;
info->height = the_gdev->pmode.r.height;
- info->stride = info->width;
- info->flush = virtio_gpu_gfx_flush;
return NO_ERROR;
}
-
-
« 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