/*
* Bump this whenever driver interface changes.
*/
-#define DRM_VIGS_DRIVER_VERSION 12
+#define DRM_VIGS_DRIVER_VERSION 14
/*
* Surface access flags.
#define DRM_VIGS_SAF_WRITE 2
#define DRM_VIGS_SAF_MASK 3
+/*
+ * Number of DP framebuffers.
+ */
+#define DRM_VIGS_NUM_DP_FB_BUF 4
+
+/*
+ * DP memory types.
+ */
+#define DRM_VIGS_DP_FB_Y 2
+#define DRM_VIGS_DP_FB_C 3
+
struct drm_vigs_get_protocol_version
{
uint32_t version;
int zpos;
};
+struct drm_vigs_plane_set_transform
+{
+ uint32_t plane_id;
+ int hflip;
+ int vflip;
+ int rotation;
+};
+
+struct drm_vigs_dp_create_surface
+{
+ uint32_t dp_plane;
+ uint32_t dp_fb_buf;
+ uint32_t dp_mem_flag;
+ uint32_t width;
+ uint32_t height;
+ uint32_t stride;
+ uint32_t format;
+ uint32_t handle;
+ uint32_t size;
+ uint32_t id;
+};
+
+struct drm_vigs_dp_open_surface
+{
+ uint32_t dp_plane;
+ uint32_t dp_fb_buf;
+ uint32_t dp_mem_flag;
+ uint32_t handle;
+};
+
#define DRM_VIGS_GET_PROTOCOL_VERSION 0x00
#define DRM_VIGS_CREATE_SURFACE 0x01
#define DRM_VIGS_CREATE_EXECBUFFER 0x02
#define DRM_VIGS_FENCE_SIGNALED 0x0C
#define DRM_VIGS_FENCE_UNREF 0x0D
#define DRM_VIGS_PLANE_SET_ZPOS 0x0E
+#define DRM_VIGS_PLANE_SET_TRANSFORM 0x0F
+
+#define DRM_VIGS_DP_CREATE_SURFACE 0x20
+#define DRM_VIGS_DP_OPEN_SURFACE 0x21
#define DRM_IOCTL_VIGS_GET_PROTOCOL_VERSION DRM_IOR(DRM_COMMAND_BASE + \
DRM_VIGS_GET_PROTOCOL_VERSION, struct drm_vigs_get_protocol_version)
DRM_VIGS_FENCE_UNREF, struct drm_vigs_fence_unref)
#define DRM_IOCTL_VIGS_PLANE_SET_ZPOS DRM_IOW(DRM_COMMAND_BASE + \
DRM_VIGS_PLANE_SET_ZPOS, struct drm_vigs_plane_set_zpos)
+#define DRM_IOCTL_VIGS_PLANE_SET_TRANSFORM DRM_IOW(DRM_COMMAND_BASE + \
+ DRM_VIGS_PLANE_SET_TRANSFORM, struct drm_vigs_plane_set_transform)
+
+#define DRM_IOCTL_VIGS_DP_CREATE_SURFACE DRM_IOWR(DRM_COMMAND_BASE + \
+ DRM_VIGS_DP_CREATE_SURFACE, struct drm_vigs_dp_create_surface)
+#define DRM_IOCTL_VIGS_DP_OPEN_SURFACE DRM_IOWR(DRM_COMMAND_BASE + \
+ DRM_VIGS_DP_OPEN_SURFACE, struct drm_vigs_dp_open_surface)
#endif
Name: libdrm
Version: 2.4.35
-Release: 18
+Release: 20
License: MIT
Summary: Userspace interface to kernel DRM services
Group: System/Libraries
%post -n libkms1 -p /sbin/ldconfig
%postun -n libkms1 -p /sbin/ldconfig
+
%files devel
%dir %{_includedir}/libdrm
%{_includedir}/*
libdrm_vigs_la_LTLIBRARIES = libdrm_vigs.la
libdrm_vigs_ladir = $(libdir)
-libdrm_vigs_la_LDFLAGS = -version-number 7:0:0 -no-undefined
+libdrm_vigs_la_LDFLAGS = -version-number 9:0:0 -no-undefined
libdrm_vigs_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
libdrm_vigs_la_SOURCES = vigs.c
return (ret != 0) ? -errno : 0;
}
+
+int vigs_drm_plane_set_transform(struct vigs_drm_device *dev,
+ uint32_t plane_id,
+ int hflip,
+ int vflip,
+ vigs_drm_rotation rotation)
+{
+ struct drm_vigs_plane_set_transform req =
+ {
+ .plane_id = plane_id,
+ .hflip = hflip,
+ .vflip = vflip,
+ .rotation = rotation
+ };
+ int ret;
+
+ ret = drmIoctl(dev->fd, DRM_IOCTL_VIGS_PLANE_SET_TRANSFORM, &req);
+
+ return (ret != 0) ? -errno : 0;
+}
+
+int vigs_drm_dp_surface_create(struct vigs_drm_device *dev,
+ uint32_t dp_plane,
+ uint32_t dp_fb_buf,
+ uint32_t dp_mem_flag,
+ uint32_t width,
+ uint32_t height,
+ uint32_t stride,
+ uint32_t format,
+ struct vigs_drm_surface **sfc)
+{
+ struct vigs_drm_surface_impl *sfc_impl;
+ struct drm_vigs_dp_create_surface req =
+ {
+ .dp_plane = dp_plane,
+ .dp_fb_buf = dp_fb_buf,
+ .dp_mem_flag = dp_mem_flag,
+ .width = width,
+ .height = height,
+ .stride = stride,
+ .format = format,
+ };
+ int ret;
+
+ sfc_impl = calloc(sizeof(*sfc_impl), 1);
+
+ if (!sfc_impl) {
+ ret = -ENOMEM;
+ goto fail1;
+ }
+
+ ret = drmIoctl(dev->fd, DRM_IOCTL_VIGS_DP_CREATE_SURFACE, &req);
+
+ if (ret != 0) {
+ ret = -errno;
+ goto fail2;
+ }
+
+ vigs_drm_gem_impl_init((struct vigs_drm_gem_impl*)sfc_impl,
+ dev,
+ req.handle,
+ req.size,
+ 0);
+
+ sfc_impl->base.width = width;
+ sfc_impl->base.height = height;
+ sfc_impl->base.stride = stride;
+ sfc_impl->base.format = format;
+ sfc_impl->base.scanout = 0;
+ sfc_impl->base.id = req.id;
+
+ *sfc = &sfc_impl->base;
+
+ return 0;
+
+fail2:
+ free(sfc_impl);
+fail1:
+ *sfc = NULL;
+
+ return ret;
+}
+
+int vigs_drm_dp_surface_open(struct vigs_drm_device *dev,
+ uint32_t dp_plane,
+ uint32_t dp_fb_buf,
+ uint32_t dp_mem_flag,
+ struct vigs_drm_surface **sfc)
+{
+ struct vigs_drm_surface_impl *sfc_impl;
+ struct drm_vigs_dp_open_surface req =
+ {
+ .dp_plane = dp_plane,
+ .dp_fb_buf = dp_fb_buf,
+ .dp_mem_flag = dp_mem_flag
+ };
+ struct drm_vigs_surface_info info_req;
+ int ret;
+
+ sfc_impl = calloc(sizeof(*sfc_impl), 1);
+
+ if (!sfc_impl) {
+ ret = -ENOMEM;
+ goto fail1;
+ }
+
+ ret = drmIoctl(dev->fd, DRM_IOCTL_VIGS_DP_OPEN_SURFACE, &req);
+
+ if (ret != 0) {
+ ret = -errno;
+ goto fail2;
+ }
+
+ info_req.handle = req.handle;
+
+ ret = drmIoctl(dev->fd, DRM_IOCTL_VIGS_SURFACE_INFO, &info_req);
+
+ if (ret != 0) {
+ ret = -errno;
+ goto fail3;
+ }
+
+ vigs_drm_gem_impl_init((struct vigs_drm_gem_impl*)sfc_impl,
+ dev,
+ req.handle,
+ info_req.size,
+ 0);
+
+ sfc_impl->base.width = info_req.width;
+ sfc_impl->base.height = info_req.height;
+ sfc_impl->base.stride = info_req.stride;
+ sfc_impl->base.format = info_req.format;
+ sfc_impl->base.scanout = info_req.scanout;
+ sfc_impl->base.id = info_req.id;
+
+ *sfc = &sfc_impl->base;
+
+ return 0;
+
+fail3:
+ vigs_drm_gem_close(dev, req.handle);
+fail2:
+ free(sfc_impl);
+fail1:
+ *sfc = NULL;
+
+ return ret;
+}
} vigs_drm_surface_format;
/*
+ * Rotations.
+ */
+typedef enum
+{
+ vigs_drm_rotation_0 = 0x0,
+ vigs_drm_rotation_90 = 0x1,
+ vigs_drm_rotation_180 = 0x2,
+ vigs_drm_rotation_270 = 0x3,
+} vigs_drm_rotation;
+
+/*
* Surface access flags.
*/
#define VIGS_DRM_SAF_READ 1
uint32_t plane_id,
int zpos);
+int vigs_drm_plane_set_transform(struct vigs_drm_device *dev,
+ uint32_t plane_id,
+ int hflip,
+ int vflip,
+ vigs_drm_rotation rotation);
+
+/*
+ * @}
+ */
+
+/*
+ * DP functions.
+ * @{
+ */
+
+int vigs_drm_dp_surface_create(struct vigs_drm_device *dev,
+ uint32_t dp_plane,
+ uint32_t dp_fb_buf,
+ uint32_t dp_mem_flag,
+ uint32_t width,
+ uint32_t height,
+ uint32_t stride,
+ uint32_t format,
+ struct vigs_drm_surface **sfc);
+
+int vigs_drm_dp_surface_open(struct vigs_drm_device *dev,
+ uint32_t dp_plane,
+ uint32_t dp_fb_buf,
+ uint32_t dp_mem_flag,
+ struct vigs_drm_surface **sfc);
+
/*
* @}
*/