mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 17:36:11 +00:00
lib: extract kmstest_dump_mode
This commit is contained in:
parent
b7aa6756ce
commit
17787f30c6
@ -41,8 +41,6 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "xf86drm.h"
|
|
||||||
#include "xf86drmMode.h"
|
|
||||||
#include "i915_drm.h"
|
#include "i915_drm.h"
|
||||||
#include "drmtest.h"
|
#include "drmtest.h"
|
||||||
|
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
#include <pciaccess.h>
|
#include <pciaccess.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "xf86drmMode.h"
|
|
||||||
|
|
||||||
#include "drmtest.h"
|
#include "drmtest.h"
|
||||||
#include "i915_drm.h"
|
#include "i915_drm.h"
|
||||||
#include "intel_chipset.h"
|
#include "intel_chipset.h"
|
||||||
@ -719,3 +717,22 @@ unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
|
|||||||
|
|
||||||
return fb_id;
|
return fb_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kmstest_dump_mode(drmModeModeInfo *mode)
|
||||||
|
{
|
||||||
|
printf(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d\n",
|
||||||
|
mode->name,
|
||||||
|
mode->vrefresh,
|
||||||
|
mode->hdisplay,
|
||||||
|
mode->hsync_start,
|
||||||
|
mode->hsync_end,
|
||||||
|
mode->htotal,
|
||||||
|
mode->vdisplay,
|
||||||
|
mode->vsync_start,
|
||||||
|
mode->vsync_end,
|
||||||
|
mode->vtotal,
|
||||||
|
mode->flags,
|
||||||
|
mode->type,
|
||||||
|
mode->clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
|
||||||
#include "xf86drm.h"
|
#include "xf86drm.h"
|
||||||
|
#include "xf86drmMode.h"
|
||||||
#include "intel_batchbuffer.h"
|
#include "intel_batchbuffer.h"
|
||||||
|
|
||||||
int drm_get_card(int master);
|
int drm_get_card(int master);
|
||||||
@ -90,6 +91,7 @@ unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
|
|||||||
struct kmstest_fb *fb_info,
|
struct kmstest_fb *fb_info,
|
||||||
kmstest_paint_func paint_func,
|
kmstest_paint_func paint_func,
|
||||||
void *func_arg);
|
void *func_arg);
|
||||||
|
void kmstest_dump_mode(drmModeModeInfo *mode);
|
||||||
|
|
||||||
inline static void _do_or_die(const char *function, int line, int ret)
|
inline static void _do_or_die(const char *function, int line, int ret)
|
||||||
{
|
{
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "xf86drm.h"
|
|
||||||
#include "xf86drmMode.h"
|
|
||||||
#include "i915_drm.h"
|
#include "i915_drm.h"
|
||||||
#include "drmtest.h"
|
#include "drmtest.h"
|
||||||
#include "testdisplay.h"
|
#include "testdisplay.h"
|
||||||
@ -65,24 +63,6 @@ struct test_output {
|
|||||||
unsigned int fb_ids[2];
|
unsigned int fb_ids[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void dump_mode(drmModeModeInfo *mode)
|
|
||||||
{
|
|
||||||
printf(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d\n",
|
|
||||||
mode->name,
|
|
||||||
mode->vrefresh,
|
|
||||||
mode->hdisplay,
|
|
||||||
mode->hsync_start,
|
|
||||||
mode->hsync_end,
|
|
||||||
mode->htotal,
|
|
||||||
mode->vdisplay,
|
|
||||||
mode->vsync_start,
|
|
||||||
mode->vsync_end,
|
|
||||||
mode->vtotal,
|
|
||||||
mode->flags,
|
|
||||||
mode->type,
|
|
||||||
mode->clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
|
static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
|
||||||
unsigned int usec, void *data)
|
unsigned int usec, void *data)
|
||||||
{
|
{
|
||||||
@ -243,7 +223,7 @@ static void set_mode(struct test_output *o, int crtc)
|
|||||||
gem_close(drm_fd, fb_info[0].gem_handle);
|
gem_close(drm_fd, fb_info[0].gem_handle);
|
||||||
gem_close(drm_fd, fb_info[1].gem_handle);
|
gem_close(drm_fd, fb_info[1].gem_handle);
|
||||||
|
|
||||||
dump_mode(&o->mode);
|
kmstest_dump_mode(&o->mode);
|
||||||
if (drmModeSetCrtc(drm_fd, o->crtc, o->fb_ids[0], 0, 0,
|
if (drmModeSetCrtc(drm_fd, o->crtc, o->fb_ids[0], 0, 0,
|
||||||
&o->id, 1, &o->mode)) {
|
&o->id, 1, &o->mode)) {
|
||||||
fprintf(stderr, "failed to set mode (%dx%d@%dHz): %s\n",
|
fprintf(stderr, "failed to set mode (%dx%d@%dHz): %s\n",
|
||||||
|
@ -58,8 +58,6 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "xf86drm.h"
|
|
||||||
#include "xf86drmMode.h"
|
|
||||||
#include "i915_drm.h"
|
#include "i915_drm.h"
|
||||||
#include "drmtest.h"
|
#include "drmtest.h"
|
||||||
#include "testdisplay.h"
|
#include "testdisplay.h"
|
||||||
@ -153,25 +151,6 @@ struct connector {
|
|||||||
int pipe;
|
int pipe;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void dump_mode(drmModeModeInfo *mode)
|
|
||||||
{
|
|
||||||
printf(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d\n",
|
|
||||||
mode->name,
|
|
||||||
mode->vrefresh,
|
|
||||||
mode->hdisplay,
|
|
||||||
mode->hsync_start,
|
|
||||||
mode->hsync_end,
|
|
||||||
mode->htotal,
|
|
||||||
mode->vdisplay,
|
|
||||||
mode->vsync_start,
|
|
||||||
mode->vsync_end,
|
|
||||||
mode->vtotal,
|
|
||||||
mode->flags,
|
|
||||||
mode->type,
|
|
||||||
mode->clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void dump_connectors_fd(int drmfd)
|
static void dump_connectors_fd(int drmfd)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -211,7 +190,7 @@ static void dump_connectors_fd(int drmfd)
|
|||||||
printf(" name refresh (Hz) hdisp hss hse htot vdisp "
|
printf(" name refresh (Hz) hdisp hss hse htot vdisp "
|
||||||
"vss vse vtot flags type clock\n");
|
"vss vse vtot flags type clock\n");
|
||||||
for (j = 0; j < connector->count_modes; j++)
|
for (j = 0; j < connector->count_modes; j++)
|
||||||
dump_mode(&connector->modes[j]);
|
kmstest_dump_mode(&connector->modes[j]);
|
||||||
|
|
||||||
drmModeFreeConnector(connector);
|
drmModeFreeConnector(connector);
|
||||||
}
|
}
|
||||||
@ -241,7 +220,7 @@ static void dump_crtcs_fd(int drmfd)
|
|||||||
crtc->buffer_id,
|
crtc->buffer_id,
|
||||||
crtc->x, crtc->y,
|
crtc->x, crtc->y,
|
||||||
crtc->width, crtc->height);
|
crtc->width, crtc->height);
|
||||||
dump_mode(&crtc->mode);
|
kmstest_dump_mode(&crtc->mode);
|
||||||
|
|
||||||
drmModeFreeCrtc(crtc);
|
drmModeFreeCrtc(crtc);
|
||||||
}
|
}
|
||||||
@ -492,7 +471,7 @@ set_mode(struct connector *c)
|
|||||||
gem_close(drm_fd, fb_info.gem_handle);
|
gem_close(drm_fd, fb_info.gem_handle);
|
||||||
|
|
||||||
fprintf(stdout, "CRTS(%u):",c->crtc);
|
fprintf(stdout, "CRTS(%u):",c->crtc);
|
||||||
dump_mode(&c->mode);
|
kmstest_dump_mode(&c->mode);
|
||||||
if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0,
|
if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0,
|
||||||
&c->id, 1, &c->mode)) {
|
&c->id, 1, &c->mode)) {
|
||||||
fprintf(stderr, "failed to set mode (%dx%d@%dHz): %s\n",
|
fprintf(stderr, "failed to set mode (%dx%d@%dHz): %s\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user