Giter VIP home page Giter VIP logo

drm_tool's Introduction

drm_tool

A simple tool for getting drm info and setting properties.

This tool came as an experiment when trying to use audio through HDMI in a ATI card. Audio started to work after starting Xorg.

This was tested on the following ATI cards:

  • XFX R7 240
  • XFX R7 850

Links of interest (none of this links solve the issue, but describe it):

Description

Aparently Xorg enable the audio property when it starts. The function resposible to do this in the kernel is evergreen_hdmi_setmode (drivers/gpu/drm/radeon/evergreen_hdmi.c), this cards use the dce6 hdmi audio (drivers/gpu/drm/radeon/dce6_afmt.c). By default, when the cards are setted up audio is disabled.

In order to enable the audio the drmModeConnectorSetProperty(drm_fd, connector_id, prop_id, value); function of libdrm (/usr/include/xf86drmMode.h) must be called. The audio property id is usually 12 (in the tool the property is looked up by the name). Xorg sets this property with the value 2.

For more information on how to use the drm api check the followin links:

Example

$ make
gcc -c -Wall -D_FILE_OFFSET_BITS=64 `pkg-config --cflags libdrm`  -o "src/drm_tool.o" "src/drm_tool.c"
gcc `pkg-config --libs libdrm` src/drm_tool.o -o "./drm_tool"
$ ./drm_tool list
Card /dev/dri/card0
 capability 'DUMP BUFFER' (1) : 1
 capability 'VBLANK HIGH CRTC' (2) : 1
 capability 'DUMB PREFERED DEPTH' (3) : 24
 capability 'DUMB PREFER SHADOW' (4) : 1
 capability 'PRIME' (5) : 3
 capability 'TIMESTAMP MONOTONIC' (6) : 1
  Connector: 27
    unused connector 27
    property (#1):  EDID
    property (#2):  DPMS
    property (#5):  coherent
    property (#9):  underscan
    property (#10):  underscan hborder
    property (#11):  underscan vborder
    property (#12):  audio
    property (#13):  dither
  Connector: 29
    unused connector 29
    property (#1):  EDID
    property (#2):  DPMS
    property (#5):  coherent
    property (#9):  underscan
    property (#10):  underscan hborder
    property (#11):  underscan vborder
    property (#12):  audio
    property (#13):  dither
  Connector: 31
    mode  0: 1920x1080       60Hz 1920x1080
    mode  1: 1920x1080       60Hz 1920x1080
    mode  2: 1920x1080i      60Hz 1920x1080
    mode  3: 1920x1080i      60Hz 1920x1080
    mode  4: 1920x1080       50Hz 1920x1080
    mode  5: 1920x1080i      50Hz 1920x1080
    mode  6: 1600x1200       60Hz 1600x1200
    mode  7: 1680x1050       60Hz 1680x1050
    mode  8: 1280x1024       60Hz 1280x1024
    mode  9: 1440x900        60Hz 1440x900
    mode 10: 1280x960        60Hz 1280x960
    mode 11: 1280x800        60Hz 1280x800
    mode 12: 1280x720        60Hz 1280x720
    mode 13: 1280x720        60Hz 1280x720
    mode 14: 1280x720        50Hz 1280x720
    mode 15: 1024x768        60Hz 1024x768
    mode 16: 800x600         60Hz 800x600
    mode 17: 800x600         56Hz 800x600
    mode 18: 720x576         50Hz 720x576
    mode 19: 720x480         60Hz 720x480
    mode 20: 720x480         60Hz 720x480
    mode 21: 640x480         60Hz 640x480
    mode 22: 640x480         60Hz 640x480
    property (#1):  EDID
    property (#2):  DPMS
    property (#5):  coherent
    property (#9):  underscan
    property (#10):  underscan hborder
    property (#11):  underscan vborder
    property (#12):  audio
    property (#13):  dither
  Connector: 33
    unused connector 33
    property (#1):  EDID
    property (#2):  DPMS
    property (#5):  coherent
    property (#9):  underscan
    property (#10):  underscan hborder
    property (#11):  underscan vborder
    property (#12):  audio
    property (#13):  dither
  Connector: 35
    unused connector 35
    property (#1):  EDID
    property (#2):  DPMS
    property (#5):  coherent
    property (#9):  underscan
    property (#10):  underscan hborder
    property (#11):  underscan vborder
    property (#12):  audio
    property (#13):  dither
    property (#6):  load detection
$ ./drm_tool set /dev/dri/card0 31 audio 2
Setting 'audio' -> 2 - ret: 0 :: connector_id: 31 prop_id: 12

drm_tool's People

Contributors

nickcis avatar embtom avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.