[Piglit] [PATCH 7/7] html: Use XHTML 1.0 Strict.

2013-04-25 Thread Dylan Baker
From: Kenneth Graunke 

We weren't specifying a DTD, which made validator.w3.org angry.  There's
no reason not to be strict or use SGML-based HTML, so go with XHTML.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Dylan Baker 
---
 templates/index.html | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/templates/index.html b/templates/index.html
index 400dde3..00a47bb 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,6 +1,9 @@
-
+
+http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+http://www.w3.org/1999/xhtml";>

-   
+   
Result summary 


-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 6/7] html: Escape test names in the summary page.

2013-04-25 Thread Dylan Baker
From: Kenneth Graunke 

Characters like & and < are need to be escaped in proper HTML/XML.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Dylan Baker 
---
 piglit-summary-html.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 0f3e049..24dd302 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -150,7 +150,7 @@ def hrefFromParts(codename, path):
 
 def buildTestSummary(indent, testsummary):
path = testsummary.path
-   name = testsummary.name
+   name = cgi.escape(testsummary.name)
testruns = "".join([IndexTestTestrun % {
'status': result.status,
'link': hrefFromParts(result.testrun.codename, path)
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 5/7] html: Use the vastly faster "fixed" table layout algorithm.

2013-04-25 Thread Dylan Baker
From: Kenneth Graunke 

The usual "auto" table layout algorithm makes the browser look at the
contents of each row in the table in order to determine the layout.  We
have 10,000 rows.  This is insanely expensive.

The "fixed" algorithm just uses the  info, and possibly the first
row.  This works out just fine.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Dylan Baker 
---
 templates/index.css | 1 +
 1 file changed, 1 insertion(+)

diff --git a/templates/index.css b/templates/index.css
index 27128e4..d066a04 100644
--- a/templates/index.css
+++ b/templates/index.css
@@ -5,6 +5,7 @@ table {
padding-left: 1.75em;
padding-right: 1.75em;
width: 100%;
+   table-layout: fixed;
 }
 
 col:not(:first-child) {
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/7] html: Rework colgroup generation.

2013-04-25 Thread Dylan Baker
From: Kenneth Graunke 

There's no need to specify width="50pt" on every ; we can easily
specify a width for all but the first column with CSS3.

At that point, using a template file that contains only  seems
absurd; just repeat that the right number of times in the python code.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Dylan Baker 
---
 piglit-summary-html.py   | 3 +--
 templates/index.css  | 4 
 templates/index_testrun.html | 1 -
 3 files changed, 5 insertions(+), 3 deletions(-)
 delete mode 100644 templates/index_testrun.html

diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index d2fe5ee..0f3e049 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -62,7 +62,6 @@ ResultListItem = readfile(os.path.join(templatedir, 
'result_listitem.html'))
 ResultMString = readfile(os.path.join(templatedir, 'result_mstring.html'))
 
 Index = readfile(os.path.join(templatedir, 'index.html'))
-IndexTestrun = readfile(os.path.join(templatedir, 'index_testrun.html'))
 IndexTestrunB = readfile(os.path.join(templatedir, 'index_testrunb.html'))
 IndexTestrunBHref = readfile(os.path.join(templatedir, 
'index_testrunb_href.html'))
 IndexGroup = readfile(os.path.join(templatedir, 'index_group.html'))
@@ -232,7 +231,7 @@ results is an array containing the top-level results 
dictionarys.
return IndexTestrunB % tr.__dict__
 
group = buildGroupSummary(0, summary.root, showcurrent)
-   testruns = "".join([IndexTestrun % tr.__dict__ for tr in 
summary.testruns])
+   testruns = '' * len(summary.testruns)
testrunsb = "".join([testrunb(tr) for tr in summary.testruns])
 
tolist = SummaryPages.keys()
diff --git a/templates/index.css b/templates/index.css
index 0e48e1c..27128e4 100644
--- a/templates/index.css
+++ b/templates/index.css
@@ -7,6 +7,10 @@ table {
width: 100%;
 }
 
+col:not(:first-child) {
+   width: 50pt;
+}
+
 tr {
padding: 4pt;
 }
diff --git a/templates/index_testrun.html b/templates/index_testrun.html
deleted file mode 100644
index 1dc68ff..000
--- a/templates/index_testrun.html
+++ /dev/null
@@ -1 +0,0 @@
-
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/7] html: Remove the index_groupgroup template.

2013-04-25 Thread Dylan Baker
From: Kenneth Graunke 

It was entirely empty.

Reviewed-by: Dylan Baker 
---
 piglit-summary-html.py  | 5 +
 templates/index_groupgroup.html | 1 -
 2 files changed, 1 insertion(+), 5 deletions(-)
 delete mode 100644 templates/index_groupgroup.html

diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 263a4f0..d2fe5ee 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -67,7 +67,6 @@ IndexTestrunB = readfile(os.path.join(templatedir, 
'index_testrunb.html'))
 IndexTestrunBHref = readfile(os.path.join(templatedir, 
'index_testrunb_href.html'))
 IndexGroup = readfile(os.path.join(templatedir, 'index_group.html'))
 IndexGroupTestrun = readfile(os.path.join(templatedir, 
'index_group_testrun.html'))
-IndexGroupGroup = readfile(os.path.join(templatedir, 'index_groupgroup.html'))
 IndexTest = readfile(os.path.join(templatedir, 'index_test.html'))
 IndexTestTestrun = readfile(os.path.join(templatedir, 
'index_test_testrun.html'))
 
@@ -205,9 +204,7 @@ def buildGroupSummary(indent, groupsummary, showcurrent):
for n in names:
child = groupsummary.children[n]
if isinstance(child, framework.summary.GroupSummary):
-   items = items + IndexGroupGroup % {
-   'group': buildGroupSummary(indent + indent_inc, 
child, showcurrent)
-   }
+   items = items + buildGroupSummary(indent + indent_inc, 
child, showcurrent)
else:
items = items + buildTestSummary(indent + indent_inc, 
child)
 
diff --git a/templates/index_groupgroup.html b/templates/index_groupgroup.html
deleted file mode 100644
index 53db607..000
--- a/templates/index_groupgroup.html
+++ /dev/null
@@ -1 +0,0 @@
-%(group)s
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/7] html: Use CSS3 for zebra-striping the tables.

2013-04-25 Thread Dylan Baker
From: Kenneth Graunke 

Most browsers support the :nth-child selector by now, which allows us to
zebra-stripe the tables in CSS rather than making the python code
annotate every row with an 'a' or 'b' class.

While we're at it, stripe the pass/fail/crash results too.  Based on
some CSS fragments, this was the intent all along, but didn't work.

This also changes the striping slightly: it now stripes purely based on
whether the row is even/odd, rather than striping on a per-group basis.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Dylan Baker 
---
 piglit-summary-html.py| 17 +--
 templates/index.css   | 94 ---
 templates/index_test.html |  2 +-
 templates/index_test_testrun.html |  2 +-
 templates/result.css  | 12 ++---
 templates/result.html |  2 +-
 templates/result_detail.html  |  4 +-
 7 files changed, 33 insertions(+), 100 deletions(-)

diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 1f55928..263a4f0 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -110,15 +110,9 @@ def buildDetails(testResult):
details.sort(lambda a, b: len(a[1])-len(b[1]))
 
text = ''
-   alternate = 'a'
for name, value in details:
text += ResultDetail % locals()
 
-   if alternate == 'a':
-   alternate = 'b'
-   else:
-   alternate = 'a'
-
return text
 
 
@@ -156,11 +150,10 @@ def hrefFromParts(codename, path):
outStr = outStr[1:]
return outStr
 
-def buildTestSummary(indent, alternate, testsummary):
+def buildTestSummary(indent, testsummary):
path = testsummary.path
name = testsummary.name
testruns = "".join([IndexTestTestrun % {
-   'alternate': alternate,
'status': result.status,
'link': hrefFromParts(result.testrun.codename, path)
} for result in testsummary.results])
@@ -193,7 +186,6 @@ def buildGroupSummaryTestrun(groupresult):
 def buildGroupSummary(indent, groupsummary, showcurrent):
indent_inc = 1.75 # em
items = ''
-   alternate = 'a'
path = groupsummary.path
name = groupsummary.name
names = groupsummary.children.keys()
@@ -217,12 +209,7 @@ def buildGroupSummary(indent, groupsummary, showcurrent):
'group': buildGroupSummary(indent + indent_inc, 
child, showcurrent)
}
else:
-   items = items + buildTestSummary(indent + indent_inc, 
alternate, child)
-
-   if alternate == 'a':
-   alternate = 'b'
-   else:
-   alternate = 'a'
+   items = items + buildTestSummary(indent + indent_inc, 
child)
 
testruns = "".join([buildGroupSummaryTestrun(result)
for result in groupsummary.results])
diff --git a/templates/index.css b/templates/index.css
index 6d9e903..0e48e1c 100644
--- a/templates/index.css
+++ b/templates/index.css
@@ -31,92 +31,36 @@ td:first-child > div {
background-color: #c8c838
 }
 
-.a {
-   background-color: #95
-}
-
-.b {
-   background-color: #e1e183
-}
-
-.skip {
-   text-align: right;
-   background-color: #b0b0b0;
-}
-
-.warn {
-   text-align: right;
-   background-color: #ff9020;
-}
-
-.fail {
+td.skip, td.warn, td.fail, td.pass, td.trap, td.abort, td.crash {
text-align: right;
-   background-color: #ff2020;
 }
 
-.pass {
-   text-align: right;
-   background-color: #20ff20;
-}
-
-.crash {
-   text-align: right;
-   background-color: #00;
+td.trap, td.abort, td.crash {
color: #ff;
 }
 
-.skipa {
-   text-align: right;
-   background-color: #d0d0d0;
-}
-
-.warna {
-   text-align: right;
-   background-color: #ffc050;
-}
-
-.faila {
-   text-align: right;
-   background-color: #ff5050;
-}
-
-.passa {
-   text-align: right;
-   background-color: #50ff50;
-}
-
-.crasha {
-   text-align: right;
-   background-color: #141414;
+td.trap a, td.abort a, td.crash a {
color: #ff;
 }
 
-.skipb {
-   text-align: right;
-   background-color: #c0c0c0;
-}
+tr:nth-child(odd)  > td > div:not(.head) { background-color: #95 }
+tr:nth-child(even) > td > div:not(.head) { background-color: #e1e183 }
 
-.warnb {
-   text-align: right;
-   background-color: #ffa040;
-}
+tr:nth-child(odd)  td.pass  { background-color: #20ff20; }
+tr:nth-child(even) td.pass  { background-color: #15e015; }
 
-.failb {
-   text-align: right;
-   background-color: #ff4040;
-}
+tr:nth-child(odd)  td.skip  { background-color: #b0b0b0; }
+tr:nth-child(even) td.skip  { background-color: #a0a0a0; }
 
-.passb {
-   text-align: right;
-   background-color: #40ff40;
-}
+tr:nth-child(odd)  td.warn  { backgro

[Piglit] [PATCH 1/7] html: Use CSS for indenting table rows rather than colspan.

2013-04-25 Thread Dylan Baker
From: Kenneth Graunke 

Previously, we indented groups of tests by adding 10 columns
of whitespace to the table and adding colspan.  This is pretty
ugly; we really should use CSS for things like this.

The new CSS-based approach should work with deeper nesting levels,
and simplifies the tables.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Dylan Baker 
---
 piglit-summary-html.py | 10 --
 templates/index.css| 11 +++
 templates/index.html   | 17 +++--
 templates/index_group.html |  3 +--
 templates/index_test.html  |  3 +--
 5 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 5d75d5a..1f55928 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -157,7 +157,6 @@ def hrefFromParts(codename, path):
return outStr
 
 def buildTestSummary(indent, alternate, testsummary):
-   tenindent = 10 - indent
path = testsummary.path
name = testsummary.name
testruns = "".join([IndexTestTestrun % {
@@ -192,8 +191,7 @@ def buildGroupSummaryTestrun(groupresult):
 
 
 def buildGroupSummary(indent, groupsummary, showcurrent):
-   tenindent = 10 - indent
-
+   indent_inc = 1.75 # em
items = ''
alternate = 'a'
path = groupsummary.path
@@ -216,10 +214,10 @@ def buildGroupSummary(indent, groupsummary, showcurrent):
child = groupsummary.children[n]
if isinstance(child, framework.summary.GroupSummary):
items = items + IndexGroupGroup % {
-   'group': buildGroupSummary(indent+1, child, 
showcurrent)
+   'group': buildGroupSummary(indent + indent_inc, 
child, showcurrent)
}
else:
-   items = items + buildTestSummary(indent+1, alternate, 
child)
+   items = items + buildTestSummary(indent + indent_inc, 
alternate, child)
 
if alternate == 'a':
alternate = 'b'
@@ -249,7 +247,7 @@ results is an array containing the top-level results 
dictionarys.
else:
return IndexTestrunB % tr.__dict__
 
-   group = buildGroupSummary(1, summary.root, showcurrent)
+   group = buildGroupSummary(0, summary.root, showcurrent)
testruns = "".join([IndexTestrun % tr.__dict__ for tr in 
summary.testruns])
testrunsb = "".join([testrunb(tr) for tr in summary.testruns])
 
diff --git a/templates/index.css b/templates/index.css
index 207465e..6d9e903 100644
--- a/templates/index.css
+++ b/templates/index.css
@@ -2,6 +2,9 @@
 table {
border: 0pt;
border-collapse: collapse;
+   padding-left: 1.75em;
+   padding-right: 1.75em;
+   width: 100%;
 }
 
 tr {
@@ -12,6 +15,14 @@ td {
padding: 4pt;
 }
 
+td:first-child {
+   padding: 0;
+}
+
+td:first-child > div {
+   padding: 4pt;
+}
+
 .title {
background-color: #c8c838;
 }
diff --git a/templates/index.html b/templates/index.html
index ff347df..400dde3 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -12,27 +12,16 @@

Show: %(showlinks)s

-   
+   

-   
-   
-   
-   
-   
-   
-   
-   
-   
-   
-
-   
+   

 

%(testruns)s


-   
+   
%(testrunsb)s

%(group)s
diff --git a/templates/index_group.html b/templates/index_group.html
index 9c72bcf..9f80a7c 100644
--- a/templates/index_group.html
+++ b/templates/index_group.html
@@ -1,6 +1,5 @@
 
-    
-   %(name)s
+   %(name)s
%(testruns)s
 
 %(items)s
diff --git a/templates/index_test.html b/templates/index_test.html
index 0c3bdde..4b0964e 100644
--- a/templates/index_test.html
+++ b/templates/index_test.html
@@ -1,5 +1,4 @@
 
-    
-   %(name)s
+   %(name)s
%(testruns)s
 
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] HTML generation enhancements

2013-04-25 Thread Dylan Baker
This seies is puleed from a branch Ken Graunke has on his freedesktop
accoutn, with a few bug fixes from me. These lay the ground work for some
additional HTML generation work I'm doing, but make a very signifcant
impact on performance (in a positive way) that I thought it would be
usefull to land them ahead of my own work.

This series is available on my github account here:
git://github.com/crymson/piglit.git html-fixup-ken

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Primitive restart: Test in every possible draw mode.

2013-04-25 Thread Brian Paul

On 04/25/2013 12:54 PM, Paul Berry wrote:

Some implementations (i965 in particular) treat primitive restart
differently depending what type of primitive is being drawn.  This
test verifies that primitive restart works correctly for all primitive
types.
---
  tests/all.tests |   5 +
  tests/general/CMakeLists.gl.txt |   1 +
  tests/general/primitive-restart-draw-mode.c | 275 
  3 files changed, 281 insertions(+)
  create mode 100644 tests/general/primitive-restart-draw-mode.c

diff --git a/tests/all.tests b/tests/all.tests
index 7e5bd03..9791e9a 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2244,6 +2244,11 @@ add_single_param_test_set(
  "DISABLE_VBO",
  "VBO_VERTEX_ONLY", "VBO_INDEX_ONLY",
  "VBO_SEPARATE_VERTEX_AND_INDEX", "VBO_COMBINED_VERTEX_AND_INDEX")
+add_single_param_test_set(
+nv_primitive_restart,
+'primitive-restart-draw-mode',
+'points', 'lines', 'line_loop', 'line_strip', 'triangles',
+'triangle_strip', 'triangle_fan', 'quads', 'quad_strip', 'polygon')

  ext_provoking_vertex = Group()
  spec['EXT_provoking_vertex'] = ext_provoking_vertex
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index 0e87baa..98e3271 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -94,6 +94,7 @@ piglit_add_executable (point-line-no-cull 
point-line-no-cull.c)
  piglit_add_executable (polygon-mode-offset polygon-mode-offset.c)
  piglit_add_executable (polygon-mode polygon-mode.c)
  piglit_add_executable (primitive-restart primitive-restart.c)
+piglit_add_executable (primitive-restart-draw-mode 
primitive-restart-draw-mode.c)
  piglit_add_executable (provoking-vertex provoking-vertex.c)
  piglit_add_executable (push-pop-texture-state push-pop-texture-state.c)
  piglit_add_executable (oes-read-format oes-read-format.c)
diff --git a/tests/general/primitive-restart-draw-mode.c 
b/tests/general/primitive-restart-draw-mode.c
new file mode 100644
index 000..311fd81
--- /dev/null
+++ b/tests/general/primitive-restart-draw-mode.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright © 2013 Intel 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 (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+/**
+ * \file primitive-restart-draw-mode.c
+ *
+ * Test proper functioning of primitive restart in all draw modes.  In
+ * particular, verify that dangling vertices are properly discarded.
+ *
+ * The test operates as follows:
+ *
+ * - Choose a pattern of 8 vertices which will allow easy visual
+ *   inspection of the rendered image.  For some primitive types, we
+ *   arrange the 8 vertices in an octagon.  For others, we arrange
+ *   them in two rows, with vertices alternating between the two rows.
+ *
+ * - Construct an index buffer consisting of the values 0 through 7,
+ *   interrupted at some location by the primitive restart index, and
+ *   draw using the resulting index buffer using glDrawElements().
+ *   Seven images are drawn in a vertical array, one for each possible
+ *   place where the primitive restart index might interrupt the
+ *   indices.
+ *
+ * - To the right of each of the above images, use a pair of calls to
+ *   glDrawArrays() to simulate the expected behaviour of primitive
+ *   restart.
+ *
+ * - Compare the left and right halves of the resulting window to make
+ *   sure they match.
+ *
+ * Note: for easier visual inspection of the result, the image under
+ * test is drawn in blue, and the vertices are drawn in white using
+ * GL_POINTS.
+ */
+
+#include "piglit-util-gl-common.h"
+
+
+#define NUM_VERTICES 8
+#define NUM_ROWS (NUM_VERTICES - 1)
+#define NUM_COLS 2
+#define PATTERN_SIZE 75
+#define VERTEX_ATTR 0
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_width = PATTERN_SIZE * NUM_COLS;
+   config.window_height = PATTERN_SIZE * NUM_ROWS;
+   c

[Piglit] [PATCH 2/2] gl-1.0-beginend-coverage: fix FBO-related failures when using GLUT

2013-04-25 Thread Brian Paul
When Piglit's configured to use GLUT instead of Waffle we don't have
full support for the -fbo option.  So in beginend-coverage we now
check if we really have a FBO bound in order to compute the right
fbo_attachment value.
---
 tests/spec/gl-1.0/beginend-coverage.c |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/spec/gl-1.0/beginend-coverage.c 
b/tests/spec/gl-1.0/beginend-coverage.c
index 1e8dd7d..29044ef 100644
--- a/tests/spec/gl-1.0/beginend-coverage.c
+++ b/tests/spec/gl-1.0/beginend-coverage.c
@@ -59,7 +59,6 @@ struct test {
void (*func)(void);
 };
 
-extern bool piglit_use_fbo;
 static uint32_t junk_storage[1024];
 static void *junk = junk_storage;
 static const int onei = 1;
@@ -68,6 +67,7 @@ static GLuint some_dlist;
 static GLuint newlist_dlist;
 static GLuint deletelists_dlist;
 static GLuint fbo_attachment;
+static GLint fbo_binding;
 
 #define TEST_FUNC(name, args)  \
static void test_##name(void)   \
@@ -909,7 +909,12 @@ piglit_init(int argc, char **argv)
glNewList(some_dlist, GL_COMPILE);
glEndList();
 
-   if (piglit_use_fbo)
+   if (piglit_is_extension_supported("GL_ARB_framebuffer_object"))
+   glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo_binding);
+   else
+   fbo_binding = 0;
+
+   if (fbo_binding)
fbo_attachment = GL_COLOR_ATTACHMENT0;
else
fbo_attachment = GL_FRONT;
-- 
1.7.3.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] gl-1.0-begend-coverage: remove unneeded #include "minmax-test.h"

2013-04-25 Thread Brian Paul
---
 tests/spec/gl-1.0/beginend-coverage.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/tests/spec/gl-1.0/beginend-coverage.c 
b/tests/spec/gl-1.0/beginend-coverage.c
index 22d0034..1e8dd7d 100644
--- a/tests/spec/gl-1.0/beginend-coverage.c
+++ b/tests/spec/gl-1.0/beginend-coverage.c
@@ -45,7 +45,6 @@
  */
 
 #include "piglit-util-gl-common.h"
-#include "minmax-test.h"
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-- 
1.7.3.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] dlist-beginend: test some tricky glBegin/glEnd display list corner cases

2013-04-25 Thread Brian Paul
These are some special cases not covered by the beginend-coverage test.
In particular, we do some drawing/probing.
---
 tests/all.tests |1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |1 +
 tests/spec/gl-1.0/dlist-beginend.c  |  358 +++
 3 files changed, 360 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/gl-1.0/dlist-beginend.c

diff --git a/tests/all.tests b/tests/all.tests
index 0c13e65..e7c3d04 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -570,6 +570,7 @@ add_concurrent_test(gl11, 'getteximage-targets 2D')
 gl10 = Group()
 spec['!OpenGL 1.0'] = gl10
 add_concurrent_test(gl10, 'gl-1.0-beginend-coverage')
+add_concurrent_test(gl10, 'gl-1.0-dlist-beginend')
 add_concurrent_test(gl10, 'gl-1.0-dlist-shademodel')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag-quads')
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 559fabc..bdb212a 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 piglit_add_executable (gl-1.0-beginend-coverage beginend-coverage.c)
 piglit_add_executable (gl-1.0-edgeflag edgeflag.c)
 piglit_add_executable (gl-1.0-edgeflag-quads edgeflag-quads.c)
+piglit_add_executable (gl-1.0-dlist-beginend dlist-beginend.c)
 piglit_add_executable (gl-1.0-dlist-shademodel dlist-shademodel.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.0/dlist-beginend.c 
b/tests/spec/gl-1.0/dlist-beginend.c
new file mode 100644
index 000..bb2f3ac
--- /dev/null
+++ b/tests/spec/gl-1.0/dlist-beginend.c
@@ -0,0 +1,358 @@
+/*
+ * Copyright (C) 2013 VMware, Inc.
+ *
+ * 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 (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+/**
+ * Test some tricky cases of display lists and glBegin/End.
+ */
+
+#include "piglit-util-gl-common.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 11;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const GLfloat red[] = {1.0, 0.0, 0.0, 1.0};
+static const GLfloat green[] = {0.0, 1.0, 0.0, 1.0};
+static const GLfloat black[] = {0.0, 0.0, 0.0, 0.0};
+
+
+static bool
+test_call_list_inside_begin_end(void)
+{
+   GLuint list;
+   bool pass;
+
+   list = glGenLists(1);
+   glNewList(list, GL_COMPILE);
+   glColor4fv(green);
+   glVertex2f(-1, -1);
+   glVertex2f( 1, -1);
+   glVertex2f( 1, 1);
+   glVertex2f(-1, 1);
+   glEndList();
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glBegin(GL_QUADS);
+   glCallList(list);
+   glEnd();
+
+   pass = piglit_check_gl_error(GL_NO_ERROR);
+
+   glDeleteLists(list, 1);
+
+   pass = piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, green)
+   && pass;
+
+   piglit_present_results();
+   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
+"glCallList inside glBegin/glEnd");
+
+   return pass;
+}
+
+
+static bool
+test_call_list_inside_nested_begin_end(void)
+{
+   GLuint inner, outer;
+   bool pass;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   inner = glGenLists(1);
+   glNewList(inner, GL_COMPILE);
+   glColor4fv(green);
+   glVertex2f(-1, -1);
+   glVertex2f( 1, -1);
+   glVertex2f( 1, 1);
+   glVertex2f(-1, 1);
+   glEndList();
+
+   outer = glGenLists(1);
+   glNewList(outer, GL_COMPILE_AND_EXECUTE);
+   glBegin(GL_QUADS);
+   glCallList(inner);
+   glEnd();
+   glEndList();
+
+   pass = piglit_check_gl_error(GL_NO_ERROR);
+
+   pass = piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, green)
+   && pass;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   glCallList(outer);
+
+   pass = piglit_probe_pixel_rgba(piglit_width/2, piglit_height

[Piglit] [PATCH] gl-1.0-dlist-shademodel: test glShadeModel() inside a display list

2013-04-25 Thread Brian Paul
This is pretty trivial, but it's useful for debugging a Mesa display
list optimization.
---
 tests/all.tests  |1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt  |1 +
 tests/spec/gl-1.0/dlist-shademodel.c |  101 ++
 3 files changed, 103 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/gl-1.0/dlist-shademodel.c

diff --git a/tests/all.tests b/tests/all.tests
index 7e5bd03..0c13e65 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -570,6 +570,7 @@ add_concurrent_test(gl11, 'getteximage-targets 2D')
 gl10 = Group()
 spec['!OpenGL 1.0'] = gl10
 add_concurrent_test(gl10, 'gl-1.0-beginend-coverage')
+add_concurrent_test(gl10, 'gl-1.0-dlist-shademodel')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag')
 add_concurrent_test(gl10, 'gl-1.0-edgeflag-quads')
 
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 2f819fa..559fabc 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries (
 piglit_add_executable (gl-1.0-beginend-coverage beginend-coverage.c)
 piglit_add_executable (gl-1.0-edgeflag edgeflag.c)
 piglit_add_executable (gl-1.0-edgeflag-quads edgeflag-quads.c)
+piglit_add_executable (gl-1.0-dlist-shademodel dlist-shademodel.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.0/dlist-shademodel.c 
b/tests/spec/gl-1.0/dlist-shademodel.c
new file mode 100644
index 000..0b7752e
--- /dev/null
+++ b/tests/spec/gl-1.0/dlist-shademodel.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2013 VMware, Inc.
+ *
+ * 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 (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+/**
+ * Test glShadeModel in a display list.
+ * This is pretty trivial and shouldn't fail with any decent OpenGL,
+ * but it's useful for checking an optimization in Mesa's display list
+ * compiler.
+ */
+
+#include "piglit-util-gl-common.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const GLfloat red[] = {1.0, 0.0, 0.0};
+static const GLfloat green[] = {0.0, 1.0, 0.0};
+
+
+enum piglit_result
+piglit_display(void)
+{
+   GLuint list;
+   bool pass;
+
+   list = glGenLists(1);
+   glNewList(list, GL_COMPILE);
+   glShadeModel(GL_FLAT);
+
+   glBegin(GL_QUADS);
+   glColor3fv(red);
+   glVertex2f(-1, -1);
+   glColor3fv(green);
+   glVertex2f( 0, -1);
+   glColor3fv(red);
+   glVertex2f( 0, 1);
+   glColor3fv(green);
+   glVertex2f(-1, 1);
+   glEnd();
+
+   /* Mesa should be able to optimize this away so that
+* the two GL_QUADS primitives get combined into one batch.
+*/
+   glShadeModel(GL_FLAT);
+
+   glBegin(GL_QUADS);
+   glColor3fv(red);
+   glVertex2f(0, -1);
+   glColor3fv(green);
+   glVertex2f(1, -1);
+   glColor3fv(red);
+   glVertex2f(1, 1);
+   glColor3fv(green);
+   glVertex2f(0, 1);
+   glEnd();
+
+   glEndList();
+
+   glShadeModel(GL_SMOOTH);
+   glClear(GL_COLOR_BUFFER_BIT);
+   glCallList(list);
+
+   glDeleteLists(list, 1);
+
+   pass = piglit_probe_pixel_rgb(20, 20, green);
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   /* nothing */
+}
-- 
1.7.3.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] gles3: Add outerProduct tests to generated_tests

2013-04-25 Thread Tom Gall
GL SL ES 3.00 added outerProduct as a built in fuction.

http://www.khronos.org/opengles/sdk/docs/manglsl/xhtml/outerProduct.xml

Add a script which generates testcases which validate the variety
of valid and invalid parameters that may be passed. The script
is called as part of the generated_tests.

Signed-off-by: Tom Gall 
---
 generated_tests/CMakeLists.txt |   14 +++
 generated_tests/outerProduct-invalid-parameters.sh |   91 
 2 files changed, 105 insertions(+)
 create mode 100755 generated_tests/outerProduct-invalid-parameters.sh

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index db3734f..58ff0af 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -18,6 +18,16 @@ function(piglit_make_generated_tests file_list 
generator_script)
VERBATIM)
 endfunction(piglit_make_generated_tests custom_target generator_script)
 
+function(piglit_make_sh_generated_tests file_list generator_sh_script version)
+   # Add a custom command which executes ${generator_script}
+   # during the build.
+   add_custom_command(
+   OUTPUT ${file_list}
+   COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${generator_sh_script} 
${version} > ${file_list}
+   DEPENDS ${generator_sh_script} ${ARGN}
+   VERBATIM)
+endfunction(piglit_make_sh_generated_tests custom_target generator_sh_script)
+
 # Create custom commands and targets to build generated tests.
 piglit_make_generated_tests(
builtin_packing_tests.list
@@ -54,6 +64,9 @@ piglit_make_generated_tests(
 piglit_make_generated_tests(
builtin_cl_int_tests.list
generate-cl-int-builtins.py)
+piglit_make_sh_generated_tests(
+   outerProduct-invalid-parameters_tests.list
+   outerProduct-invalid-parameters.sh 3.00)
 
 # Add a "gen-tests" target that can be used to generate all the
 # tests without doing any other compilation.
@@ -64,5 +77,6 @@ add_custom_target(gen-tests ALL
builtin_cl_int_tests.list
interpolation_tests.list
non-lvalue_tests.list
+   outerProduct-invalid-parameters_tests.list
texture_query_lod_tests.list
uniform-initializer_tests.list)
diff --git a/generated_tests/outerProduct-invalid-parameters.sh 
b/generated_tests/outerProduct-invalid-parameters.sh
new file mode 100755
index 000..7def598
--- /dev/null
+++ b/generated_tests/outerProduct-invalid-parameters.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+function emit_vs
+{
+targetdir=$1
+t=$2
+
+echo "$targetdir/outerProduct-$t.vert"
+cat > $targetdir/outerProduct-$t.vert  $targetdir/outerProduct-$t.vert  $targetdir/outerProduct-$t.vert 

[Piglit] [PATCH 1/2] Add outerProduct existance test for glsl es 1.00

2013-04-25 Thread Tom Gall
outerProduct is available with glsl es 3.00 but not
with glsl es 1.00.

http://www.khronos.org/opengles/sdk/docs/manglsl/xhtml/outerProduct.xml

Signed-off-by: Tom Gall 
---
 .../compiler/built-in-functions/outerProduct-vec2.vert |   12 
 1 file changed, 12 insertions(+)
 create mode 100644 
tests/spec/glsl-es-1.00/compiler/built-in-functions/outerProduct-vec2.vert

diff --git 
a/tests/spec/glsl-es-1.00/compiler/built-in-functions/outerProduct-vec2.vert 
b/tests/spec/glsl-es-1.00/compiler/built-in-functions/outerProduct-vec2.vert
new file mode 100644
index 000..bcdac9e
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/built-in-functions/outerProduct-vec2.vert
@@ -0,0 +1,12 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ * outerProduct is not available in OpenGL SL 1.00. It is
+ *   available in OpenGL SL 3.00.
+ * http://www.khronos.org/opengles/sdk/docs/manglsl/xhtml/outerProduct.xml
+ */
+void main () {
+  gl_Position = vec4(0);
+  outerProduct(vec2(0), vec2(0));
+}
-- 
1.7.10.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Primitive restart: Test in every possible draw mode.

2013-04-25 Thread Paul Berry
Some implementations (i965 in particular) treat primitive restart
differently depending what type of primitive is being drawn.  This
test verifies that primitive restart works correctly for all primitive
types.
---
 tests/all.tests |   5 +
 tests/general/CMakeLists.gl.txt |   1 +
 tests/general/primitive-restart-draw-mode.c | 275 
 3 files changed, 281 insertions(+)
 create mode 100644 tests/general/primitive-restart-draw-mode.c

diff --git a/tests/all.tests b/tests/all.tests
index 7e5bd03..9791e9a 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2244,6 +2244,11 @@ add_single_param_test_set(
 "DISABLE_VBO",
 "VBO_VERTEX_ONLY", "VBO_INDEX_ONLY",
 "VBO_SEPARATE_VERTEX_AND_INDEX", "VBO_COMBINED_VERTEX_AND_INDEX")
+add_single_param_test_set(
+nv_primitive_restart,
+'primitive-restart-draw-mode',
+'points', 'lines', 'line_loop', 'line_strip', 'triangles',
+'triangle_strip', 'triangle_fan', 'quads', 'quad_strip', 'polygon')
 
 ext_provoking_vertex = Group()
 spec['EXT_provoking_vertex'] = ext_provoking_vertex
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index 0e87baa..98e3271 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -94,6 +94,7 @@ piglit_add_executable (point-line-no-cull 
point-line-no-cull.c)
 piglit_add_executable (polygon-mode-offset polygon-mode-offset.c)
 piglit_add_executable (polygon-mode polygon-mode.c)
 piglit_add_executable (primitive-restart primitive-restart.c)
+piglit_add_executable (primitive-restart-draw-mode 
primitive-restart-draw-mode.c)
 piglit_add_executable (provoking-vertex provoking-vertex.c)
 piglit_add_executable (push-pop-texture-state push-pop-texture-state.c)
 piglit_add_executable (oes-read-format oes-read-format.c)
diff --git a/tests/general/primitive-restart-draw-mode.c 
b/tests/general/primitive-restart-draw-mode.c
new file mode 100644
index 000..311fd81
--- /dev/null
+++ b/tests/general/primitive-restart-draw-mode.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright © 2013 Intel 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 (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+/**
+ * \file primitive-restart-draw-mode.c
+ *
+ * Test proper functioning of primitive restart in all draw modes.  In
+ * particular, verify that dangling vertices are properly discarded.
+ *
+ * The test operates as follows:
+ *
+ * - Choose a pattern of 8 vertices which will allow easy visual
+ *   inspection of the rendered image.  For some primitive types, we
+ *   arrange the 8 vertices in an octagon.  For others, we arrange
+ *   them in two rows, with vertices alternating between the two rows.
+ *
+ * - Construct an index buffer consisting of the values 0 through 7,
+ *   interrupted at some location by the primitive restart index, and
+ *   draw using the resulting index buffer using glDrawElements().
+ *   Seven images are drawn in a vertical array, one for each possible
+ *   place where the primitive restart index might interrupt the
+ *   indices.
+ *
+ * - To the right of each of the above images, use a pair of calls to
+ *   glDrawArrays() to simulate the expected behaviour of primitive
+ *   restart.
+ *
+ * - Compare the left and right halves of the resulting window to make
+ *   sure they match.
+ *
+ * Note: for easier visual inspection of the result, the image under
+ * test is drawn in blue, and the vertices are drawn in white using
+ * GL_POINTS.
+ */
+
+#include "piglit-util-gl-common.h"
+
+
+#define NUM_VERTICES 8
+#define NUM_ROWS (NUM_VERTICES - 1)
+#define NUM_COLS 2
+#define PATTERN_SIZE 75
+#define VERTEX_ATTR 0
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_width = PATTERN_SIZE * NUM_COLS;
+   config.window_height = PATTERN_SIZE * NUM_ROWS;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_V

Re: [Piglit] Requiring Python 3.x for Piglit?

2013-04-25 Thread Brian Paul

On 04/18/2013 10:22 AM, Paul Berry wrote:


Based on some off-list discussion with Brian and Ian, I think it's
reasonable to hold these patches back for a short time (maybe a month)
to give people time to get ready for the transition.  Here's what I
propose:  Let's make a branch right now that requires Python 3.x, so
that people can start testing their Python 3.x integration
immediately, and then let's plan on merging that branch to master on
May 20.

If anyone winds up needing a little more time than that to bring their
test systems up to speed, they can always branch piglit from right
before the merge point.


How would people feel about making a Piglit 1.0 release prior to the 
Python 3.x changes?


We could actually make use of a stable release here to give our Q/A 
team a consistent Piglit snapshot to use across various environments.


Otherwise, I'd definitely want to make a Python 2.x branch before 
converting master to Python 3.x.


-Brian
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] linestipple: Report subtest results.

2013-04-25 Thread Brian Paul

On 04/24/2013 08:27 PM, Eric Anholt wrote:

It's a tricky test to get right, so being able to identify
improvements in components is useful.

This required removing the "/" from one test's name, since those are
intepreted as group dividers.
---
  tests/general/linestipple.c |   78 +--
  1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/tests/general/linestipple.c b/tests/general/linestipple.c
index 2e1b409..21d689c 100644
--- a/tests/general/linestipple.c
+++ b/tests/general/linestipple.c
@@ -38,15 +38,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN

  PIGLIT_GL_TEST_CONFIG_END

-static void
-probe_pixel(int x, int y, const float* expected)
-{
-   if (!piglit_probe_pixel_rgb(x, y, expected)) {
-   if (piglit_automatic)
-   piglit_report_result(PIGLIT_FAIL);
-   }
-}
-
  struct vertex {
GLuint x;
GLuint y;
@@ -70,12 +61,11 @@ static float background[3] = { 0, 0, 0 };
  /**
   * @note Only horizontal and vertical lines supported right now.
   */
-static GLuint
-probe_line(const struct stipple_line *line,
-  const struct vertex *v1,
-  const struct vertex *v2,
-  GLuint fragment)
+static bool
+probe_line(const struct stipple_line *line, int v1i, int v2i, GLuint *fragment)
  {
+   const struct vertex *v1 =&line->vertices[v1i];
+   const struct vertex *v2 =&line->vertices[v2i];
int x = v1->x;
int y = v1->y;
int length, dx = 0, dy = 0;
@@ -95,22 +85,28 @@ probe_line(const struct stipple_line *line,
}

while (length) {
-   GLuint s = (fragment/line->factor)&  15;
+   GLuint s = ((*fragment) / line->factor)&  15;
+   const float *color;
+
if (line->pattern&  (1<<  s))
-   probe_pixel(basex + x, basey + y, line->color);
+   color = line->color;
else
-   probe_pixel(basex + x, basey + y, background);
+   color = background;
+
+   if (!piglit_probe_pixel_rgb(basex + x, basex + y, color)) {
+   return false;
+   }

length--;
-   fragment++;
+   (*fragment)++;
x += dx;
y += dy;
}

-   return fragment;
+   return true;
  }

-static void
+static bool
  test_line(const struct stipple_line *line)
  {
GLuint i;
@@ -125,20 +121,23 @@ test_line(const struct stipple_line *line)
glReadBuffer(GL_BACK);
if (line->primitive == GL_LINES) {
for (i = 0; i + 1<  line->nvertices; i += 2) {
-   probe_line(line,&line->vertices[i],
-   &line->vertices[i+1], 0);
+   GLuint fragment = 0;
+   if (!probe_line(line, i, i + 1,&fragment))
+   return false;
}
} else {
GLuint fragment = 0;
for (i = 0; i + 1<  line->nvertices; ++i) {
-   fragment = probe_line(line,&line->vertices[i],
-   &line->vertices[i+1], fragment);
+   if (!probe_line(line, i, i + 1,&fragment))
+   return false;
}
if (line->primitive == GL_LINE_LOOP) {
-   probe_line(line,&line->vertices[i],
-   &line->vertices[0], fragment);
+   if (!probe_line(line, i, 0,&fragment))
+   return false;
}
}
+
+   return true;
  }

  static struct vertex BaselineVertices[] = { { 0, 0 },
@@ -170,7 +169,7 @@ static struct stipple_line Lines[] = {
BaselineVertices
},
{ /* Restarting lines within a single Begin/End block */
-   "Restarting lines within a single Begin/End block",
+   "Restarting lines within a single Begin-End block",
1, 0x00ff, { 1.0, 0.0, 0.0 },
GL_LINES, 4,
RestartVertices
@@ -201,9 +200,13 @@ static struct stipple_line Lines[] = {
}
  };

-static void test(void)
+enum piglit_result
+piglit_display(void)
  {
int i;
+   bool pass = true;
+
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -214,22 +217,19 @@ static void test(void)
glTranslatef(basex, basey, 0.0);

for (i = 0; i<  ARRAY_SIZE(Lines); ++i) {
-   puts(Lines[i].name);
-   test_line(&Lines[i]);
+   printf("Testing %s:\n", Lines[i].name);
+   if (test_line(&Lines[i])) {
+   piglit_report_subtest_result(PIGLIT_PASS, 
Lines[i].name);
+   } else {
+   piglit_report_subtest_result(PIGL

Re: [Piglit] [PATCH 1/3] framework: hardware independent interface for dma buffers

2013-04-25 Thread Pohjolainen, Topi
On Wed, Apr 24, 2013 at 03:34:45PM +0200, Chad Versace wrote:
> On 04/16/2013 12:45 PM, Topi Pohjolainen wrote:
> >In order to test the EXT_image_dma_buf_import, one needs a way for
> >creating dma buffers that can be imported to EGL and filling them
> >with data for the GL-stack to sample.
> >While dma buffer themselves are only defined for linux, the actual
> >writing of the buffers using CPU differs from hardware to another,
> >and possibly from window system to another. The intention here is
> >to push these details into the framework leaving the actual tests
> >environment independent.
> >
> >Signed-off-by: Topi Pohjolainen 
> 
> This patch mostly looks good, and I like the approach you've taken:
> making the utility functions independent of environment.
> 
> I have one suggestion. To enforce better type safety, I'd like to see void*
> replaced by an opaque struct, named something like `struct piglit_dma_buf`.
> But I don't want to block the series with that little nitpick, so this patch 
> is
> 
> Reviewed-by: Chad Versace 

I need to work on the series anyway, and I agree. I'll change that.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] framework: support for creating dma buffers through libdrm

2013-04-25 Thread Pohjolainen, Topi
On Wed, Apr 24, 2013 at 03:35:08PM +0200, Chad Versace wrote:
> On 04/16/2013 12:45 PM, Topi Pohjolainen wrote:
> >In order to test EXT_image_dma_buf_import one needs the capability
> >of creating driver specific buffers. By probing the environment for
> >drm libraries one can decide for which drivers the support is to
> >be built.
> >
> >Signed-off-by: Topi Pohjolainen 
> >---
> >  tests/util/CMakeLists.txt  |  47 +
> >  .../util/piglit-framework-gl/piglit_drm_dma_buf.c  | 228 
> > +
> >  .../util/piglit-framework-gl/piglit_drm_dma_buf.h  |  35 
> >  .../piglit-framework-gl/piglit_x11_framework.c |   5 +
> >  4 files changed, 315 insertions(+)
> >  create mode 100644 tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> >  create mode 100644 tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
> >
> >diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
> >index cbcf050..6a41c24 100644
> >--- a/tests/util/CMakeLists.txt
> >+++ b/tests/util/CMakeLists.txt
> >@@ -51,6 +51,53 @@ set(UTIL_GL_LIBS
> > )
> >
> >  if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
> >+find_library(DRM_LIBRARY
> >+NAMES drm
> >+PATHS /usr/lib
> >+)
> >+
> >+find_path(DRM_INCLUDE_BASE_DIR
> >+NAMES libdrm/drm.h
> >+PATHS /opt/include
> 
> Why /opt/include? I expected /usr/include.

Good catch, my mistake.

> 
> >+)
> >+
> >+find_library(DRM_LIBRARY
> >+NAMES drm
> >+PATHS /usr/lib
> >+)
> >+
> >+find_library(DRM_INTEL_LIBRARY
> >+NAMES drm_intel
> >+PATHS /usr/lib
> >+)
> 
> The searching above needs to respect pkg-config by using pkg_check_modules().
> Otherwise
>   1. As written, the above search will fail on 64-bit rpm distros,
>  which use /usr/lib64.
>   2. If someone is doing development on libdrm installed into a
>  custom prefix, then the search as-written will not to use the custom 
> libdrm
>  as defined by PKG_CONFIG_PATH.
> 
> pkg_check_modules() is documented in cmake's manpage. For example usage, just
> grep piglit.

Many thanks, it's not only cleaner, but it becomes a lot simpler, too.

> 
> >+
> >+# One needs to have at least one hardware driver present, otherwise
> >+# there is no point compiling just the dispatcher.
> 
> Yeah, that makes sense.
> 
> >+if(DRM_LIBRARY AND DRM_INCLUDE_BASE_DIR AND DRM_INTEL_LIBRARY)
> >+add_definitions(-DHAVE_LIBDRM)
> >+
> >+list(APPEND UTIL_GL_SOURCES
> >+piglit-framework-gl/piglit_drm_dma_buf.c
> >+)
> >+
> >+list(APPEND UTIL_GL_LIBS
> >+${DRM_LIBRARY}
> >+)
> >+
> >+# This is needed for the direct "drm.h" inclusion by "xh86drm.h"
> >+list(APPEND UTIL_GL_INCLUDES
> >+${DRM_INCLUDE_BASE_DIR}/libdrm
> >+)
> 
> If you use pkg_check_modules(), then the above append is unneeded. libdrm.pc
> lists $PREFIX/include/drm in the include flags.

Indeed.

> 
> >+
> >+if(DRM_INTEL_LIBRARY)
> >+add_definitions(-DHAVE_LIBDRM_INTEL)
> >+
> >+list(APPEND UTIL_GL_LIBS
> >+${DRM_INTEL_LIBRARY}
> >+)
> >+endif()
> >+endif()
> >+
> > set(UTIL_GL_LIBS
> > ${UTIL_GL_LIBS}
> > ${X11_X11_LIB}
> >diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c 
> >b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> >new file mode 100644
> >index 000..1bebf14
> >--- /dev/null
> >+++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> >@@ -0,0 +1,228 @@
> >+/*
> >+ * Copyright © 2013 Intel 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 (including the next
> >+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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 SO