diff options
author | Jesse Barnes <jbarnes@hobbes.virtuousgeek.org> | 2007-04-10 10:45:55 -0700 |
---|---|---|
committer | Jesse Barnes <jbarnes@hobbes.virtuousgeek.org> | 2007-04-10 10:45:55 -0700 |
commit | 44a8761302888080f1cb6596d4573d88c1746da4 (patch) | |
tree | 851220ca0bdcd7677eda5ea796a4eb5a670bf406 /libdrm | |
parent | e114b981bc291049fa6996d487334a408acc1ce2 (diff) | |
parent | 50672adb3142abca743535a8e60c360ef47b2a08 (diff) |
Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm into origin/modesetting-101
Conflicts:
linux-core/drm_crtc.c - trivial merge
linux-core/drm_crtc.h - trivial merge
linux-core/intel_display.c - crtc_config -> mode_config
shared-core/i915_dma.c - accommodate new init code in i915_init.c
Diffstat (limited to 'libdrm')
-rw-r--r-- | libdrm/xf86drmMode.c | 36 | ||||
-rw-r--r-- | libdrm/xf86drmMode.h | 16 |
2 files changed, 38 insertions, 14 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index c4403b1c..c0444e65 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -40,6 +40,7 @@ #include "xf86drmMode.h" #include "xf86drm.h" #include <drm.h> +#include <string.h> /* * Util functions @@ -192,6 +193,30 @@ err_allocs: return 0; } +int drmModeAddFB(int fd, uint32_t width, uint32_t height, + uint8_t bpp, uint32_t pitch, drmBO *bo, uint32_t *buf_id) +{ + struct drm_mode_fb_cmd f; + int ret; + + f.width = width; + f.height = height; + f.pitch = pitch; + f.bpp = bpp; + f.handle = bo->handle; + + if (ret = ioctl(fd, DRM_IOCTL_MODE_ADDFB, &f)) + return ret; + + *buf_id = f.buffer_id; + return 0; +} + +int drmModeRmFB(int fd, uint32_t bufferId) +{ + return ioctl(fd, DRM_IOCTL_MODE_RMFB, bufferId); +} + #if 0 int drmModeForceProbe(int fd, uint32_t outputId) { @@ -287,11 +312,9 @@ err_allocs: } -int drmModeSetCrtc( - int fd, uint32_t crtcId, uint32_t bufferId, - uint32_t x, uint32_t y, uint32_t modeId, - uint32_t *outputs, int count - ) +int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId, + uint32_t x, uint32_t y, uint32_t modeId, + uint32_t *outputs, int count) { struct drm_mode_crtc crtc; @@ -363,7 +386,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id) r->crtcs = out.crtcs; r->clones = out.clones; r->modes = drmAllocCpy(out.modes, out.count_modes, sizeof(uint32_t)); - + strncpy(r->name, out.name, DRM_OUTPUT_NAME_LEN); + r->name[DRM_OUTPUT_NAME_LEN-1] = 0; return r; err_allocs: diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index c027a16d..594eb487 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -77,8 +77,10 @@ typedef struct _drmModeRes { typedef struct _drmModeFrameBuffer { - uint32_t minWidth, maxWidth; - uint32_t minHeight, maxHeight; + uint32_t width; + uint32_t height; + uint32_t pitch; + uint8_t bpp; } drmModeFrameBuffer, *drmModeFrameBufferPtr; @@ -118,7 +120,7 @@ typedef enum { typedef struct _drmModeOutput { unsigned int crtc; /**< Crtc currently connected to */ - + unsigned char name[DRM_OUTPUT_NAME_LEN]; drmModeConnection connection; uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ drmModeSubPixel subpixel; @@ -212,14 +214,12 @@ extern drmModeFrameBufferPtr drmModeGetFramebuffer(int fd, /** * Creates a new framebuffer with an buffer object as its scanout buffer. */ -extern uint32_t drmModeNewFrameBuffer(int fd, - uint32_t width, uint32_t height, - uint8_t bbp, uint32_t pitch, drmBO *bo); - +extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, + uint8_t bpp, uint32_t pitch, drmBO *bo, uint32_t *buf_id); /** * Destroies the given framebuffer. */ -extern int drmModeDesFrameBuffer(int fd, uint32_t bufferId); +extern int drmModeRmFB(int fd, uint32_t bufferId); /** * Changes the scanout buffer to the given buffer object. |