Exemplo n.º 1
0
static GLboolean
intelCreateContext(gl_api api,
		   const struct gl_config * mesaVis,
                   __DRIcontext * driContextPriv,
		   unsigned major_version,
		   unsigned minor_version,
		   uint32_t flags,
		   unsigned *error,
                   void *sharedContextPrivate)
{
   bool success = false;

   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
   struct intel_screen *intelScreen = sPriv->driverPrivate;

   if (IS_9XX(intelScreen->deviceID)) {
      success = i915CreateContext(api, mesaVis, driContextPriv,
                                  major_version, minor_version, error,
                                  sharedContextPrivate);
   } else {
      intelScreen->no_vbo = true;
      success = i830CreateContext(api, mesaVis, driContextPriv,
                                  major_version, minor_version, error,
                                  sharedContextPrivate);
   }

   if (success)
      return true;

   if (driContextPriv->driverPrivate != NULL)
      intelDestroyContext(driContextPriv);

   return false;
}
Exemplo n.º 2
0
static GLboolean
intelCreateContext(gl_api api,
		   const struct gl_config * mesaVis,
                   __DRIcontext * driContextPriv,
		   unsigned major_version,
		   unsigned minor_version,
		   uint32_t flags,
		   unsigned *error,
                   void *sharedContextPrivate)
{
   bool success = false;

#ifdef I915
   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
   struct intel_screen *intelScreen = sPriv->driverPrivate;

   if (IS_9XX(intelScreen->deviceID)) {
      success = i915CreateContext(api, mesaVis, driContextPriv,
                                  major_version, minor_version, error,
                                  sharedContextPrivate);
   } else {
      switch (api) {
      case API_OPENGL_COMPAT:
         if (major_version > 1 || minor_version > 3) {
            *error = __DRI_CTX_ERROR_BAD_VERSION;
            success = false;
         }
         break;
      case API_OPENGLES:
         break;
      default:
         *error = __DRI_CTX_ERROR_BAD_API;
         success = false;
      }

      if (success) {
         intelScreen->no_vbo = true;
         success = i830CreateContext(mesaVis, driContextPriv,
                                     sharedContextPrivate);
         if (!success)
            *error = __DRI_CTX_ERROR_NO_MEMORY;
      }
   }
#else
   success = brwCreateContext(api, mesaVis,
                              driContextPriv,
                              major_version, minor_version, flags,
                              error, sharedContextPrivate);
#endif

   if (success)
      return true;

   if (driContextPriv->driverPrivate != NULL)
      intelDestroyContext(driContextPriv);

   return false;
}
Exemplo n.º 3
0
static GLboolean
intelCreateContext(gl_api api,
		   const struct gl_config * mesaVis,
                   __DRIcontext * driContextPriv,
		   unsigned major_version,
		   unsigned minor_version,
		   uint32_t flags,
		   unsigned *error,
                   void *sharedContextPrivate)
{
   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
   struct intel_screen *intelScreen = sPriv->driverPrivate;
   bool success = false;

#ifdef I915
   if (IS_9XX(intelScreen->deviceID)) {
      if (!IS_965(intelScreen->deviceID)) {
	 success = i915CreateContext(api, mesaVis, driContextPriv,
				     sharedContextPrivate);
      }
   } else {
      intelScreen->no_vbo = true;
      success = i830CreateContext(mesaVis, driContextPriv,
				  sharedContextPrivate);
   }
#else
   if (IS_965(intelScreen->deviceID))
      success = brwCreateContext(api, mesaVis,
			      driContextPriv,
			      sharedContextPrivate);
#endif

   if (success) {
      struct gl_context *ctx =
	 (struct gl_context *) driContextPriv->driverPrivate;

      _mesa_compute_version(ctx);
      if (ctx->Version >= major_version * 10 + minor_version) {
	 return true;
      }

      *error = __DRI_CTX_ERROR_BAD_VERSION;
      intelDestroyContext(driContextPriv);
   } else {
      *error = __DRI_CTX_ERROR_NO_MEMORY;
      fprintf(stderr, "Unrecognized deviceID 0x%x\n", intelScreen->deviceID);
   }

   return false;
}
Exemplo n.º 4
0
static GLboolean
intelCreateContext(gl_api api,
		   const struct gl_config * mesaVis,
                   __DRIcontext * driContextPriv,
		   unsigned major_version,
		   unsigned minor_version,
		   uint32_t flags,
                   bool notify_reset,
		   unsigned *error,
                   void *sharedContextPrivate)
{
   bool success = false;

   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
   struct intel_screen *intelScreen = sPriv->driverPrivate;

   if (flags & ~__DRI_CTX_FLAG_DEBUG) {
      *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
      return false;
   }

   if (notify_reset) {
      *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
      return false;
   }

   if (IS_GEN3(intelScreen->deviceID)) {
      success = i915CreateContext(api, mesaVis, driContextPriv,
                                  major_version, minor_version, flags,
                                  error, sharedContextPrivate);
   } else {
      intelScreen->no_vbo = true;
      success = i830CreateContext(api, mesaVis, driContextPriv,
                                  major_version, minor_version, flags,
                                  error, sharedContextPrivate);
   }

   if (success)
      return true;

   if (driContextPriv->driverPrivate != NULL)
      intelDestroyContext(driContextPriv);

   return false;
}
Exemplo n.º 5
0
static GLboolean
intelCreateContext(gl_api api,
		   const struct gl_config * mesaVis,
                   __DRIcontext * driContextPriv,
		   unsigned major_version,
		   unsigned minor_version,
		   uint32_t flags,
		   unsigned *error,
                   void *sharedContextPrivate)
{
   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
   struct intel_screen *intelScreen = sPriv->driverPrivate;
   bool success = false;

   switch (api) {
   case API_OPENGL:
   case API_OPENGLES:
      break;
   case API_OPENGLES2:
#ifdef I915
      if (!IS_9XX(intelScreen->deviceID)) {
         *error = __DRI_CTX_ERROR_BAD_API;
         return false;
      }
#endif
      break;
   case API_OPENGL_CORE:
      *error = __DRI_CTX_ERROR_BAD_API;
      return GL_FALSE;
   }

#ifdef I915
   if (IS_9XX(intelScreen->deviceID)) {
      success = i915CreateContext(api, mesaVis, driContextPriv,
                                  major_version, minor_version, error,
                                  sharedContextPrivate);
   } else {
      switch (api) {
      case API_OPENGL:
         if (major_version > 1 || minor_version > 3) {
            *error = __DRI_CTX_ERROR_BAD_VERSION;
            return false;
         }
         break;
      case API_OPENGLES:
         break;
      default:
         *error = __DRI_CTX_ERROR_BAD_API;
         return false;
      }

      intelScreen->no_vbo = true;
      success = i830CreateContext(mesaVis, driContextPriv,
				  sharedContextPrivate);
      if (!success) {
         *error = __DRI_CTX_ERROR_NO_MEMORY;
         return false;
      }
   }
#else
   success = brwCreateContext(api, mesaVis,
                              driContextPriv,
                              major_version, minor_version, error,
                              sharedContextPrivate);
#endif

   if (success) {
      struct gl_context *ctx =
	 (struct gl_context *) driContextPriv->driverPrivate;

      _mesa_compute_version(ctx);
      if (ctx->Version >= major_version * 10 + minor_version) {
	 return true;
      }

      *error = __DRI_CTX_ERROR_BAD_VERSION;
      intelDestroyContext(driContextPriv);
   } else {
      *error = __DRI_CTX_ERROR_NO_MEMORY;
      fprintf(stderr, "Unrecognized deviceID 0x%x\n", intelScreen->deviceID);
   }

   return false;
}