Use the new-style function using drm fourcc codes instead everywhere.
To easily use thew fourcc based interface also expose
bpp_depth_to_drm_format from the library. Finally include drm_fourcc.h
from the igt_kms.h header since pretty much everyone needs this now.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
#include "drmtest.h"
#include "igt_kms.h"
-#include <drm_fourcc.h>
-
#include "ioctl_wrappers.h"
/*
#include <linux/kd.h>
#include <errno.h>
-#include <drm_fourcc.h>
-
#include "drmtest.h"
#include "igt_kms.h"
#include "igt_aux.h"
#define for_each_format(f) \
for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++)
-static uint32_t bpp_depth_to_drm_format(int bpp, int depth)
+uint32_t bpp_depth_to_drm_format(int bpp, int depth)
{
struct format_desc_struct *f;
}
/* Return fb_id on success, 0 on error */
-unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
- int depth, bool tiled, struct kmstest_fb *fb)
-{
- memset(fb, 0, sizeof(*fb));
-
- if (create_bo_for_fb(fd, width, height, bpp, tiled, &fb->gem_handle,
- &fb->size, &fb->stride) < 0)
- return 0;
-
- if (drmModeAddFB(fd, width, height, depth, bpp, fb->stride,
- fb->gem_handle, &fb->fb_id) < 0) {
- gem_close(fd, fb->gem_handle);
-
- return 0;
- }
-
- fb->width = width;
- fb->height = height;
- fb->tiling = tiled;
- fb->drm_format = bpp_depth_to_drm_format(bpp, depth);
-
- return fb->fb_id;
-}
-
uint32_t drm_format_to_bpp(uint32_t drm_format)
{
struct format_desc_struct *f;
#include <cairo.h>
#include <xf86drmMode.h>
+#include <drm_fourcc.h>
#include "igt_display.h"
double yspacing, const char *fmt, ...)
__attribute__((format (printf, 4, 5)));
-unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
- int depth, bool tiled,
- struct kmstest_fb *fb_info);
unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format,
bool tiled, struct kmstest_fb *fb);
unsigned int kmstest_create_color_fb(int fd, int width, int height,
const char *kmstest_connector_status_str(int type);
const char *kmstest_connector_type_str(int type);
+uint32_t bpp_depth_to_drm_format(int bpp, int depth);
uint32_t drm_format_to_bpp(uint32_t drm_format);
/*
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
-#include <drm_fourcc.h>
#include "drmtest.h"
#include "igt_debugfs.h"
#include <stdio.h>
#include <string.h>
-#include <drm_fourcc.h>
-
#include "drmtest.h"
#include "igt_debugfs.h"
#include "igt_kms.h"
if (o->flags & TEST_FENCE_STRESS)
tiled = true;
- o->fb_ids[0] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height,
- o->bpp, o->depth, tiled, &o->fb_info[0]);
- o->fb_ids[1] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height,
- o->bpp, o->depth, tiled, &o->fb_info[1]);
- o->fb_ids[2] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height,
- o->bpp, o->depth, true, &o->fb_info[2]);
+ o->fb_ids[0] = kmstest_create_fb2(drm_fd, o->fb_width, o->fb_height,
+ bpp_depth_to_drm_format(o->bpp, o->depth),
+ tiled, &o->fb_info[0]);
+ o->fb_ids[1] = kmstest_create_fb2(drm_fd, o->fb_width, o->fb_height,
+ bpp_depth_to_drm_format(o->bpp, o->depth),
+ tiled, &o->fb_info[1]);
+ o->fb_ids[2] = kmstest_create_fb2(drm_fd, o->fb_width, o->fb_height,
+ bpp_depth_to_drm_format(o->bpp, o->depth),
+ true, &o->fb_info[2]);
igt_assert(o->fb_ids[0]);
igt_assert(o->fb_ids[1]);
igt_assert(o->fb_ids[2]);
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
-#include <drm_fourcc.h>
#include "drmtest.h"
#include "igt_debugfs.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
-#include <drm_fourcc.h>
#include "drmtest.h"
#include "igt_debugfs.h"
unsigned int fb_id;
cairo_t *cr;
- fb_id = kmstest_create_fb(data->drm_fd,
+ fb_id = kmstest_create_fb2(data->drm_fd,
mode->hdisplay, mode->vdisplay,
- 32 /* bpp */, 24 /* depth */,
+ DRM_FORMAT_XRGB8888,
false /* tiling */,
fb);
igt_assert(fb_id);
#include <unistd.h>
#include <sys/time.h>
-#include <drm_fourcc.h>
-
#include "drmtest.h"
#include "testdisplay.h"
#include "intel_bufmgr.h"
#include <getopt.h>
#include <sys/time.h>
-#include "drm_fourcc.h"
#include "drmtest.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
bpp = 32;
depth = 24;
enable_tiling = false;
- fb_id = kmstest_create_fb(drm_fd, crtc->mode.hdisplay,
- crtc->mode.vdisplay, bpp, depth,
+ fb_id = kmstest_create_fb2(drm_fd, crtc->mode.hdisplay,
+ crtc->mode.vdisplay,
+ bpp_depth_to_drm_format(bpp, depth),
enable_tiling, fb_info);
igt_assert(fb_id > 0);
}
cairo_t *cr;
uint32_t buffer_id;
- buffer_id = kmstest_create_fb(drm_fd, width, height, 32, 24, false,
- &fb);
+ buffer_id = kmstest_create_fb2(drm_fd, width, height,
+ DRM_FORMAT_XRGB8888,
+ false, &fb);
cr = kmstest_get_cairo_ctx(drm_fd, &fb);
kmstest_paint_test_pattern(cr, width, height);
cairo_destroy(cr);
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
-#include "drm.h"
+#include <drm.h>
+
#include "drmtest.h"
#include "intel_batchbuffer.h"
#include "intel_io.h"
fb_info = malloc(sizeof(struct scanout_fb));
igt_assert(fb_info);
- fb_info->handle = kmstest_create_fb(drm_fd, width, height, 32, 24,
+ fb_info->handle = kmstest_create_fb2(drm_fd, width, height,
+ DRM_FORMAT_XRGB8888,
false, &fb);
fb_info->width = width;
fb_info->height = height;
width = c->mode.hdisplay;
height = c->mode.vdisplay;
- fb_id = kmstest_create_fb(drm_fd, width, height, bpp, depth,
+ fb_id = kmstest_create_fb2(drm_fd, width, height,
+ bpp_depth_to_drm_format(bpp, depth),
enable_tiling, &fb_info[current_fb]);
paint_output_info(c, &fb_info[current_fb]);
paint_color_key(&fb_info[current_fb]);
uint32_t fb_id;
stereo_fb_layout_from_mode(&layout, mode);
- fb_id = kmstest_create_fb(drm_fd, layout.fb_width, layout.fb_height,
- bpp, depth, enable_tiling, fb);
+ fb_id = kmstest_create_fb2(drm_fd, layout.fb_width, layout.fb_height,
+ bpp_depth_to_drm_format(bpp, depth),
+ enable_tiling, fb);
cr = kmstest_get_cairo_ctx(drm_fd, fb);
kmstest_paint_image(cr, IGT_DATADIR"/1080p-left.png",