/**************************************************************************
- *
+ *
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
- *
+ *
* 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
* distribute, sub license, 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 NON-INFRINGEMENT.
* 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.
- *
+ *
**************************************************************************/
#include "utils.h"
#include "intel_context.h"
#include "intel_screen.h"
#include "intel_batchbuffer.h"
-//#include "intel_batchpool.h"
#include "intel_swapbuffers.h"
-#include "intel_winsys.h"
#include "i830_dri.h"
-#include "ws_dri_bufpool.h"
+#include "intel_drm/ws_dri_bufpool.h"
#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_inlines.h"
#include "state_tracker/st_public.h"
#include "state_tracker/st_cb_fbo.h"
+static void
+intelCreateSurface(struct intel_screen *intelScreen, struct pipe_winsys *winsys, unsigned handle);
+static void
+intelCreateSurface(struct intel_screen *intelScreen, struct pipe_winsys *winsys, unsigned handle)
+{
+ struct intel_be_buffer *be_buf = malloc(sizeof(*be_buf));
+ struct pipe_screen *screen = intelScreen->base.screen;
+ struct pipe_texture *texture;
+ struct pipe_texture templat;
+ struct pipe_surface *surface;
+ struct pipe_buffer *buffer = &be_buf->base;
+ unsigned pitch;
+
+ assert(intelScreen->front.cpp == 4);
+
+ /* XXX create a intel_be function for this */
+ {
+ driGenBuffers(intelScreen->base.staticPool, "front", 1, &intelScreen->front.buffer, 0, 0, 0);
+ driBOSetReferenced(intelScreen->front.buffer, handle);
+
+ memset(be_buf, 0, sizeof(*be_buf));
+ buffer->refcount = 1;
+ buffer->alignment = 0;
+ buffer->usage = 0;
+ buffer->size = driBOSize(intelScreen->front.buffer);
+ be_buf->driBO = intelScreen->front.buffer;
+ }
+
+ memset(&templat, 0, sizeof(templat));
+ templat.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ templat.target = PIPE_TEXTURE_2D;
+ templat.last_level = 0;
+ templat.depth[0] = 1;
+ templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ templat.width[0] = intelScreen->front.width;
+ templat.height[0] = intelScreen->front.height;
+ pf_get_block(templat.format, &templat.block);
+ pitch = intelScreen->front.pitch;
+
+ texture = screen->texture_blanket(screen,
+ &templat,
+ &pitch,
+ buffer);
+
+ /* Unref the buffer we don't need it anyways */
+ pipe_buffer_reference(screen->winsys, &buffer, NULL);
+
+ surface = screen->get_tex_surface(screen,
+ texture,
+ 0,
+ 0,
+ 0,
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ intelScreen->front.texture = texture;
+ intelScreen->front.surface = surface;
+}
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_NO_MOVE |
DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0);
- driBOSetStatic(intelScreen->front.buffer,
- intelScreen->front.offset,
- intelScreen->front.pitch * intelScreen->front.height,
+ driBOSetStatic(intelScreen->front.buffer,
+ intelScreen->front.offset,
+ intelScreen->front.pitch * intelScreen->front.height,
intelScreen->front.map, 0);
}
#else
- if (intelScreen->staticPool) {
- if (intelScreen->front.buffer)
+ if (intelScreen->base.staticPool) {
+ if (intelScreen->front.buffer) {
driBOUnReference(intelScreen->front.buffer);
- driGenBuffers(intelScreen->staticPool, "front", 1, &intelScreen->front.buffer, 0, 0, 0);
- driBOSetReferenced(intelScreen->front.buffer, sarea->front_bo_handle);
+ pipe_surface_reference(&intelScreen->front.surface, NULL);
+ pipe_texture_reference(&intelScreen->front.texture, NULL);
+ }
+ intelCreateSurface(intelScreen, &intelScreen->base.base, sarea->front_bo_handle);
}
#endif
}
if (intelScreen->havePools)
return GL_TRUE;
-#if 0 /* ZZZ JB fix this */
- intelScreen->staticPool = driDRMStaticPoolInit(sPriv->fd);
- if (!intelScreen->staticPool)
- return GL_FALSE;
-
- batchPoolSize /= BATCH_SZ;
- intelScreen->batchPool = driBatchPoolInit(sPriv->fd,
- DRM_BO_FLAG_EXE |
- DRM_BO_FLAG_MEM_TT |
- DRM_BO_FLAG_MEM_LOCAL,
- BATCH_SZ,
- batchPoolSize, 5);
- if (!intelScreen->batchPool) {
- fprintf(stderr, "Failed to initialize batch pool - possible incorrect agpgart installed\n");
- return GL_FALSE;
- }
-#else
- intelScreen->staticPool = driDRMPoolInit(sPriv->fd);
- intelScreen->batchPool = driSlabPoolInit(sPriv->fd,
- DRM_BO_FLAG_EXE |
- DRM_BO_FLAG_MEM_TT,
- DRM_BO_FLAG_EXE |
- DRM_BO_FLAG_MEM_TT,
- intelScreen->max_batch_size,
- 1, 40, intelScreen->max_batch_size * 16, 0,
- intelScreen->fMan);
-#endif
intelScreen->havePools = GL_TRUE;
intelUpdateScreenRotation(sPriv, intelScreen->sarea);
return GL_TRUE;
}
+static const char *
+intel_get_name( struct pipe_winsys *winsys )
+{
+ return "Intel/DRI/ttm";
+}
+
+/*
+ * The state tracker (should!) keep track of whether the fake
+ * frontbuffer has been touched by any rendering since the last time
+ * we copied its contents to the real frontbuffer. Our task is easy:
+ */
+static void
+intel_flush_frontbuffer( struct pipe_winsys *winsys,
+ struct pipe_surface *surf,
+ void *context_private)
+{
+ //struct intel_context *intel = (struct intel_context *) context_private;
+ //__DRIdrawablePrivate *dPriv = intel->driDrawable;
+
+ assert((int)"Doesn't work currently" & 0);
+
+ //intelDisplaySurface(dPriv, surf, NULL);
+}
static boolean
intelInitDriver(__DRIscreenPrivate * sPriv)
/* Allocate the private area */
intelScreen = CALLOC_STRUCT(intel_screen);
- if (!intelScreen)
+ if (!intelScreen)
return GL_FALSE;
/* parse information in __driConfigOptions */
(*glx_enable_extension) (psc, "GLX_SGI_make_current_read");
}
- intelScreen->max_batch_size = 16 * 4096;
-
-#if 1 // ZZZ JB
- intelScreen->mgr = driFenceMgrTTMInit(sPriv->fd);
- if (!intelScreen->mgr) {
- fprintf(stderr, "Failed to create fence manager.\n");
- return GL_FALSE;
- }
-
- intelScreen->fMan = driInitFreeSlabManager(10, 10);
- if (!intelScreen->fMan) {
- fprintf(stderr, "Failed to create free slab manager.\n");
- return GL_FALSE;
- }
-
- if (!intelCreatePools(sPriv))
- return GL_FALSE;
-#endif
-
- intelScreen->winsys = intel_create_pipe_winsys(sPriv->fd, intelScreen->fMan);
+ intelScreen->base.base.flush_frontbuffer = intel_flush_frontbuffer;
+ intelScreen->base.base.get_name = intel_get_name;
+ intel_be_init_device(&intelScreen->base, sPriv->fd, intelScreen->deviceID);
return GL_TRUE;
}
{
struct intel_screen *intelScreen = intel_screen(sPriv);
+ intel_be_destroy_device(&intelScreen->base);
/* intelUnmapScreenRegions(intelScreen); */
- if (intelScreen->havePools) {
- driPoolTakeDown(intelScreen->staticPool);
- driPoolTakeDown(intelScreen->batchPool);
- }
FREE(intelScreen);
sPriv->private = NULL;
}
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
};
- u_int8_t depth_bits_array[3];
- u_int8_t stencil_bits_array[3];
+ uint8_t depth_bits_array[3];
+ uint8_t stencil_bits_array[3];
+ uint8_t msaa_samples_array[1];
depth_bits_array[0] = 0;
depth_bits_array[1] = depth_bits;
depth_bits_array[2] = depth_bits;
+ msaa_samples_array[0] = 0;
/* Just like with the accumulation buffer, always provide some modes
* with a stencil buffer. It will be a sw fallback, but some apps won't
if (!driFillInModes(&m, fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, GLX_TRUE_COLOR)) {
+ back_buffer_factor, msaa_samples_array, 1, GLX_TRUE_COLOR)) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
return NULL;
if (!driFillInModes(&m, fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, GLX_DIRECT_COLOR)) {
+ back_buffer_factor, msaa_samples_array, 1, GLX_DIRECT_COLOR)) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);
return NULL;
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
- *
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
+ *
+ * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
* failure.
*/
PUBLIC void *