[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz doc/Gzz_Memory.rst gfx/libos/Os.hxx gzz/cli...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz doc/Gzz_Memory.rst gfx/libos/Os.hxx gzz/cli... |
Date: |
Mon, 13 Jan 2003 01:48:53 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 03/01/13 01:48:50
Modified files:
doc : Gzz_Memory.rst
gfx/libos : Os.hxx
gzz/client : AbstractUpdateManager.java
gzz/gfx/gl : GL.java
gzz/mem : MemoryConsumer.java MemoryPartitioner.java
gzz/util : Background.java PriorityQueue.java
test/gzz/mem : partition.test
Added files:
gzz/util : ImageSize.java
test/gzz/util : imagesize.test modularspace.png
Log message:
More memorypartitioner work
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/Gzz_Memory.rst.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os.hxx.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/AbstractUpdateManager.java.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/mem/MemoryConsumer.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/mem/MemoryPartitioner.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/ImageSize.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/Background.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/PriorityQueue.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/mem/partition.test.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/util/imagesize.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/util/modularspace.png?rev=1.1
Patches:
Index: gzz/doc/Gzz_Memory.rst
diff -u gzz/doc/Gzz_Memory.rst:1.11 gzz/doc/Gzz_Memory.rst:1.12
--- gzz/doc/Gzz_Memory.rst:1.11 Sat Jan 11 06:37:57 2003
+++ gzz/doc/Gzz_Memory.rst Mon Jan 13 01:48:49 2003
@@ -99,7 +99,7 @@
methods
boolean getScalable()
int getMaxBytes(float quality)
- void setReservation(int bytes, float quality, Obs o)
+ int setReservation(int bytes, float quality, Obs o)
int getReservation()
class client
@@ -119,6 +119,24 @@
the number of bytes can be scaled, and set the current memory consumption
to a particular amount.
+Defining the importance function is not simple; this represents the
+tradeoffs between memory use for the focus and context. The first,
+obvious quality is that the most immediate focus has priority: it must
+never be blurred to make the context sharper. In the other end of the
+scale are the spans that are not really visible but might become visible
+when the user moves; these should only be loaded if there's extra memory
+available.
+
+The cases between the two extremes are the difficult ones.
+
+
+Need to be able to handle case of 1 focus-request for A
++ 100 low-quality non-focus requests for B
+IN A SINGLE VOBSCENE.
+
+
+
+
As an example of how this system will be tied to the rest of Gzz,
consider PageSpans and OpenGL. The basic operation is: "get a texture
rectangle for the given pagespan". In order to have the information about
@@ -191,19 +209,13 @@
gzz.mem.se = MemoryConsumer.se + (30, -30);
-Defining the importance function is not simple; this represents the
-tradeoffs between memory use for the focus and context. The first,
-obvious quality is that the most immediate focus has priority: it must
-never be blurred to make the context sharper. In the other end of the
-scale are the spans that are not really visible but might become visible
-when the user moves; these should only be loaded if there's extra memory
-available.
-
-The cases between the two extremes are the difficult ones.
-
-
-Need to be able to handle case of 1 focus-request + 100 low-quality non-focus
requests
-IN A SINGLE VOBSCENE.
-
+The loading of a texture from an image file is an intricate process:
+first, the image is loaded into a memory buffer in a background thread.
+Then, the image must be loaded from the buffer to the OpenGL graphics memory -
+but herein lies a snag: this loading must be done in the OpenGL context,
+which is usable only in the main thread, and also this loading may take
+considerable time if texture compression is used.
+Thus, the loading will be done piecemeal, subimage by subimage, and always in
between
+new events are checked for.
Index: gzz/gfx/libos/Os.hxx
diff -u gzz/gfx/libos/Os.hxx:1.16 gzz/gfx/libos/Os.hxx:1.17
--- gzz/gfx/libos/Os.hxx:1.16 Fri Dec 13 07:16:06 2002
+++ gzz/gfx/libos/Os.hxx Mon Jan 13 01:48:49 2003
@@ -49,7 +49,8 @@
*/
virtual void loadInto(Mosaic::MosaicTile &tile,
int x, int y, int w, int h) = 0;
- /** Load this image into the current texture_2D.
+ /** Load this image into the current texture_2D
+ * using glTexSubImage2D.
*/
virtual void loadIntoTexture(GLint level, GLint x, GLint y, GLint
xoffset,
GLint yoffset, GLint w, GLint h) = 0;
Index: gzz/gzz/client/AbstractUpdateManager.java
diff -u gzz/gzz/client/AbstractUpdateManager.java:1.27
gzz/gzz/client/AbstractUpdateManager.java:1.28
--- gzz/gzz/client/AbstractUpdateManager.java:1.27 Sat Jan 11 06:37:57 2003
+++ gzz/gzz/client/AbstractUpdateManager.java Mon Jan 13 01:48:49 2003
@@ -41,7 +41,7 @@
*/
public abstract class AbstractUpdateManager implements Runnable {
-public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.27
2003/01/11 11:37:57 tjl Exp $";
+public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.28
2003/01/13 06:48:49 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -325,7 +325,7 @@
* in the future.
* @see gzz.util.Background#addTask
*/
- public void doWhenIdle(Runnable r, int priority) {
+ public void doWhenIdle(Runnable r, float priority) {
synchronized(queue) {
queue.add(r, priority);
queue.notifyAll();
Index: gzz/gzz/gfx/gl/GL.java
diff -u gzz/gzz/gfx/gl/GL.java:1.35 gzz/gzz/gfx/gl/GL.java:1.36
--- gzz/gzz/gfx/gl/GL.java:1.35 Sun Jan 12 06:41:46 2003
+++ gzz/gzz/gfx/gl/GL.java Mon Jan 13 01:48:49 2003
@@ -154,6 +154,11 @@
RenderInfo info1,
RenderInfo info2
) { }
+ /** Delete the C++ object corresponding to this object.
+ * Note that using this object anywhere afterwards
+ * may cause Null pointers or even worse on the C++ side.
+ * Use with MUCH care.
+ */
public void deleteObject() {
if(GL.dbg) pa("DeleteObj "+this+" "+id);
deleteObj();
Index: gzz/gzz/mem/MemoryConsumer.java
diff -u gzz/gzz/mem/MemoryConsumer.java:1.5 gzz/gzz/mem/MemoryConsumer.java:1.6
--- gzz/gzz/mem/MemoryConsumer.java:1.5 Sat Jan 11 13:10:06 2003
+++ gzz/gzz/mem/MemoryConsumer.java Mon Jan 13 01:48:50 2003
@@ -61,8 +61,11 @@
* @param quality Maximum quality that should be loaded (if quality is
* adjusted in discrete steps, the class may round
upwards).
* @param o Observer to call (if non-null) when size has been adjusted
+ * @return The number of bytes this consumer will actually use: e.g. if
+ * sizes come in certain increments, less memory will be
used
+ * than needed..
*/
- void setReservation(int bytes, float quality, Obs o);
+ int setReservation(int bytes, float quality, Obs o);
/** Get the number of bytes currently used.
*/
int getReservation();
Index: gzz/gzz/mem/MemoryPartitioner.java
diff -u gzz/gzz/mem/MemoryPartitioner.java:1.6
gzz/gzz/mem/MemoryPartitioner.java:1.7
--- gzz/gzz/mem/MemoryPartitioner.java:1.6 Sat Jan 11 13:10:06 2003
+++ gzz/gzz/mem/MemoryPartitioner.java Mon Jan 13 01:48:50 2003
@@ -114,7 +114,9 @@
}
void fit(MemoryConsumer cons, int bytes) {
+ if(dbg) pa("Reservating "+bytes+" for "+cons);
cons.setReservation(bytes, curQuality, o);
+ if(dbg) pa("Reserved");
setBytes = bytes;
setQuality = curQuality;
}
Index: gzz/gzz/util/Background.java
diff -u gzz/gzz/util/Background.java:1.3 gzz/gzz/util/Background.java:1.4
--- gzz/gzz/util/Background.java:1.3 Sat Jan 11 06:37:57 2003
+++ gzz/gzz/util/Background.java Mon Jan 13 01:48:50 2003
@@ -54,7 +54,7 @@
* (higher priority) of the two, but the task will only
* be run once.
*/
- public void addTask(Runnable r, int priority) {
+ public void addTask(Runnable r, float priority) {
synchronized(queue) {
queue.add(r, priority);
queue.notifyAll();
Index: gzz/gzz/util/PriorityQueue.java
diff -u gzz/gzz/util/PriorityQueue.java:1.5 gzz/gzz/util/PriorityQueue.java:1.6
--- gzz/gzz/util/PriorityQueue.java:1.5 Sat Jan 11 13:10:07 2003
+++ gzz/gzz/util/PriorityQueue.java Mon Jan 13 01:48:50 2003
@@ -40,21 +40,21 @@
*/
private class Comp implements Comparator {
public int compare(Object o1, Object o2) {
- Integer p1 = (Integer)jobPriority.get(o1);
- Integer p2 = (Integer)jobPriority.get(o2);
- int i1 = p1.intValue();
- int i2 = p2.intValue();
- if(i1 < i2) return -1;
- if(i1 > i2) return 1;
- i1 = o1.hashCode();
- i2 = o2.hashCode();
+ Float p1 = (Float)jobPriority.get(o1);
+ Float p2 = (Float)jobPriority.get(o2);
+ float f1 = p1.floatValue();
+ float f2 = p2.floatValue();
+ if(f1 < f2) return -1;
+ if(f1 > f2) return 1;
+ int i1 = o1.hashCode();
+ int i2 = o2.hashCode();
if(i1 < i2) return -1;
if(i1 > i2) return 1;
return 0;
}
}
- /** Job object to Integer (the priority).
+ /** Job object to Float (the priority).
*/
private Map jobPriority = new HashMap();
@@ -67,8 +67,8 @@
* If the job has already been added, set the priority
* to the lower value (more important) of the two.
*/
- public void add(Object job, int priority) {
- Integer prevprio = (Integer)jobPriority.get(job);
+ public void add(Object job, float priority) {
+ Float prevprio = (Float)jobPriority.get(job);
if(prevprio != null) {
if(priority >= prevprio.intValue()) return;
// Now, in order not to corrupt the TreeSet,
@@ -77,7 +77,7 @@
// has been changed.
jobs.remove(job);
}
- jobPriority.put(job, new Integer(priority));
+ jobPriority.put(job, new Float(priority));
jobs.add(job);
}
Index: gzz/test/gzz/mem/partition.test
diff -u gzz/test/gzz/mem/partition.test:1.8 gzz/test/gzz/mem/partition.test:1.9
--- gzz/test/gzz/mem/partition.test:1.8 Sun Jan 12 06:41:47 2003
+++ gzz/test/gzz/mem/partition.test Mon Jan 13 01:48:50 2003
@@ -15,6 +15,7 @@
def setReservation(self, byt, qual, o):
self.rese = byt
self.qual = qual
+ return byt
def getReservation(self):
return self.rese
def getQuality(self):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz doc/Gzz_Memory.rst gfx/libos/Os.hxx gzz/cli...,
Tuomas J. Lukka <=