Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mesa/kmscube
  • rantogno/kmscube
  • allocator/kmscube
  • mvicomoya/kmscube
  • ds-hwang/kmscube
  • jianhuilee/kmscube
  • lyudess/kmscube
  • robclark/kmscube
  • strassek/kmscube
  • borneoa/kmscube
  • alex.kanavin/kmscube
  • ezequielgarcia/kmscube
  • lemon.py/kmscube
  • afd/kmscube
  • KhaledEmaraDev/kmscube
  • dv1/kmscube
  • nirmoy/kmscube
  • cubanismo/kmscube
  • ayaka/kmscube
  • antonovitch/kmscube
  • vitalyp/kmscube
  • anholt/kmscube
  • festevam/kmscube
  • austriancoder/kmscube
  • Yaong/kmscube
  • tagr/kmscube
  • nroberts/kmscube
  • lynxeye/kmscube
  • gediz/kmscube
  • dhobsong/kmscube
  • tantan/kmscube
  • rui/kmscube
  • uniontechWu/kmscube
  • tomstokes/kmscube
  • lfrb/kmscube
  • lauramazzuca21/kmscube
  • bbrezillon/kmscube
  • larumbe/kmscube
  • asahilina/kmscube
  • tq-steina/kmscube
  • moiman/kmscube
  • enunes/kmscube
  • lumag/kmscube
  • ralphcampbell/kmscube
  • oreaus/kmscube
  • eric/kmscube
  • bbatson/kmscube
  • swick/kmscube
  • mairacanal/kmscube
  • hugues.fruchet/kmscube
  • ericsmith/kmscube
51 results
Show changes
Commits on Source (5)
workflow:
rules:
# do not duplicate pipelines on merge pipelines
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
# Everything else gets a pipeline
- when: always
.meson:
stage: build
script:
......@@ -10,7 +18,7 @@
latest-meson:
extends: .meson
image: $CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/archlinux:base-devel
image: archlinux:base-devel
before_script:
- pacman -Syu --noconfirm --needed
meson
......@@ -22,7 +30,7 @@ latest-meson:
oldest-meson:
extends: .meson
image: $CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/debian:stable
image: debian:stable
before_script:
- printf > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft "%s\n"
'path-exclude=/usr/share/doc/*'
......
......@@ -175,6 +175,7 @@ enum mode {
const struct egl * init_cube_smooth(const struct gbm *gbm, int samples);
const struct egl * init_cube_tex(const struct gbm *gbm, enum mode mode, int samples);
const struct egl * init_cube_gears(const struct gbm *gbm, int samples);
#ifdef HAVE_GLES3
const struct egl * init_cube_shadertoy(const struct gbm *gbm, const char *shadertoy, int samples);
......
This diff is collapsed.
......@@ -392,12 +392,12 @@ static int get_plane_id(void)
}
const struct drm * init_drm_atomic(const char *device, const char *mode_str,
unsigned int vrefresh, unsigned int count)
int connector_id, unsigned int vrefresh, unsigned int count)
{
uint32_t plane_id;
int ret;
ret = init_drm(&drm, device, mode_str, vrefresh, count);
ret = init_drm(&drm, device, mode_str, connector_id, vrefresh, count);
if (ret)
return NULL;
......
......@@ -238,8 +238,39 @@ static int find_drm_device(drmModeRes **resources)
return fd;
}
static drmModeConnector * find_drm_connector(int fd, drmModeRes *resources,
int connector_id)
{
drmModeConnector *connector = NULL;
int i;
if (connector_id >= 0) {
if (connector_id >= resources->count_connectors)
return NULL;
connector = drmModeGetConnector(fd, resources->connectors[connector_id]);
if (connector && connector->connection == DRM_MODE_CONNECTED)
return connector;
drmModeFreeConnector(connector);
return NULL;
}
for (i = 0; i < resources->count_connectors; i++) {
connector = drmModeGetConnector(fd, resources->connectors[i]);
if (connector && connector->connection == DRM_MODE_CONNECTED) {
/* it's connected, let's use this! */
break;
}
drmModeFreeConnector(connector);
connector = NULL;
}
return connector;
}
int init_drm(struct drm *drm, const char *device, const char *mode_str,
unsigned int vrefresh, unsigned int count)
int connector_id, unsigned int vrefresh, unsigned int count)
{
drmModeRes *resources;
drmModeConnector *connector = NULL;
......@@ -266,15 +297,7 @@ int init_drm(struct drm *drm, const char *device, const char *mode_str,
}
/* find a connected connector: */
for (i = 0; i < resources->count_connectors; i++) {
connector = drmModeGetConnector(drm->fd, resources->connectors[i]);
if (connector->connection == DRM_MODE_CONNECTED) {
/* it's connected, let's use this! */
break;
}
drmModeFreeConnector(connector);
connector = NULL;
}
connector = find_drm_connector(drm->fd, resources, connector_id);
if (!connector) {
/* we could be fancy and listen for hotplug events and wait for
......
......@@ -76,10 +76,10 @@ struct drm_fb {
struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo);
int init_drm(struct drm *drm, const char *device, const char *mode_str, unsigned int vrefresh, unsigned int count);
int init_drm(struct drm *drm, const char *device, const char *mode_str, int connector_id, unsigned int vrefresh, unsigned int count);
int init_drm_render(struct drm *drm, const char *device, const char *mode_str, unsigned int count);
const struct drm * init_drm_legacy(const char *device, const char *mode_str, unsigned int vrefresh, unsigned int count);
const struct drm * init_drm_atomic(const char *device, const char *mode_str, unsigned int vrefresh, unsigned int count);
const struct drm * init_drm_legacy(const char *device, const char *mode_str, int connector_id, unsigned int vrefresh, unsigned int count);
const struct drm * init_drm_atomic(const char *device, const char *mode_str, int connector_id, unsigned int vrefresh, unsigned int count);
const struct drm * init_drm_offscreen(const char *device, const char *mode_str, unsigned int count);
#endif /* _DRM_COMMON_H */
......@@ -170,11 +170,11 @@ static int legacy_run(const struct gbm *gbm, const struct egl *egl)
}
const struct drm * init_drm_legacy(const char *device, const char *mode_str,
unsigned int vrefresh, unsigned int count)
int connector_id, unsigned int vrefresh, unsigned int count)
{
int ret;
ret = init_drm(&drm, device, mode_str, vrefresh, count);
ret = init_drm(&drm, device, mode_str, connector_id, vrefresh, count);
if (ret)
return NULL;
......
......@@ -77,54 +77,29 @@ esTranslate(ESMatrix *result, GLfloat tx, GLfloat ty, GLfloat tz)
void ESUTIL_API
esRotate(ESMatrix *result, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
{
GLfloat sinAngle, cosAngle;
GLfloat mag = sqrtf(x * x + y * y + z * z);
sinAngle = sinf ( angle * PI / 180.0f );
cosAngle = cosf ( angle * PI / 180.0f );
if ( mag > 0.0f )
{
GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs;
GLfloat oneMinusCos;
ESMatrix rotMat;
x /= mag;
y /= mag;
z /= mag;
xx = x * x;
yy = y * y;
zz = z * z;
xy = x * y;
yz = y * z;
zx = z * x;
xs = x * sinAngle;
ys = y * sinAngle;
zs = z * sinAngle;
oneMinusCos = 1.0f - cosAngle;
rotMat.m[0][0] = (oneMinusCos * xx) + cosAngle;
rotMat.m[0][1] = (oneMinusCos * xy) - zs;
rotMat.m[0][2] = (oneMinusCos * zx) + ys;
rotMat.m[0][3] = 0.0F;
rotMat.m[1][0] = (oneMinusCos * xy) + zs;
rotMat.m[1][1] = (oneMinusCos * yy) + cosAngle;
rotMat.m[1][2] = (oneMinusCos * yz) - xs;
rotMat.m[1][3] = 0.0F;
rotMat.m[2][0] = (oneMinusCos * zx) - ys;
rotMat.m[2][1] = (oneMinusCos * yz) + xs;
rotMat.m[2][2] = (oneMinusCos * zz) + cosAngle;
rotMat.m[2][3] = 0.0F;
rotMat.m[3][0] = 0.0F;
rotMat.m[3][1] = 0.0F;
rotMat.m[3][2] = 0.0F;
rotMat.m[3][3] = 1.0F;
esMatrixMultiply( result, &rotMat, result );
}
GLfloat s, c;
ESMatrix r;
s = sinf(angle * PI / 180.0f);
c = cosf(angle * PI / 180.0f);
r.m[0][0] = x * x * (1 - c) + c;
r.m[0][1] = y * x * (1 - c) + z * s;
r.m[0][2] = x * z * (1 - c) - y * s;
r.m[0][3] = 0;
r.m[1][0] = x * y * (1 - c) - z * s;
r.m[1][1] = y * y * (1 - c) + c;
r.m[1][2] = y * z * (1 - c) + x * s;
r.m[1][3] = 0;
r.m[2][0] = x * z * (1 - c) + y * s;
r.m[2][1] = y * z * (1 - c) - x * s;
r.m[2][2] = z * z * (1 - c) + c;
r.m[2][3] = 0;
r.m[3][0] = 0;
r.m[3][1] = 0;
r.m[3][2] = 0;
r.m[3][3] = 1;
esMatrixMultiply(result, &r, result);
}
void ESUTIL_API
......@@ -135,6 +110,8 @@ esFrustum(ESMatrix *result, float left, float right, float bottom, float top, fl
float deltaZ = farZ - nearZ;
ESMatrix frust;
esMatrixLoadIdentity(result);
if ( (nearZ <= 0.0f) || (farZ <= 0.0f) ||
(deltaX <= 0.0f) || (deltaY <= 0.0f) || (deltaZ <= 0.0f) )
return;
......@@ -233,3 +210,49 @@ esMatrixLoadIdentity(ESMatrix *result)
result->m[3][3] = 1.0f;
}
void ESUTIL_API
esTranspose(ESMatrix *result)
{
ESMatrix tmp;
tmp.m[0][0] = result->m[0][0];
tmp.m[0][1] = result->m[1][0];
tmp.m[0][2] = result->m[2][0];
tmp.m[0][3] = result->m[3][0];
tmp.m[1][0] = result->m[0][1];
tmp.m[1][1] = result->m[1][1];
tmp.m[1][2] = result->m[2][1];
tmp.m[1][3] = result->m[3][1];
tmp.m[2][0] = result->m[0][2];
tmp.m[2][1] = result->m[1][2];
tmp.m[2][2] = result->m[2][2];
tmp.m[2][3] = result->m[3][2];
tmp.m[3][0] = result->m[0][3];
tmp.m[3][1] = result->m[1][3];
tmp.m[3][2] = result->m[2][3];
tmp.m[3][3] = result->m[3][3];
memcpy(result, &tmp, sizeof(tmp));
}
void ESUTIL_API
esInvert(ESMatrix *result)
{
ESMatrix tmp;
esMatrixLoadIdentity(&tmp);
// Extract and invert the translation part 't'. The inverse of a
// translation matrix can be calculated by negating the translation
// coordinates.
tmp.m[3][0] = -result->m[3][0];
tmp.m[3][1] = -result->m[3][1];
tmp.m[3][2] = -result->m[3][2];
// Invert the rotation part 'r'. The inverse of a rotation matrix is
// equal to its transpose.
result->m[3][0] = result->m[3][1] = result->m[3][2] = 0;
esTranspose(result);
// inv(m) = inv(r) * inv(t)
esMatrixMultiply(result, &tmp, result);
}
......@@ -256,7 +256,7 @@ void ESUTIL_API esTranslate(ESMatrix *result, GLfloat tx, GLfloat ty, GLfloat tz
void ESUTIL_API esRotate(ESMatrix *result, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
//
// \brief multiply matrix specified by result with a perspective matrix and return new matrix in result
/// \brief multiply matrix specified by result with a perspective matrix and return new matrix in result
/// \param result Specifies the input matrix. new matrix is returned in result.
/// \param left, right Coordinates for the left and right vertical clipping planes
/// \param bottom, top Coordinates for the bottom and top horizontal clipping planes
......@@ -291,11 +291,24 @@ void ESUTIL_API esOrtho(ESMatrix *result, float left, float right, float bottom,
void ESUTIL_API esMatrixMultiply(ESMatrix *result, ESMatrix *srcA, ESMatrix *srcB);
//
//// \brief return an identity matrix
//// \param result returns identity matrix
/// \brief return an identity matrix
/// \param result returns identity matrix
//
void ESUTIL_API esMatrixLoadIdentity(ESMatrix *result);
//
/// \brief Transposes a 4x4 matrix.
/// \param result Specifies the matrix to transpose. New matrix is returned in result.
//
void ESUTIL_API esTranspose(ESMatrix *result);
//
/// \brief Inverts a 4x4 matrix.
/// \param result Specifies the input matrix. New matrix is returned in result.
//
void ESUTIL_API esInvert(ESMatrix *result);
#ifdef __cplusplus
}
#endif
......
......@@ -41,15 +41,17 @@ static const struct egl *egl;
static const struct gbm *gbm;
static const struct drm *drm;
static const char *shortopts = "Ac:D:f:M:m:Op:S:s:V:v:x";
static const char *shortopts = "Ac:D:f:gM:m:n:Op:S:s:V:v:x";
static const struct option longopts[] = {
{"atomic", no_argument, 0, 'A'},
{"count", required_argument, 0, 'c'},
{"device", required_argument, 0, 'D'},
{"format", required_argument, 0, 'f'},
{"gears", no_argument, 0, 'g'},
{"mode", required_argument, 0, 'M'},
{"modifier", required_argument, 0, 'm'},
{"connector_id", required_argument, 0, 'n'},
{"offscreen", no_argument, 0, 'O'},
{"perfcntr", required_argument, 0, 'p'},
{"samples", required_argument, 0, 's'},
......@@ -61,19 +63,21 @@ static const struct option longopts[] = {
static void usage(const char *name)
{
printf("Usage: %s [-ADfMmSsVvx]\n"
printf("Usage: %s [-ADfgMmSsVvx]\n"
"\n"
"options:\n"
" -A, --atomic use atomic modesetting and fencing\n"
" -c, --count run for the specified number of frames\n"
" -c, --count=N run for the specified number of frames\n"
" -D, --device=DEVICE use the given device\n"
" -f, --format=FOURCC framebuffer format\n"
" -g, --gears render gears on each cube face\n"
" -M, --mode=MODE specify mode, one of:\n"
" smooth - smooth shaded cube (default)\n"
" rgba - rgba textured cube\n"
" nv12-2img - yuv textured (color conversion in shader)\n"
" nv12-1img - yuv textured (single nv12 texture)\n"
" -m, --modifier=MODIFIER hardcode the selected modifier\n"
" -n, --connector_id=N use connector ID N (see drm_info)\n"
" -O, --offscreen use offscreen rendering (e.g. for render nodes)\n"
" -p, --perfcntr=LIST sample specified performance counters using\n"
" the AMD_performance_monitor extension (comma\n"
......@@ -101,7 +105,9 @@ int main(int argc, char *argv[])
uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
int samples = 0;
int atomic = 0;
int gears = 0;
int offscreen = 0;
int connector_id = -1;
int opt;
unsigned int len;
unsigned int vrefresh = 0;
......@@ -139,6 +145,9 @@ int main(int argc, char *argv[])
fourcc[2], fourcc[3]);
break;
}
case 'g':
gears = 1;
break;
case 'M':
if (strcmp(optarg, "smooth") == 0) {
mode = SMOOTH;
......@@ -157,6 +166,9 @@ int main(int argc, char *argv[])
case 'm':
modifier = strtoull(optarg, NULL, 0);
break;
case 'n':
connector_id = strtoul(optarg, NULL, 0);
break;
case 'O':
offscreen = 1;
break;
......@@ -204,9 +216,9 @@ int main(int argc, char *argv[])
if (offscreen)
drm = init_drm_offscreen(device, mode_str, count);
else if (atomic)
drm = init_drm_atomic(device, mode_str, vrefresh, count);
drm = init_drm_atomic(device, mode_str, connector_id, vrefresh, count);
else
drm = init_drm_legacy(device, mode_str, vrefresh, count);
drm = init_drm_legacy(device, mode_str, connector_id, vrefresh, count);
if (!drm) {
printf("failed to initialize %s DRM\n",
offscreen ? "offscreen" :
......@@ -221,7 +233,9 @@ int main(int argc, char *argv[])
return -1;
}
if (mode == SMOOTH)
if (gears)
egl = init_cube_gears(gbm, samples);
else if (mode == SMOOTH)
egl = init_cube_smooth(gbm, samples);
else if (mode == VIDEO)
egl = init_cube_video(gbm, video, samples);
......
......@@ -36,6 +36,7 @@ endif
sources = files(
'common.c',
'cube-smooth.c',
'cube-gears.c',
'cube-tex.c',
'drm-atomic.c',
'drm-common.c',
......
......@@ -950,7 +950,7 @@ int main(int argc, char *argv[])
print_summary();
/* no real need for atomic here: */
drm = init_drm_legacy(device, mode_str, vrefresh, ~0);
drm = init_drm_legacy(device, mode_str, -1, vrefresh, ~0);
if (!drm) {
printf("failed to initialize DRM\n");
return -1;
......