summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/bochs/bochs_hw.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-02-27 01:38:33 +0300
committerDave Airlie <airlied@redhat.com>2020-02-27 01:38:57 +0300
commitaaa9d265a21e7c4fcec12b1203cbfa516277e4ad (patch)
tree430a148961f39e387d9104d70326bed243c6144a /drivers/gpu/drm/bochs/bochs_hw.c
parent1b245ec5b685ebf8e6e5d1e6b5bcc03b6608e8b0 (diff)
parentd718e53a48f7bcfa6cdd0c00d5ed1fb516595446 (diff)
downloadlinux-aaa9d265a21e7c4fcec12b1203cbfa516277e4ad.tar.xz
Merge tag 'drm-misc-next-2020-02-21' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.7: UAPI Changes: Cross-subsystem Changes: Core Changes: - crtc: Drop get_crtc callback - dp: Add support for DP1.4 EDID corruption test - edid: Improve CEA detailed timings support - format-helper: Move to a GPL2/MIT dual license - mode: Drop drm_display_mode.private - vblank: Convert drm-driver vblank related code to CRTC equivalents and cleanup the core. - drm_global_mutex reworks Driver Changes: - hibmc: Add gamma_set support and improve DPMS support - pl111: Support Integrator IM-PD1 - sun4i: LVDS support for the A20, improvements to panel handling in DSI - virtio: job batching improvements, mem handling code rework - panel: Support for Rocktech RK101II01D-CT - bridge: Support for ADV7535, tc358768, improvements to ti-sn65dsi86 Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20200221100928.anipic2v7q5wswkb@gilmour.lan
Diffstat (limited to 'drivers/gpu/drm/bochs/bochs_hw.c')
-rw-r--r--drivers/gpu/drm/bochs/bochs_hw.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c
index b615b7dfdd9d..952199cc0462 100644
--- a/drivers/gpu/drm/bochs/bochs_hw.c
+++ b/drivers/gpu/drm/bochs/bochs_hw.c
@@ -4,6 +4,7 @@
#include <linux/pci.h>
+#include <drm/drm_drv.h>
#include <drm/drm_fourcc.h>
#include "bochs.h"
@@ -194,6 +195,8 @@ void bochs_hw_fini(struct drm_device *dev)
{
struct bochs_device *bochs = dev->dev_private;
+ /* TODO: shot down existing vram mappings */
+
if (bochs->mmio)
iounmap(bochs->mmio);
if (bochs->ioports)
@@ -207,6 +210,11 @@ void bochs_hw_fini(struct drm_device *dev)
void bochs_hw_setmode(struct bochs_device *bochs,
struct drm_display_mode *mode)
{
+ int idx;
+
+ if (!drm_dev_enter(bochs->dev, &idx))
+ return;
+
bochs->xres = mode->hdisplay;
bochs->yres = mode->vdisplay;
bochs->bpp = 32;
@@ -232,11 +240,18 @@ void bochs_hw_setmode(struct bochs_device *bochs,
bochs_dispi_write(bochs, VBE_DISPI_INDEX_ENABLE,
VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
+
+ drm_dev_exit(idx);
}
void bochs_hw_setformat(struct bochs_device *bochs,
const struct drm_format_info *format)
{
+ int idx;
+
+ if (!drm_dev_enter(bochs->dev, &idx))
+ return;
+
DRM_DEBUG_DRIVER("format %c%c%c%c\n",
(format->format >> 0) & 0xff,
(format->format >> 8) & 0xff,
@@ -256,13 +271,18 @@ void bochs_hw_setformat(struct bochs_device *bochs,
__func__, format->format);
break;
}
+
+ drm_dev_exit(idx);
}
void bochs_hw_setbase(struct bochs_device *bochs,
int x, int y, int stride, u64 addr)
{
unsigned long offset;
- unsigned int vx, vy, vwidth;
+ unsigned int vx, vy, vwidth, idx;
+
+ if (!drm_dev_enter(bochs->dev, &idx))
+ return;
bochs->stride = stride;
offset = (unsigned long)addr +
@@ -277,4 +297,6 @@ void bochs_hw_setbase(struct bochs_device *bochs,
bochs_dispi_write(bochs, VBE_DISPI_INDEX_VIRT_WIDTH, vwidth);
bochs_dispi_write(bochs, VBE_DISPI_INDEX_X_OFFSET, vx);
bochs_dispi_write(bochs, VBE_DISPI_INDEX_Y_OFFSET, vy);
+
+ drm_dev_exit(idx);
}