summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-07-15 00:57:45 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-07-15 00:57:45 +0000
commit8aa2891569bc80b89cdcc6e355be03af5c232bde (patch)
treefd9417269e2d932e1ed674852c965d1cf41275ad /sys
parentc7c615108118742a345f07500f19ab61746797e6 (diff)
Replace local method of determining rasops rotation with
drm_get_panel_orientation_quirk(). ok mlarkin@ kettenis@ tested by kettenis@ on Asus T100HA
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c
index 65947f6146f..c3fbdf5ce79 100644
--- a/sys/dev/pci/drm/i915/i915_drv.c
+++ b/sys/dev/pci/drm/i915/i915_drv.c
@@ -45,6 +45,7 @@
#include <drm/drm_crtc_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/i915_drm.h>
+#include <drm/drm_utils.h>
#include "i915_drv.h"
#include "i915_trace.h"
@@ -3598,6 +3599,7 @@ inteldrm_attachhook(struct device *self)
struct wsemuldisplaydev_attach_args aa;
const struct drm_pcidev *id = dev_priv->id;
struct drm_device *dev = &dev_priv->drm;
+ int orientation_quirk;
if (i915_driver_load(dev_priv, id))
goto fail;
@@ -3613,24 +3615,14 @@ inteldrm_attachhook(struct device *self)
inteldrm_init_backlight(dev_priv);
ri->ri_flg = RI_CENTER | RI_WRONLY | RI_VCONS | RI_CLEAR;
- if (ri->ri_width < ri->ri_height) {
- pcireg_t subsys;
-#define PCI_PRODUCT_ASUSTEK_T100HA 0x1bdd
+ orientation_quirk = drm_get_panel_orientation_quirk(ri->ri_width,
+ ri->ri_height);
+ if (orientation_quirk == DRM_MODE_PANEL_ORIENTATION_LEFT_UP)
+ ri->ri_flg |= RI_ROTATE_CCW;
+ else if (orientation_quirk == DRM_MODE_PANEL_ORIENTATION_RIGHT_UP)
+ ri->ri_flg |= RI_ROTATE_CW;
- /*
- * Asus T100HA needs to be rotated counter-clockwise.
- * Everybody else seems to mount their panels the
- * other way around.
- */
- subsys = pci_conf_read(dev_priv->pc, dev_priv->tag,
- PCI_SUBSYS_ID_REG);
- if (PCI_VENDOR(subsys) == PCI_VENDOR_ASUSTEK &&
- PCI_PRODUCT(subsys) == PCI_PRODUCT_ASUSTEK_T100HA)
- ri->ri_flg |= RI_ROTATE_CCW;
- else
- ri->ri_flg |= RI_ROTATE_CW;
- }
ri->ri_hw = dev_priv;
rasops_init(ri, 160, 160);