summaryrefslogtreecommitdiff
path: root/tests/modetest/modetest.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modetest/modetest.c')
-rw-r--r--tests/modetest/modetest.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 2c9a17a1..4b9cf2f5 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -57,7 +57,6 @@
#include "xf86drm.h"
#include "xf86drmMode.h"
#include "drm_fourcc.h"
-#include "libkms.h"
#include "buffers.h"
#include "cursor.h"
@@ -104,14 +103,13 @@ struct device {
int fd;
struct resources *resources;
- struct kms_driver *kms;
struct {
unsigned int width;
unsigned int height;
unsigned int fb_id;
- struct kms_bo *bo;
+ struct bo *bo;
} mode;
};
@@ -968,7 +966,7 @@ static int set_plane(struct device *dev, struct plane_arg *p)
drmModePlane *ovr;
uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
uint32_t plane_id = 0;
- struct kms_bo *plane_bo;
+ struct bo *plane_bo;
uint32_t plane_flags = 0;
int crtc_x, crtc_y, crtc_w, crtc_h;
struct crtc *crtc = NULL;
@@ -1009,8 +1007,8 @@ static int set_plane(struct device *dev, struct plane_arg *p)
fprintf(stderr, "testing %dx%d@%s overlay plane %u\n",
p->w, p->h, p->format_str, plane_id);
- plane_bo = create_test_buffer(dev->kms, p->fourcc, p->w, p->h, handles,
- pitches, offsets, PATTERN_TILES);
+ plane_bo = bo_create(dev->fd, p->fourcc, p->w, p->h, handles,
+ pitches, offsets, PATTERN_TILES);
if (plane_bo == NULL)
return -1;
@@ -1050,7 +1048,7 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
{
uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
unsigned int fb_id;
- struct kms_bo *bo;
+ struct bo *bo;
unsigned int i;
unsigned int j;
int ret, x;
@@ -1070,9 +1068,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
dev->mode.height = pipe->mode->vdisplay;
}
- bo = create_test_buffer(dev->kms, pipes[0].fourcc,
- dev->mode.width, dev->mode.height,
- handles, pitches, offsets, PATTERN_SMPTE);
+ bo = bo_create(dev->fd, pipes[0].fourcc, dev->mode.width, dev->mode.height,
+ handles, pitches, offsets, PATTERN_SMPTE);
if (bo == NULL)
return;
@@ -1129,7 +1126,7 @@ static void set_planes(struct device *dev, struct plane_arg *p, unsigned int cou
static void set_cursors(struct device *dev, struct pipe_arg *pipes, unsigned int count)
{
uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
- struct kms_bo *bo;
+ struct bo *bo;
unsigned int i;
int ret;
@@ -1140,8 +1137,8 @@ static void set_cursors(struct device *dev, struct pipe_arg *pipes, unsigned int
/* create cursor bo.. just using PATTERN_PLAIN as it has
* translucent alpha
*/
- bo = create_test_buffer(dev->kms, DRM_FORMAT_ARGB8888,
- cw, ch, handles, pitches, offsets, PATTERN_PLAIN);
+ bo = bo_create(dev->fd, DRM_FORMAT_ARGB8888, cw, ch, handles, pitches,
+ offsets, PATTERN_PLAIN);
if (bo == NULL)
return;
@@ -1170,14 +1167,14 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned
{
uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
unsigned int other_fb_id;
- struct kms_bo *other_bo;
+ struct bo *other_bo;
drmEventContext evctx;
unsigned int i;
int ret;
- other_bo = create_test_buffer(dev->kms, pipes[0].fourcc,
- dev->mode.width, dev->mode.height,
- handles, pitches, offsets, PATTERN_PLAIN);
+ other_bo = bo_create(dev->fd, pipes[0].fourcc,
+ dev->mode.width, dev->mode.height,
+ handles, pitches, offsets, PATTERN_PLAIN);
if (other_bo == NULL)
return;
@@ -1252,7 +1249,7 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned
drmHandleEvent(dev->fd, &evctx);
}
- kms_bo_destroy(&other_bo);
+ bo_destroy(other_bo);
}
#define min(a, b) ((a) < (b) ? (a) : (b))
@@ -1611,10 +1608,11 @@ int main(int argc, char **argv)
set_property(&dev, &prop_args[i]);
if (count || plane_count) {
- ret = kms_create(dev.fd, &dev.kms);
- if (ret) {
- fprintf(stderr, "failed to create kms driver: %s\n",
- strerror(-ret));
+ uint64_t cap = 0;
+
+ ret = drmGetCap(dev.fd, DRM_CAP_DUMB_BUFFER, &cap);
+ if (ret || cap == 0) {
+ fprintf(stderr, "driver doesn't support the dumb buffer API\n");
return 1;
}
@@ -1638,8 +1636,7 @@ int main(int argc, char **argv)
if (test_cursor)
clear_cursors(&dev);
- kms_bo_destroy(&dev.mode.bo);
- kms_destroy(&dev.kms);
+ bo_destroy(dev.mode.bo);
}
free_resources(dev.resources);