On Wed, Apr 9, 2014 at 1:40 PM, Thierry Reding thierry.reding@gmail.com wrote:
diff --git a/tests/tegra/gr2d-fill.c b/tests/tegra/gr2d-fill.c new file mode 100644 index 000000000000..b6ba35a9d668 --- /dev/null +++ b/tests/tegra/gr2d-fill.c @@ -0,0 +1,146 @@ +/*
- Copyright © 2014 NVIDIA Corporation
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
- */
+#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
+#include <errno.h> +#include <fcntl.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h>
+#include <sys/ioctl.h>
+#include "xf86drm.h" +#include "xf86drmMode.h" +#include "drm_fourcc.h"
+#include "drm-test-tegra.h" +#include "tegra.h"
+int main(int argc, char *argv[]) +{
uint32_t format = DRM_FORMAT_XRGB8888;
struct drm_tegra_gr2d *gr2d;
struct drm_framebuffer *fb;
struct drm_screen *screen;
unsigned int pitch, size;
struct drm_tegra_bo *bo;
struct drm_tegra *drm;
uint32_t handle;
int fd, err;
void *ptr;
fd = drm_open(argv[1]);
if (fd < 0) {
fprintf(stderr, "failed to open DRM device %s: %s\n", argv[1],
strerror(errno));
return 1;
}
I'm not quite sure I understand this part. Why would argv[1] be anything else than NULL? Is this useful for manual debugging, perhaps?
err = drm_tegra_gr2d_fill(gr2d, fb, fb->width / 4, fb->height / 4,
fb->width / 2, fb->height / 2, 0x00000000);
if (err < 0) {
fprintf(stderr, "failed to fill rectangle: %s\n",
strerror(-err));
return 1;
}
sleep(1);
Why do we need to sleep here?