[RFC 3/3] drm: simpledrm: Add panic handling
Noralf Trønnes
noralf at tronnes.org
Tue Aug 9 17:45:42 UTC 2016
This enables panic message output support in simpledrm.
simpledrm has a fixed buffer that is set up to be scanned out
and the virtual address is already available.
Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
---
drivers/gpu/drm/simpledrm/simpledrm_drv.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c b/drivers/gpu/drm/simpledrm/simpledrm_drv.c
index a329e4c..ceff617 100644
--- a/drivers/gpu/drm/simpledrm/simpledrm_drv.c
+++ b/drivers/gpu/drm/simpledrm/simpledrm_drv.c
@@ -23,6 +23,29 @@
#include <drm/drmP.h>
#include "simpledrm.h"
+static struct drm_framebuffer sdrm_panic_fb;
+
+struct drm_framebuffer *sdrm_panic(struct drm_device *dev, void **vmem)
+{
+ struct sdrm_device *sdrm = dev->dev_private;
+ struct drm_framebuffer *fb = &sdrm_panic_fb;
+
+ if (!sdrm)
+ return NULL;
+
+ fb->dev = dev;
+ fb->width = sdrm->fb_width;
+ fb->height = sdrm->fb_height;
+ fb->pixel_format = sdrm->fb_format;
+ drm_fb_get_bpp_depth(fb->pixel_format, &fb->depth,
+ &fb->bits_per_pixel);
+ fb->pitches[0] = sdrm->fb_stride;
+
+ *vmem = sdrm->fb_map;
+
+ return fb;
+}
+
static const struct file_operations sdrm_drm_fops = {
.owner = THIS_MODULE,
.open = drm_open,
@@ -42,6 +65,7 @@ static struct drm_driver sdrm_drm_driver = {
DRIVER_ATOMIC,
.fops = &sdrm_drm_fops,
.lastclose = sdrm_lastclose,
+ .panic = sdrm_panic,
.gem_free_object = sdrm_gem_free_object,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
--
2.8.2
More information about the dri-devel
mailing list